Skip to content

Commit

Permalink
Generic Error Response on Token Endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
KaveeshaPiumini committed Jan 28, 2025
1 parent 72b70c8 commit f4067e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ private void executeClientAuthenticators(HttpServletRequest request, OAuthClient
executeAuthenticator(oAuthClientAuthenticator, oAuthClientAuthnContext, request, bodyContentMap);
});
} catch (InvalidOAuthClientException e) {
String errorMessage = "A valid OAuth client could not be found for client_id: " + clientId;
if (log.isDebugEnabled()) {
log.debug(errorMessage, e);
log.debug("A valid OAuth client could not be found for client_id: " + clientId, e);
}
setErrorToContext(OAuth2ErrorCodes.INVALID_CLIENT, errorMessage, oAuthClientAuthnContext);
setErrorToContext(OAuth2ErrorCodes.INVALID_CLIENT, "Client credentials are invalid.",
oAuthClientAuthnContext);
} catch (IdentityOAuth2Exception e) {
throw new OAuthClientAuthnException("Error while obtaining the service provider for client_id: " +
clientId, OAuth2ErrorCodes.SERVER_ERROR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ public Object[][] testAuthenticateClientData() {
{headersWithClientIDandSecret, new HashMap<String, List>(), false, false, "invalid_client", 1,
CLIENT_ID, false},

// Client ID is there but no valid client is present for that Client ID.
{headerWithClientId, new HashMap<String, List>(), false, false, "invalid_client", 0, null, false},

};
}

Expand Down

0 comments on commit f4067e3

Please sign in to comment.