auth

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: 24 Imported by: 0

Documentation

Overview

Package auth defines a universal authentication manager

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComposedAuthenticator

type ComposedAuthenticator struct {
	Authenticators   []authmode.RelyAuthenticator
	CustomAttributes []attribute.KeyValue
}

ComposedAuthenticator represents an authenticator that composes a list of authenticators and authenticates fallback in order.

func NewComposedAuthenticator

func NewComposedAuthenticator(authenticators []authmode.RelyAuthenticator) *ComposedAuthenticator

NewComposedAuthenticator creates a new ComposedAuthenticator instance.

func (*ComposedAuthenticator) Authenticate

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

func (*ComposedAuthenticator) Close

func (a *ComposedAuthenticator) Close() error

Close terminates all underlying authenticator resources.

func (*ComposedAuthenticator) IDs added in v0.0.2

func (a *ComposedAuthenticator) IDs() []string

IDs returns identities of this authenticator.

func (*ComposedAuthenticator) Mode

Mode returns the auth mode of the current authenticator.

type RelyAuthConfig

type RelyAuthConfig struct {
	// Global settings of the auth config.
	Settings *authmode.RelyAuthSettings `json:"settings,omitempty" yaml:"settings,omitempty"`
	// List of authenticator configurations.
	Definitions []RelyAuthDefinition `json:"definitions" yaml:"definitions"`
}

RelyAuthConfig is the data structure for authentication configurations.

func (RelyAuthConfig) Validate

func (rac RelyAuthConfig) Validate() error

Validate checks if the configuration is valid.

type RelyAuthDefinition

type RelyAuthDefinition struct {
	authmode.RelyAuthDefinitionInterface `yaml:",inline"`

	// Configurations for extra security rules .
	SecurityRules *authmode.RelyAuthSecurityRulesConfig `json:"securityRules,omitempty" yaml:"securityRules,omitempty"`
}

RelyAuthDefinition wraps authentication configurations for an auth mode.

func NewRelyAuthDefinition

func NewRelyAuthDefinition[T authmode.RelyAuthDefinitionInterface](inner T) RelyAuthDefinition

NewRelyAuthDefinition creates a new RelyAuthDefinition instance.

func (RelyAuthDefinition) JSONSchema

func (RelyAuthDefinition) JSONSchema() *jsonschema.Schema

JSONSchema defines a custom definition for JSON schema.

func (*RelyAuthDefinition) UnmarshalJSON

func (j *RelyAuthDefinition) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*RelyAuthDefinition) UnmarshalYAML

func (j *RelyAuthDefinition) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements the custom behavior for the yaml.Unmarshaler interface.

func (RelyAuthDefinition) Validate

func (j RelyAuthDefinition) Validate() error

Validate if the current instance is valid.

type RelyAuthManager

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

RelyAuthManager manages multiple authentication strategies to verify HTTP requests.

func NewRelyAuthManager

func NewRelyAuthManager(
	ctx context.Context,
	config *RelyAuthConfig,
	options ...authmode.RelyAuthenticatorOption,
) (*RelyAuthManager, error)

NewRelyAuthManager creates a new RelyAuthManager instance from config.

func (*RelyAuthManager) Authenticate

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

func (*RelyAuthManager) Authenticator

func (am *RelyAuthManager) Authenticator() *ComposedAuthenticator

Authenticator returns the internal ComposedAuthenticator instance.

func (*RelyAuthManager) Close

func (am *RelyAuthManager) Close() error

Close terminates all underlying authenticator resources.

func (*RelyAuthManager) Settings

func (am *RelyAuthManager) Settings() *authmode.RelyAuthSettings

Settings return settings of the manager.

Directories

Path Synopsis
Package apikey implements the API key auth mode.
Package apikey implements the API key auth mode.
Package authmetrics defines global metrics and attributes for the auth service.
Package authmetrics defines global metrics and attributes for the auth service.
Package authmode defines common types and utilities for auth modes.
Package authmode defines common types and utilities for auth modes.
Package jwt implements the authenticator for the JWT auth mode
Package jwt implements the authenticator for the JWT auth mode
Package noauth implements the noAuth mode.
Package noauth implements the noAuth mode.
Package webhook implements the webhook auth mode
Package webhook implements the webhook auth mode

Jump to

Keyboard shortcuts

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