oauth

package
v1.1.16 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// AuthorizationPrefix is authorization prefix
	AuthorizationPrefix = "Bearer"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizedClient

type AuthorizedClient struct {
	Client *http.Client
	Token  *oauth2.Token
}

AuthorizedClient is authorized client and token

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider contains oauth provider config

func NewProvider

func NewProvider(oauthConfig *oauth2.Config) Provider

NewProvider returns new provider

func (Provider) AuthenticateUser

func (p Provider) AuthenticateUser(values url.Values) (client *AuthorizedClient, err error)

AuthenticateUser starts the login process

func (Provider) CallbackHandler

func (p Provider) CallbackHandler(ctx context.Context, clientChan chan *AuthorizedClient) func(w http.ResponseWriter, r *http.Request)

CallbackHandler is oauth callback handler

func (Provider) ErrorHandler

func (p Provider) ErrorHandler() func(w http.ResponseWriter, r *http.Request)

ErrorHandler is oauth error handler

func (Provider) ValidateToken

func (p Provider) ValidateToken(token *oauth2.Token) (*oauth2.Token, error)

ValidateToken validates token

Jump to

Keyboard shortcuts

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