oauth2

package
v2.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 12 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 AuthCodePlgdProvider added in v2.2.4

type AuthCodePlgdProvider struct {
	Config     Config
	HTTPClient *client.Client
}

PlgdProvider configuration with new http client

func NewAuthCodePlgdProvider added in v2.2.4

func NewAuthCodePlgdProvider(config Config, httpClient *client.Client) *AuthCodePlgdProvider

NewPlgdProvider creates OAuth client

func (*AuthCodePlgdProvider) Close added in v2.2.4

func (p *AuthCodePlgdProvider) Close()

func (*AuthCodePlgdProvider) Exchange added in v2.2.4

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

Exchange Auth Code for Access Token via OAuth

func (*AuthCodePlgdProvider) HTTP added in v2.2.4

func (p *AuthCodePlgdProvider) HTTP() *http.Client

func (*AuthCodePlgdProvider) Refresh added in v2.2.4

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

Refresh gets new Access Token via OAuth.

type ClientCredentialsPlgdProvider added in v2.2.4

type ClientCredentialsPlgdProvider struct {
	Config     Config
	HTTPClient *client.Client
	// contains filtered or unexported fields
}

PlgdProvider configuration with new http client

func NewClientCredentialsPlgdProvider added in v2.2.4

func NewClientCredentialsPlgdProvider(config Config, httpClient *client.Client, jwksURL string, ownerClaim, deviceIDClaim string) *ClientCredentialsPlgdProvider

NewPlgdProvider creates OAuth client

func (*ClientCredentialsPlgdProvider) Close added in v2.2.4

func (p *ClientCredentialsPlgdProvider) Close()

func (*ClientCredentialsPlgdProvider) Exchange added in v2.2.4

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

Exchange Auth Code for Access Token via OAuth

func (*ClientCredentialsPlgdProvider) HTTP added in v2.2.4

func (*ClientCredentialsPlgdProvider) Refresh added in v2.2.4

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

Refresh gets new Access Token via OAuth.

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

	OpenID openid.Config
	// contains filtered or unexported fields
}

PlgdProvider configuration with new http client

func NewPlgdProvider

func NewPlgdProvider(ctx context.Context, config Config, fileWatcher *fsnotify.Watcher, logger log.Logger, tracerProvider trace.TracerProvider, ownerClaim, deviceIDClaim string) (*PlgdProvider, error)

NewPlgdProvider creates OAuth client

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