Skip to content

Commit

Permalink
feat: add webauthn configuration variables (#1773)
Browse files Browse the repository at this point in the history
## What kind of change does this PR introduce?

Add `MFA_WEB_AUTHN_ENROLL_ENABLED` and `MFA_WEB_AUTHN_VERIFY_ENABLED` in
support of the MFA WebAuthn implementation.
  • Loading branch information
J0 committed Sep 13, 2024
1 parent 567ea7e commit 77d5897
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
3 changes: 3 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,6 @@ GOTRUE_HOOK_CUSTOM_SMS_PROVIDER_SECRET=""
# Test OTP Config
GOTRUE_SMS_TEST_OTP="<phone-1>:<otp-1>, <phone-2>:<otp-2>..."
GOTRUE_SMS_TEST_OTP_VALID_UNTIL="<ISO date time>" # (e.g. 2023-09-29T08:14:06Z)

GOTRUE_MFA_WEB_AUTHN_ENROLL_ENABLED="false"
GOTRUE_MFA_WEB_AUTHN_VERIFY_ENABLED="false"
19 changes: 12 additions & 7 deletions internal/conf/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,22 @@ type JWTConfiguration struct {
}

type MFAFactorTypeConfiguration struct {
EnrollEnabled bool `json:"enroll_enabled" split_words:"true" default:"false"`
VerifyEnabled bool `json:"verify_enabled" split_words:"true" default:"false"`
}

type TOTPFactorTypeConfiguration struct {
EnrollEnabled bool `json:"enroll_enabled" split_words:"true" default:"true"`
VerifyEnabled bool `json:"verify_enabled" split_words:"true" default:"true"`
}

type PhoneFactorTypeConfiguration struct {
// Default to false in order to ensure Phone MFA is opt-in
EnrollEnabled bool `json:"enroll_enabled" split_words:"true" default:"false"`
VerifyEnabled bool `json:"verify_enabled" split_words:"true" default:"false"`
OtpLength int `json:"otp_length" split_words:"true"`
SMSTemplate *template.Template `json:"-"`
MaxFrequency time.Duration `json:"max_frequency" split_words:"true"`
Template string `json:"template"`
MFAFactorTypeConfiguration
OtpLength int `json:"otp_length" split_words:"true"`
SMSTemplate *template.Template `json:"-"`
MaxFrequency time.Duration `json:"max_frequency" split_words:"true"`
Template string `json:"template"`
}

// MFAConfiguration holds all the MFA related Configuration
Expand All @@ -133,7 +137,8 @@ type MFAConfiguration struct {
MaxEnrolledFactors float64 `split_words:"true" default:"10"`
MaxVerifiedFactors int `split_words:"true" default:"10"`
Phone PhoneFactorTypeConfiguration `split_words:"true"`
TOTP MFAFactorTypeConfiguration `split_words:"true"`
TOTP TOTPFactorTypeConfiguration `split_words:"true"`
WebAuthn MFAFactorTypeConfiguration `split_words:"true"`
}

type APIConfiguration struct {
Expand Down

0 comments on commit 77d5897

Please sign in to comment.