Documentation ¶
Overview ¶
Package github implements OAuth2 based authentication for github
Index ¶
- Constants
- type Provider
- func (p *Provider) Authenticate(ctx context.Context, code string, v identity.State) (*oauth2.Token, error)
- func (p *Provider) Name() string
- func (p *Provider) Refresh(_ context.Context, t *oauth2.Token, _ identity.State) (*oauth2.Token, error)
- func (p *Provider) Revoke(ctx context.Context, token *oauth2.Token) error
- func (p *Provider) SignIn(w http.ResponseWriter, r *http.Request, state string) error
- func (p *Provider) SignOut(_ http.ResponseWriter, _ *http.Request, _, _, _ string) error
- func (p *Provider) UpdateUserInfo(ctx context.Context, t *oauth2.Token, v any) error
Constants ¶
const Name = "github"
Name identifies the GitHub identity provider
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
Provider is an implementation of the OAuth Provider.
func (*Provider) Authenticate ¶
func (p *Provider) Authenticate(ctx context.Context, code string, v identity.State) (*oauth2.Token, error)
Authenticate creates an identity session with github from a authorization code, and follows up call to the user and user group endpoint with the
func (*Provider) Refresh ¶
func (p *Provider) Refresh(_ context.Context, t *oauth2.Token, _ identity.State) (*oauth2.Token, error)
Refresh is a no-op for github, because github sessions never expire.
func (*Provider) Revoke ¶
Revoke method will remove all the github grants the user gave pomerium application during authorization.
https://developer.github.com/v3/apps/oauth_applications/#delete-an-app-authorization
func (*Provider) SignIn ¶
SignIn redirects to the OAuth 2.0 provider's consent page that asks for permissions for the required scopes explicitly.
func (*Provider) UpdateUserInfo ¶
UpdateUserInfo will get the user information from github and also retrieve the user's team(s)
https://developer.github.com/v3/users/#get-the-authenticated-user