Documentation
¶
Index ¶
- func CreateMfaChallenge(challenge MfaChallenge) error
- func GenerateEmailOTP() (string, error)
- func GenerateTotpSecret(username, issuer string) (secret string, otpauthURL string, err error)
- func HandleMfa(w http.ResponseWriter, r *http.Request)
- func MarkChallengeUsed(id string) error
- func SendEmailOTP(to, code string) error
- func UpdateChallengeCode(id, code string) error
- func ValidateTotpCode(secret, code string) bool
- type LoginState
- type MfaChallenge
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateMfaChallenge ¶
func CreateMfaChallenge(challenge MfaChallenge) error
func GenerateEmailOTP ¶
func GenerateTotpSecret ¶
func HandleMfa ¶
func HandleMfa(w http.ResponseWriter, r *http.Request)
HandleMfa handles multi-factor authentication requests. @Summary Multi-factor authentication @Description Renders the MFA verification or enrollment page (GET) or processes the MFA code (POST). @Tags mfa @Accept x-www-form-urlencoded @Produce html @Param challenge_id query string false "MFA challenge ID (GET)" @Param challenge_id formData string false "MFA challenge ID (POST)" @Param code formData string false "Verification code (POST)" @Param totp_secret formData string false "TOTP secret for enrollment (POST)" @Param trust_device formData string false "Whether to trust the device (POST)" @Success 200 {string} string "MFA form (GET)" @Success 302 {string} string "Redirect back to client with code after success (POST)" @Router /oauth2/mfa [get] @Router /oauth2/mfa [post]