mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-28 01:52:16 +00:00
This PR starts the OIDC implementation for the API V2 including the Implicit and Code Flow. Co-authored-by: Livio Spring <[email protected]> Co-authored-by: Tim Möhlmann <[email protected]> Co-authored-by: Stefan Benz <[email protected]>
44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
// Package amr maps zitadel session factors to Authentication Method Reference Values
|
|
// as defined in [RFC 8176, section 2].
|
|
//
|
|
// [RFC 8176, section 2]: https://datatracker.ietf.org/doc/html/rfc8176#section-2
|
|
package amr
|
|
|
|
const (
|
|
// Password states that the users password has been verified
|
|
// Deprecated: use `PWD` instead
|
|
Password = "password"
|
|
// PWD states that the users password has been verified
|
|
PWD = "pwd"
|
|
// MFA states that multiple factors have been verified (e.g. pwd and otp or passkey)
|
|
MFA = "mfa"
|
|
// OTP states that a one time password has been verified (e.g. TOTP)
|
|
OTP = "otp"
|
|
// UserPresence states that the end users presence has been verified (e.g. passkey and u2f)
|
|
UserPresence = "user"
|
|
)
|
|
|
|
type AuthenticationMethodReference interface {
|
|
IsPasswordChecked() bool
|
|
IsPasskeyChecked() bool
|
|
IsU2FChecked() bool
|
|
IsOTPChecked() bool
|
|
}
|
|
|
|
func List(model AuthenticationMethodReference) []string {
|
|
amr := make([]string, 0)
|
|
if model.IsPasswordChecked() {
|
|
amr = append(amr, PWD)
|
|
}
|
|
if model.IsPasskeyChecked() || model.IsU2FChecked() {
|
|
amr = append(amr, UserPresence)
|
|
}
|
|
if model.IsOTPChecked() {
|
|
amr = append(amr, OTP)
|
|
}
|
|
if model.IsPasskeyChecked() || len(amr) >= 2 {
|
|
amr = append(amr, MFA)
|
|
}
|
|
return amr
|
|
}
|