uaa

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2017 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// URL is the URL to UAA, e.g. https://uaa.system.example.com.
	URL string
	// contains filtered or unexported fields
}

Client will validate access tokens against a UAA instance, caching keys as required.

func NewClientFromAPIURL

func NewClientFromAPIURL(apiEndpoint string) (*Client, error)

NewClientFromAPIURL looks up, via the apiEndpoint, the correct UAA address and returns a client.

func (*Client) ExchangeBearerTokenForClientToken

func (c *Client) ExchangeBearerTokenForClientToken(clientID, clientSecret, bearerLine string) (*OAuthGrant, error)

ExchangeBearerTokenForClientToken takes a bearer token (such as that returned by CF), and exchanges via the API auth flow, for an OAuthGrant for the specified clientID. The clientSecret here is really not a secret.

func (*Client) FetchAccessToken

func (c *Client) FetchAccessToken(clientID, clientSecret string, postData url.Values) (*OAuthGrant, error)

FetchAccessToken sends data to endpoint to fetch a token and returns a grant object.

func (*Client) GetAuthorizeEndpoint

func (c *Client) GetAuthorizeEndpoint() string

func (*Client) GetTokenEndpoint

func (c *Client) GetTokenEndpoint() string

func (*Client) ValidateAccessToken

func (c *Client) ValidateAccessToken(at, expectedClientID string) (jwt.MapClaims, error)

ValidateAccessToken will validate the given access token, ensure it matches the client ID, and return the claims reported within.

type OAuthGrant

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

OAuthGrant used to parse JSON for an access token from UAA server.

Jump to

Keyboard shortcuts

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