Is there a way to return a customized error message from servlet interception of keycloak.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Is there a way to return a customized error message from servlet interception of keycloak.

rafterjiang
This post has NOT been accepted by the mailing list yet.
We are using spring boot to do the web api/url authentication. We have set up the auth roles and patterns in application.properties. Everything works fine. Only problem is, when web API auth fails,keycloak returns a either 401 or 403 to client. For example:
{
    "status": "401",
    "errorCode": "SERVER_ERROR",
    "message": "internal server error"
}

or

{
    "status": "403",
    "errorCode": "SERVER_ERROR",
    "message": "internal server error"
}

The error message is too vague, is it possible to customize the error message so client knows clearly what goes wrong?