oauth

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: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AuthStyleAutoDetect means to auto-detect which authentication
	// style the provider wants by trying both ways and caching
	// the successful way for the future.
	AuthStyleAutoDetect AuthStyle = "autoDetect"

	// AuthStyleInParams sends the "client_id" and "client_secret"
	// in the POST body as application/x-www-form-urlencoded parameters.
	AuthStyleInParams AuthStyle = "inParams"

	// AuthStyleInHeader sends the client_id and client_password
	// using HTTP Basic Authorization. This is an optional style
	// described in the OAuth2 RFC 6749 section 2.3.1.
	AuthStyleInHeader AuthStyle = "inHeader"

	ClientCredentials GrantType = "clientCredentials"
	AuthorizationCode GrantType = "authorizationCode"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthStyle

type AuthStyle string

func (AuthStyle) ToOAuth2

func (a AuthStyle) ToOAuth2() oauth2.AuthStyle

type Config

type Config struct {
	ClientID         string              `yaml:"clientID" json:"clientId"`
	ClientSecretFile urischeme.URIScheme `yaml:"clientSecretFile" json:"clientSecretFile"`
	Scopes           []string            `yaml:"scopes" json:"scopes"`
	AuthURL          string              `yaml:"-" json:"authUrl"`
	TokenURL         string              `yaml:"-" json:"tokenUrl"`
	AuthStyle        AuthStyle           `yaml:"authStyle" json:"authStyle"`
	Audience         string              `yaml:"audience" json:"audience"`
	RedirectURL      string              `yaml:"redirectURL" json:"redirectUrl"`
	AccessType       string              `yaml:"accessType" json:"accessType"`
	ResponseType     string              `yaml:"responseType" json:"responseType"`
	ResponseMode     string              `yaml:"responseMode" json:"responseMode"`
	ClientSecret     string              `yaml:"-" json:"clientSecret"`
	GrantType        GrantType           `yaml:"grantType" json:"grantType"`
}

TODO cleanup settings AccessType, ResponseType, ResponseMode, AuthStyle - be careful it is used by c2c.

func (Config) AuthCodeURL

func (c Config) AuthCodeURL(csrfToken string) string

func (Config) ToClientCredentials added in v2.2.4

func (c Config) ToClientCredentials(tokenURL, clientSecret string) clientcredentials.Config

func (Config) ToDefaultClientCredentials added in v2.2.4

func (c Config) ToDefaultClientCredentials() clientcredentials.Config

func (Config) ToDefaultOAuth2

func (c Config) ToDefaultOAuth2() oauth2.Config

func (Config) ToOAuth2

func (c Config) ToOAuth2(authURL, tokenURL, clientSecret string) oauth2.Config

func (*Config) Validate

func (c *Config) Validate() error

type GrantType added in v2.2.4

type GrantType string

Jump to

Keyboard shortcuts

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