GitHubProvider#
- class gafaelfawr.providers.github.GitHubProvider(*, config, http_client, logger)#
Bases:
ProviderAuthenticate 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
githubfield of thestateparameter 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.
PermissionDeniedError – Raised if the GitHub username is not a valid username for Gafaelfawr.
httpx.HTTPError – Raised if an HTTP client error occurred trying to talk to GitHub.
- 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.