bearer

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BearerHookID

type BearerHookID string
const (
	// HookIDBearerAuth identifies the bearer token authentication hook
	// Validates Authorization: Bearer <token> header and sets ctx.UserID
	HookIDBearerAuth BearerHookID = "bearer.auth"

	// HookIDBearerAuthOptional identifies the optional bearer token authentication hook
	// Validates Authorization: Bearer <token> header and sets ctx.UserID if valid, but does not return unauthorized if invalid
	HookIDBearerAuthOptional BearerHookID = "bearer.auth.optional"
)

Constants for bearer plugin hook IDs and metadata

func (BearerHookID) String

func (id BearerHookID) String() string

type BearerPlugin

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

BearerPlugin validates Authorization headers using the JWT plugin.

func New

func New(config BearerPluginConfig) *BearerPlugin

New creates a new BearerPlugin instance with sane defaults.

func (*BearerPlugin) AuthMiddleware

func (p *BearerPlugin) AuthMiddleware() func(http.Handler) http.Handler

func (*BearerPlugin) Close

func (p *BearerPlugin) Close() error

func (*BearerPlugin) Config

func (p *BearerPlugin) Config() any

func (*BearerPlugin) Hooks

func (p *BearerPlugin) Hooks() []models.Hook

func (*BearerPlugin) Init

func (p *BearerPlugin) Init(ctx *models.PluginContext) error

func (*BearerPlugin) Metadata

func (p *BearerPlugin) Metadata() models.PluginMetadata

func (*BearerPlugin) OnConfigUpdate

func (p *BearerPlugin) OnConfigUpdate(config *models.Config) error

func (*BearerPlugin) OptionalAuthMiddleware

func (p *BearerPlugin) OptionalAuthMiddleware() func(http.Handler) http.Handler

type BearerPluginConfig

type BearerPluginConfig struct {
	Enabled    bool   `json:"enabled" toml:"enabled"`
	HeaderName string `json:"header_name" toml:"header_name"`
}

BearerPluginConfig defines configuration options for the bearer plugin.

func (*BearerPluginConfig) ApplyDefaults

func (config *BearerPluginConfig) ApplyDefaults()

Jump to

Keyboard shortcuts

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