Documentation
¶
Overview ¶
Package auth is the official authentication module: credential login, self-service registration, email verification, password reset, and first-login bootstrap over the admin handler surface.
Index ¶
- Constants
- type Module
- func (m *Module) AdminManifest() kernel.AdminExtensionManifest
- func (m *Module) AuthHandler() *api.AuthHandler
- func (m *Module) FirstLoginHandler() *api.FirstLoginHandler
- func (m *Module) Init(_ kernel.Kernel) error
- func (m *Module) Name() string
- func (m *Module) Optional() []string
- func (m *Module) Requires() []string
- func (m *Module) Shutdown() error
- func (m *Module) Version() string
- type Option
- func WithAdminApprovalRequired() Option
- func WithAuthService(service *authdomain.AuthService) Option
- func WithBlockedEmailChecker(checker api.BlockedEmailChecker) Option
- func WithCredentialPolicy(policy authdomain.CredentialPolicy) Option
- func WithFailedLoginStore(store authdomain.FailedLoginAttemptRepo) Option
- func WithFirstLoginService(service *authdomain.FirstLoginService) Option
- func WithLogger(logger kernel.Logger) Option
- func WithLoginService(service *authdomain.LoginService) Option
- func WithMFADeliverer(deliverer api.MFACodeDeliverer) Option
- func WithMFAService(service *authdomain.MFAService) Option
- func WithMailer(mailer api.Mailer) Option
- func WithNotificationRecorder(recorder api.NotificationRecorder) Option
- func WithPasswordResetService(service *authdomain.PasswordResetService) Option
- func WithRegistrationService(service *authdomain.RegistrationService) Option
- func WithTokenIssuer(issuer api.TokenIssuer) Option
- func WithUserStore(store api.UserStore) Option
- func WithVerificationService(service *authdomain.VerificationService) Option
Constants ¶
const Name = "auth"
Name is the registry key for this module.
const Version = "0.1.0"
Version is the module version reported via Module.Version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module is the auth kernel module.
func New ¶
New builds the module, adopting the composition root's wiring. The handlers are built once here so every realm serves the same instances.
func (*Module) AdminManifest ¶
func (m *Module) AdminManifest() kernel.AdminExtensionManifest
AdminManifest declares this module's admin-shell extensions. Auth is chrome, not a navigation surface: login and setup screens render outside the shell.
func (*Module) AuthHandler ¶
func (m *Module) AuthHandler() *api.AuthHandler
AuthHandler exposes the auth handler for core mounting. Core mounts it explicitly (rather than via RouteProvider) because the surface spans the public auth group, where a single RegisterRoutes call cannot express the per-route anonymous contract.
func (*Module) FirstLoginHandler ¶
func (m *Module) FirstLoginHandler() *api.FirstLoginHandler
FirstLoginHandler exposes the first-login handler for core mounting. Same explicit-mount deviation as the auth surface.
func (*Module) Init ¶
Init wires the module. The handlers are already built by New; Init only validates presence.
func (*Module) Optional ¶
Optional lists soft dependencies. There are none: every collaborator is either adopted or required.
func (*Module) Requires ¶
Requires lists hard dependencies. Authentication resolves users, matching the retired wrapper edge.
type Option ¶
type Option func(*Module)
Option configures a Module. The composition root supplies every option; direct construction without options yields a standalone module whose handlers serve nil services (they must not be invoked unconfigured).
func WithAdminApprovalRequired ¶
func WithAdminApprovalRequired() Option
WithAdminApprovalRequired configures the admin-approval registration mode on the auth handler.
func WithAuthService ¶
func WithAuthService(service *authdomain.AuthService) Option
WithAuthService adopts the default-credentials auth service.
func WithBlockedEmailChecker ¶
func WithBlockedEmailChecker(checker api.BlockedEmailChecker) Option
WithBlockedEmailChecker adopts the blocked-email checker.
func WithCredentialPolicy ¶
func WithCredentialPolicy(policy authdomain.CredentialPolicy) Option
WithCredentialPolicy adopts the credential policy for the first-login handler's password and email validation.
func WithFailedLoginStore ¶
func WithFailedLoginStore(store authdomain.FailedLoginAttemptRepo) Option
WithFailedLoginStore adopts the failed-login store for the lockout-email flow. The domain FailedLoginAttemptRepo covers it directly.
func WithFirstLoginService ¶
func WithFirstLoginService(service *authdomain.FirstLoginService) Option
WithFirstLoginService adopts the first-login service.
func WithLogger ¶
WithLogger attaches the module logger. Without one handler failures are dropped (discard sink).
func WithLoginService ¶
func WithLoginService(service *authdomain.LoginService) Option
WithLoginService adopts the login service.
func WithMFADeliverer ¶
func WithMFADeliverer(deliverer api.MFACodeDeliverer) Option
WithMFADeliverer adopts the login-code deliverer (email in production, the dev log sink only under DEV_MODE without SMTP).
func WithMFAService ¶
func WithMFAService(service *authdomain.MFAService) Option
WithMFAService adopts the login MFA service.
func WithNotificationRecorder ¶
func WithNotificationRecorder(recorder api.NotificationRecorder) Option
WithNotificationRecorder adopts the admin notification recorder.
func WithPasswordResetService ¶
func WithPasswordResetService(service *authdomain.PasswordResetService) Option
WithPasswordResetService adopts the password-reset service.
func WithRegistrationService ¶
func WithRegistrationService(service *authdomain.RegistrationService) Option
WithRegistrationService adopts the registration service.
func WithTokenIssuer ¶
func WithTokenIssuer(issuer api.TokenIssuer) Option
WithTokenIssuer adopts the JWT issuer for login sessions.
func WithUserStore ¶
WithUserStore adopts the user store for handler-level lookups.
func WithVerificationService ¶
func WithVerificationService(service *authdomain.VerificationService) Option
WithVerificationService adopts the verification service.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package admin owns this module's admin-shell manifest: the declarative UI the single admin SPA renders for authentication.
|
Package admin owns this module's admin-shell manifest: the declarative UI the single admin SPA renders for authentication. |
|
Package testutil provides the kernel fixture module tests run against.
|
Package testutil provides the kernel fixture module tests run against. |