github

package
v0.27.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package github implements OAuth2 based authentication for github

https://www.pomerium.com/docs/identity-providers/github

Index

Constants

View Source
const Name = "github"

Name identifies the GitHub identity provider

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	Oauth *oauth2.Config
	// contains filtered or unexported fields
}

Provider is an implementation of the OAuth Provider.

func New

func New(_ context.Context, o *oauth.Options) (*Provider, error)

New instantiates an OAuth2 provider for Github.

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) Name

func (p *Provider) Name() string

Name returns the provider name.

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

func (p *Provider) Revoke(ctx context.Context, token *oauth2.Token) error

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

func (p *Provider) SignIn(w http.ResponseWriter, r *http.Request, state string) error

SignIn redirects to the OAuth 2.0 provider's consent page that asks for permissions for the required scopes explicitly.

func (*Provider) SignOut

func (p *Provider) SignOut(_ http.ResponseWriter, _ *http.Request, _, _, _ string) error

SignOut is not implemented.

func (*Provider) UpdateUserInfo

func (p *Provider) UpdateUserInfo(ctx context.Context, t *oauth2.Token, v any) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL