shiropac4j

Pac4j and Custom Forbidden page?


If a user has no permission, I got only this blank Forbidden page: enter image description here

In the org.pac4j.jee.filter.SecurityFilter there is no unauthorizedUrl field to define the URL.

Is there any other possibility to set / redirect the user to a custom page, if the user has not the permission? How can this be done?


Solution

  • Either you can override the 403 error page in your app or you can create your own permission Authorizer and throw a FoundAction exception with the wanted location (to break the flow and redirect to the expected error page).