dashboard

package
v0.0.16 Latest Latest
Warning

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

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

README

Dashboard Plugin

A server-rendered admin interface for AuthSome built with ForgeUI, gomponents, and Tailwind CSS 4.

Quick Start

import (
    "github.com/xraph/authsome"
    "github.com/xraph/authsome/plugins/dashboard"
)

auth, err := authsome.New(
    authsome.WithPlugins(
        dashboard.NewPlugin(),
    ),
)

Then access the dashboard at http://localhost:8080/api/auth/ui/ (or your base path + /ui/). Admin role required.

Features

  • Server-side rendering with ForgeUI and gomponents
  • Bridge API for frontend-backend communication
  • Built-in auth, RBAC, CSRF, rate limiting, and audit logging
  • Responsive, mobile-first design
  • Real-time statistics and user management
  • Dark mode support with system preference detection and localStorage persistence
  • Plugin extension system for adding custom dashboard pages and widgets

Access Control

The dashboard implements production-grade security with:

  • Fast Permission Checking: Role-based access control with 5-minute cache (< 100µs per check)
  • CSRF Protection: Session-bound tokens with HMAC signatures
  • First-User Admin: First user automatically gets admin role
Assigning Admin Role
# Using the CLI
authsome-cli user assign-role --user-id=<id> --role=admin

# Or programmatically
rbacSvc.AssignRole(ctx, userID, roleID, orgID)
Permission System
// Check permissions with expressive fluent API
checker := dashboard.NewPermissionChecker(rbacSvc, userRoleRepo)

// Simple check
canView := checker.Can(ctx, userID, "view", "users")

// Fluent API
user := checker.For(ctx, userID)
if user.Dashboard().CanAccess() {
    // Grant access
}

Documentation

  • EXTENSION_GUIDE.md - How to add dashboard extensions from plugins
  • BRIDGE_ARCHITECTURE.md, BRIDGE_EXTENSIONS.md (if present) - Bridge API and extension docs

Pages and Routes

The dashboard is served under the ForgeUI base path (default: {authBasePath}/ui). All routes are app-scoped.

Dashboard Index: App selection (multiapp mode) or redirect to default app (standalone).

App-scoped routes (under /ui/app/:appId/ or equivalent) include: home, users, sessions, organizations, apps management, environments, settings, and plugins. Plugin extensions register their own routes and navigation items.

Dark Mode

The dashboard includes a built-in dark mode switcher located in the top-right header.

Features
  • System Preference Detection: Automatically detects and respects OS-level dark mode preferences
  • localStorage Persistence: User preference is saved locally and persists across sessions
  • Smooth Transitions: All theme changes are animated with smooth CSS transitions
  • Complete Coverage: All components, forms, tables, and UI elements are fully styled for dark mode
How It Works
  1. Initial Load: Checks localStorage for saved preference, falls back to system preference
  2. Toggle Button: Click the sun/moon icon in the header to switch themes manually
  3. Automatic Updates: Listens for system preference changes when no manual preference is set
  4. CSS Classes: Uses Tailwind's dark: prefix for conditional dark mode styling
Technical Implementation
  • Alpine.js Component: themeData() component manages state and persistence
  • Tailwind CSS: darkMode: 'class' configuration for class-based toggling
  • localStorage Key: theme (values: 'light' or 'dark')
  • CSS Variables: Custom scrollbar colors for both light and dark themes

Development

# Build
go build ./plugins/dashboard/...

# Test
go test ./plugins/dashboard/... -v

# Lint
golangci-lint run ./plugins/dashboard/...

Premium React Dashboard

A premium React-based dashboard with advanced features is available separately at frontend/dashboard-premium/. See its README for details.

License

Part of AuthSome. See main LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrExtensionAlreadyRegistered indicates an extension with the same ID is already registered.
	ErrExtensionAlreadyRegistered = &DashboardError{
		Code:    "extension_already_registered",
		Message: "dashboard extension already registered",
	}
)

Functions

func EnsureFirstUserIsAdmin

func EnsureFirstUserIsAdmin(ctx context.Context, userID, orgID xid.ID, userRoleRepo rbac.UserRoleRepository, roleRepo rbac.RoleRepository) error

EnsureFirstUserIsAdmin assigns admin role to the first user DEPRECATED: Use EnsureFirstUserIsSuperAdmin for first user setup.

func EnsureFirstUserIsSuperAdmin

