GitHubProvider¶
- class gafaelfawr.providers.github.GitHubProvider(*, config, http_client, logger)¶
Bases:
Provider
Authenticate a user with GitHub.
- Parameters:
config (
GitHubConfig
) – Configuration for the GitHub authentication provider.http_client (
AsyncClient
) – Session to use to make HTTP requests.logger (
BoundLogger
) – Logger for any log messages.
Methods Summary
create_user_info
(code, state, session)Given the code from an authentication, create the user information.
get_redirect_url
(state)Get the login URL to which to redirect the user.
logout
(session)Revoke the OAuth authorization grant for this user.
Methods Documentation
- async create_user_info(code, state, session)¶
Given the code from an authentication, create the user information.
The GitHub access token is stored in the
github
field of thestate
parameter so that it can be used during logout.- Parameters:
- Returns:
The user information corresponding to that authentication.
- Return type:
- Raises:
GitHubError – Raised if GitHub responded with an error to a request.
GitHubWebError – Raised if an HTTP client error occurred trying to talk to GitHub.
PermissionDeniedError – Raised if the GitHub username is not a valid username for Gafaelfawr.
- get_redirect_url(state)¶
Get the login URL to which to redirect the user.
- async logout(session)¶
Revoke the OAuth authorization grant for this user.
During logout, revoke the user’s OAuth authorization. This ensures that, after an explicit logout, logging in again forces a reauthorization and thus an update of the granted information.