Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Challenge ¶
type Challenge struct { // Scheme is the auth-scheme according to RFC 2617 Scheme string // Parameters are the auth-params according to RFC 2617 Parameters map[string]string }
Challenge carries information from a WWW-Authenticate response header. See RFC 2617.
func ResponseChallenges ¶
ResponseChallenges takes in the response and it is unauthorized returns a challenge containing realm and service information
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(token string, repo string, username string, challengeSlice []Challenge) (*TokenResponse, error)
Request is a helper for getting an OAuth token from the Registry OAuth Service. Takes the following as input:
token - Auth token being used for the request repo - Repo you are requesting access too e.g. bainsy88/busybox 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 service - The service you are retrieving the OAuth token for. Current services are either "notary" or "registry" hostname - Hostname of the registry you wish to call e.g. https://registry.ng.bluemix.net
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.