-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
I encounter issues when initializing flask-pyoidc and using url_for to define callbacks URLs.
bp = Blueprint("endpoints", __name__)
user_provider_configuration = ProviderConfiguration(
...
post_logout_redirect_uris=url_for("endpoints.logout", _external=True),
)
auth = OIDCAuthentication({"default": user_provider_configuration}, current_app)
@bp.route("/logout")
@auth.oidc_logout
def logout():
...There is a cycling dependency here, the logout endpoint needs a OIDCAuthentication object, that needs a ProviderConfiguration, that calls url_for, that needs the endpoint to be initialized.
I think this can be mitigated by delaying the ProviderConfiguration part, for instance with the help of init_app. I suggest to pass the configuration options to init_app so this would be valid:
bp = Blueprint("endpoints", __name__)
auth = OIDCAuthentication()
@bp.route("/logout")
@auth.oidc_logout
def logout():
...
user_provider_configuration = ProviderConfiguration(
...
post_logout_redirect_uris=url_for("endpoints.logout", _external=True),
)
auth.init_app(app, {"default": user_provider_configuration})What do you think?
Metadata
Metadata
Assignees
Labels
No labels