Documentation
¶
Index ¶
- func WithAuth0ClientEnvEntry(key string, value string) *core.Auth0ClientEnvEntryOption
- func WithBaseURL(baseURL string) *core.BaseURLOption
- func WithBodyProperties(bodyProperties map[string]interface{}) *core.BodyPropertiesOption
- func WithClientCredentials(ctx context.Context, clientID, clientSecret string) *core.ClientCredentialsOption
- func WithClientCredentialsAndAudience(ctx context.Context, clientID, clientSecret, audience string) *core.ClientCredentialsAndAudienceOption
- func WithClientCredentialsPrivateKeyJwt(ctx context.Context, clientID string, privateKey string, algorithm string) *core.ClientCredentialsPrivateKeyJwtOption
- func WithClientCredentialsPrivateKeyJwtAndAudience(ctx context.Context, clientID string, privateKey string, ...) *core.ClientCredentialsPrivateKeyJwtAndAudienceOption
- func WithCustomDomainHeader(domain string) *core.CustomDomainHeaderOption
- func WithDebug(debug bool) *core.DebugOption
- func WithHTTPClient(httpClient core.HTTPClient) *core.HTTPClientOption
- func WithHTTPHeader(httpHeader http.Header) *core.HTTPHeaderOption
- func WithInsecure() *core.InsecureOption
- func WithMaxAttempts(attempts uint) *core.MaxAttemptsOption
- func WithNoAuth0ClientInfo() *core.NoAuth0ClientInfoOption
- func WithQueryParameters(queryParameters url.Values) *core.QueryParametersOption
- func WithToken(token string) *core.TokenOption
- func WithTokenSource(tokenSource oauth2.TokenSource) *core.TokenSourceOption
- func WithUserAgent(userAgent string) *core.UserAgentOption
- type RequestOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAuth0ClientEnvEntry ¶
func WithAuth0ClientEnvEntry(key string, value string) *core.Auth0ClientEnvEntryOption
WithAuth0ClientEnvEntry allows adding extra environment keys to the client information.
func WithBaseURL ¶
func WithBaseURL(baseURL string) *core.BaseURLOption
WithBaseURL sets the base URL, overriding the default environment, if any.
func WithBodyProperties ¶
func WithBodyProperties(bodyProperties map[string]interface{}) *core.BodyPropertiesOption
WithBodyProperties adds the given body properties to the request.
func WithClientCredentials ¶
func WithClientCredentials(ctx context.Context, clientID, clientSecret string) *core.ClientCredentialsOption
WithClientCredentials configures OAuth2 client credentials authentication using a client ID and secret. The SDK will automatically fetch and refresh tokens from the Auth0 token endpoint.
This option is mutually exclusive with other token source options (WithClientCredentialsAndAudience, WithClientCredentialsPrivateKeyJwt, WithClientCredentialsPrivateKeyJwtAndAudience, and WithTokenSource). If multiple are provided, the last one applied takes effect.
func WithClientCredentialsAndAudience ¶
func WithClientCredentialsAndAudience(ctx context.Context, clientID, clientSecret, audience string) *core.ClientCredentialsAndAudienceOption
WithClientCredentialsAndAudience configures OAuth2 client credentials authentication using a client ID, secret, and a custom audience.
This option is mutually exclusive with other token source options (WithClientCredentials, WithClientCredentialsPrivateKeyJwt, WithClientCredentialsPrivateKeyJwtAndAudience, and WithTokenSource). If multiple are provided, the last one applied takes effect.
func WithClientCredentialsPrivateKeyJwt ¶
func WithClientCredentialsPrivateKeyJwt(ctx context.Context, clientID string, privateKey string, algorithm string) *core.ClientCredentialsPrivateKeyJwtOption
WithClientCredentialsPrivateKeyJwt configures OAuth2 client credentials authentication using private key JWT assertion.
This option is mutually exclusive with other token source options (WithClientCredentials, WithClientCredentialsAndAudience, WithClientCredentialsPrivateKeyJwtAndAudience, and WithTokenSource). If multiple are provided, the last one applied takes effect.
func WithClientCredentialsPrivateKeyJwtAndAudience ¶
func WithClientCredentialsPrivateKeyJwtAndAudience(ctx context.Context, clientID string, privateKey string, algorithm, audience string) *core.ClientCredentialsPrivateKeyJwtAndAudienceOption
WithClientCredentialsPrivateKeyJwtAndAudience configures OAuth2 client credentials authentication using private key JWT assertion with a custom audience.
This option is mutually exclusive with other token source options (WithClientCredentials, WithClientCredentialsAndAudience, WithClientCredentialsPrivateKeyJwt, and WithTokenSource). If multiple are provided, the last one applied takes effect.
func WithCustomDomainHeader ¶
func WithCustomDomainHeader(domain string) *core.CustomDomainHeaderOption
WithCustomDomainHeader sets the custom domain for the Management instance. The custom domain header is only sent for whitelisted API endpoints.
func WithDebug ¶
func WithDebug(debug bool) *core.DebugOption
WithDebug configures the HTTP client to enable debug logging of requests and responses.
func WithHTTPClient ¶
func WithHTTPClient(httpClient core.HTTPClient) *core.HTTPClientOption
WithHTTPClient uses the given HTTPClient to issue the request.
func WithHTTPHeader ¶
func WithHTTPHeader(httpHeader http.Header) *core.HTTPHeaderOption
WithHTTPHeader adds the given http.Header to the request.
func WithInsecure ¶
func WithInsecure() *core.InsecureOption
WithInsecure configures the client to allow HTTP instead of HTTPS and sets a static "insecure" token for testing.
This option is available for testing purposes and should not be used in production. Note: Users should pass the domain without a scheme (e.g., "localhost:8080").
func WithMaxAttempts ¶
func WithMaxAttempts(attempts uint) *core.MaxAttemptsOption
WithMaxAttempts configures the maximum number of retry attempts.
func WithNoAuth0ClientInfo ¶
func WithNoAuth0ClientInfo() *core.NoAuth0ClientInfoOption
WithNoAuth0ClientInfo configures the client to not send the "Auth0-Client" header at all.
func WithQueryParameters ¶
func WithQueryParameters(queryParameters url.Values) *core.QueryParametersOption
WithQueryParameters adds the given query parameters to the request.
func WithToken ¶
func WithToken(token string) *core.TokenOption
WithToken sets the 'Authorization: Bearer <token>' request header with a static token.
Note: If a TokenSource is also configured (via WithClientCredentials, WithClientCredentialsPrivateKeyJwt, or WithTokenSource), the TokenSource takes priority and this static token will be ignored.
func WithTokenSource ¶ added in v2.6.0
func WithTokenSource(tokenSource oauth2.TokenSource) *core.TokenSourceOption
WithTokenSource sets a custom oauth2.TokenSource for acquiring access tokens. This allows users to provide their own token management strategy, such as caching tokens across multiple services or using a custom token provider.
The SDK calls TokenSource.Token() on every request to obtain the access token. If token caching is desired, wrap the source with oauth2.ReuseTokenSource:
option.WithTokenSource(oauth2.ReuseTokenSource(nil, myTokenSource))
This option is mutually exclusive with other token source options (WithClientCredentials, WithClientCredentialsAndAudience, WithClientCredentialsPrivateKeyJwt, and WithClientCredentialsPrivateKeyJwtAndAudience). If multiple are provided, the last one applied takes effect.
Note: When a TokenSource is configured, it takes priority over any static token set via WithToken.
func WithUserAgent ¶
func WithUserAgent(userAgent string) *core.UserAgentOption
WithUserAgent configures the HTTP client to use a custom User-Agent header.
Types ¶
type RequestOption ¶
type RequestOption = core.RequestOption
RequestOption adapts the behavior of an individual request.