deps

package
v1.9.10 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultServices

type DefaultServices struct{}

DefaultServices is the default implementation that delegates to core package handlers.

func NewDefaultServices

func NewDefaultServices() *DefaultServices

func (DefaultServices) BeginRegistration

func (DefaultServices) BeginRegistration() gin.HandlerFunc

BeginRegistration handles the initiation of WebAuthn registration, verifying user sessions and returning registration options.

func (DefaultServices) ConsentGETHandler

func (DefaultServices) ConsentGETHandler() gin.HandlerFunc

ConsentGETHandler processes GET requests to the '/consent' page, handling consent challenges, CSRF tokens, and error cases.

func (DefaultServices) ConsentPOSTHandler

func (DefaultServices) ConsentPOSTHandler() gin.HandlerFunc

ConsentPOSTHandler handles POST requests to the '/consent' endpoint, processing consent challenges and handling errors.

func (DefaultServices) DeviceGETHandler

func (DefaultServices) DeviceGETHandler() gin.HandlerFunc

DeviceGETHandler processes GET requests for the device login page, handling login challenges, CSRF tokens, and UI rendering.

func (DefaultServices) DevicePOSTHandler

func (DefaultServices) DevicePOSTHandler() gin.HandlerFunc

DevicePOSTHandler handles POST requests for the device authentication page. It processes device-related login data and manages error handling for unsupported functionality.

func (DefaultServices) FinishRegistration

func (DefaultServices) FinishRegistration() gin.HandlerFunc

FinishRegistration handles the completion of WebAuthn registration by verifying user session data and creating credentials.

func (DefaultServices) LoginGET2FAHandler

func (DefaultServices) LoginGET2FAHandler() gin.HandlerFunc

LoginGET2FAHandler handles GET requests for the 2FA registration page, managing session state and TOTP page display logic.

func (DefaultServices) LoginGETHandler

func (DefaultServices) LoginGETHandler() gin.HandlerFunc

LoginGETHandler handles GET requests for the login page, performing login flow initiation and error handling.

func (DefaultServices) LoginPOST2FAHandler

func (DefaultServices) LoginPOST2FAHandler() gin.HandlerFunc

LoginPOST2FAHandler handles POST requests for the '/2fa/v1/register/post' endpoint, managing TOTP-based 2FA processing.

func (DefaultServices) LoginPOSTHandler

func (DefaultServices) LoginPOSTHandler() gin.HandlerFunc

LoginPOSTHandler handles POST requests for the login page, managing the login flow, validation, and 2FA logic.

func (DefaultServices) LogoutGETHandler

func (DefaultServices) LogoutGETHandler() gin.HandlerFunc

LogoutGETHandler handles GET requests to the '/logout' page, managing logout challenges, session checks, and redirects.

func (DefaultServices) LogoutPOSTHandler

func (DefaultServices) LogoutPOSTHandler() gin.HandlerFunc

LogoutPOSTHandler handles POST requests to the '/logout/post' endpoint, managing logout challenges and handling errors.

func (DefaultServices) NotifyGETHandler

func (DefaultServices) NotifyGETHandler() gin.HandlerFunc

NotifyGETHandler handles GET requests for the notification page, managing HTTP status, messages, and HTML rendering.

func (DefaultServices) Register2FAHomeHandler

func (DefaultServices) Register2FAHomeHandler() gin.HandlerFunc

Register2FAHomeHandler serves as the handler for the '/2fa/v1/register/home' endpoint, managing TOTP and WebAuthn setups.

func (DefaultServices) RegisterTotpGETHandler

func (DefaultServices) RegisterTotpGETHandler() gin.HandlerFunc

RegisterTotpGETHandler serves the TOTP registration page, handles session validation and CSRF protection.

func (DefaultServices) RegisterTotpPOSTHandler

func (DefaultServices) RegisterTotpPOSTHandler() gin.HandlerFunc

RegisterTotpPOSTHandler handles POST requests for TOTP registration, validates the TOTP code, and completes the registration.

type Deps

type Deps struct {
	Cfg      config.File
	Logger   kitlog.Logger
	WebAuthn *webauthn.WebAuthn
	Svc      Services
}

Deps aggregates top-level dependencies to be injected into handler modules. Keep it minimal initially to avoid large refactors while enabling future DI.

type Services

type Services interface {

	// LoginGETHandler returns a gin.HandlerFunc responsible for rendering the login page.
	LoginGETHandler() gin.HandlerFunc

	// LoginPOSTHandler returns a gin.HandlerFunc to handle POST requests for login, performing authentication and session creation.
	LoginPOSTHandler() gin.HandlerFunc

	// DeviceGETHandler returns a gin.HandlerFunc to handle GET requests for the device login page, supporting U2F/FIDO2 workflows.
	DeviceGETHandler() gin.HandlerFunc

	// DevicePOSTHandler handles POST requests for the device login process, supporting U2F/FIDO2 workflows for authentication.
	DevicePOSTHandler() gin.HandlerFunc

	// ConsentGETHandler handles GET requests for the consent page, retrieving necessary data for user consent processing.
	ConsentGETHandler() gin.HandlerFunc

	// ConsentPOSTHandler handles POST requests for the consent endpoint to process user consent and authorization decisions.
	ConsentPOSTHandler() gin.HandlerFunc

	// LogoutGETHandler provides a gin.HandlerFunc to handle GET requests for logging out, typically clearing sessions.
	LogoutGETHandler() gin.HandlerFunc

	// LogoutPOSTHandler handles POST requests for user logout, processing any required actions like session termination.
	LogoutPOSTHandler() gin.HandlerFunc

	// NotifyGETHandler returns a gin.HandlerFunc for handling GET requests on the notification endpoint.
	NotifyGETHandler() gin.HandlerFunc

	// LoginGET2FAHandler handles GET requests for the two-factor authentication login page.
	LoginGET2FAHandler() gin.HandlerFunc

	// LoginPOST2FAHandler handles POST requests for two-factor authentication during user login flow.
	LoginPOST2FAHandler() gin.HandlerFunc

	// Register2FAHomeHandler returns a handler for rendering the home page of the two-factor authentication registration process.
	Register2FAHomeHandler() gin.HandlerFunc

	// RegisterTotpGETHandler defines a handler that serves the GET request for TOTP registration.
	RegisterTotpGETHandler() gin.HandlerFunc

	// RegisterTotpPOSTHandler handles the POST request for registering a TOTP (Time-based One-Time Password) authenticator.
	RegisterTotpPOSTHandler() gin.HandlerFunc

	// BeginRegistration initiates a new user registration process and returns a gin.HandlerFunc for handling HTTP requests.
	BeginRegistration() gin.HandlerFunc

	// FinishRegistration handles the final step of the registration process for a new user or device in the system.
	FinishRegistration() gin.HandlerFunc
}

Services defines the transport-agnostic business endpoints that HTTP handlers depend on. Each method returns a gin.HandlerFunc to keep registration code unchanged while allowing a clean DI seam.

Jump to

Keyboard shortcuts

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