Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthToken ¶
type AuthToken struct { TokenType string `json:"token_type"` AccessToken string `json:"access_token"` ExpiresIn time.Duration `json:"expires_in"` ExpiresAt time.Time }
AuthToken provides a structure for the XSUAA auth token to be marshalled into
type XSUAA ¶
XSUAA contains the fields to authenticate to a xsuaa service instance on BTP to retrieve a access token It also caches the latest retrieved access token
func (*XSUAA) GetBearerToken ¶
GetBearerToken authenticates to and retrieves the auth information from the provided XSUAA oAuth base url. The following path and query is always used: /oauth/token?grant_type=client_credentials&response_type=token. The gotten JSON string is marshalled into an AuthToken struct and returned. If no 'access_token' field was present in the JSON response, an error is returned.
func (*XSUAA) SetAuthHeaderIfNotPresent ¶
SetAuthHeaderIfNotPresent retrieves a XSUAA bearer token and sets the 'Authorization' header on a given http.Header. If another 'Authorization' header is already present, no change is done to the given header.