(authMethod string)
| 109 | } |
| 110 | |
| 111 | func ParseAuthenticationMethod(authMethod string) (AuthenticationMethod, error) { |
| 112 | if strings.HasSuffix(authMethod, "signup") { |
| 113 | authMethod = "email/signup" |
| 114 | } |
| 115 | switch authMethod { |
| 116 | case "oauth": |
| 117 | return OAuth, nil |
| 118 | case "password": |
| 119 | return PasswordGrant, nil |
| 120 | case "otp": |
| 121 | return OTP, nil |
| 122 | case "totp": |
| 123 | return TOTPSignIn, nil |
| 124 | case "recovery": |
| 125 | return Recovery, nil |
| 126 | case "invite": |
| 127 | return Invite, nil |
| 128 | case "sso/saml": |
| 129 | return SSOSAML, nil |
| 130 | case "magiclink": |
| 131 | return MagicLink, nil |
| 132 | case "email/signup": |
| 133 | return EmailSignup, nil |
| 134 | case "email_change": |
| 135 | return EmailChange, nil |
| 136 | case "token_refresh": |
| 137 | return TokenRefresh, nil |
| 138 | case "mfa/sms": |
| 139 | return MFAPhone, nil |
| 140 | case "mfa/webauthn": |
| 141 | return MFAWebAuthn, nil |
| 142 | case "web3": |
| 143 | return Web3, nil |
| 144 | case "oauth_provider/authorization_code": |
| 145 | return OAuthProviderAuthorizationCode, nil |
| 146 | case "passkey": |
| 147 | return PasskeyLogin, nil |
| 148 | } |
| 149 | return 0, fmt.Errorf("unsupported authentication method %q", authMethod) |
| 150 | } |
| 151 | |
| 152 | type Factor struct { |
| 153 | ID uuid.UUID `json:"id" db:"id"` |
no outgoing calls
no test coverage detected