Skip to content

Commit

Permalink
refactor: move OIDC configuration in the oidc module
Browse files Browse the repository at this point in the history
  • Loading branch information
azmeuk committed Jan 21, 2025
1 parent 7fc4ee1 commit 4642b74
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 0 additions & 2 deletions canaille/app/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ def setup_config(app, config=None, test_config=True, env_file=None, env_prefix="
app.config.from_mapping(
{
"SESSION_COOKIE_NAME": "canaille",
"OAUTH2_REFRESH_TOKEN_GENERATOR": True,
"OAUTH2_ACCESS_TOKEN_GENERATOR": "canaille.oidc.oauth.generate_access_token",
}
)
if not config and "CONFIG" in os.environ:
Expand Down
6 changes: 6 additions & 0 deletions canaille/oidc/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,11 @@ def generate_access_token(client, grant_type, user, scope):


def setup_oauth(app):
app.config["OAUTH2_REFRESH_TOKEN_GENERATOR"] = True
app.config["OAUTH2_ACCESS_TOKEN_GENERATOR"] = (
"canaille.oidc.oauth.generate_access_token"
)

# hacky, but needed for tests as somehow the same 'authorization' object is used
# between tests
authorization.__init__()
Expand All @@ -553,3 +558,4 @@ def setup_oauth(app):
authorization.register_endpoint(RevocationEndpoint)
authorization.register_endpoint(ClientRegistrationEndpoint)
authorization.register_endpoint(ClientConfigurationEndpoint)

0 comments on commit 4642b74

Please sign in to comment.