Skip to content

Commit

Permalink
feat(api): This commit is to implement in the logic of
Browse files Browse the repository at this point in the history
token generation  the validation field for MFA
  • Loading branch information
danyecls committed Sep 4, 2023
1 parent 32e4ac3 commit 1476b61
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/services/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ func (s *service) AuthGetToken(ctx context.Context, id string) (*models.UserAuth
}
}

statusMFA, err := s.store.GetMFA(ctx, user.ID)
if err != nil {
return nil, NewErrUserNotFound(id, err)
}

token := jwt.NewWithClaims(jwt.SigningMethodRS256, models.UserAuthClaims{
Username: user.Username,
Admin: true,
Expand All @@ -246,6 +251,9 @@ func (s *service) AuthGetToken(ctx context.Context, id string) (*models.UserAuth
AuthClaims: models.AuthClaims{
Claims: "user",
},
StatusMFA: models.StatusMFA{
StatusMFA: statusMFA.StatusMFA,
},
RegisteredClaims: jwt.RegisteredClaims{
ExpiresAt: jwt.NewNumericDate(clock.Now().Add(time.Hour * 72)),
},
Expand Down

0 comments on commit 1476b61

Please sign in to comment.