fix(oidc): return bad request for an invalid refresh token (#7419)

This commit is contained in:
Tim Möhlmann
2024-02-20 17:54:52 +02:00
committed by GitHub
parent 1791f46424
commit 1d6dfadad8
2 changed files with 2 additions and 2 deletions

View File

@@ -147,7 +147,7 @@ func (c *Commands) renewRefreshToken(ctx context.Context, userID, orgID, refresh
tokenUserID, tokenID, token, err := domain.FromRefreshToken(refreshToken, c.keyAlgorithm) tokenUserID, tokenID, token, err := domain.FromRefreshToken(refreshToken, c.keyAlgorithm)
if err != nil { if err != nil {
return nil, "", "", zerrors.ThrowInvalidArgument(err, "COMMAND-Dbfe4", "Errors.User.RefreshToken.Invalid") return nil, "", "", err
} }
if tokenUserID != userID { if tokenUserID != userID {
return nil, "", "", zerrors.ThrowInvalidArgument(nil, "COMMAND-Ht2g2", "Errors.User.RefreshToken.Invalid") return nil, "", "", zerrors.ThrowInvalidArgument(nil, "COMMAND-Ht2g2", "Errors.User.RefreshToken.Invalid")

View File

@@ -31,7 +31,7 @@ func FromRefreshToken(refreshToken string, algorithm crypto.EncryptionAlgorithm)
} }
split := strings.Split(string(decrypted), ":") split := strings.Split(string(decrypted), ":")
if len(split) != 3 { if len(split) != 3 {
return "", "", "", zerrors.ThrowInternal(nil, "DOMAIN-BGDhn", "Errors.User.RefreshToken.Invalid") return "", "", "", zerrors.ThrowInvalidArgument(nil, "DOMAIN-BGDhn", "Errors.User.RefreshToken.Invalid")
} }
return split[0], split[1], split[2], nil return split[0], split[1], split[2], nil
} }