oauth2

package
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken string

func (AccessToken) String

func (t AccessToken) String() string

type Config

type Config struct {
	Authority    string `yaml:"authority" json:"authority"`
	oauth.Config `yaml:",inline"`
	HTTP         client.Config `yaml:"http" json:"http"`
}

Config general configuration

func (*Config) Validate

func (c *Config) Validate() error

type PlgdProvider

type PlgdProvider struct {
	Config     Config
	OAuth2     *oauth2.Config
	HTTPClient *client.Client
	OpenID     openid.Config
}

PlgdProvider configuration with new http client

func NewPlgdProvider

func NewPlgdProvider(ctx context.Context, config Config, logger log.Logger) (*PlgdProvider, error)

NewPlgdProvider creates OAuth client

func (*PlgdProvider) Close

func (p *PlgdProvider) Close()

func (*PlgdProvider) Exchange

func (p *PlgdProvider) Exchange(ctx context.Context, authorizationCode string) (*Token, error)

Exchange Auth Code for Access Token via OAuth

func (*PlgdProvider) Refresh

func (p *PlgdProvider) Refresh(ctx context.Context, refreshToken string) (*Token, error)

Refresh gets new Access Token via OAuth.

type Token

type Token struct {
	AccessToken  AccessToken
	RefreshToken string
	Expiry       time.Time
}

Token provides access tokens and their attributes.

func (Token) IsValidAccessToken

func (o Token) IsValidAccessToken() bool

func (Token) Refresh

func (o Token) Refresh(ctx context.Context, cfg oauth2.Config) (Token, bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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