auth

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Apache-2.0 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 added in v1.5.0

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 Options

type Options struct {
	User                  string
	Password              string
	ClientID              string `mapstructure:"client_id"`
	ClientSecret          string `mapstructure:"client_secret"`
	AuthorizationEndpoint string `mapstructure:"authorization_endpoint"`
	TokenEndpoint         string `mapstructure:"token_endpoint"`
	IssuerURL             string `mapstructure:"issuer_url"`

	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

type Refresher

type Refresher interface {
	Token() (*Token, error)
}

Refresher should be implemented for refreshing access tokens with refresh token flow

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

func GetToken added in v1.5.0

func GetToken(options *Options, authenticator Authenticator) (*Token, error)

GetToken uses the provided authenticator to get a token using the appropriate flow depending on the provided options

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