github

package
v0.15.7 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package github implements OAuth2 based authentication for github

https://www.pomerium.io/docs/identity-providers/github.html

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(ctx 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) GetSignInURL

func (p *Provider) GetSignInURL(state string) (string, error)

GetSignInURL returns a URL to OAuth 2.0 provider's consent page that asks for permissions for the required scopes explicitly.

func (*Provider) LogOut

func (p *Provider) LogOut() (*url.URL, error)

LogOut is not implemented by github.

func (*Provider) Name added in v0.11.0

func (p *Provider) Name() string

Name returns the provider name.

func (*Provider) Refresh

func (p *Provider) Refresh(ctx context.Context, t *oauth2.Token, v 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) UpdateUserInfo added in v0.10.0

func (p *Provider) UpdateUserInfo(ctx context.Context, t *oauth2.Token, v interface{}) 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