tokens

package
v0.0.0-...-a8b8e24 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHeaderTokenAuthenticator

func NewHeaderTokenAuthenticator(headers []string, ts types.Storage, logger *zap.Logger) authenticator.Authenticator

NewHeaderTokenAuthenticator returns an authenticator checking requests based on the passed header, and the passed storage adapter

Types

type HeaderTokenAuthenticator

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

HeaderTokenAuthenticator is carrying the state of token-adapter-based header-token authenticators

func (*HeaderTokenAuthenticator) Authenticate

Authenticate processes the passed request, checking if the configured header's FIRST value matches any of the the hard-coded tokens list.

type HeaderTokenConfig

type HeaderTokenConfig struct {
	Headers []string      `json:"headers"`
	Storage StorageConfig `json:"storage"`
}

HeaderTokenConfig is used for configuring tokens-storage-based header-token authenticators

func (*HeaderTokenConfig) Open

Open returns an storage-adapter-based header token authenticator

type StorageConfig

type StorageConfig struct {
	Type string `json:"type"`

	Config types.TokenConfig `json:"config"`
}

StorageConfig is the type for unmarshalling token storage-adapter configs

func (*StorageConfig) UnmarshalJSON

func (c *StorageConfig) UnmarshalJSON(b []byte) error

UnmarshalJSON allows Token to implement the unmarshaler interface to dynamically determine the type of the storage adapter config.

Jump to

Keyboard shortcuts

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