credentials

package
v2.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthWebhookUriRequired = errors.New(
		"the env var HASURA_CREDENTIALS_PROVIDER_URI must be set and non-empty",
	)
	ErrEmptyCredentials = errors.New("empty credentials")
)

Functions

func AcquireCredentials

func AcquireCredentials(ctx context.Context, key string, forceRefresh bool) (string, error)

AcquireCredentials calls the credentials provider webhook to get the credentials for the given key. If force_refresh is true, the provider will ignore any cached credentials and fetch new ones. The credentials provider URI is read from the HASURA_CREDENTIALS_PROVIDER_URI environment variable. If the HASURA_CREDENTIALS_PROVIDER_BEARER_TOKEN environment variable is set, it will be used as a bearer token for the request.

Types

type CredentialClient

type CredentialClient struct {
	// contains filtered or unexported fields
}

CredentialClient is an HTTP client that can requests the credentials provider webhook to get the credentials.

func NewCredentialClient

func NewCredentialClient(httpClient *http.Client) (*CredentialClient, error)

NewCredentialClient creates a CredentialClient instance.

func (*CredentialClient) AcquireCredentials

func (cc *CredentialClient) AcquireCredentials(
	ctx context.Context,
	key string,
	forceRefresh bool,
) (string, error)

AcquireCredentials calls the credentials provider webhook to get the credentials for the given key.

type Payload

type Payload struct {
	Credentials string `json:"credentials"`
}

Payload is the credentials provider webhook response payload.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL