Skip to content

fix: OpenIDConnectFrontend: check for empty db_uri #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 9, 2022

Conversation

vladimir-mencl-eresearch
Copy link
Contributor

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:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you added an explanation of what problem you are trying to solve with this PR?
  • Have you added information on what your changes do and why you chose this as your solution?
  • [N/A] Have you written new tests for your changes?
  • [N/A] Does your submission pass tests?
  • [N/A] This project follows PEP8 style guide. Have you run your code against the 'flake8' linter?

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`.
@c00kiemon5ter c00kiemon5ter merged commit c629dd5 into IdentityPython:master Nov 9, 2022
@c00kiemon5ter
Copy link
Member

Sounds good - thank you!

@vladimir-mencl-eresearch vladimir-mencl-eresearch deleted the fix-check-db_uri branch November 9, 2022 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants