authentications

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExtractModeHeader     = "header"
	ExtractModeCookie     = "cookie"
	ExtractModeQuery      = "query"
	ExtractModePathSuffix = "path"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Custom

type Custom struct {
	CustomConfig
	// contains filtered or unexported fields
}

func (Custom) CheckAuthentication

func (c Custom) CheckAuthentication(ctx context.Context, req *http.Request) bool

type CustomConfig

type CustomConfig struct {
	Token     map[string]string // How to extract the auth token from the request. Key should be one of the ExtractMode and Value is the specific identifier (or blank if inapplicable)
	CacheSize int               // Configures the size of the cache of already verified tokens to avoid re-verifying every request. Set to -1 to disable. Defaults to 100
	File      string            // Contains the go code to perform validation of the auth token as a file.
	Script    string            // Contains the go code to perform validation of the auth token inline.
}

type CustomRegistration

type CustomRegistration struct {
}

func (CustomRegistration) Initialize

func (s CustomRegistration) Initialize(cfgAny any, errorMessages config.ErrorMessages) (authentication.Authentication, error)

func (CustomRegistration) InitializeConfig

func (s CustomRegistration) InitializeConfig() any

func (CustomRegistration) Name

func (s CustomRegistration) Name() string

type JWT

type JWT struct {
	JWTConfig
	Cache *otter.Cache[string, jwt.NumericDate]
	// contains filtered or unexported fields
}

func (JWT) CheckAuthentication

func (c JWT) CheckAuthentication(ctx context.Context, req *http.Request) bool

type JWTConfig

type JWTConfig struct {
	//TODO: Performance profile if the cache is actually worthwhile
	CacheSize        uint16 // Configures the size of the cache of already verified JWTs to avoid re-verifying keys for every token. Expiration still applies. Set to 0 to disable. Defaults to 0
	Key              string // The key for verifying the signature. The public key if using asymmetric signing. Required
	Algorithm        string // Algorithm to allow for JWT signature. Required
	HeaderName       string // The header to extract the JWT from. If this is "Authorization" it removes the "Bearer " from the start. Defaults to "Authorization"
	MaxExpiration    uint32 // How many seconds from now can the expiration be. JWTs more than X seconds from now will result in a 401. Defaults to 1 day
	ExpectedAudience string // If specified, require the "aud" grant to be this string
	ExpectedSubject  string // If specified, require the "sub" grant to be this string
	ExpectedIssuer   string // If specified, require the "iss" grant to be this string
	ExpectedScope    string // If specified, require the "scope" grant to contain this string.
	LayerScope       bool   // If specified, the "scope" grant is used to limit access to layer
	ScopePrefix      string // If LayerScope is true, this prefix indicates scopes to use
	UserID           string // Use the specified grant as the user identifier. Defaults to sub
}

type JWTRegistration

type JWTRegistration struct {
}

func (JWTRegistration) Initialize

func (s JWTRegistration) Initialize(configAny any, errorMessages config.ErrorMessages) (authentication.Authentication, error)

func (JWTRegistration) InitializeConfig

func (s JWTRegistration) InitializeConfig() any

func (JWTRegistration) Name

func (s JWTRegistration) Name() string

type Noop

type Noop struct {
	NoopConfig
}

func (Noop) CheckAuthentication

func (c Noop) CheckAuthentication(_ context.Context, _ *http.Request) bool

type NoopConfig

type NoopConfig struct {
}

type NoopRegistration

type NoopRegistration struct {
}

func (NoopRegistration) Initialize

func (NoopRegistration) InitializeConfig

func (s NoopRegistration) InitializeConfig() any

func (NoopRegistration) Name

func (s NoopRegistration) Name() string

type StaticKey

type StaticKey struct {
	StaticKeyConfig
}

func (StaticKey) CheckAuthentication

func (c StaticKey) CheckAuthentication(_ context.Context, req *http.Request) bool

type StaticKeyConfig

type StaticKeyConfig struct {
	Key string
}

type StaticKeyRegistration

type StaticKeyRegistration struct {
}

func (StaticKeyRegistration) Initialize

func (StaticKeyRegistration) InitializeConfig

func (s StaticKeyRegistration) InitializeConfig() any

func (StaticKeyRegistration) Name

func (s StaticKeyRegistration) Name() string

type ValidationResult

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

Jump to

Keyboard shortcuts

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