auth

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: Apache-2.0, BSD-3-Clause, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	ClientCredentials() (*Token, error)
	PasswordCredentials(user, password string) (*Token, error)
}

Authenticator should be implemented for different authentication strategies

type Client

type Client interface {
	Do(*http.Request) (*http.Response, error)
}

Client should be implemented for http like clients which do automatic authentication

type Flow

type Flow string

Flow defiens an OAuth 2 authentication flow, a.k.a. grant type

const (
	// DefaultFlow is the default auth flow
	DefaultFlow Flow = ""
	// ClientCredentials flow used for technical user
	ClientCredentials Flow = "client-credentials"
	// PasswordGrant flow used for named users
	PasswordGrant Flow = "password-grant"
)

type Options

type Options struct {
	User                  string
	Password              string
	ClientID              string `mapstructure:"client_id"`
	ClientSecret          string `mapstructure:"client_secret"`
	Certificate           string `mapstructure:"cert"`
	Key                   string `mapstructure:"key"`
	AuthorizationEndpoint string `mapstructure:"authorization_endpoint"`
	TokenEndpoint         string `mapstructure:"token_endpoint"`
	IssuerURL             string `mapstructure:"issuer_url"`
	AuthFlow              Flow   `mapstructure:"auth_flow"`

	TokenBasicAuth bool `mapstructure:"token_basic_auth"`
	SSLDisabled    bool `mapstructure:"ssl_disabled"`

	Timeout time.Duration `mapstructure:"timeout"`
}

Options is used to configure new authenticators and clients

func (*Options) MtlsEnabled

func (o *Options) MtlsEnabled() bool

type Token

type Token struct {
	AccessToken  string    `json:"access_token"`
	TokenType    string    `json:"token_type"`
	RefreshToken string    `json:"refresh_token"`
	ExpiresIn    time.Time `json:"expires_in"`
	Scope        string    `json:"scope"`
}

Token contains the structure of a typical UAA response token

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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