func EnsureFirstUserIsSuperAdmin(ctx context.Context, userID, orgID xid.ID, userRoleRepo rbac.UserRoleRepository, roleRepo rbac.RoleRepository) error

EnsureFirstUserIsSuperAdmin assigns superadmin role to the first user This makes them the platform owner with full system access.

func RegisterDashboardRoles

func RegisterDashboardRoles(registry *rbac.RoleRegistry) error

RegisterDashboardRoles registers dashboard-specific roles in the RoleRegistry This extends the default platform roles with dashboard-specific permissions Supports override semantics - plugins can modify other plugins' roles.

func RenderNavigationItems

func RenderNavigationItems(items []ui.NavigationItem, basePath string, currentApp *app.App, activePage string) []g.Node

RenderNavigationItems renders navigation items as gomponents nodes.

func SetupDefaultPolicies

func SetupDefaultPolicies(rbacSvc *rbac.Service) error

SetupDefaultPolicies creates default RBAC policies for the dashboard Role hierarchy: superadmin > owner > admin > member This is kept for backward compatibility and immediate policy loading The role bootstrap system will persist these roles to the database.

Types

type ActivityItem

type ActivityItem struct {
	Title       string
	Description string
	Time        string
	Type        string // success, warning, error, info
}

ActivityItem represents a recent activity entry.

type CSRFProtector

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

CSRFProtector provides production-grade CSRF protection.

func NewCSRFProtector

func NewCSRFProtector() (*CSRFProtector, error)

NewCSRFProtector creates a new CSRF protector with a random secret.

func (*CSRFProtector) CleanupExpiredTokens

func (c *CSRFProtector) CleanupExpiredTokens()

CleanupExpiredTokens manually triggers cleanup of expired tokens.

func (*CSRFProtector) GenerateToken

func (c *CSRFProtector) GenerateToken(sessionID string) (string, error)

GenerateToken generates a new CSRF token for a session Format: base64(randomBytes) + "." + base64(hmac(randomBytes + sessionID)).

func (*CSRFProtector) InvalidateToken

func (c *CSRFProtector) InvalidateToken(token string)

InvalidateToken removes a token from the store.

func (*CSRFProtector) RotateSecret

func (c *CSRFProtector) RotateSecret() error

RotateSecret generates a new CSRF secret Should be called periodically for enhanced security.

func (*CSRFProtector) Stats

func (c *CSRFProtector) Stats() map[string]any

Stats returns statistics about the CSRF token store.

func (*CSRFProtector) ValidateToken

func (c *CSRFProtector) ValidateToken(token, sessionID string) bool

ValidateToken validates a CSRF token against a session.

type Config

type Config struct {
	// EnableSignup allows new users to sign up for dashboard access
	EnableSignup bool `json:"enableSignup"`

	// RequireEmailVerification requires email verification for new signups
	RequireEmailVerification bool `json:"requireEmailVerification"`

	// SessionDuration sets the duration for dashboard sessions in hours
	SessionDuration int `json:"sessionDuration"`

	// MaxLoginAttempts sets the maximum login attempts before lockout
	MaxLoginAttempts int `json:"maxLoginAttempts"`

	// LockoutDuration sets the lockout duration in minutes
	LockoutDuration int `json:"lockoutDuration"`

	// DefaultTheme sets the default theme (light, dark, auto)
	DefaultTheme string `json:"defaultTheme"`
}

Config holds the dashboard plugin configuration.

type DashboardError

type DashboardError struct {
	Code    string
	Message string
}

DashboardError represents a dashboard-specific error.

func (*DashboardError) Error

func (e *DashboardError) Error() string

type DashboardErrorResponse

type DashboardErrorResponse struct {
	Error string `example:"Error message" json:"error"`
}

DashboardErrorResponse for dashboard routes.

type DashboardHTMLResponse

type DashboardHTMLResponse struct {
	HTML string `example:"<html>...</html>" json:"html"`
}

type DashboardLoginResponse

type DashboardLoginResponse struct {
	RedirectURL string `example:"/ui/" json:"redirect_url"`
}

type DashboardPermissions

type DashboardPermissions struct {
	*PermissionBuilder
}

DashboardPermissions provides dashboard-specific permission checks.

func (*DashboardPermissions) CanAccess

func (d *DashboardPermissions) CanAccess() bool

CanAccess checks if user can access the dashboard.

