Class ExperimentalAccessController
- java.lang.Object
-
- org.owasp.esapi.reference.accesscontrol.ExperimentalAccessController
-
- All Implemented Interfaces:
AccessController
public class ExperimentalAccessController extends java.lang.Object implements AccessController
-
-
Constructor Summary
Constructors Constructor Description ExperimentalAccessController()ExperimentalAccessController(java.util.Map ruleMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidassertAuthorized(java.lang.Object key, java.lang.Object runtimeParameter)assertAuthorizedexecutes theAccessControlRulethat is identified bykeyand listed in theresources/ESAPI-AccessControlPolicy.xmlfile.voidassertAuthorizedForData(java.lang.String action, java.lang.Object data)Deprecated.voidassertAuthorizedForFile(java.lang.String filepath)Deprecated.voidassertAuthorizedForFunction(java.lang.String functionName)Deprecated.voidassertAuthorizedForService(java.lang.String serviceName)Deprecated.voidassertAuthorizedForURL(java.lang.String url)Deprecated.booleanisAuthorized(java.lang.Object key, java.lang.Object runtimeParameter)isAuthorizedexecutes theAccessControlRulethat is identified bykeyand listed in theresources/ESAPI-AccessControlPolicy.xmlfile.booleanisAuthorizedForData(java.lang.String action, java.lang.Object data)Deprecated.booleanisAuthorizedForFile(java.lang.String filepath)Deprecated.booleanisAuthorizedForFunction(java.lang.String functionName)Deprecated.booleanisAuthorizedForService(java.lang.String serviceName)Deprecated.booleanisAuthorizedForURL(java.lang.String url)Deprecated.
-
-
-
Field Detail
-
logger
protected final Logger logger
-
-
Constructor Detail
-
ExperimentalAccessController
public ExperimentalAccessController(java.util.Map ruleMap)
-
ExperimentalAccessController
public ExperimentalAccessController() throws AccessControlException- Throws:
AccessControlException
-
-
Method Detail
-
isAuthorized
public boolean isAuthorized(java.lang.Object key, java.lang.Object runtimeParameter)Description copied from interface:AccessControllerisAuthorizedexecutes theAccessControlRulethat is identified bykeyand listed in theresources/ESAPI-AccessControlPolicy.xmlfile. It returns true if theAccessControlRuledecides that the operation should be allowed. Otherwise, it returns false. Any exception thrown by theAccessControlRulemust result in false. Ifkeydoes not map to anAccessControlRule, 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.- Specified by:
isAuthorizedin interfaceAccessController- Parameters:
key-keymaps to<AccessControlPolicy><AccessControlRules> <AccessControlRule name="key"runtimeParameter- runtimeParameter can contain anything that the AccessControlRule needs from the runtime system.- Returns:
- Returns
trueif and only if the AccessControlRule specified bykeyexists and returnedtrue. Otherwise returnsfalse
-
assertAuthorized
public void assertAuthorized(java.lang.Object key, java.lang.Object runtimeParameter) throws AccessControlExceptionDescription copied from interface:AccessControllerassertAuthorizedexecutes theAccessControlRulethat is identified bykeyand listed in theresources/ESAPI-AccessControlPolicy.xmlfile. It does nothing if theAccessControlRuledecides that the operation should be allowed. Otherwise, it throws anorg.owasp.esapi.errors.AccessControlException. Any exception thrown by theAccessControlRulewill also result in anAccesControlException. Ifkeydoes not map to anAccessControlRule, then anAccessControlExceptionis thrown. Developers should callassertAuthorizedto enforce privileged access to the system. It should be used to answer the question: "Should execution continue." Ideally, the call toassertAuthorizedshould be integrated into the application framework so that it is called automatically.- Specified by:
assertAuthorizedin interfaceAccessController- Parameters:
key-keymaps to <AccessControlPolicy><AccessControlRules> <AccessControlRule name="key"runtimeParameter- runtimeParameter can contain anything that the AccessControlRule needs from the runtime system.- Throws:
AccessControlException
-
assertAuthorizedForData
@Deprecated public void assertAuthorizedForData(java.lang.String action, java.lang.Object data) throws AccessControlExceptionDeprecated.Description copied from interface:AccessControllerChecks if the current user is authorized to access the referenced data. This method simply returns if access is authorized. It throws an AccessControlException if access is not authorized, or if the referenced data does not exist.Specification: The implementation should do the following:
- Check to see if the resource exists and if not, throw an AccessControlException
- Use available information to make an access control decision
- Ideally, this policy would be data driven
- You can use the current User, roles, data type, data name, time of day, etc.
- Access control decisions must deny by default
- If access is not permitted, throw an AccessControlException with details
- Specified by:
assertAuthorizedForDatain interfaceAccessController- Parameters:
action-data-- Throws:
AccessControlException- See Also:
FileBasedACRs.isAuthorizedForData(java.lang.String, java.lang.Object)
-
assertAuthorizedForFile
@Deprecated public void assertAuthorizedForFile(java.lang.String filepath) throws AccessControlExceptionDeprecated.Description copied from interface:AccessControllerChecks if the current user is authorized to access the referenced file. The implementation should validate and canonicalize the input to be sure the filepath is not malicious.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:
- Check to see if the File exists and if not, throw an AccessControlException
- Use available information to make an access control decision
- Ideally, this policy would be data driven
- You can use the current User, roles, data type, data name, time of day, etc.
- Access control decisions must deny by default
- If access is not permitted, throw an AccessControlException with details
- Specified by:
assertAuthorizedForFilein interfaceAccessController- Parameters:
filepath-- Throws:
AccessControlException- See Also:
FileBasedACRs.isAuthorizedForFile(java.lang.String)
-
assertAuthorizedForFunction
@Deprecated public void assertAuthorizedForFunction(java.lang.String functionName) throws AccessControlExceptionDeprecated.Description copied from interface:AccessControllerChecks if the current user is authorized to access the referenced function. The implementation should define the function "namespace" to be enforced. Choosing something simple like the class name of action classes or menu item names will make this implementation easier to use.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:
- Check to see if the function exists and if not, throw an AccessControlException
- Use available information to make an access control decision
- Ideally, this policy would be data driven
- You can use the current User, roles, data type, data name, time of day, etc.
- Access control decisions must deny by default
- If access is not permitted, throw an AccessControlException with details
- Specified by:
assertAuthorizedForFunctionin interfaceAccessController- Parameters:
functionName-- Throws:
AccessControlException- See Also:
FileBasedACRs.isAuthorizedForFunction(java.lang.String)
-
assertAuthorizedForService
@Deprecated public void assertAuthorizedForService(java.lang.String serviceName) throws AccessControlExceptionDeprecated.Description copied from interface:AccessControllerChecks if the current user is authorized to access the referenced service. This can be used in applications that provide access to a variety of backend services.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:
- Check to see if the service exists and if not, throw an AccessControlException
- Use available information to make an access control decision
- Ideally, this policy would be data driven
- You can use the current User, roles, data type, data name, time of day, etc.
- Access control decisions must deny by default
- If access is not permitted, throw an AccessControlException with details
- Specified by:
assertAuthorizedForServicein interfaceAccessController- Parameters:
serviceName-- Throws:
AccessControlException- See Also:
FileBasedACRs.isAuthorizedForService(java.lang.String)
-
assertAuthorizedForURL
@Deprecated public void assertAuthorizedForURL(java.lang.String url) throws AccessControlExceptionDeprecated.Description copied from interface:AccessControllerChecks if the current user is authorized to access the referenced URL. The implementation should allow access to be granted to any part of the URL. Generally, this method should be invoked in the application's controller or a filter as follows: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:
- Check to see if the resource exists and if not, throw an AccessControlException
- Use available information to make an access control decision
- Ideally, this policy would be data driven
- You can use the current User, roles, data type, data name, time of day, etc.
- Access control decisions must deny by default
- If access is not permitted, throw an AccessControlException with details
- Specified by:
assertAuthorizedForURLin interfaceAccessController- Parameters:
url-- Throws:
AccessControlException- See Also:
FileBasedACRs.isAuthorizedForURL(java.lang.String)
-
isAuthorizedForData
@Deprecated public boolean isAuthorizedForData(java.lang.String action, java.lang.Object data)Deprecated.Description copied from interface:AccessControllerChecks if the current user is authorized to access the referenced data, represented as an Object. The implementation of this method should call assertAuthorizedForData(String action, Object data), and if an AccessControlException is not thrown, this method should return true.- Specified by:
isAuthorizedForDatain interfaceAccessController- Parameters:
action-data-- Returns:
trueif access is permitted;falseotherwise.- See Also:
FileBasedACRs.isAuthorizedForData(java.lang.String, java.lang.Object)
-
isAuthorizedForFile
@Deprecated public boolean isAuthorizedForFile(java.lang.String filepath)
Deprecated.Description copied from interface:AccessControllerChecks if the current user is authorized to access the referenced file. The implementation of this method should call assertAuthorizedForFile(String filepath), and if an AccessControlException is not thrown, this method should return true.- Specified by:
isAuthorizedForFilein interfaceAccessController- Parameters:
filepath-- Returns:
trueif access is permitted;falseotherwise.- See Also:
FileBasedACRs.isAuthorizedForFile(java.lang.String)
-
isAuthorizedForFunction
@Deprecated public boolean isAuthorizedForFunction(java.lang.String functionName)
Deprecated.Description copied from interface:AccessControllerChecks if the current user is authorized to access the referenced function. The implementation of this method should call assertAuthorizedForFunction(String functionName), and if an AccessControlException is not thrown, this method should return true.- Specified by:
isAuthorizedForFunctionin interfaceAccessController- Parameters:
functionName-- Returns:
trueif access is permitted;falseotherwise.- See Also:
FileBasedACRs.isAuthorizedForFunction(java.lang.String)
-
isAuthorizedForService
@Deprecated public boolean isAuthorizedForService(java.lang.String serviceName)
Deprecated.Description copied from interface:AccessControllerChecks if the current user is authorized to access the referenced service. This can be used in applications that provide access to a variety of back end services. The implementation of this method should call assertAuthorizedForService(String serviceName), and if an AccessControlException is not thrown, this method should return true.- Specified by:
isAuthorizedForServicein interfaceAccessController- Parameters:
serviceName-- Returns:
trueif access is permitted;falseotherwise.- See Also:
FileBasedACRs.isAuthorizedForService(java.lang.String)
-
isAuthorizedForURL
@Deprecated public boolean isAuthorizedForURL(java.lang.String url)
Deprecated.Description copied from interface:AccessControllerChecks if the current user is authorized to access the referenced URL. Generally, this method should be invoked in the application's controller or a filter as follows: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.- Specified by:
isAuthorizedForURLin interfaceAccessController- Parameters:
url-- Returns:
trueif access is permitted;falseotherwise.- See Also:
FileBasedACRs.isAuthorizedForURL(java.lang.String)
-
-