Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add has verified factor mfa claim #1838

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/api/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ func (a *API) generateAccessToken(r *http.Request, tx *storage.Connection, user
Role: user.Role,
SessionId: sid,
AuthenticatorAssuranceLevel: aal.String(),
// MFA is enabled if a developer has one at least one verified factor
HasVerifiedFactor: user.HasMFAEnabled(),
AuthenticationMethodReference: amr,
IsAnonymous: user.IsAnonymous,
}
Expand Down
1 change: 1 addition & 0 deletions internal/hooks/auth_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ type AccessTokenClaims struct {
AuthenticatorAssuranceLevel string `json:"aal,omitempty"`
AuthenticationMethodReference []models.AMREntry `json:"amr,omitempty"`
SessionId string `json:"session_id,omitempty"`
HasVerifiedFactor bool `json:"has_verified_factor"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be set to false if there are no factors / nil slice so there's no need for an omitempty specifier

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we call this mfa_enabled ? seems easier to understand vs has_verified_factor?

IsAnonymous bool `json:"is_anonymous"`
}

Expand Down
Loading