public class ExperimentalAccessController extends Object implements AccessController
Constructor and Description |
---|
ExperimentalAccessController() |
ExperimentalAccessController(Map ruleMap) |
Modifier and Type | Method and Description |
---|---|
void |
assertAuthorized(Object key,
Object runtimeParameter)
assertAuthorized executes the AccessControlRule
that is identified by key and listed in the
resources/ESAPI-AccessControlPolicy.xml file. |
void |
assertAuthorizedForData(String action,
Object data)
Deprecated.
|
void |
assertAuthorizedForFile(String filepath)
Deprecated.
|
void |
assertAuthorizedForFunction(String functionName)
Deprecated.
|
void |
assertAuthorizedForService(String serviceName)
Deprecated.
|
void |
assertAuthorizedForURL(String url)
Deprecated.
|
boolean |
isAuthorized(Object key,
Object runtimeParameter)
isAuthorized executes the AccessControlRule
that is identified by key and listed in the
resources/ESAPI-AccessControlPolicy.xml file. |
boolean |
isAuthorizedForData(String action,
Object data)
Deprecated.
|
boolean |
isAuthorizedForFile(String filepath)
Deprecated.
|
boolean |
isAuthorizedForFunction(String functionName)
Deprecated.
|
boolean |
isAuthorizedForService(String serviceName)
Deprecated.
|
boolean |
isAuthorizedForURL(String url)
Deprecated.
|
protected final Logger logger
public ExperimentalAccessController(Map ruleMap)
public ExperimentalAccessController() throws AccessControlException
AccessControlException
public boolean isAuthorized(Object key, Object runtimeParameter)
AccessController
isAuthorized
executes the AccessControlRule
that is identified by key
and listed in the
resources/ESAPI-AccessControlPolicy.xml
file. It returns
true if the AccessControlRule
decides that the operation
should be allowed. Otherwise, it returns false. Any exception thrown by
the AccessControlRule
must result in false. If
key
does not map to an AccessControlRule
, then
false is returned.
Developers should call isAuthorized to control execution flow. For
example, if you want to decide whether to display a UI widget in the
browser using the same logic that you will use to enforce permissions
on the server, then isAuthorized is the method that you want to use.
Typically, assertAuthorized should be used to enforce permissions on the
server.isAuthorized
in interface AccessController
key
- key
maps to
<AccessControlPolicy><AccessControlRules>
<AccessControlRule name="key"
runtimeParameter
- runtimeParameter can contain anything that
the AccessControlRule needs from the runtime system.true
if and only if the AccessControlRule specified
by key
exists and returned true
.
Otherwise returns false
public void assertAuthorized(Object key, Object runtimeParameter) throws AccessControlException
AccessController
assertAuthorized
executes the AccessControlRule
that is identified by key
and listed in the
resources/ESAPI-AccessControlPolicy.xml
file. It does
nothing if the AccessControlRule
decides that the operation
should be allowed. Otherwise, it throws an
org.owasp.esapi.errors.AccessControlException
. Any exception
thrown by the AccessControlRule
will also result in an
AccesControlException
. If key
does not map to
an AccessControlRule
, then an AccessControlException
is thrown.
Developers should call assertAuthorized
to enforce privileged access to
the system. It should be used to answer the question: "Should execution
continue." Ideally, the call to assertAuthorized
should
be integrated into the application framework so that it is called
automatically.assertAuthorized
in interface AccessController
key
- key
maps to
<AccessControlPolicy><AccessControlRules>
<AccessControlRule name="key"runtimeParameter
- runtimeParameter can contain anything that
the AccessControlRule needs from the runtime system.AccessControlException
@Deprecated public void assertAuthorizedForData(String action, Object data) throws AccessControlException
AccessController
Specification: The implementation should do the following:
assertAuthorizedForData
in interface AccessController
action
- data
- AccessControlException
FileBasedACRs.isAuthorizedForData(java.lang.String, java.lang.Object)
@Deprecated public void assertAuthorizedForFile(String filepath) throws AccessControlException
AccessController
This method throws an AccessControlException if access is not authorized, or if the referenced File does not exist. If the User is authorized, this method simply returns.
Specification: The implementation should do the following:
assertAuthorizedForFile
in interface AccessController
filepath
- AccessControlException
FileBasedACRs.isAuthorizedForFile(java.lang.String)
@Deprecated public void assertAuthorizedForFunction(String functionName) throws AccessControlException
AccessController
This method throws an AccessControlException if access is not authorized, or if the referenced function does not exist. If the User is authorized, this method simply returns.
Specification: The implementation should do the following:
assertAuthorizedForFunction
in interface AccessController
functionName
- AccessControlException
FileBasedACRs.isAuthorizedForFunction(java.lang.String)
@Deprecated public void assertAuthorizedForService(String serviceName) throws AccessControlException
AccessController
This method throws an AccessControlException if access is not authorized, or if the referenced service does not exist. If the User is authorized, this method simply returns.
Specification: The implementation should do the following:
assertAuthorizedForService
in interface AccessController
serviceName
- AccessControlException
FileBasedACRs.isAuthorizedForService(java.lang.String)
@Deprecated public void assertAuthorizedForURL(String url) throws AccessControlException
AccessController
ESAPI.accessController().assertAuthorizedForURL(request.getRequestURI().toString());This method throws an AccessControlException if access is not authorized, or if the referenced URL does not exist. If the User is authorized, this method simply returns.
Specification: The implementation should do the following:
assertAuthorizedForURL
in interface AccessController
url
- AccessControlException
FileBasedACRs.isAuthorizedForURL(java.lang.String)
@Deprecated public boolean isAuthorizedForData(String action, Object data)
AccessController
isAuthorizedForData
in interface AccessController
action
- data
- true
if access is permitted; false
otherwise.FileBasedACRs.isAuthorizedForData(java.lang.String, java.lang.Object)
@Deprecated public boolean isAuthorizedForFile(String filepath)
AccessController
isAuthorizedForFile
in interface AccessController
filepath
- true
if access is permitted; false
otherwise.FileBasedACRs.isAuthorizedForFile(java.lang.String)
@Deprecated public boolean isAuthorizedForFunction(String functionName)
AccessController
isAuthorizedForFunction
in interface AccessController
functionName
- true
if access is permitted; false
otherwise.FileBasedACRs.isAuthorizedForFunction(java.lang.String)
@Deprecated public boolean isAuthorizedForService(String serviceName)
AccessController
isAuthorizedForService
in interface AccessController
serviceName
- true
if access is permitted; false
otherwise.FileBasedACRs.isAuthorizedForService(java.lang.String)
@Deprecated public boolean isAuthorizedForURL(String url)
AccessController
ESAPI.accessController().isAuthorizedForURL(request.getRequestURI().toString());The implementation of this method should call assertAuthorizedForURL(String url), and if an AccessControlException is not thrown, this method should return true. This way, if the user is not authorized, false would be returned, and the exception would be logged.
isAuthorizedForURL
in interface AccessController
url
- true
if access is permitted; false
otherwise.FileBasedACRs.isAuthorizedForURL(java.lang.String)
Copyright © 2019 The Open Web Application Security Project (OWASP). All rights reserved.