public abstract class AbstractAuthorizeAction extends ActionCommandBase
Determine whether the requested action is authorized for the current user. If not, abort chain processing and perferably, return an error message of some kind.
| Constructor and Description |
|---|
AbstractAuthorizeAction() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
execute(ActionContext actionCtx)
Determine whether the requested action is authorized for the current
user.
|
protected abstract java.lang.String |
getErrorMessage(ActionContext context,
ActionConfig actionConfig)
Retrieve error message from context.
|
protected boolean |
isAuthorizationRequired(ActionConfig actionConfig)
Must authorization rules be consulted? The base implementation
returns
true if the given ActionConfig has
one or more roles defined. |
protected abstract boolean |
isAuthorized(ActionContext context,
java.lang.String[] roles,
ActionConfig actionConfig)
Determine if the action is authorized for the given roles.
|
executepublic boolean execute(ActionContext actionCtx) throws java.lang.Exception
Determine whether the requested action is authorized for the current user. If not, abort chain processing and perferably, return an error message of some kind.
execute in interface ActionCommandexecute in class ActionCommandBaseactionCtx - The Context for the current requestfalse if the user is authorized for the selected
action, else true to abort processing.UnauthorizedActionException - if authorization fails
or if an error is encountered in the course of performing the authorization.java.lang.Exception - On any errorprotected boolean isAuthorizationRequired(ActionConfig actionConfig)
Must authorization rules be consulted? The base implementation
returns true if the given ActionConfig has
one or more roles defined.
actionConfig - the current ActionConfig objectisAuthorized method should be
consulted.protected abstract boolean isAuthorized(ActionContext context, java.lang.String[] roles, ActionConfig actionConfig) throws java.lang.Exception
Determine if the action is authorized for the given roles.
context - The Context for the current requestroles - An array of valid roles for this requestactionConfig - The current action mappingtrue if the request is authorized, else
falseUnauthorizedActionException - If the logic determines that the request is not authorized
but does not wish to rely upon the default mechanism reporting the error.java.lang.Exception - If the action cannot be tested for authorizationprotected abstract java.lang.String getErrorMessage(ActionContext context, ActionConfig actionConfig)
Retrieve error message from context.
context - The Context for the current requestactionConfig - The current action mappingCopyright © 2000–2025 Apache Software Foundation. All rights reserved.