Skip to content

Commit

Permalink
fix: OpenIDConnectFrontend: check for empty db_uri (#420)
Browse files Browse the repository at this point in the history
With IdentityPython/pyop#44 merged, OpenIDConnectFrontend init fails
when `db_uri` is not set, as `StorageBase.type` now throws a `ValueError`
for db_uri values that do not match one of the recognised storage types
(including when `db_uri` is `None`).

Fix this by guarding the `StorageBase.type` with a pythonic test
whether `db_uri` was provided.

Same test already guards `StorageBase.from_uri`, add it also
to the `StorageBase.type` call made to determine `self.stateless`.
  • Loading branch information
vladimir-mencl-eresearch authored Nov 9, 2022
1 parent 7b37f69 commit c629dd5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/satosa/frontends/openid_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self, auth_req_callback_func, internal_attributes, conf, base_url,
)

db_uri = self.config.get("db_uri")
self.stateless = StorageBase.type(db_uri) == "stateless"
self.stateless = db_uri and StorageBase.type(db_uri) == "stateless"
self.user_db = (
StorageBase.from_uri(db_uri, db_name="satosa", collection="authz_codes")
if db_uri and not self.stateless
Expand Down

0 comments on commit c629dd5

Please sign in to comment.