Skip to content

Commit c0f167c

Browse files
J0cemalkilic
authored andcommitted
feat: add webauthn configuration variables (#1773)
## 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.
1 parent f6c8d98 commit c0f167c

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

example.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,6 @@ GOTRUE_HOOK_CUSTOM_SMS_PROVIDER_SECRET=""
233233
# Test OTP Config
234234
GOTRUE_SMS_TEST_OTP="<phone-1>:<otp-1>, <phone-2>:<otp-2>..."
235235
GOTRUE_SMS_TEST_OTP_VALID_UNTIL="<ISO date time>" # (e.g. 2023-09-29T08:14:06Z)
236+
237+
GOTRUE_MFA_WEB_AUTHN_ENROLL_ENABLED="false"
238+
GOTRUE_MFA_WEB_AUTHN_VERIFY_ENABLED="false"

internal/conf/configuration.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,22 @@ type JWTConfiguration struct {
111111
}
112112

113113
type MFAFactorTypeConfiguration struct {
114+
EnrollEnabled bool `json:"enroll_enabled" split_words:"true" default:"false"`
115+
VerifyEnabled bool `json:"verify_enabled" split_words:"true" default:"false"`
116+
}
117+
118+
type TOTPFactorTypeConfiguration struct {
114119
EnrollEnabled bool `json:"enroll_enabled" split_words:"true" default:"true"`
115120
VerifyEnabled bool `json:"verify_enabled" split_words:"true" default:"true"`
116121
}
117122

118123
type PhoneFactorTypeConfiguration struct {
119124
// Default to false in order to ensure Phone MFA is opt-in
120-
EnrollEnabled bool `json:"enroll_enabled" split_words:"true" default:"false"`
121-
VerifyEnabled bool `json:"verify_enabled" split_words:"true" default:"false"`
122-
OtpLength int `json:"otp_length" split_words:"true"`
123-
SMSTemplate *template.Template `json:"-"`
124-
MaxFrequency time.Duration `json:"max_frequency" split_words:"true"`
125-
Template string `json:"template"`
125+
MFAFactorTypeConfiguration
126+
OtpLength int `json:"otp_length" split_words:"true"`
127+
SMSTemplate *template.Template `json:"-"`
128+
MaxFrequency time.Duration `json:"max_frequency" split_words:"true"`
129+
Template string `json:"template"`
126130
}
127131

128132
// MFAConfiguration holds all the MFA related Configuration
@@ -133,7 +137,8 @@ type MFAConfiguration struct {
133137
MaxEnrolledFactors float64 `split_words:"true" default:"10"`
134138
MaxVerifiedFactors int `split_words:"true" default:"10"`
135139
Phone PhoneFactorTypeConfiguration `split_words:"true"`
136-
TOTP MFAFactorTypeConfiguration `split_words:"true"`
140+
TOTP TOTPFactorTypeConfiguration `split_words:"true"`
141+
WebAuthn MFAFactorTypeConfiguration `split_words:"true"`
137142
}
138143

139144
type APIConfiguration struct {

0 commit comments

Comments
 (0)