Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Callback routes #17

wants to merge 5 commits into from

Conversation

regilero
Copy link
Member

  • 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.

Comment on lines +160 to +172
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:
]

Copy link
Collaborator

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:
Copy link
Collaborator

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 ?

Comment on lines +174 to +176
op_definition[
"oidc_callback_path"
] = f"{op_definition['oidc_paths_prefix']}-callback"
Copy link
Collaborator

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.

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