Documentation ¶
Index ¶
Constants ¶
View Source
const ApiTokenHeaderKey = "Authorization"
View Source
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 ¶
func (c *Credentials) GetHttpClientAndHeaderOverrides() (*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
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" )
type HeaderParams ¶
Click to show internal directories.
Click to hide internal directories.