-
Notifications
You must be signed in to change notification settings - Fork 61
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
Make the relay_state optional in the response. #15
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ class ServiceProvider: | |
def login_successful( | ||
self, | ||
auth_data: AuthData, | ||
relay_state: str, | ||
redirect_to: str, | ||
) -> Response: | ||
""" Called when a user is successfully logged on. | ||
Subclasses should override this if they want to do more | ||
|
@@ -49,7 +49,9 @@ def login_successful( | |
but they *must* call ``super()``. | ||
""" | ||
self.set_auth_data_in_session(auth_data) | ||
return redirect(relay_state) | ||
if not redirect_to: | ||
redirect_to = self.get_login_return_url() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be Both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for your review! |
||
return redirect(redirect_to) | ||
|
||
# Service provider configuration | ||
|
||
|
@@ -168,7 +170,7 @@ def get_login_return_url(self) -> Optional[str]: | |
for url in urls: | ||
if url is None: | ||
continue | ||
url = self.make_absolute_url(url) | ||
|
||
if self.is_valid_redirect_url(url): | ||
return url | ||
|
||
|
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.
As you've used
request.form.get('RelayState')
below, the type of this should now beOptional[str]