app

package
v0.0.0-...-41d25ed Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

func New

func New(cfg Config) (*App, error)

func (*App) Handler

func (app *App) Handler() http.Handler

type AuthProvider

type AuthProvider interface {
	BeginAuth(http.ResponseWriter, *http.Request) error
	CompleteAuth(http.ResponseWriter, *http.Request) (*AuthResult, error)
}

AuthProvider handles an external auth flow (e.g. OIDC). Each provider has a name (e.g. "ugent_oidc") used in routes and user records.

type AuthResult

type AuthResult struct {
	Match string // "username" or identifier scheme (e.g. "ugent_id")
	Value string // the claim value (e.g. "abc123")
}

AuthResult is the outcome of a successful external auth flow. Match is either "username" (matched against bbl_users.username) or an identifier scheme name (matched against bbl_user_identifiers).

type Config

type Config struct {
	Logger   *slog.Logger
	Services *bbl.Services
	RootURL  string // public root URL (e.g. "https://biblio.ugent.be/bbl")
	Dev      bool   // dev mode: serve assets from disk, re-read manifest on every request

	// Auth — all nil-safe. Without auth, session is not created,
	// User is always nil, and login/callback return 404.
	// Keyed by provider name (e.g. "ugent_oidc").
	Auth       map[string]AuthProvider
	HashSecret []byte // HMAC key for session cookie signing
	Secret     []byte // encryption key for session cookie
	Secure     bool   // true = HTTPS-only cookies
	Wire       *catbird.Wire
}

type Ctx

type Ctx struct {
	User       *bbl.User
	ViewAsUser *bbl.User // non-nil = admin/curator is impersonating User; ViewAsUser is the real identity
	ViewCtx    views.Ctx
}

Ctx holds per-request state. Just data — no methods, no infrastructure.

Directories

Path Synopsis
templ: version: v0.3.1001
templ: version: v0.3.1001

Jump to

Keyboard shortcuts

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