func (*DashboardPermissions) CanManageSessions

func (d *DashboardPermissions) CanManageSessions() bool

CanManageSessions checks if user can manage sessions.

func (*DashboardPermissions) CanManageUsers

func (d *DashboardPermissions) CanManageUsers() bool

CanManageUsers checks if user can manage users.

func (*DashboardPermissions) CanViewAuditLogs

func (d *DashboardPermissions) CanViewAuditLogs() bool

CanViewAuditLogs checks if user can view audit logs.

func (*DashboardPermissions) CanViewSessions

func (d *DashboardPermissions) CanViewSessions() bool

CanViewSessions checks if user can view sessions.

func (*DashboardPermissions) CanViewUsers

func (d *DashboardPermissions) CanViewUsers() bool

CanViewUsers checks if user can view users.

type DashboardPingResponse

type DashboardPingResponse struct {
	Message string `example:"Dashboard plugin is working!" json:"message"`
}

type DashboardStaticResponse

type DashboardStaticResponse struct {
	ContentType string `example:"text/css" json:"content_type"`
	Content     []byte `json:"content"`
}

type DashboardStats

type DashboardStats struct {
	TotalUsers     int
	ActiveUsers    int
	NewUsersToday  int
	TotalSessions  int
	ActiveSessions int
	FailedLogins   int
	UserGrowth     float64
	SessionGrowth  float64
	RecentActivity []ActivityItem
	SystemStatus   []StatusItem
	Plugins        []PluginItem
}

DashboardStats represents statistics for the dashboard.

type DashboardStatusResponse

type DashboardStatusResponse struct {
	Status string `example:"success" json:"status"`
}

type ErrorResponse

type ErrorResponse = responses.ErrorResponse

ErrorResponse types - use shared responses from core.

type ExtensionRegistry

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

ExtensionRegistry manages dashboard extensions from plugins.

func NewExtensionRegistry

func NewExtensionRegistry() *ExtensionRegistry

NewExtensionRegistry creates a new extension registry.

func (*ExtensionRegistry) Get

Get retrieves an extension by ID.

func (*ExtensionRegistry) GetAllRoutes

func (r *ExtensionRegistry) GetAllRoutes() []ui.Route

GetAllRoutes returns all routes from all extensions.

func (*ExtensionRegistry) GetDashboardWidgets

func (r *ExtensionRegistry) GetDashboardWidgets() []ui.DashboardWidget

GetDashboardWidgets returns all dashboard widgets sorted by order.

func (*ExtensionRegistry) GetHandler

func (r *ExtensionRegistry) GetHandler() *Handler

GetHandler returns the handler instance for extensions to use Extensions can use this to access renderWithLayout and other helpers.

func (*ExtensionRegistry) GetNavigationItems

func (r *ExtensionRegistry) GetNavigationItems(position ui.NavigationPosition, enabledPlugins map[string]bool) []ui.NavigationItem

GetNavigationItems returns all navigation items for a specific position.

func (*ExtensionRegistry) GetSettingsPages

func (r *ExtensionRegistry) GetSettingsPages(enabledPlugins map[string]bool) []ui.SettingsPage

GetSettingsPages returns all settings pages from extensions.

func (*ExtensionRegistry) GetSettingsSections

func (r *ExtensionRegistry) GetSettingsSections() []ui.SettingsSection

GetSettingsSections returns all settings sections sorted by order Deprecated: Use GetSettingsPages for the new sidebar layout.

func (*ExtensionRegistry) List

List returns all registered extensions.

func (*ExtensionRegistry) Register

func (r *ExtensionRegistry) Register(ext ui.DashboardExtension) error

Register registers a dashboard extension.

func (*ExtensionRegistry) RegisterBridgeFunctions added in v0.0.15

func (r *ExtensionRegistry) RegisterBridgeFunctions(ext ui.DashboardExtension, log forge.Logger) error

RegisterBridgeFunctions registers all bridge functions from an extension.

func (*ExtensionRegistry) SetBridge added in v0.0.15

func (r *ExtensionRegistry) SetBridge(b *bridge.Bridge)

SetBridge provides the bridge instance for registering extension functions.

func (*ExtensionRegistry) SetHandler

func (r *ExtensionRegistry) SetHandler(h *Handler)

SetHandler sets the handler instance (called by dashboard plugin during init).

type Handler

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

Handler handles dashboard HTTP requests.

func NewHandler

