-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cache existing authentication tokens when chaning username+password
when changing `auth.user.username` and `auth.user.password` during runtime, any existing authorization tokens should be cached, so they can be re-used if changed back to the original user. this is to avoid having to authenticate everytime a user is switched. tokens are only refresh when the original `refresh_time` has expired.
- Loading branch information
Showing
9 changed files
with
225 additions
and
49 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 |
---|---|---|
|
@@ -209,13 +209,13 @@ def request(_: RestApiUser, *_args: Any, **_kwargs: Any) -> GrizzlyResponse: | |
get_token_mock.assert_called_once_with(parent.user, AuthMethod.USER) | ||
get_token_mock.reset_mock() | ||
|
||
parent.user.add_context({'auth': {'user': {'username': '[email protected]'}}}) | ||
parent.user.add_context({'auth': {'user': {'username': '[email protected]', 'password': 'foobar'}}}) | ||
assert 'Authorization' not in parent.user.metadata | ||
auth_context = parent.user._context.get('auth', None) | ||
assert auth_context is not None | ||
assert auth_context.get('user', None) == { | ||
'username': '[email protected]', | ||
'password': 'HemligaArne', | ||
'password': 'foobar', | ||
'otp_secret': None, | ||
'redirect_uri': '/authenticated', | ||
'initialize_uri': None, | ||
|
Oops, something went wrong.