oauth

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: BSD-2-Clause Imports: 9 Imported by: 7

Documentation

Index

Constants

View Source
const ErrorAccessDenied = "access_denied"

Variables

This section is empty.

Functions

func IsAccessTokenError added in v1.22.0

func IsAccessTokenError(err error) bool

func IsRefreshTokenError added in v1.22.0

func IsRefreshTokenError(err error) bool

Types

type HTTPClientSource added in v1.24.0

type HTTPClientSource interface {
	HTTPClient(ctx context.Context, tokenSourceSource TokenSourceSource) (*http.Client, error)
}

type Provider

type Provider interface {
	provider.Provider
	TokenSourceSource

	CalculateStateForRestrictedToken(restrictedToken string) string // state = crypto of provider name, restrictedToken, secret
	GetAuthorizationCodeURLWithState(state string) string
	ExchangeAuthorizationCodeForToken(ctx context.Context, authorizationCode string) (*Token, error)
}

type Token

type Token struct {
	AccessToken    string    `json:"accessToken" bson:"accessToken"`
	TokenType      string    `json:"tokenType,omitempty" bson:"tokenType,omitempty"`
	RefreshToken   string    `json:"refreshToken,omitempty" bson:"refreshToken,omitempty"`
	ExpirationTime time.Time `json:"expirationTime,omitempty" bson:"expirationTime,omitempty"`
}

func NewToken

func NewToken() *Token

func NewTokenFromRawToken

func NewTokenFromRawToken(rawToken *oauth2.Token) (*Token, error)

func (*Token) Expire added in v1.22.0

func (t *Token) Expire()

func (*Token) MatchesRawToken

func (t *Token) MatchesRawToken(rawToken *oauth2.Token) bool

func (*Token) Normalize

func (t *Token) Normalize(normalizer structure.Normalizer)

func (*Token) Parse

func (t *Token) Parse(parser structure.ObjectParser)

func (*Token) RawToken

func (t *Token) RawToken() *oauth2.Token

func (*Token) Validate

func (t *Token) Validate(validator structure.Validator)

type TokenSource

type TokenSource interface {
	HTTPClientSource

	RefreshedToken() (*Token, error)
	ExpireToken()
}

type TokenSourceSource added in v1.24.0

type TokenSourceSource interface {
	TokenSource(ctx context.Context, token *Token) (oauth2.TokenSource, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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