auth

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldCallbackHost   = "callbackhost"
	FieldCallbackMethod = "callbackmethod"
	FieldListenAddress  = "listenaddress"
	FieldPort           = "port"
	FieldCallbackPort   = "callbackport"
	FieldSkipBrowser    = "skip_browser"
	FieldAbortOnError   = "abort_on_error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationResponse

type AuthenticationResponse interface {
	// ClientToken is the token to use when authenticating with Vault when fetching secrets.
	ClientToken() string

	// LeaseDurationSeconds is the duration of the token in seconds. This is the verbatim value returned by Vault.
	LeaseDurationSeconds() int

	// Renewable is true if the token is renewable.
	Renewable() bool

	// After returns a channel that fire when the token is about to expire. The channel will fire when the token has
	// 30 seconds left to live.
	After() <-chan time.Time
}

AuthenticationResponse is the response from the Vault server after authentication.

func Authenticate

func Authenticate(ctx context.Context, addr string, method Method, opts ...Option) (AuthenticationResponse, error)

type Method

type Method int

Method is the authentication method to use when authenticating with Vault.

const (

	// MethodGitHub is the authentication method where GitHub tokens are used to autenticate the user.
	MethodGitHub Method = iota

	// MethodK8s is the authentication method where Kubernetes service accounts are used to authenticate the user.
	MethodK8s

	// MethodOICD is the authentication method where OpenID Connect tokens are used to authenticate the user.
	MethodOICD

	// MethodToken is the authentication method where a Vault token has been obtained elsewhere and is used directly.
	MethodToken
)

type Option

type Option func(*optionsCollector)

Option expl

func WithClient

func WithClient(client *http.Client) Option

WithClient sets the http client to use for requests

func WithGitHubToken

func WithGitHubToken(token string) Option

WithGitHubToken sets the GitHub token to use for authentication

func WithK8s

func WithK8s(servicePath, role string) Option

WithK8s sets the Kubernetes service path and role to use for authentication

func WithLogger added in v1.0.0

func WithLogger(l *log.Logger) Option

func WithOtelTracerName added in v1.0.0

func WithOtelTracerName(name string) Option

Jump to

Keyboard shortcuts

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