func NewHandler(
	assets embed.FS,
	appService app.Service,
	userSvc user.ServiceInterface,
	sessionSvc session.ServiceInterface,
	auditSvc *audit.Service,
	rbacSvc *rbac.Service,
	apikeyService *apikey.Service,
	orgService *organization.Service,
	envService environment.EnvironmentService,
	db *bun.DB,
	isMultiApp bool,
	basePath string,
	enabledPlugins map[string]bool,
	hookRegistry *hooks.HookRegistry,
	configManager forge.ConfigManager,
) *Handler

NewHandler creates a new dashboard handler.

func (*Handler) GetBasePath

func (h *Handler) GetBasePath() string

GetBasePath returns the dashboard base path.

func (*Handler) GetCSRFToken

func (h *Handler) GetCSRFToken(c forge.Context) string

GetCSRFToken returns the CSRF token for the request.

func (*Handler) GetCurrentApp

func (h *Handler) GetCurrentApp(c forge.Context) (*app.App, error)

GetCurrentApp extracts and returns the current app from URL parameter.

func (*Handler) GetCurrentEnvironment

func (h *Handler) GetCurrentEnvironment(c forge.Context, appID xid.ID) (*environment.Environment, error)

GetCurrentEnvironment returns the current environment from cookie or default.

func (*Handler) GetEnabledPlugins

func (h *Handler) GetEnabledPlugins() map[string]bool

GetEnabledPlugins returns map of enabled plugins.

func (*Handler) GetUserApps

func (h *Handler) GetUserApps(c forge.Context, userID xid.ID) ([]*app.App, error)

GetUserApps returns all apps the user has access to.

func (*Handler) GetUserEnvironments

func (h *Handler) GetUserEnvironments(c forge.Context, appID xid.ID) ([]*environment.Environment, error)

GetUserEnvironments returns all environments for the given app.

func (*Handler) GetUserFromContext

func (h *Handler) GetUserFromContext(c forge.Context) *user.User

GetUserFromContext returns the authenticated user from request context.

func (*Handler) RenderSettingsPage

func (h *Handler) RenderSettingsPage(c forge.Context, pageID string, content g.Node) error

RenderSettingsPage renders content within the settings layout.

func (*Handler) RenderWithBaseLayout added in v0.0.3

func (h *Handler) RenderWithBaseLayout(c forge.Context, pageData components.PageData, content g.Node) error

RenderWithBaseLayout renders content with an empty layout (public for extensions).

func (*Handler) RenderWithHeaderLayout added in v0.0.3

func (h *Handler) RenderWithHeaderLayout(c forge.Context, pageData components.PageData, content g.Node) error

RenderWithHeaderLayout renders content with a header layout (public for extensions).

func (*Handler) RenderWithLayout

func (h *Handler) RenderWithLayout(c forge.Context, pageData components.PageData, content g.Node) error

RenderWithLayout renders content with the dashboard layout (public for extensions) RenderWithLayout method automatically populates app, environment, and extension data.

func (*Handler) RenderWithSidebarLayout added in v0.0.3

func (h *Handler) RenderWithSidebarLayout(c forge.Context, pageData components.PageData, content g.Node) error

RenderWithSidebarLayout renders content with a sidebar layout (public for extensions).

func (*Handler) ServeStatic

func (h *Handler) ServeStatic(c forge.Context) error

ServeStatic serves static assets (CSS, JS, images).

type MessageResponse

type MessageResponse = responses.MessageResponse

type Permission

type Permission struct {
	Action   string // e.g., "view", "edit", "delete"
	Resource string // e.g., "dashboard", "users", "sessions"
}

Permission represents a fine-grained permission check.

type PermissionBuilder

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

PermissionBuilder provides a fluent API for building permission checks.

func (*PermissionBuilder) Can

func (b *PermissionBuilder) Can(action, resource string) bool

Can checks a single permission.

func (*PermissionBuilder) CanCreate

func (b *PermissionBuilder) CanCreate(resource string) bool

CanCreate is a shorthand for Can("create", resource).

func (*PermissionBuilder) CanDelete

func (b *PermissionBuilder) CanDelete(resource string) bool

CanDelete is a shorthand for Can("delete", resource).

func (*PermissionBuilder) CanEdit

func (b *PermissionBuilder) CanEdit(resource string) bool

CanEdit is a shorthand for Can("edit", resource).

func (*PermissionBuilder) CanView

