tokens

package
v0.0.0-...-0490640 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

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

func (c *HeaderTokenConfig) Open(u *url.URL, serviceCerts *certs.ServiceCerts,
	logger *zap.Logger) (authenticator.Authenticator, error)

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