jakarta.servlet.http.HttpServletRequest#isUserInRole
| Modifier and Type | Field and Description |
|---|---|
| private String[] |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | handleNotAuthorized(HttpServletRequest
current HTTP request request, HttpServletResponse current HTTP response response, Object chosen handler to execute, for type and/or instance evaluation handler)Handle a request that is not authorized according to this interceptor. |
| public final boolean | preHandle(HttpServletRequest
current HTTP request request, HttpServletResponse current HTTP response response, Object chosen handler to execute, for type and/or instance evaluation handler)Overrides default org. Interception point before the execution of a handler. |
| public final void | setAuthorizedRoles(String...
array of role names authorizedRoles)Set the roles that this interceptor should treat as authorized. |
| authorizedRoles | back to summary |
|---|---|
| private String[] authorizedRoles
| |
| UserRoleAuthorizationInterceptor | back to summary |
|---|---|
| public UserRoleAuthorizationInterceptor() | |
| handleNotAuthorized | back to summary |
|---|---|
| protected void handleNotAuthorized(HttpServletRequest request, HttpServletResponse response, Object handler) throws ServletException, IOException Handle a request that is not authorized according to this interceptor. Default implementation sends HTTP status code 403 ("forbidden"). This method can be overridden to write a custom message, forward or redirect to some error page or login page, or throw a ServletException.
| |
| preHandle | back to summary |
|---|---|
| public final boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws ServletException, IOException Overrides default org. Doc from org. Interception point before the execution of a handler. Called after HandlerMapping determined an appropriate handler object, but before HandlerAdapter invokes the handler. DispatcherServlet processes a handler in an execution chain, consisting of any number of interceptors, with the handler itself at the end. With this method, each interceptor can decide to abort the execution chain, typically sending an HTTP error or writing a custom response. Note special considerations apply for asynchronous
request processing. For more details see
The default implementation returns
| |
| setAuthorizedRoles | back to summary |
|---|---|
| public final void setAuthorizedRoles(String... authorizedRoles) Set the roles that this interceptor should treat as authorized.
| |