Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHTTPClient ¶
GetHTTPClient gets an http client to use for getting an oauth token Takes the following as input:
customFile - Path to custom ca certificate
Returns:
*http.Client
Types ¶
type TokenResponse ¶
type TokenResponse struct { Token string `json:"token,omitempty"` AccessToken string `json:"access_token,omitempty"` RefreshToken string `json:"refresh_token,omitempty"` ExpiresIn int `json:"expires_in,omitempty"` IssuedAt time.Time `json:"issued_at,omitempty"` }
TokenResponse is a generic OAuth2 token response
func Request ¶
func Request(oauthEndpoint string, username string, token string, service string, scope string) (*TokenResponse, error)
Request is a helper for getting an OAuth token from the Registry OAuth Service. Takes the following as input:
oauthEndpoint - URL of the oauth endpoint to be used username - Username for the OAuth request, identifies the type of token being passed in. Valid usernames are token (for registry token), iambearer, iamapikey, bearer (UAA bearer (legacy)), iamrefresh token - Auth token being used for the request service - The service you are retrieving the OAuth token for. Current services are either "notary" or "registry" scope - The scope to be requested for the oauth token
Returns:
*auth.TokenResponse - Details of the type is here https://github.ibm.com/alchemy-registry/registry-types/tree/master/auth#type-tokenresponse Token is the element you will need to forward to the registry/notary as part of a Bearer Authorization Header error
Click to show internal directories.
Click to hide internal directories.