fix(security): harden refresh token validation and add auth tests
Reject refresh attempts when the DB token type is not refresh_token, and add service-layer tests for bearer refresh rejection, logout revocation, and expired-token logout handling.
This commit is contained in:
@@ -978,6 +978,9 @@ func (s *userService) RefreshToken(
|
||||
if err != nil || tokenRecord == nil || tokenRecord.IsRevoked {
|
||||
return "", "", errors.New("refresh token is revoked")
|
||||
}
|
||||
if tokenRecord.TokenType != "refresh_token" {
|
||||
return "", "", errors.New("not a refresh token")
|
||||
}
|
||||
|
||||
// Get user
|
||||
user, err := s.userRepo.GetUserByID(ctx, userID)
|
||||
|
||||
Reference in New Issue
Block a user