Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #2323 Make status code 401 if the token kid cannot find jwk #2324

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions status/src/main/resources/config/status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,11 @@ ERR10089:
code: ERR10089
message: FAILED_TO_INVOKE_SERVICE
description: Failed to invoke HTTP service with serviceId %.
ERR10090:
statusCode: 400
code: ERR10090
message: TOKEN_VERIFICATION_EXCEPTION
description: Token verification exception %.

# 11000-11499 swagger-validator errors
ERR11000:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class AbstractJwtVerifyHandler extends UndertowVerifyHandler imp
static final Logger logger = LoggerFactory.getLogger(AbstractJwtVerifyHandler.class);
static final String STATUS_INVALID_AUTH_TOKEN = "ERR10000";
static final String STATUS_AUTH_TOKEN_EXPIRED = "ERR10001";
static final String STATUS_GENERIC_EXCEPTION = "ERR10014";
static final String TOKEN_VERIFICATION_EXCEPTION = "ERR10090";
static final String STATUS_MISSING_AUTH_TOKEN = "ERR10002";
static final String STATUS_INVALID_SCOPE_TOKEN = "ERR10003";
static final String STATUS_SCOPE_TOKEN_EXPIRED = "ERR10004";
Expand Down Expand Up @@ -198,7 +198,7 @@ public boolean handleJwt(HttpServerExchange exchange, String pathPrefix, String
if (logger.isDebugEnabled())
logger.debug("JwtVerifyHandler.handleRequest ends with an error.");

setExchangeStatus(exchange, STATUS_GENERIC_EXCEPTION, e.getMessage());
setExchangeStatus(exchange, TOKEN_VERIFICATION_EXCEPTION, e.getMessage());
exchange.endExchange();
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public abstract class AbstractSimpleJwtVerifyHandler extends UndertowVerifyHandl
static final Logger logger = LoggerFactory.getLogger(AbstractSimpleJwtVerifyHandler.class);
static final String STATUS_INVALID_AUTH_TOKEN = "ERR10000";
static final String STATUS_AUTH_TOKEN_EXPIRED = "ERR10001";
static final String STATUS_GENERIC_EXCEPTION = "ERR10014";
static final String TOKEN_VERIFICATION_EXCEPTION = "ERR10090";
static final String STATUS_MISSING_AUTH_TOKEN = "ERR10002";
static final String STATUS_METHOD_NOT_ALLOWED = "ERR10008";

Expand Down Expand Up @@ -176,7 +176,7 @@ public boolean handleJwt(HttpServerExchange exchange, String pathPrefix, String
if (logger.isDebugEnabled())
logger.debug("SimpleJwtVerifyHandler.handleRequest ends with an error.");

setExchangeStatus(exchange, STATUS_GENERIC_EXCEPTION, e.getMessage());
setExchangeStatus(exchange, TOKEN_VERIFICATION_EXCEPTION, e.getMessage());
exchange.endExchange();
return false;
}
Expand Down