Documentation
¶
Overview ¶
SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Cloud Security Client Go contributors
SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
HTTPClient *http.Client // Default: basic http.Client with a timeout of 10 seconds and allowing 50 idle connections
}
Options allows configuration http(s) client
type RequestFailedError ¶
type RequestFailedError struct { // StatusCode of failed request StatusCode int // contains filtered or unexported fields }
RequestFailedError represents a HTTP server error
func (*RequestFailedError) Error ¶
func (e *RequestFailedError) Error() string
Error initializes RequestFailedError
type RequestOptions ¶
type RequestOptions struct { // Request parameters that shall be overwritten or added to the payload Params map[string]string // Token Endpoint overwrites the default used /oauth2/token TokenEndpoint string }
RequestOptions allows to configure the token request
type TokenFlows ¶
type TokenFlows struct { Options Options // contains filtered or unexported fields }
TokenFlows setup once per application.
func NewTokenFlows ¶
func NewTokenFlows(identity env.Identity, options Options) (*TokenFlows, error)
NewTokenFlows initializes token flows
identity provides credentials and url to authenticate client with identity service options specifies rest client including tls config. Note: Setup of default tls config is not supported for windows os. Module crypto/x509 supports SystemCertPool with go 1.18 (https://go-review.googlesource.com/c/go/+/353589/)
func (*TokenFlows) ClientCredentials ¶
func (t *TokenFlows) ClientCredentials(ctx context.Context, customerTenantURL string, options RequestOptions) (string, error)
ClientCredentials implements the client credentials flow (RFC 6749, section 4.4). Clients obtain an access token outside of the context of a user. It is used for non interactive applications (a CLI, a batch job, or for service-2-service communication) where the token is issued to the application itself, instead of an end user for accessing resources without principal propagation.
ctx carries the request context like the deadline or other values that should be shared across API boundaries. customerTenantURL like "https://custom.accounts400.ondemand.com" gives the host of the customers ias tenant options allows to provide additional request parameters