Documentation
¶
Index ¶
- type Client
- func (c *Client) ExchangeBearerTokenForClientToken(clientID, clientSecret, bearerLine string) (*OAuthGrant, error)
- func (c *Client) FetchAccessToken(clientID, clientSecret string, postData url.Values) (*OAuthGrant, error)
- func (c *Client) GetAuthorizeEndpoint() string
- func (c *Client) GetTokenEndpoint() string
- func (c *Client) ValidateAccessToken(at, expectedClientID string) (jwt.MapClaims, error)
- type OAuthGrant
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 ¶
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 (*Client) GetTokenEndpoint ¶
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.
Click to show internal directories.
Click to hide internal directories.