jwt

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: 7 Imported by: 0

Documentation

Overview

Package jwt provides an implementation of the JWT Auth Method for Vault.

Index

Constants

View Source
const DefaultMountPath = "jwt"

DefaultMountPath specifies the default mount path for the JWT Authentication Method.

Variables

View Source
var ErrInvalidMountPath = errors.New("invalid auth method mount path specified")

ErrInvalidMountPath is an error, which is returned when configuring Auth to use an invalid mount path for a Vault Authentication Method.

View Source
var ErrNoRoleName = errors.New("no role name specified")

ErrNoRoleName is an error, which is returned when no role name was specified when creating a Auth.

View Source
var ErrNoToken = errors.New("no token specified")

ErrNoToken is an error, which is returned when Auth is configured with an empty token.

Functions

This section is empty.

Types

type Auth

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

Auth implements support for the JWT Authentication Method.

func New

func New(roleName string, opts ...Option) (*Auth, error)

New creates a new Auth and configures it with the given options.

The default mount path for the JWT Authentication Method is DefaultMountPath. In order to configure a different mount path for the Authentication Method you can use the WithMountPath option.

The JWT token which will be used for authentication against the Vault Authentication Method login endpoint may be specified either as a string, from path, or via an environment variable. In order to configure the token for authentication use the WithToken, WithTokenFromPath or WithTokenFromEnv options.

func (*Auth) Login

func (a *Auth) Login(ctx context.Context, client *vault.Client) (*vault.Secret, error)

Login implements the vault.AuthMethod interface.

type Option

type Option func(a *Auth) error

Option is a function which configures Auth.

func WithMountPath

func WithMountPath(mountPath string) Option

WithMountPath is an Option, which configures Auth to use the given mount path for the Vault Authentication Method.

func WithToken

func WithToken(token string) Option

WithToken is an Option, which configures Auth to use the given token when authenticating against the Vault JWT Authentication Method.

func WithTokenFromEnv

func WithTokenFromEnv(env string) Option

WithTokenFromEnv is an Option, which configures Auth to read the token from the given environment variable.

func WithTokenFromPath

func WithTokenFromPath(path string) Option

WithTokenFromPath is an Option, which configures Auth to read the token from the given path.

Jump to

Keyboard shortcuts

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