Separated the error message for Bearer token and Basic authentication failures.
This commit is contained in:
1 parent
b3f142d715
commit
3a4897c7d2
1 file changed
+7
-2
+7
-2
@@ -188,9 +188,14 @@ public class KeycloakAuthenticationProcessingFilter extends AbstractAuthenticati
|
||||
protected void unsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException failed) throws IOException, ServletException {
|
||||
|
||||
if (this.isBearerTokenRequest(request) || this.isBasicAuthRequest(request)) {
|
||||
if (this.isBearerTokenRequest(request)) {
|
||||
SecurityContextHolder.clearContext();
|
||||
response.sendError(HttpServletResponse.SC_FORBIDDEN, "Unable to authenticate bearer token/basic authentication");
|
||||
response.sendError(HttpServletResponse.SC_FORBIDDEN, "Unable to authenticate bearer token");
|
||||
return;
|
||||
}
|
||||
else if (this.isBasicAuthRequest(request)) {
|
||||
SecurityContextHolder.clearContext();
|
||||
response.sendError(HttpServletResponse.SC_FORBIDDEN, "Unable to authenticate with basic authentication");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user