func (b *PermissionBuilder) CanView(resource string) bool

CanView is a shorthand for Can("view", resource).

func (*PermissionBuilder) Dashboard

func (b *PermissionBuilder) Dashboard() *DashboardPermissions

Dashboard returns a dashboard-specific permission checker.

func (*PermissionBuilder) HasRole

func (b *PermissionBuilder) HasRole(roleName string) bool

HasRole checks if the user has a specific role.

func (*PermissionBuilder) IsAdmin

func (b *PermissionBuilder) IsAdmin() bool

IsAdmin checks if the user has the admin role.

func (*PermissionBuilder) IsOwner

func (b *PermissionBuilder) IsOwner() bool

IsOwner checks if the user has the owner role.

func (*PermissionBuilder) IsSuperAdmin

func (b *PermissionBuilder) IsSuperAdmin() bool

IsSuperAdmin checks if the user has the superadmin role.

type PermissionChecker

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

PermissionChecker provides a fast, expressive API for checking permissions.

func NewPermissionChecker

func NewPermissionChecker(rbacSvc *rbac.Service, userRoleRepo rbac.UserRoleRepository) *PermissionChecker

NewPermissionChecker creates a new permission checker.

func (*PermissionChecker) Can

func (p *PermissionChecker) Can(ctx context.Context, userID xid.ID, action, resource string) bool

Can checks if a user has permission to perform an action on a resource This is the main expressive API for permission checking.

func (*PermissionChecker) CanAll

func (p *PermissionChecker) CanAll(ctx context.Context, userID xid.ID, permissions ...Permission) bool

CanAll checks if a user has all of the specified permissions.

func (*PermissionChecker) CanAny

func (p *PermissionChecker) CanAny(ctx context.Context, userID xid.ID, permissions ...Permission) bool

CanAny checks if a user has any of the specified permissions.

func (*PermissionChecker) For

For creates a new permission builder for a user.

func (*PermissionChecker) HasAnyRole

func (p *PermissionChecker) HasAnyRole(ctx context.Context, userID xid.ID, roleNames ...string) bool

HasAnyRole checks if a user has any of the specified roles.

func (*PermissionChecker) HasRole

func (p *PermissionChecker) HasRole(ctx context.Context, userID xid.ID, roleName string) bool

HasRole checks if a user has a specific role.

func (*PermissionChecker) InvalidateUserCache

func (p *PermissionChecker) InvalidateUserCache(userID xid.ID)

InvalidateUserCache clears the cached roles for a user Call this when user roles are modified.

type Plugin

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

Plugin implements the dashboard plugin for AuthSome.

func NewPlugin

func NewPlugin(opts ...PluginOption) *Plugin

NewPlugin creates a new dashboard plugin instance with optional configuration.

func (*Plugin) AppContext

func (p *Plugin) AppContext() func(func(forge.Context) error) func(forge.Context) error

AppContext middleware injects app context into dashboard requests for authless routes.

func (*Plugin) AuditLog

func (p *Plugin) AuditLog() func(func(forge.Context) error) func(forge.Context) error

AuditLog middleware logs all dashboard access.

func (*Plugin) BridgeContextMiddleware added in v0.0.15

func (p *Plugin) BridgeContextMiddleware() http.Handler

BridgeContextMiddleware enriches the HTTP request context with user, app, and environment IDs before the bridge handler processes it. This eliminates the need for each bridge function to manually extract and build context, providing a single source of truth for context enrichment.

The middleware extracts: 1. User ID from session cookie 2. App ID from session 3. Environment ID from cookie

This middleware runs BEFORE bridge function execution, so all bridge functions automatically receive an enriched context via bridgeCtx.Context().

func (*Plugin) CSRF

func (p *Plugin) CSRF() func(func(forge.Context) error) func(forge.Context) error

CSRF middleware provides CSRF protection.

func (*Plugin) Dependencies

func (p *Plugin) Dependencies() []string

Dependencies declares the plugin dependencies Dependencies requires multiapp plugin for environment management.

func (*Plugin) EnvironmentContext

func (p *Plugin) EnvironmentContext() func(func(forge.Context) error) func(forge.Context) error

EnvironmentContext middleware injects environment context into all dashboard requests

This middleware ensures that every app-scoped dashboard request has an environment ID set in the context. This is critical for: - Environment-scoped data operations - Multi-environment isolation - Audit trails with environment information - Dashboard extensions that need environment context

