Documentation
¶
Index ¶
- Constants
- type Config
- type Credentials
- func (c *Credentials) GetApiTokenHeader() *HeaderParams
- func (c *Credentials) GetHttpClientAndHeaderOverrides(retryParams retryutils.RetryParams, debug bool) (*http.Client, []*HeaderParams)deprecated
- func (c *Credentials) GetHttpClientAndHeaderOverridesWithBase(retryParams retryutils.RetryParams, debug bool, baseClient *http.Client) (*http.Client, []*HeaderParams)
- func (c *Credentials) ValidateCredentialsConfig() error
- type CredentialsMethod
- type HeaderParams
Constants ¶
const ApiTokenHeaderKey = "Authorization"
const ApiTokenHeaderValuePrefix = "Bearer"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ApiToken string `json:"apiToken,omitempty"`
ClientCredentialsApiTokenIssuer string `json:"apiTokenIssuer,omitempty"`
ClientCredentialsApiAudience string `json:"apiAudience,omitempty"`
ClientCredentialsClientId string `json:"clientId,omitempty"`
ClientCredentialsClientSecret string `json:"clientSecret,omitempty"`
ClientCredentialsScopes string `json:"scopes,omitempty"`
}
type Credentials ¶
type Credentials struct {
Method CredentialsMethod `json:"method,omitempty"`
Config *Config `json:"config,omitempty"`
Context context.Context
}
func NewCredentials ¶
func NewCredentials(config Credentials) (*Credentials, error)
func (*Credentials) GetApiTokenHeader ¶
func (c *Credentials) GetApiTokenHeader() *HeaderParams
func (*Credentials) GetHttpClientAndHeaderOverrides
deprecated
func (c *Credentials) GetHttpClientAndHeaderOverrides(retryParams retryutils.RetryParams, debug bool) (*http.Client, []*HeaderParams)
GetHttpClientAndHeaderOverrides The main export the client uses to get a configuration with the necessary httpClient and header overrides based on the chosen credential method.
Deprecated: use GetHttpClientAndHeaderOverridesWithBase, which can wrap a caller-provided base http.Client. This variant is retained for backward compatibility and behaves as if no base client were provided.
func (*Credentials) GetHttpClientAndHeaderOverridesWithBase ¶ added in v0.8.2
func (c *Credentials) GetHttpClientAndHeaderOverridesWithBase(retryParams retryutils.RetryParams, debug bool, baseClient *http.Client) (*http.Client, []*HeaderParams)
GetHttpClientAndHeaderOverridesWithBase returns the httpClient and header overrides for the chosen credential method. When the method requires an OAuth2-enabled client (ClientCredentials), baseClient (if non-nil) is wrapped so its settings are preserved; otherwise the returned client is nil and the caller should keep its existing client.
func (*Credentials) ValidateCredentialsConfig ¶
func (c *Credentials) ValidateCredentialsConfig() error
type CredentialsMethod ¶
type CredentialsMethod string
Available credential methods
const ( // No credentials (default) CredentialsMethodNone CredentialsMethod = "none" // API Token credentials (will be sent in "Authorization: Bearer $TOKEN" header) CredentialsMethodApiToken CredentialsMethod = "api_token" // Client Credentials flow will be performed, resulting token will be sent in "Authorization: Bearer $TOKEN" header CredentialsMethodClientCredentials CredentialsMethod = "client_credentials" )