Skip to content

Commit

Permalink
Deduplicate access token error
Browse files Browse the repository at this point in the history
  • Loading branch information
p53 committed Dec 4, 2023
1 parent 500c797 commit 0c428a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions pkg/apperrors/apperrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ var (
ErrPKCECookieEmpty = errors.New("seems that pkce code verifier cookie value is empty string")

ErrSessionExpiredVerifyOff = errors.New("the session has expired and verification switch off")
ErrAccTokenVerifyFailure = errors.New("access token failed verification")
ErrSessionExpiredRefreshOff = errors.New("session expired and access token refreshing is disabled")
ErrRefreshTokenNotFound = errors.New("unable to find refresh token for user")
ErrAccTokenRefreshFailure = errors.New("failed to refresh the access token")
Expand All @@ -61,9 +60,9 @@ var (
ErrParseAccessTokenClaims = errors.New("faled to parse access token claims")
ErrParseRefreshTokenClaims = errors.New("faled to parse refresh token claims")

ErrAccTokenVerifyFailure = errors.New("access token failed verification")
ErrTokenSignature = errors.New("invalid token signature")
ErrVerifyIDToken = errors.New("unable to verify ID token")
ErrVerifyAccessToken = errors.New("unable to verify access token")
ErrVerifyRefreshToken = errors.New("refresh token failed verification")
ErrAccRefreshTokenMismatch = errors.New("seems that access token and refresh token doesn't match")

Expand Down
4 changes: 2 additions & 2 deletions pkg/keycloak/proxy/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ func verifyOIDCTokens(
if oIDToken.AccessTokenHash != "" {
err = oIDToken.VerifyAccessToken(rawAccessToken)
if err != nil {
return nil, nil, errors.Join(apperrors.ErrVerifyAccessToken, err)
return nil, nil, errors.Join(apperrors.ErrAccTokenVerifyFailure, err)
}
}

Expand All @@ -619,7 +619,7 @@ func verifyOIDCTokens(
skipIssuerCheck,
)
if err != nil {
return nil, nil, errors.Join(apperrors.ErrVerifyAccessToken, err)
return nil, nil, errors.Join(apperrors.ErrAccTokenVerifyFailure, err)
}

return oAccToken, oIDToken, nil
Expand Down

0 comments on commit 0c428a7

Please sign in to comment.