oauth2

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	M Method
}

func (Adapter) Acquire

func (a Adapter) Acquire(ctx context.Context) (string, error)

type Auth2Config

type Auth2Config struct {
	GrantType   string                 `mapstructure:"grant_type"`
	GrantConfig map[string]interface{} `mapstructure:"grant_config"`
}

func (Auth2Config) GetGrantMethod

func (c Auth2Config) GetGrantMethod() (Method, error)

GetGrantMethod builds and returns a grant-specific oauth2 Method using the GrantType and GrantConfig fields. This avoids the generic Build() path for simplicity.

type ClientCredentialsConfig

type ClientCredentialsConfig struct {
	ClientID  string   `mapstructure:"client_id"`
	ClientSec string   `mapstructure:"client_secret"`
	TokenURL  string   `mapstructure:"token_url"`
	Scopes    []string `mapstructure:"scopes"`
}

ClientCredentialsConfig holds configuration for the Client Credentials grant.

func (ClientCredentialsConfig) ToMap

func (c ClientCredentialsConfig) ToMap() map[string]interface{}

ToMap returns a spec for oauth2 client_credentials

type ImplicitConfig

type ImplicitConfig struct {
	ClientID    string   `mapstructure:"client_id"`
	RedirectURL string   `mapstructure:"redirect_url"`
	AuthURL     string   `mapstructure:"auth_url"`
	Scopes      []string `mapstructure:"scopes"`
}

ImplicitConfig holds configuration for the Implicit grant. Behavior: returns the header name and an authorization URL that includes response_type=token.

func (ImplicitConfig) ToMap

func (c ImplicitConfig) ToMap() map[string]interface{}

ToMap returns a spec for oauth2 implicit grant

type Method

type Method interface {
	Acquire(ctx context.Context) (value string, err error)
}

Method is the local interface implemented by oauth2 auth methods. It matches the parent auth.Method signature (Acquire only, returning value).

type PasswordConfig

type PasswordConfig struct {
	ClientID  string   `mapstructure:"client_id"`
	ClientSec string   `mapstructure:"client_secret"`
	AuthURL   string   `mapstructure:"auth_url"`
	TokenURL  string   `mapstructure:"token_url"`
	Username  string   `mapstructure:"username"`
	Password  string   `mapstructure:"password"`
	Scopes    []string `mapstructure:"scopes"`
}

PasswordConfig holds configuration for the Resource Owner Password Credentials grant.

func (PasswordConfig) ToMap

func (c PasswordConfig) ToMap() map[string]interface{}

ToMap returns a spec compatible with the oauth2 provider factory (password grant).

Jump to

Keyboard shortcuts

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