IdentityPython / SATOSA

Proxy translating between different authentication protocols (SAML2, OpenID Connect and OAuth2)
https://idpy.org
Apache License 2.0
197 stars 121 forks source link

fix: OpenIDConnectFrontend: check for empty db_uri #420

Closed vladimir-mencl-eresearch closed 1 year ago

vladimir-mencl-eresearch commented 1 year ago

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.

PS: This worked before IdentityPython/pyop#44 was merged because StorageBase.type used to return the ValueError object, which evaluated as not matching string "stateless". I also thought about changing StorageBase.type to return None for db_uri of value None, but I think it's cleaner to handle it this way and keep the StorageBase.type contract clear: Only valid values allowed.

All Submissions:

c00kiemon5ter commented 1 year ago

Sounds good - thank you!