The middleware follows this flow: 1. Extract app ID from URL path parameter (:appId) 2. Check for environment ID in cookie (authsome_environment) 3. If no cookie, fetch the default environment for the app 4. Set environment context using contexts.SetEnvironmentID() 5. Update cookie for future requests (30-day expiry)

Routes without :appId parameter are skipped (e.g., /dashboard/login) Gracefully handles missing environment service for backward compatibility.

func (*Plugin) ForgeUIApp added in v0.0.15

func (p *Plugin) ForgeUIApp() *forgeui.App

ForgeUIApp returns the ForgeUI App instance.

func (*Plugin) ForgeUIBridge added in v0.0.15

func (p *Plugin) ForgeUIBridge() *bridge.Bridge

ForgeUIBridge returns the ForgeUI Bridge instance.

func (*Plugin) ID

func (p *Plugin) ID() string

ID returns the unique identifier for this plugin.

func (*Plugin) Init

func (p *Plugin) Init(authInstance core.Authsome) error

Init initializes the plugin with dependencies.

func (*Plugin) Migrate

func (p *Plugin) Migrate() error

Migrate runs database migrations for the dashboard plugin.

func (*Plugin) PlatformOrgContext

func (p *Plugin) PlatformOrgContext() func(func(forge.Context) error) func(forge.Context) error

PlatformOrgContext middleware injects platform organization context into all dashboard requests PlatformOrgContext always operates in the context of the platform organization without requiring API keys.

func (*Plugin) RateLimit

func (p *Plugin) RateLimit() func(func(forge.Context) error) func(forge.Context) error

RateLimit middleware implements rate limiting.

func (*Plugin) RegisterHooks

func (p *Plugin) RegisterHooks(hooks *hooks.HookRegistry) error

RegisterHooks registers hooks for the dashboard plugin.

func (*Plugin) RegisterRoles

func (p *Plugin) RegisterRoles(registry any) error

RegisterRoles implements the PluginWithRoles optional interface RegisterRoles is called automatically during server initialization to register dashboard roles.

func (*Plugin) RegisterRoutes

func (p *Plugin) RegisterRoutes(router forge.Router) error

RegisterRoutes registers the dashboard routes.

func (*Plugin) RegisterServiceDecorators

func (p *Plugin) RegisterServiceDecorators(services *registry.ServiceRegistry) error

RegisterServiceDecorators registers service decorators.

func (*Plugin) RequireAdmin

func (p *Plugin) RequireAdmin() func(func(forge.Context) error) func(forge.Context) error

RequireAdmin middleware ensures the user has admin role.

func (*Plugin) RequireAuth

func (p *Plugin) RequireAuth() func(func(forge.Context) error) func(forge.Context) error

RequireAuth middleware ensures the user is authenticated.

type PluginItem

type PluginItem struct {
	ID          string
	Name        string
	Description string
	Category    string
	Status      string // enabled, disabled
	Icon        string // lucide icon name
}

PluginItem represents a plugin entry.

type PluginOption

type PluginOption func(*Plugin)

PluginOption is a functional option for configuring the dashboard plugin.

func WithDefaultConfig

func WithDefaultConfig(cfg Config) PluginOption

WithDefaultConfig sets the default configuration for the plugin.

func WithDefaultTheme

func WithDefaultTheme(theme string) PluginOption

WithDefaultTheme sets the default theme.

func WithEnableSignup

func WithEnableSignup(enabled bool) PluginOption

WithEnableSignup sets whether signup is enabled.

func WithLockoutDuration

func WithLockoutDuration(minutes int) PluginOption

WithLockoutDuration sets the lockout duration in minutes.

func WithMaxLoginAttempts

func WithMaxLoginAttempts(max int) PluginOption

WithMaxLoginAttempts sets the maximum login attempts.

func WithRequireEmailVerification

func WithRequireEmailVerification(required bool) PluginOption

WithRequireEmailVerification sets whether email verification is required.

func WithSessionDuration

func WithSessionDuration(hours int) PluginOption

WithSessionDuration sets the session duration in hours.

type StatusItem

type StatusItem struct {
	Name   string
	Status string // operational, degraded, down
	Color  string // green, yellow, red
}

StatusItem represents a system status entry.

type StatusResponse

type StatusResponse = responses.StatusResponse

type SuccessResponse

type SuccessResponse = responses.SuccessResponse

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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