basic2token

package
v1.77.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenResponse

type AccessTokenResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int    `json:"expires_in"`
	Scope        string `json:"scope"`
	Jti          string `json:"jti"`
}

type Basic2Token

type Basic2Token struct{}

func NewBasic2Token

func NewBasic2Token() *Basic2Token

func (Basic2Token) Handler

func (h Basic2Token) Handler(proxyRoute gobis.ProxyRoute, params interface{}, handler http.Handler) (http.Handler, error)

func (Basic2Token) Schema

func (h Basic2Token) Schema() interface{}

type Basic2TokenAuth

type Basic2TokenAuth struct {
	// contains filtered or unexported fields
}

func NewBasic2TokenAuth

func NewBasic2TokenAuth(client *http.Client, options Basic2TokenOptions) *Basic2TokenAuth

func (Basic2TokenAuth) Auth

func (a Basic2TokenAuth) Auth(user, password string, origRequest *http.Request) bool

type Basic2TokenConfig

type Basic2TokenConfig struct {
	Basic2Token *Basic2TokenOptions `mapstructure:"basic2token" json:"basic2token" yaml:"basic2token"`
}

type Basic2TokenOptions

type Basic2TokenOptions struct {
	utils.ClientRouteOption `mapstructure:",squash"`
	// Uri to retrieve access token e.g.: https://my.uaa.local/oauth/token
	AccessTokenUri string `mapstructure:"access_token_uri" json:"access_token_uri" yaml:"access_token_uri"`
	// Client id which will connect user on behalf him
	ClientId string `mapstructure:"client_id" json:"client_id" yaml:"client_id"`
	// Client secret which will connect user on behalf him
	ClientSecret string `mapstructure:"client_secret" json:"client_secret" yaml:"client_secret"`
	// Some oauth server can be configured to use a different of token
	// if you want an opaque token from uaa you will set this value to "opaque"
	TokenFormat string `mapstructure:"token_format" json:"token_format" yaml:"token_format"`
	// Permit to basic2token to detect if a oauth token has been already set
	// If token was already given it will forward to the next handler without trying to acquire a new token
	// Default: bearer
	TokenType string `mapstructure:"token_type" json:"token_type" yaml:"token_type"`
	// By default request token is sent by post form, set to true to send as json
	ParamsAsJson bool `mapstructure:"params_as_json" json:"params_as_json" yaml:"params_as_json"`
	// Passthrough if a previous middleware already set user context
	// This is helpful when you want add user with basic auth middleware
	TrustCurrentUser bool `mapstructure:"trust_current_user" json:"trust_current_user" yaml:"trust_current_user"`
}

Jump to

Keyboard shortcuts

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