-
Notifications
You must be signed in to change notification settings - Fork 1
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
Callback routes #17
base: main
Are you sure you want to change the base?
Callback routes #17
Conversation
regilero
commented
Feb 24, 2025
- Introduce OIDCHelper, as trying to manipulate routes directly from the provider would make infinite dependencies loops with settings.
- get_urlpatterns is moved inside OIDCHelper
- Side note: when using get_urlpatterns to generates routes in tests this must be defined in the test settings and cannotbe overriden later in individual tests, as the route assignement is done early
- Fix the callback_uri_name/callback_path/callback names mess tobe able to handle routes with prefix. e2e tests done in lemonldap integration currently.
if "oidc_paths_prefix" in op_definition: | ||
# we cannot be sure that this part will be the full path at the end | ||
# because the routes based on this path can be used in prefix | ||
# but we can document that when prefix are used the callback_uri_name | ||
# is a better way to define callback path. | ||
# here this will only work when no route prefix is used. | ||
|
||
# remove '/' prefix if any." | ||
if op_definition["oidc_paths_prefix"][:1] == "/": | ||
op_definition["oidc_paths_prefix"] = op_definition["oidc_paths_prefix"][ | ||
1: | ||
] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je crois que la méthode str.strip()
te permet de faire la même chose !
@@ -239,6 +271,9 @@ def get( | |||
return default | |||
return res | |||
|
|||
def provider(self) -> Provider: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ici peut être que c'est intéressant de décorer avec @property
?
op_definition[ | ||
"oidc_callback_path" | ||
] = f"{op_definition['oidc_paths_prefix']}-callback" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ici je pense qu'il faudrait résoudre le nom de l'url avec la fonction reverse (ou reverse_lazy) de jdango.