client

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TokenAuthMethodName is the name of the token-based auth method.
	TokenAuthMethodName = "token"

	// JWTAuthMethodName is the name of the JWT Auth Method.
	JWTAuthMethodName = "jwt"
)

Variables

View Source
var ErrNoAuthInfo = errors.New("no auth info returned")

ErrNoAuthInfo is an error, which is returned when a successful authentication to an Auth Method endpoint was performed, but no auth info was returned as part of the response.

View Source
var ErrNoAuthMethod = errors.New("no auth method implementation configured")

ErrNoAuthMethod is an error, which is returned when attempting to login using an Auth Method, but no Auth Method implementation was configured.

View Source
var ErrUnknownAuthMethod = errors.New("empty or unknown auth method specified")

ErrUnknownAuthMethod is an error, which is returned when creating a new Client using an unknown auth method. It is returned by NewFromConfig, which creates new Client based on provided config.VaultServerConfig settings.

Functions

This section is empty.

Types

type Client

type Client struct {
	*vault.Client
	// contains filtered or unexported fields
}

Client is a wrapper around vault.Client with additional funtionality such as renewing authentication tokens.

func New

func New(conf *vault.Config, opts ...Option) (*Client, error)

New creates a new Client from the given config and options.

func NewFromConfig

func NewFromConfig(conf *config.VaultEndpointConfig) (*Client, error)

NewFromConfig creates a new Client based on the provided config.VaultServerConfig settings.

func (*Client) ManageAuthTokenLifetime

func (c *Client) ManageAuthTokenLifetime(ctx context.Context) error

ManageAuthTokenLifetime starts managing the auth token lifetime.

It uses a periodic ticker, which will renew the auth token, if it is renewable. When the token is not renewable (e.g. batch tokens) a complete re-authentication will be done instead when ~ 80% of the token lifetime is reached.

type Option

type Option func(c *Client) error

Option is a function which configures the Client

func WithAuthMethod

func WithAuthMethod(am vault.AuthMethod) Option

WithAuthMethod is an Option, which configures the Client to use the given Auth Method.

Jump to

Keyboard shortcuts

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