Skip to content

Commit

Permalink
feat: treat lookup as aal2 in session
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Oct 19, 2021
1 parent 458f559 commit 3269028
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ func (s *Session) SetAuthenticatorAssuranceLevel() {
firstFactor = true
case identity.CredentialsTypeTOTP:
secondFactor = true
case identity.CredentialsTypeLookup:
secondFactor = true
}
}

Expand Down
24 changes: 24 additions & 0 deletions session/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ func TestSession(t *testing.T) {
},
expected: identity.AuthenticatorAssuranceLevel2,
},
{
d: "password + lookup is aal2",
methods: []identity.CredentialsType{
identity.CredentialsTypePassword,
identity.CredentialsTypeLookup,
},
expected: identity.AuthenticatorAssuranceLevel2,
},
{
d: "oidc + totp is aal2",
methods: []identity.CredentialsType{
Expand All @@ -115,6 +123,14 @@ func TestSession(t *testing.T) {
},
expected: identity.AuthenticatorAssuranceLevel2,
},
{
d: "oidc + lookup is aal2",
methods: []identity.CredentialsType{
identity.CredentialsTypeOIDC,
identity.CredentialsTypeLookup,
},
expected: identity.AuthenticatorAssuranceLevel2,
},
{
d: "recovery link + totp is aal2",
methods: []identity.CredentialsType{
Expand All @@ -123,6 +139,14 @@ func TestSession(t *testing.T) {
},
expected: identity.AuthenticatorAssuranceLevel2,
},
{
d: "recovery link + lookup is aal2",
methods: []identity.CredentialsType{
identity.CredentialsTypeRecoveryLink,
identity.CredentialsTypeLookup,
},
expected: identity.AuthenticatorAssuranceLevel2,
},
} {
t.Run("case="+tc.d, func(t *testing.T) {
s := session.NewInactiveSession()
Expand Down

0 comments on commit 3269028

Please sign in to comment.