auth

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

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

Authenticator stores authentication information that can be used to get an auth token.

func NewAuthenticator

func NewAuthenticator(id, secret, uaaAddr string, opts ...AuthenticatorOption) *Authenticator

NewAuthenticator returns an initialized Authenticator. The authenticator, by default is configured to use http.DefaultClient. It is recommended that the authenticator is configured with the `WithHTTPClient` AuthenticatorOption.

func (*Authenticator) CheckToken

func (a *Authenticator) CheckToken(token, scope string) bool

CheckToken validates an auth token with the UAA. It also ensures that the given auth token has permissions to a given scope.

func (*Authenticator) RefreshAuthToken

func (a *Authenticator) RefreshAuthToken() (string, error)

RefreshAuthToken will request a new auth token from UAA.

type AuthenticatorOption

type AuthenticatorOption func(*Authenticator)

AuthenticatorOption is a type of function that can be passed into NewAuthenticator for optional configuration.

func WithHTTPClient

func WithHTTPClient(c HTTPClient) AuthenticatorOption

WithHTTPClient is an AuthenticatorOption to configure the HTTPClient to be used by the authenticator.

type HTTPClient

type HTTPClient interface {
	PostForm(string, url.Values) (*http.Response, error)
	Do(*http.Request) (*http.Response, error)
}

HTTPClient is an interface that http.Client conforms to.

Jump to

Keyboard shortcuts

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