diff options
Diffstat (limited to 'internal/oidc/amr.go')
| -rw-r--r-- | internal/oidc/amr.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/oidc/amr.go b/internal/oidc/amr.go index cd2d8d6b0..8c13c5b20 100644 --- a/internal/oidc/amr.go +++ b/internal/oidc/amr.go @@ -1,5 +1,24 @@ package oidc +func NewAuthenticationMethodsReferencesFromClaim(claim []string) (amr AuthenticationMethodsReferences) { + for _, ref := range claim { + switch ref { + case AMRPasswordBasedAuthentication: + amr.UsernameAndPassword = true + case AMROneTimePassword: + amr.TOTP = true + case AMRShortMessageService: + amr.Duo = true + case AMRHardwareSecuredKey: + amr.WebAuthn = true + case AMRUserPresence: + amr.WebAuthnUserVerified = true + } + } + + return amr +} + // AuthenticationMethodsReferences holds AMR information. type AuthenticationMethodsReferences struct { UsernameAndPassword bool |
