loginMethodToAMR maps an internal LoginMethod value to the OIDC Core §2 Authentication Methods Reference array. Returns nil (omit the claim) for unknown or empty methods.
(method string)
| 69 | // Authentication Methods Reference array. Returns nil (omit the claim) |
| 70 | // for unknown or empty methods. |
| 71 | func loginMethodToAMR(method string) []string { |
| 72 | switch strings.ToLower(method) { |
| 73 | case constants.AuthRecipeMethodBasicAuth, constants.AuthRecipeMethodMobileBasicAuth: |
| 74 | return []string{"pwd"} |
| 75 | case constants.AuthRecipeMethodMagicLinkLogin, constants.AuthRecipeMethodMobileOTP: |
| 76 | return []string{"otp"} |
| 77 | case constants.AuthRecipeMethodGoogle, |
| 78 | constants.AuthRecipeMethodGithub, |
| 79 | constants.AuthRecipeMethodFacebook, |
| 80 | constants.AuthRecipeMethodLinkedIn, |
| 81 | constants.AuthRecipeMethodApple, |
| 82 | constants.AuthRecipeMethodDiscord, |
| 83 | constants.AuthRecipeMethodTwitter, |
| 84 | constants.AuthRecipeMethodTwitch, |
| 85 | constants.AuthRecipeMethodRoblox, |
| 86 | constants.AuthRecipeMethodMicrosoft: |
| 87 | return []string{"fed"} |
| 88 | } |
| 89 | return nil |
| 90 | } |
| 91 | |
| 92 | // JWTToken is a struct to hold JWT token and its expiration time |
| 93 | type JWTToken struct { |