-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe6fefb
commit 53cccb4
Showing
15 changed files
with
930 additions
and
446 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.6 | ||
hooks: | ||
- id: ruff | ||
args: [ --fix ] | ||
- id: ruff-format |
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 |
---|---|---|
@@ -1,17 +1,28 @@ | ||
from requests_auth import OAuth2AuthorizationCodePKCE, OAuth2ResourceOwnerPasswordCredentials | ||
from requests_auth import ( | ||
OAuth2AuthorizationCodePKCE, | ||
OAuth2ResourceOwnerPasswordCredentials, | ||
) | ||
|
||
|
||
def resource_owner_password_credentials_grant( | ||
username: str, password: str, client_id: str, client_secret: str, token_url: str | ||
username: str, password: str, client_id: str, client_secret: str, token_url: str | ||
) -> OAuth2ResourceOwnerPasswordCredentials: | ||
auth = OAuth2ResourceOwnerPasswordCredentials(token_url=token_url, username=username, password=password, client_id=client_id, client_secret=client_secret) | ||
auth = OAuth2ResourceOwnerPasswordCredentials( | ||
token_url=token_url, | ||
username=username, | ||
password=password, | ||
client_id=client_id, | ||
client_secret=client_secret, | ||
) | ||
# explicitly remove authorization header from request, otherwise both the header and body contain authorization | ||
# information causing the request to WekEO WSO2 IdP (as used in HRVPP project) to fail with a 400 error (bad request) | ||
auth.session.auth = None | ||
return auth | ||
|
||
|
||
def authorization_code_grant( | ||
authorization_url: str, token_url: str, client_id: str | ||
authorization_url: str, token_url: str, client_id: str | ||
) -> OAuth2AuthorizationCodePKCE: | ||
return OAuth2AuthorizationCodePKCE(authorization_url=authorization_url, token_url=token_url, client_id=client_id) | ||
return OAuth2AuthorizationCodePKCE( | ||
authorization_url=authorization_url, token_url=token_url, client_id=client_id | ||
) |
Oops, something went wrong.