auth

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDatabaseTokenSource added in v0.2.0

func NewDatabaseTokenSource(db storage.Database, service string, config *oauth2.Config, tok *oauth2.Token) oauth2.TokenSource

func RandomState added in v0.3.0

func RandomState() string

func RunOauth2CallbackServer

func RunOauth2CallbackServer(redirectURL url.URL, param string, responseChan chan CodeResponse)

Types

type AuthUrl added in v0.2.0

type AuthUrl struct {
	// The URL the user must visit to approve access
	Url string
	// Random state string passed on to the callback.
	// Leave empty if the service does not support state.
	State string
	// Parameter name of the code passed on to the callback (usually "code")
	Param string
}

type CodeResponse

type CodeResponse struct {
	Code  string
	State string
}

type OAuth2Strategy

type OAuth2Strategy interface {
	Config() oauth2.Config

	AuthCodeURL(verifier string, state string) AuthUrl

	ExchangeToken(code CodeResponse, verifier string) (*oauth2.Token, error)
}

func NewStandardStrategy

func NewStandardStrategy(conf oauth2.Config) OAuth2Strategy

type StandardStrategy

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

func (StandardStrategy) AuthCodeURL

func (s StandardStrategy) AuthCodeURL(verifier string, state string) AuthUrl

func (StandardStrategy) Config

func (s StandardStrategy) Config() oauth2.Config

func (StandardStrategy) ExchangeToken

func (s StandardStrategy) ExchangeToken(code CodeResponse, verifier string) (*oauth2.Token, error)

Jump to

Keyboard shortcuts

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