Documentation
¶
Overview ¶
Package auth holds shared authentication primitives used by both the API and the Web UI — currently the password policy (issue #48). Keeping it in its own package gives every password-setting code path (operator create, self-registration, future password-reset) a single import surface to validate against.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Policy ¶
type Policy struct {
MinLength int
RequireClasses int // 1..4 of {lower, upper, digit, symbol}
BlockCommon bool // reject embedded common-passwords list
BlockUsername bool // reject equality / substring of username
}
Policy is the configurable password policy. Zero-value Policy ⇒ no constraints; production callers should construct via Default() and override individual knobs from the server config / settings table.
func (Policy) HumanHint ¶
HumanHint returns a human-readable description of the password policy. Used to provide inline guidance on password form pages.
func (Policy) Validate ¶
Validate reports the first rule that fails for password under policy. Returns nil when every rule passes. usernameLower is the lowercase form of the operator's username; pass "" when no username context exists (e.g. one-off bootstrap password). The returned error message names the specific rule so the UI can show actionable feedback.