oauth

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthStyle

type AuthStyle string
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"
)

func (AuthStyle) ToOAuth2

func (a AuthStyle) ToOAuth2() oauth2.AuthStyle

type Config

type Config struct {
	ClientID     string   `json:"ClientId" envconfig:"CLIENT_ID" env:"CLIENT_ID"`
	ClientSecret string   `json:"ClientSecret" envconfig:"CLIENT_SECRET" env:"CLIENT_SECRET"`
	Scopes       []string `json:"Scopes" envconfig:"SCOPES" env:"SCOPES"`
	Endpoint     Endpoint `json:"Endpoint" envconfig:"ENDPOINT" env:"ENDPOINT"`
	Audience     string   `json:"Audience" envconfig:"AUDIENCE" env:"AUDIENCE"`
	RedirectURL  string   `json:"RedirectUrl" envconfig:"REDIRECT_URL" env:"REDIRECT_URL"`
	AccessType   string   `json:"AccessType" envconfig:"ACCESS_TYPE" env:"ACCESS_TYPE"`
	ResponseType string   `json:"ResponseType" envconfig:"RESPONSE_TYPE" env:"RESPONSE_TYPE"`
	ResponseMode string   `json:"ResponseMode" envconfig:"RESPONSE_MODE" env:"RESPONSE_MODE"`
}

func (Config) AuthCodeURL

func (c Config) AuthCodeURL(csrfToken string) string

func (Config) ToOAuth2

func (c Config) ToOAuth2() oauth2.Config

type Endpoint

type Endpoint struct {
	AuthURL   string    `json:"AuthUrl" envconfig:"AUTH_URL" env:"AUTH_URL"`
	TokenURL  string    `json:"TokenUrl" envconfig:"TOKEN_URL" env:"TOKEN_URL"`
	AuthStyle AuthStyle `envconfig:"AUTH_STYLE" env:"AUTH_STYLE"`
}

Jump to

Keyboard shortcuts

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