session

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SessionHookID

type SessionHookID string
const (
	// HookIDSessionAuth identifies the session authentication hook.
	// Validates session cookie and sets ctx.UserID if valid
	HookIDSessionAuth SessionHookID = "session.auth"

	// HookIDSessionAuthOptional identifies the optional session authentication hook.
	// Validates session cookie and sets ctx.UserID if valid, but does not return unauthorized if invalid
	HookIDSessionAuthOptional SessionHookID = "session.auth.optional"
)

Constants for session plugin hook IDs and metadata

func (SessionHookID) String

func (id SessionHookID) String() string

type SessionPlugin

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

func New

func (*SessionPlugin) AuthMiddleware

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

AuthMiddleware validates session cookie and extracts user ID

func (*SessionPlugin) ClearSessionCookie

func (p *SessionPlugin) ClearSessionCookie(w http.ResponseWriter)

func (*SessionPlugin) Close

func (p *SessionPlugin) Close() error

func (*SessionPlugin) Config

func (p *SessionPlugin) Config() any

func (*SessionPlugin) Hooks

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

func (*SessionPlugin) Init

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

func (*SessionPlugin) Metadata

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

func (*SessionPlugin) OnConfigUpdate

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

func (*SessionPlugin) OptionalAuthMiddleware

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

OptionalAuthMiddleware validates session if present but doesn't require it

func (*SessionPlugin) SetSessionCookie

func (p *SessionPlugin) SetSessionCookie(w http.ResponseWriter, sessionToken string)

type SessionPluginConfig

type SessionPluginConfig struct {
	Enabled bool `json:"enabled" toml:"enabled"`
}

func (*SessionPluginConfig) ApplyDefaults

func (config *SessionPluginConfig) ApplyDefaults()

Jump to

Keyboard shortcuts

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