-
Notifications
You must be signed in to change notification settings - Fork 184
fix: handle authorization_details in back_channel_login
#695
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b95cb5a
fix: support `authorization_details`
kishore7snehil 5fa2719
Making it v3.8 compatible
kishore7snehil b0703dc
Changing poetry version
kishore7snehil 4409d5d
printing error logs
kishore7snehil 7bc1076
Reverting to original workflow
kishore7snehil b15e280
Checking Logs
kishore7snehil a4eb152
Adding fix for userpath
kishore7snehil 3e4dc86
Adding poetry install fix
kishore7snehil ccbe91c
Adding curl_path
kishore7snehil 01dd04b
Adding the path
kishore7snehil 4582ecd
Removing v3.8 from tests
kishore7snehil 65a96b0
Serialization Docstring Update
kishore7snehil 0be92a4
Removed dicts from the serialization
kishore7snehil fa71d66
Review Feedback Changes
kishore7snehil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,60 @@ | ||
| from typing import Any | ||
| from typing import Any, Optional, Union, List, Dict | ||
|
|
||
| from .base import AuthenticationBase | ||
|
|
||
| import json | ||
|
|
||
|
|
||
| class BackChannelLogin(AuthenticationBase): | ||
| """Back-Channel Login endpoint""" | ||
|
|
||
| def back_channel_login( | ||
| self, binding_message: str, login_hint: str, scope: str, **kwargs | ||
| self, | ||
| binding_message: str, | ||
| login_hint: str, | ||
| scope: str, | ||
| authorization_details: Optional[Union[str, List[Dict]]] = None, | ||
| **kwargs | ||
| ) -> Any: | ||
| """Send a Back-Channel Login. | ||
|
|
||
| Args: | ||
| binding_message (str): Human-readable string displayed on both the device calling /bc-authorize and the user’s | ||
| authentication device to ensure the user is approves the correct request. | ||
|
|
||
| login_hint (str): String containing information about the user to contact for authentication. | ||
| login_hint (str): JSON string containing user details for authentication in the iss_sub format.Ensure | ||
| serialization before passing. | ||
|
|
||
| scope(str): "openid" is a required scope.Multiple scopes are separated | ||
| with whitespace. | ||
|
|
||
| **kwargs: Other fields to send along with the PAR. | ||
| authorization_details (str, list of dict, optional): JSON string or a list of dictionaries representing | ||
| Rich Authorization Requests (RAR) details to include in the CIBA request. | ||
|
|
||
| **kwargs: Other fields to send along with the request. | ||
|
|
||
| Returns: | ||
| auth_req_id, expires_in, interval | ||
| """ | ||
| return self.authenticated_post( | ||
| f"{self.protocol}://{self.domain}/bc-authorize", | ||
| data={ | ||
|
|
||
| data = { | ||
| "client_id": self.client_id, | ||
| "binding_message": binding_message, | ||
| "login_hint": login_hint, | ||
| "scope": scope, | ||
| **kwargs, | ||
| }, | ||
| } | ||
|
|
||
| if authorization_details is not None: | ||
| if isinstance(authorization_details, str): | ||
| data["authorization_details"] = authorization_details | ||
| elif isinstance(authorization_details, list): | ||
| data["authorization_details"] = json.dumps(authorization_details) | ||
|
|
||
| data.update(kwargs) | ||
|
|
||
| return self.authenticated_post( | ||
| f"{self.protocol}://{self.domain}/bc-authorize", | ||
| data = data, | ||
| headers={"Content-Type": "application/x-www-form-urlencoded"}, | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.