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.