apikey

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package apikey implements the API key auth mode.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyAuthenticator

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

APIKeyAuthenticator implements the authenticator with API key.

func NewAPIKeyAuthenticator

func NewAPIKeyAuthenticator(
	ctx context.Context,
	config *RelyAuthAPIKeyConfig,
	options authmode.RelyAuthenticatorOptions,
) (*APIKeyAuthenticator, error)

NewAPIKeyAuthenticator creates an API key authenticator instance.

func (*APIKeyAuthenticator) Authenticate

Authenticate validates and authenticates the token from the auth webhook request.

func (*APIKeyAuthenticator) Close

func (*APIKeyAuthenticator) Close() error

Close handles the resources cleaning.

func (APIKeyAuthenticator) Equal

func (aka APIKeyAuthenticator) Equal(target APIKeyAuthenticator) bool

Equal checks if the target value is equal.

func (*APIKeyAuthenticator) IDs added in v0.0.2

func (aka *APIKeyAuthenticator) IDs() []string

IDs returns identities of this authenticator.

func (*APIKeyAuthenticator) Mode

Mode returns the auth mode of the current authenticator.

type RelyAuthAPIKeyConfig

type RelyAuthAPIKeyConfig struct {
	// Unique identity of the auth config.
	// If not set, ID will be the index of the array.
	ID string `json:"id,omitempty" yaml:"id,omitempty"`
	// Authentication mode which is always apiKey.
	Mode authmode.AuthMode `json:"mode" jsonschema:"enum=apiKey" yaml:"mode"`
	// Brief description of the auth config.
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	// Source of the authentication token.
	TokenLocation authscheme.TokenLocation `json:"tokenLocation" yaml:"tokenLocation"`
	// Custom session variables for this auth mode.
	SessionVariables map[string]goenvconf.EnvAny `json:"sessionVariables" yaml:"sessionVariables"`
	// Value of the static API key to be compared.
	Value goenvconf.EnvString `json:"value" yaml:"value"`
}

RelyAuthAPIKeyConfig contains configurations for HTTP authentication with static secrets.

func NewRelyAuthAPIKeyConfig

func NewRelyAuthAPIKeyConfig(
	location authscheme.TokenLocation,
	value goenvconf.EnvString,
	sessionVariables map[string]goenvconf.EnvAny,
) *RelyAuthAPIKeyConfig

NewRelyAuthAPIKeyConfig creates a new APIKeyAuthConfig instance.

func (RelyAuthAPIKeyConfig) Equal

Equal checks if the target value is equal.

func (RelyAuthAPIKeyConfig) GetMode

GetMode returns the auth mode of the current config.

func (RelyAuthAPIKeyConfig) IsZero

func (j RelyAuthAPIKeyConfig) IsZero() bool

IsZero if the current instance is empty.

func (RelyAuthAPIKeyConfig) Validate

func (j RelyAuthAPIKeyConfig) Validate() error

Validate if the current instance is valid.

Jump to

Keyboard shortcuts

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