Skip to content

Commit

Permalink
fix: generate token after claims have been processed (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
bludot authored May 19, 2023
1 parent 44c21a8 commit cec9046
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mfa/mfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ func (m *Service) handleRequest(ctx context.Context, decodedJWT entities.JWTData

scopes := make([]string, 0)
claims, _ := m.generateClaims(ctx, requestFlow, decodedJWT, &challenge)
token, jwtErr := m.JWTService.GenerateToken(claims, scopes)

if err != nil {
if _, ok := claims.Challenges[challenge]; ok {
Expand All @@ -197,6 +196,8 @@ func (m *Service) handleRequest(ctx context.Context, decodedJWT entities.JWTData
}
}

token, jwtErr := m.JWTService.GenerateToken(claims, scopes)

if jwtErr != nil {
return &entities.MFAResult{
Token: token,
Expand Down

0 comments on commit cec9046

Please sign in to comment.