Documentation
¶
Index ¶
- Constants
- func CheckRebootCompletions(app core.App)
- func LoadAuthContext(app core.App) func(next func(*core.RequestEvent) error) func(*core.RequestEvent) error
- func OnAuthFailed(app App) func(*core.RecordAuthRequestEvent) error
- func OnAuthRequest(app App) func(*core.RecordAuthRequestEvent) error
- func OnAuthWithPasswordRequest(app App) func(*core.RecordAuthWithPasswordRequestEvent) error
- func OnUserCreate(app App) func(*core.RecordEvent) error
- func OnUserUpdate(app App) func(*core.RecordEvent) error
- func RegisterAgentHooks(app core.App)
- func RegisterInvestigationHooks(app core.App)
- func RegisterPackageExceptionHooks(app core.App)
- func RegisterPatchHooks(app core.App)
- func RegisterProxmoxHooks(app core.App)
- func RegisterRebootHooks(app core.App)
- func RequireAuth() func(next func(*core.RequestEvent) error) func(*core.RequestEvent) error
- func RequireAuthCollection(collectionName string) func(next func(*core.RequestEvent) error) func(*core.RequestEvent) error
- type App
- type MFAHooks
- func (h *MFAHooks) CheckMFARequired(userID string) (bool, string, error)
- func (h *MFAHooks) OnAuthSuccess(e *core.RecordAuthRequestEvent) error
- func (h *MFAHooks) RequireMFAMiddleware(next http.Handler) http.Handler
- func (h *MFAHooks) VerifyMFAForLogin(userID, factorID, challengeID, code string) error
Constants ¶
const MFASessionKey = "mfa_session"
MFASessionKey is the key used to store MFA session info in the request context
Variables ¶
This section is empty.
Functions ¶
func CheckRebootCompletions ¶ added in v0.0.4
CheckRebootCompletions checks for agents with pending_reboot_id that have reconnected Exported for testing
func LoadAuthContext ¶
func LoadAuthContext(app core.App) func(next func(*core.RequestEvent) error) func(*core.RequestEvent) error
LoadAuthContext returns a middleware that loads the auth record from the Authorization header
func OnAuthFailed ¶
func OnAuthFailed(app App) func(*core.RecordAuthRequestEvent) error
OnAuthFailed tracks failed auth attempts and locks account after 5 failures
func OnAuthRequest ¶
func OnAuthRequest(app App) func(*core.RecordAuthRequestEvent) error
OnAuthRequest checks account lockout before allowing auth
func OnAuthWithPasswordRequest ¶
func OnAuthWithPasswordRequest(app App) func(*core.RecordAuthWithPasswordRequestEvent) error
OnAuthWithPasswordRequest checks account lockout and tracks failures
func OnUserCreate ¶
func OnUserCreate(app App) func(*core.RecordEvent) error
OnUserCreate validates password when creating a new user
func OnUserUpdate ¶
func OnUserUpdate(app App) func(*core.RecordEvent) error
OnUserUpdate validates password and checks security constraints when updating user
func RegisterAgentHooks ¶
RegisterAgentHooks registers all agent-related functionality
func RegisterInvestigationHooks ¶
RegisterInvestigationHooks registers all investigation management endpoints
func RegisterPackageExceptionHooks ¶ added in v0.0.2
RegisterPackageExceptionHooks registers hooks for package_exceptions collection
func RegisterPatchHooks ¶
RegisterPatchHooks registers all patch management endpoints and hooks
func RegisterProxmoxHooks ¶ added in v0.0.2
RegisterProxmoxHooks registers the Proxmox related hooks and routes
func RegisterRebootHooks ¶ added in v0.0.4
RegisterRebootHooks registers all reboot management endpoints and hooks Note: Reboot schedule cron management is handled by schedules.RegisterRebootScheduler
func RequireAuth ¶
func RequireAuth() func(next func(*core.RequestEvent) error) func(*core.RequestEvent) error
RequireAuth returns a middleware that requires authentication
func RequireAuthCollection ¶ added in v0.0.2
func RequireAuthCollection(collectionName string) func(next func(*core.RequestEvent) error) func(*core.RequestEvent) error
RequireAuthCollection returns a middleware that requires authentication for a specific collection
Types ¶
type App ¶
type App interface {
FindCollectionByNameOrId(collectionNameOrId string) (*core.Collection, error)
FindRecordsByFilter(collection any, filter string, sort string, limit int, offset int, params ...dbx.Params) ([]*core.Record, error)
Save(record core.Model) error
}
App interface for PocketBase operations
type MFAHooks ¶ added in v0.0.5
type MFAHooks struct {
// contains filtered or unexported fields
}
MFAHooks provides MFA-related hooks for the authentication system
func NewMFAHooks ¶ added in v0.0.5
NewMFAHooks creates a new MFA hooks instance
func (*MFAHooks) CheckMFARequired ¶ added in v0.0.5
CheckMFARequired checks if the user has MFA enabled and needs to verify
func (*MFAHooks) OnAuthSuccess ¶ added in v0.0.5
func (h *MFAHooks) OnAuthSuccess(e *core.RecordAuthRequestEvent) error
OnAuthSuccess is called after successful primary authentication It checks if the user has MFA enabled and returns appropriate response
func (*MFAHooks) RequireMFAMiddleware ¶ added in v0.0.5
RequireMFAMiddleware is a middleware that requires MFA verification for certain routes
func (*MFAHooks) VerifyMFAForLogin ¶ added in v0.0.5
VerifyMFAForLogin verifies MFA during the login process