<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mikehfauzy</id>
		<title>OWASP - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.owasp.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mikehfauzy"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php/Special:Contributions/Mikehfauzy"/>
		<updated>2026-05-30T04:01:04Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User:Mikehfauzy&amp;diff=71350</id>
		<title>User:Mikehfauzy</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User:Mikehfauzy&amp;diff=71350"/>
				<updated>2009-10-12T12:49:27Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mike Fauzy is a Certified Information System Security Professional (CISSP) and Sr. Security Engineer with Aspect Security. He has 11 years of combined experience in Java web application development and information security during which time his clients have included government agencies and companies in the financial, manufacturing and health care industries. He has built 2 application security organizations and helped lead another. He is currently leading OWASP's ESAPI Access Control 2.0 and routinely performs code reviews, penetration tests, security architecture reviews and training.&lt;br /&gt;
&lt;br /&gt;
He lives in Sacramento, CA where he enjoys swing dancing, hiking and road trips.&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=56760</id>
		<title>ESAPI Access Control</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=56760"/>
				<updated>2009-03-16T04:28:47Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: /* Outstanding Questions from the ESAPI Summit and their Answers: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Access Control 2.0=&lt;br /&gt;
At the ESAPI summit, we discussed changing Access Control 2.0 to use the command pattern. The following are the current design goals for Access Control 2.0. Enough proof of concept development has been completed for me to believe that these goals are achievable. I’d appreciate your input as to whether they are both desirable and sufficient. Below the goals are the answers to outstanding questions, the sequence of execution and some code snippets to give a better feel for the current direction. Feedback is welcome. I’m happy to make changes.&amp;lt;br&amp;gt;&lt;br /&gt;
==Current Design Goals:==&lt;br /&gt;
# Allow developers to implement access control rules (ACR) using arbitrary java code.&lt;br /&gt;
#:Benefit: Allowing arbitrary java code gives ACR developers as much flexibility to write ACRs as they do throughout the normal code base. &lt;br /&gt;
# Facilitate integration with frameworks to enforce ACRs automatically and default to deny access.&lt;br /&gt;
#:Benefit: Automatically making the call reduces developer error, because both the call will be made correctly and the developer is forced to provide the security check. &lt;br /&gt;
# Allow developers to call ACRs for evaluation or enforcement manually.&lt;br /&gt;
#:Benefit: Allowing manual calls for both uses increases flexibility and facilitates reuse for access control and flow control.&lt;br /&gt;
# Allow ACRs to make decisions based on arbitrary runtime parameters and deployment parameters.&lt;br /&gt;
#:Benefit: The policy file stores deployment parameters. Accepting an arbitrary runtime parameter allows stateless ACRs, which decreases object creation costs.&lt;br /&gt;
==Proposed Additional Design Goals==&lt;br /&gt;
The following were not in the original set of goals, but I would like us to consider whether they should be included:&lt;br /&gt;
# Keep the Access Control Matrix (ACM) synchronized throughout the SDLC by making the ACM specification drive the integration framework that calls the ACRs.&lt;br /&gt;
#:Benefit: Understanding of permissions is clearer and more accurate throughout requirements and test phases. &lt;br /&gt;
# Allow resource names to be grouped and ensure that ACR selection is deterministic.&lt;br /&gt;
#:Benefit: Grouping similar resources makes the ACM clearer and easier to manage.&lt;br /&gt;
# Integration with Struts 2, Struts 1, JSR 115, Spring ?.?, JBoss Seam, JBossAop, Aspect J. I’m currently using the Struts2Spring2JtaJpa quickstart for the integration tests.  &lt;br /&gt;
==Outstanding Questions from the ESAPI Summit and their Answers:==&lt;br /&gt;
'''Question''': Can the runtimeParameter AccessController.isAuthorized(“Resource”, runtimeParameter) be strongly typed in the ACR definition class? &amp;lt;br&amp;gt;&lt;br /&gt;
'''Answer''': Yes. Java versions 1.5 and above can leverage Generics. AccessControlRules written for 1.4 and below will need to use Object as parameters and then cast appropriately. The current version of Access Control 2.0 is written without generics for backwards compatibility, but I plan to add generics compatible version.&lt;br /&gt;
&lt;br /&gt;
==Sequence:==&lt;br /&gt;
IntegrationComponent -&amp;gt; AccessController -&amp;gt; ACR -&amp;gt; Access is granted or an AccessControlException is thrown.&lt;br /&gt;
# When the system starts, the ACM is read and resources are linked to an ACR.  &lt;br /&gt;
# The IntegrationComponent (e.g. a Struts2 Interceptor) calls AccessController.enforceAuthorization(key, runtimeParameter).&lt;br /&gt;
# AccessController maps the key to an ACR and passes it the runtime parameters and static policy file parameters.&lt;br /&gt;
# The ACR executes Java code to evaluate an arbitrarily complex rule set. Note that an ACR could evaluate unusually complex role requirements by assigning it to all roles for a given resource. Also note that ACRs can delegate to other ACRs or even a rules engine.&lt;br /&gt;
==Code Samples:==&lt;br /&gt;
What follows is a partial strawman implementation from some proof of concept code that I’ve been working on. Code has been removed to help focus on the critical path. I’d appreciate any feedback and I’m looking especially interested in feedback on usability from a developer’s point of view. Would this help you to implement Access Control for large projects? What can I do to make it safer and easier for developers? &lt;br /&gt;
To help illustrate the mappings, I’ve used &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''bold red'''&amp;lt;/span&amp;gt; to represent the resource identifier and &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''bold green'''&amp;lt;/span&amp;gt; to represent the ACR throughout the files. Only the first 3 files (ACM, Policy file and ACR) are implemented by the developer. The rest are provided by the AccessController infrastructure. &lt;br /&gt;
===ACM: Access Control Matrix===&lt;br /&gt;
This table is (roughly) what the Access Control Matrix looks like. It would probably be a .csv file or database file and would have options to group resources using regular expressions, String.startsWith, etc. The ACM and Policy File (below) combine to define which ACR is executed by AccessController. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!         !!Role1!!Role2!!Role3&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''Resource1'''&amp;lt;/span&amp;gt;||Deny ||Grant||&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''SpecialCaseAccessControlRule'''&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Resource2||Grant||Deny	||Deny&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Policy File===&lt;br /&gt;
This xml file is (roughly) what the ACR definitions would look like. It handles what would normally be “footnotes” in an ACM requirements specification document. The name correlates to an ACM cell. The AccessControlRule.class specifies the Java code that will execute. The parameters are passed to the ACR at runtime. Note that this shows the default name-value pair parameter loader, but other parameter loaders (not shown) can be specified. An enhancement would be to allow ACRs to be tagged using annotations so that the Policy file isn't required.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;AccessControlPolicy&amp;gt;&lt;br /&gt;
      &amp;lt;AccessControlRules&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would not implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Grant&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always granted&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysTrueACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Deny&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always denied&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysFalseACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''SpecialCaseAccessControlRule'''&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access depends on the value of the policy parameter: isTrue&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.policy.&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''EchoDynaBeanPolicyParameterACR'''&amp;lt;/span&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;Parameters&amp;gt;&lt;br /&gt;
                        &amp;lt;Parameter name=&amp;quot;isTrue&amp;quot; type=&amp;quot;Boolean&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
                  &amp;lt;/Parameters&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
      &amp;lt;/AccessControlRules&amp;gt;&lt;br /&gt;
 &amp;lt;/AccessControlPolicy&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ACR: Access Control Rule===&lt;br /&gt;
The following class is (roughly) what a simple ACR could look like. Note that the runtimeParameter can leverage generics for type safety. Developers would implement this.&lt;br /&gt;
&lt;br /&gt;
 public class &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''EchoDynaBeanPolicyParameterACR'''&amp;lt;/span&amp;gt; extends DynaBeanPolicyBaseACR {&lt;br /&gt;
      /**&lt;br /&gt;
       * @return true iff policyParameter isTrue is a Boolean set to true.&lt;br /&gt;
       * throws ClassCastException if runtimeParameter is not a Boolean.&lt;br /&gt;
       */&lt;br /&gt;
      public boolean isAuthorized(Object runtimeParameter) throws ClassCastException{           &lt;br /&gt;
            return getPolicyParameters().getBoolean(&amp;quot;isTrue&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===IntegrationComponent===&lt;br /&gt;
This class is (roughly) what a framework integration using a Struts2 interceptor would look like. This is part of the framework, developers don’t implement this. However, if a developer wants to execute an ACR, they can do so as demonstrated in the intercept method.&lt;br /&gt;
&lt;br /&gt;
 public class AccessControlEnforcementInterceptor extends AbstractInterceptor {&lt;br /&gt;
    public String intercept(ActionInvocation invocation) throws Exception {&lt;br /&gt;
          ESAPI.accessController().enforceAuthorization(&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''invocation.getAction()'''&amp;lt;/span&amp;gt;, //assume that getAction() returns “Resource1”&lt;br /&gt;
                  invocation.getInvocationContext()); //Note that this line may change to facilitate &lt;br /&gt;
                                                      //mappings between Framework Integrations and multi-purpose ACRs&lt;br /&gt;
       return invocation.invoke();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===AccessController===&lt;br /&gt;
This class is (roughly) what the enforceAuthorization method in AccessController could look like. The key is the resource. In our example “Resource1.” This method will need to be enhanced to handle resource groups. This is part of the framework, developers don’t implement this. This doesn’t currently take the user’s role into account, but could.&lt;br /&gt;
&lt;br /&gt;
 public void enforceAuthorization(Object &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''key'''&amp;lt;/span&amp;gt;, Object runtimeParameter)&lt;br /&gt;
      throws org.owasp.esapi.errors.AccessControlException {&lt;br /&gt;
      boolean isAuthorized = false;&lt;br /&gt;
      try {&lt;br /&gt;
            AccessControlRule &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''rule'''&amp;lt;/span&amp;gt; = (AccessControlRule)ruleMap.get(&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''key'''&amp;lt;/span&amp;gt;);&lt;br /&gt;
            if(rule == null) {&lt;br /&gt;
                  throw new AccessControlException(&lt;br /&gt;
                              &amp;quot;AccessControlRule was not found for key: &amp;quot; + key,&lt;br /&gt;
                              &amp;quot;&amp;quot;); &lt;br /&gt;
            }&lt;br /&gt;
            System.out.println(&amp;quot;Enforcing Authorization Rule \&amp;quot;&amp;quot; + key + &amp;quot;\&amp;quot; Using class: &amp;quot; + rule.getClass().getCanonicalName());&lt;br /&gt;
            isAuthorized = &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''rule'''&amp;lt;/span&amp;gt;.isAuthorized(runtimeParameter);&lt;br /&gt;
      } catch(Exception e) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;An unhandled Exception was &amp;quot; +&lt;br /&gt;
                        &amp;quot;caught, so we are recasting it as an &amp;quot; +&lt;br /&gt;
                        &amp;quot;AccessControlException.&amp;quot;, &lt;br /&gt;
                        &amp;quot;&amp;quot;,&lt;br /&gt;
                        e);&lt;br /&gt;
      }&lt;br /&gt;
      if(!isAuthorized) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;Access Denied for key: &amp;quot; + key +&lt;br /&gt;
                        &amp;quot; runtimeParameter: &amp;quot; + runtimeParameter, &amp;quot;&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=56405</id>
		<title>ESAPI Access Control</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=56405"/>
				<updated>2009-03-10T00:09:21Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: /* Code Samples: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Access Control 2.0=&lt;br /&gt;
At the ESAPI summit, we discussed changing Access Control 2.0 to use the command pattern. The following are the current design goals for Access Control 2.0. Enough proof of concept development has been completed for me to believe that these goals are achievable. I’d appreciate your input as to whether they are both desirable and sufficient. Below the goals are the answers to outstanding questions, the sequence of execution and some code snippets to give a better feel for the current direction. Feedback is welcome. I’m happy to make changes.&amp;lt;br&amp;gt;&lt;br /&gt;
==Current Design Goals:==&lt;br /&gt;
# Allow developers to implement access control rules (ACR) using arbitrary java code.&lt;br /&gt;
#:Benefit: Allowing arbitrary java code gives ACR developers as much flexibility to write ACRs as they do throughout the normal code base. &lt;br /&gt;
# Facilitate integration with frameworks to enforce ACRs automatically and default to deny access.&lt;br /&gt;
#:Benefit: Automatically making the call reduces developer error, because both the call will be made correctly and the developer is forced to provide the security check. &lt;br /&gt;
# Allow developers to call ACRs for evaluation or enforcement manually.&lt;br /&gt;
#:Benefit: Allowing manual calls for both uses increases flexibility and facilitates reuse for access control and flow control.&lt;br /&gt;
# Allow ACRs to make decisions based on arbitrary runtime parameters and deployment parameters.&lt;br /&gt;
#:Benefit: The policy file stores deployment parameters. Accepting an arbitrary runtime parameter allows stateless ACRs, which decreases object creation costs.&lt;br /&gt;
==Proposed Additional Design Goals==&lt;br /&gt;
The following were not in the original set of goals, but I would like us to consider whether they should be included:&lt;br /&gt;
# Keep the Access Control Matrix (ACM) synchronized throughout the SDLC by making the ACM specification drive the integration framework that calls the ACRs.&lt;br /&gt;
#:Benefit: Understanding of permissions is clearer and more accurate throughout requirements and test phases. &lt;br /&gt;
# Allow resource names to be grouped and ensure that ACR selection is deterministic.&lt;br /&gt;
#:Benefit: Grouping similar resources makes the ACM clearer and easier to manage.&lt;br /&gt;
# Integration with Struts 2, Struts 1, JSR 115, Spring ?.?, JBoss Seam, JBossAop, Aspect J. I’m currently using the Struts2Spring2JtaJpa quickstart for the integration tests.  &lt;br /&gt;
==Outstanding Questions from the ESAPI Summit and their Answers:==&lt;br /&gt;
'''Question''': Can the runtimeParameter AccessController.isAuthorized(“Resource”, runtimeParameter) be strongly typed in the ACR definition class? &amp;lt;br&amp;gt;&lt;br /&gt;
'''Answer''': Yes. Java versions 1.5 and above can leverage Generics. Commands written for 1.4 and below will need to use Object as parameters and then cast appropriately. The current version of Access Control 2.0 is written without generics for backwards compatibility, but I plan to add generics compatible version.&lt;br /&gt;
&lt;br /&gt;
==Sequence:==&lt;br /&gt;
IntegrationComponent -&amp;gt; AccessController -&amp;gt; ACR -&amp;gt; Access is granted or an AccessControlException is thrown.&lt;br /&gt;
# When the system starts, the ACM is read and resources are linked to an ACR.  &lt;br /&gt;
# The IntegrationComponent (e.g. a Struts2 Interceptor) calls AccessController.enforceAuthorization(key, runtimeParameter).&lt;br /&gt;
# AccessController maps the key to an ACR and passes it the runtime parameters and static policy file parameters.&lt;br /&gt;
# The ACR executes Java code to evaluate an arbitrarily complex rule set. Note that an ACR could evaluate unusually complex role requirements by assigning it to all roles for a given resource. Also note that ACRs can delegate to other ACRs or even a rules engine.&lt;br /&gt;
==Code Samples:==&lt;br /&gt;
What follows is a partial strawman implementation from some proof of concept code that I’ve been working on. Code has been removed to help focus on the critical path. I’d appreciate any feedback and I’m looking especially interested in feedback on usability from a developer’s point of view. Would this help you to implement Access Control for large projects? What can I do to make it safer and easier for developers? &lt;br /&gt;
To help illustrate the mappings, I’ve used &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''bold red'''&amp;lt;/span&amp;gt; to represent the resource identifier and &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''bold green'''&amp;lt;/span&amp;gt; to represent the ACR throughout the files. Only the first 3 files (ACM, Policy file and ACR) are implemented by the developer. The rest are provided by the AccessController infrastructure. &lt;br /&gt;
===ACM: Access Control Matrix===&lt;br /&gt;
This table is (roughly) what the Access Control Matrix looks like. It would probably be a .csv file or database file and would have options to group resources using regular expressions, String.startsWith, etc. The ACM and Policy File (below) combine to define which ACR is executed by AccessController. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!         !!Role1!!Role2!!Role3&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''Resource1'''&amp;lt;/span&amp;gt;||Deny ||Grant||&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''SpecialCaseAccessControlRule'''&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Resource2||Grant||Deny	||Deny&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Policy File===&lt;br /&gt;
This xml file is (roughly) what the ACR definitions would look like. It handles what would normally be “footnotes” in an ACM requirements specification document. The name correlates to an ACM cell. The AccessControlRule.class specifies the Java code that will execute. The parameters are passed to the ACR at runtime. Note that this shows the default name-value pair parameter loader, but other parameter loaders (not shown) can be specified. An enhancement would be to allow ACRs to be tagged using annotations so that the Policy file isn't required.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;AccessControlPolicy&amp;gt;&lt;br /&gt;
      &amp;lt;AccessControlRules&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would not implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Grant&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always granted&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysTrueACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Deny&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always denied&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysFalseACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''SpecialCaseAccessControlRule'''&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access depends on the value of the policy parameter: isTrue&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.policy.&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''EchoDynaBeanPolicyParameterACR'''&amp;lt;/span&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;Parameters&amp;gt;&lt;br /&gt;
                        &amp;lt;Parameter name=&amp;quot;isTrue&amp;quot; type=&amp;quot;Boolean&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
                  &amp;lt;/Parameters&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
      &amp;lt;/AccessControlRules&amp;gt;&lt;br /&gt;
 &amp;lt;/AccessControlPolicy&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ACR: Access Control Rule===&lt;br /&gt;
The following class is (roughly) what a simple ACR could look like. Note that the runtimeParameter can leverage generics for type safety. Developers would implement this.&lt;br /&gt;
&lt;br /&gt;
 public class &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''EchoDynaBeanPolicyParameterACR'''&amp;lt;/span&amp;gt; extends DynaBeanPolicyBaseACR {&lt;br /&gt;
      /**&lt;br /&gt;
       * @return true iff policyParameter isTrue is a Boolean set to true.&lt;br /&gt;
       * throws ClassCastException if runtimeParameter is not a Boolean.&lt;br /&gt;
       */&lt;br /&gt;
      public boolean isAuthorized(Object runtimeParameter) throws ClassCastException{           &lt;br /&gt;
            return getPolicyParameters().getBoolean(&amp;quot;isTrue&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===IntegrationComponent===&lt;br /&gt;
This class is (roughly) what a framework integration using a Struts2 interceptor would look like. This is part of the framework, developers don’t implement this. However, if a developer wants to execute an ACR, they can do so as demonstrated in the intercept method.&lt;br /&gt;
&lt;br /&gt;
 public class AccessControlEnforcementInterceptor extends AbstractInterceptor {&lt;br /&gt;
    public String intercept(ActionInvocation invocation) throws Exception {&lt;br /&gt;
          ESAPI.accessController().enforceAuthorization(&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''invocation.getAction()'''&amp;lt;/span&amp;gt;, //assume that getAction() returns “Resource1”&lt;br /&gt;
                  invocation.getInvocationContext()); //Note that this line may change to facilitate &lt;br /&gt;
                                                      //mappings between Framework Integrations and multi-purpose ACRs&lt;br /&gt;
       return invocation.invoke();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===AccessController===&lt;br /&gt;
This class is (roughly) what the enforceAuthorization method in AccessController could look like. The key is the resource. In our example “Resource1.” This method will need to be enhanced to handle resource groups. This is part of the framework, developers don’t implement this. This doesn’t currently take the user’s role into account, but could.&lt;br /&gt;
&lt;br /&gt;
 public void enforceAuthorization(Object &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''key'''&amp;lt;/span&amp;gt;, Object runtimeParameter)&lt;br /&gt;
      throws org.owasp.esapi.errors.AccessControlException {&lt;br /&gt;
      boolean isAuthorized = false;&lt;br /&gt;
      try {&lt;br /&gt;
            AccessControlRule &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''rule'''&amp;lt;/span&amp;gt; = (AccessControlRule)ruleMap.get(&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''key'''&amp;lt;/span&amp;gt;);&lt;br /&gt;
            if(rule == null) {&lt;br /&gt;
                  throw new AccessControlException(&lt;br /&gt;
                              &amp;quot;AccessControlRule was not found for key: &amp;quot; + key,&lt;br /&gt;
                              &amp;quot;&amp;quot;); &lt;br /&gt;
            }&lt;br /&gt;
            System.out.println(&amp;quot;Enforcing Authorization Rule \&amp;quot;&amp;quot; + key + &amp;quot;\&amp;quot; Using class: &amp;quot; + rule.getClass().getCanonicalName());&lt;br /&gt;
            isAuthorized = &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''rule'''&amp;lt;/span&amp;gt;.isAuthorized(runtimeParameter);&lt;br /&gt;
      } catch(Exception e) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;An unhandled Exception was &amp;quot; +&lt;br /&gt;
                        &amp;quot;caught, so we are recasting it as an &amp;quot; +&lt;br /&gt;
                        &amp;quot;AccessControlException.&amp;quot;, &lt;br /&gt;
                        &amp;quot;&amp;quot;,&lt;br /&gt;
                        e);&lt;br /&gt;
      }&lt;br /&gt;
      if(!isAuthorized) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;Access Denied for key: &amp;quot; + key +&lt;br /&gt;
                        &amp;quot; runtimeParameter: &amp;quot; + runtimeParameter, &amp;quot;&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ESAPI_Summit&amp;diff=55570</id>
		<title>ESAPI Summit</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ESAPI_Summit&amp;diff=55570"/>
				<updated>2009-02-26T21:01:17Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: /* Summit Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summit Overview ==&lt;br /&gt;
&lt;br /&gt;
The first OWASP ESAPI Summit was held December 9-11, 2008. It was hosted by Aspect Security in their Columbia, MD office.&lt;br /&gt;
&lt;br /&gt;
The following were the attendees of the Summit:&lt;br /&gt;
&lt;br /&gt;
*[[User:Jeff Williams|Jeff Williams]], Aspect Security - [[ESAPI|ESAPI Project Lead]]&lt;br /&gt;
*[[User:Wichers|Dave Wichers]], Aspect Security - [http://code.google.com/p/owasp-esapi-java/ ESAPI Java Committer]&lt;br /&gt;
*Ron Monzillo, Sun Microsystems - [http://java.sun.com/javaee/security/ Java EE Security Architect] &lt;br /&gt;
*[[User:Arshan|Arshan Dabirsiaghi]], Aspect Security - [[:Category:Intrinsic_Security_Working_Group|OWASP Intrisic Security Working Group Chair]]&lt;br /&gt;
*[[User:Jerryhoff|Jerry Hoff]], Aspect Security&lt;br /&gt;
*[[User:Mikehfauzy|Mike Fauzy]], Aspect Security&lt;br /&gt;
*[[User:Kevin.Fealey|Kevin Fealey]], Aspect Security - [[ESAPI Swingset|ESAPI Swingset Lead]]&lt;br /&gt;
*[[User:Jmanico|Jim Manico]], Aspect Security - [http://code.google.com/p/owasp-esapi-java/ ESAPI Java Committer]&lt;br /&gt;
*Steve Lavenhar, Booz Allen Hamilton&lt;br /&gt;
*Lian Jin, Booz Allen Hamilton&lt;br /&gt;
*John Steven, Cigital, Technical Director&lt;br /&gt;
*Joel Winstead, Cigital&lt;br /&gt;
*Alex Smolen, Foundstone - [[.NET ESAPI | ESAPI .NET Lead]]&lt;br /&gt;
*Andy Miller, Lockheed Martin&lt;br /&gt;
*John Munsch, Lockheed Martin&lt;br /&gt;
*Steve Christey, MITRE - [http://cve.mitre.org CVE]/[http://cwe.mitre.org CWE] Project Lead&lt;br /&gt;
&lt;br /&gt;
The following pages contain our thoughts/results from the summit.&lt;br /&gt;
&lt;br /&gt;
Summary: TODO&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [[ESAPI Charter]]&lt;br /&gt;
* [[ESAPI Roadmap]]&lt;br /&gt;
* [[ESAPI Adoption Strategy]]&lt;br /&gt;
* [[ESAPI Framework Strategy]]&lt;br /&gt;
* [[ESAPI Assurance]]&lt;br /&gt;
* [[ESAPI Documentation]]&lt;br /&gt;
* [[ESAPI Marketing]]&lt;br /&gt;
* [[ESAPI Tooling]]&lt;br /&gt;
* [[ESAPI Static Analysis Support]]&lt;br /&gt;
* [[ESAPI Performance]]&lt;br /&gt;
* [[ESAPI Internationalization]]&lt;br /&gt;
* [[ESAPI Installation]]&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
* [[ESAPI API]]&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
* [[ESAPI Validation]]&lt;br /&gt;
* [[ESAPI Canonicalization]]&lt;br /&gt;
* [[ESAPI Encoding]]&lt;br /&gt;
* [[ESAPI Authentication]]&lt;br /&gt;
* [[ESAPI Session Management]]&lt;br /&gt;
* [[ESAPI Access Control]]&lt;br /&gt;
* [[ESAPI Encryption]]&lt;br /&gt;
* [[ESAPI Randomizer]]&lt;br /&gt;
* [[ESAPI Error Handling]]&lt;br /&gt;
* [[ESAPI Logging]]&lt;br /&gt;
* [[ESAPI Intrusion Detection]]&lt;br /&gt;
* [[ESAPI HTTP Protection]]&lt;br /&gt;
* [[ESAPI Utilities]]&lt;br /&gt;
* [[ESAPI Filters]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
[[Category:OWASP Enterprise Security API]]&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ESAPI_Summit&amp;diff=55569</id>
		<title>ESAPI Summit</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ESAPI_Summit&amp;diff=55569"/>
				<updated>2009-02-26T21:00:12Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: Linked Mike Fauzy to his page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summit Overview ==&lt;br /&gt;
&lt;br /&gt;
The first OWASP ESAPI Summit was held December 9-11, 2008. It was hosted by Aspect Security in their Columbia, MD office.&lt;br /&gt;
&lt;br /&gt;
The following were the attendees of the Summit:&lt;br /&gt;
&lt;br /&gt;
*[[User:Jeff Williams|Jeff Williams]], Aspect Security - [[ESAPI|ESAPI Project Lead]]&lt;br /&gt;
*[[User:Wichers|Dave Wichers]], Aspect Security - [http://code.google.com/p/owasp-esapi-java/ ESAPI Java Committer]&lt;br /&gt;
*Ron Monzillo, Sun Microsystems - [http://java.sun.com/javaee/security/ Java EE Security Architect] &lt;br /&gt;
*[[User:Arshan|Arshan Dabirsiaghi]], Aspect Security - [[:Category:Intrinsic_Security_Working_Group|OWASP Intrisic Security Working Group Chair]]&lt;br /&gt;
*[[User:Jerryhoff|Jerry Hoff]], Aspect Security&lt;br /&gt;
*[[User:MikeHFauzy|Mike Fauzy]], Aspect Security&lt;br /&gt;
*[[User:Kevin.Fealey|Kevin Fealey]], Aspect Security - [[ESAPI Swingset|ESAPI Swingset Lead]]&lt;br /&gt;
*[[User:Jmanico|Jim Manico]], Aspect Security - [http://code.google.com/p/owasp-esapi-java/ ESAPI Java Committer]&lt;br /&gt;
*Steve Lavenhar, Booz Allen Hamilton&lt;br /&gt;
*Lian Jin, Booz Allen Hamilton&lt;br /&gt;
*John Steven, Cigital, Technical Director&lt;br /&gt;
*Joel Winstead, Cigital&lt;br /&gt;
*Alex Smolen, Foundstone - [[.NET ESAPI | ESAPI .NET Lead]]&lt;br /&gt;
*Andy Miller, Lockheed Martin&lt;br /&gt;
*John Munsch, Lockheed Martin&lt;br /&gt;
*Steve Christey, MITRE - [http://cve.mitre.org CVE]/[http://cwe.mitre.org CWE] Project Lead&lt;br /&gt;
&lt;br /&gt;
The following pages contain our thoughts/results from the summit.&lt;br /&gt;
&lt;br /&gt;
Summary: TODO&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [[ESAPI Charter]]&lt;br /&gt;
* [[ESAPI Roadmap]]&lt;br /&gt;
* [[ESAPI Adoption Strategy]]&lt;br /&gt;
* [[ESAPI Framework Strategy]]&lt;br /&gt;
* [[ESAPI Assurance]]&lt;br /&gt;
* [[ESAPI Documentation]]&lt;br /&gt;
* [[ESAPI Marketing]]&lt;br /&gt;
* [[ESAPI Tooling]]&lt;br /&gt;
* [[ESAPI Static Analysis Support]]&lt;br /&gt;
* [[ESAPI Performance]]&lt;br /&gt;
* [[ESAPI Internationalization]]&lt;br /&gt;
* [[ESAPI Installation]]&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
* [[ESAPI API]]&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
* [[ESAPI Validation]]&lt;br /&gt;
* [[ESAPI Canonicalization]]&lt;br /&gt;
* [[ESAPI Encoding]]&lt;br /&gt;
* [[ESAPI Authentication]]&lt;br /&gt;
* [[ESAPI Session Management]]&lt;br /&gt;
* [[ESAPI Access Control]]&lt;br /&gt;
* [[ESAPI Encryption]]&lt;br /&gt;
* [[ESAPI Randomizer]]&lt;br /&gt;
* [[ESAPI Error Handling]]&lt;br /&gt;
* [[ESAPI Logging]]&lt;br /&gt;
* [[ESAPI Intrusion Detection]]&lt;br /&gt;
* [[ESAPI HTTP Protection]]&lt;br /&gt;
* [[ESAPI Utilities]]&lt;br /&gt;
* [[ESAPI Filters]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
[[Category:OWASP Enterprise Security API]]&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ESAPI_Summit&amp;diff=55568</id>
		<title>ESAPI Summit</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ESAPI_Summit&amp;diff=55568"/>
				<updated>2009-02-26T20:59:49Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: Linked Mike Fauzy to his page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summit Overview ==&lt;br /&gt;
&lt;br /&gt;
The first OWASP ESAPI Summit was held December 9-11, 2008. It was hosted by Aspect Security in their Columbia, MD office.&lt;br /&gt;
&lt;br /&gt;
The following were the attendees of the Summit:&lt;br /&gt;
&lt;br /&gt;
*[[User:Jeff Williams|Jeff Williams]], Aspect Security - [[ESAPI|ESAPI Project Lead]]&lt;br /&gt;
*[[User:Wichers|Dave Wichers]], Aspect Security - [http://code.google.com/p/owasp-esapi-java/ ESAPI Java Committer]&lt;br /&gt;
*Ron Monzillo, Sun Microsystems - [http://java.sun.com/javaee/security/ Java EE Security Architect] &lt;br /&gt;
*[[User:Arshan|Arshan Dabirsiaghi]], Aspect Security - [[:Category:Intrinsic_Security_Working_Group|OWASP Intrisic Security Working Group Chair]]&lt;br /&gt;
*[[User:Jerryhoff|Jerry Hoff]], Aspect Security&lt;br /&gt;
*[[User:MikeHFauzy|Mike Fauzy, Aspect Security&lt;br /&gt;
*[[User:Kevin.Fealey|Kevin Fealey]], Aspect Security - [[ESAPI Swingset|ESAPI Swingset Lead]]&lt;br /&gt;
*[[User:Jmanico|Jim Manico]], Aspect Security - [http://code.google.com/p/owasp-esapi-java/ ESAPI Java Committer]&lt;br /&gt;
*Steve Lavenhar, Booz Allen Hamilton&lt;br /&gt;
*Lian Jin, Booz Allen Hamilton&lt;br /&gt;
*John Steven, Cigital, Technical Director&lt;br /&gt;
*Joel Winstead, Cigital&lt;br /&gt;
*Alex Smolen, Foundstone - [[.NET ESAPI | ESAPI .NET Lead]]&lt;br /&gt;
*Andy Miller, Lockheed Martin&lt;br /&gt;
*John Munsch, Lockheed Martin&lt;br /&gt;
*Steve Christey, MITRE - [http://cve.mitre.org CVE]/[http://cwe.mitre.org CWE] Project Lead&lt;br /&gt;
&lt;br /&gt;
The following pages contain our thoughts/results from the summit.&lt;br /&gt;
&lt;br /&gt;
Summary: TODO&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
* [[ESAPI Charter]]&lt;br /&gt;
* [[ESAPI Roadmap]]&lt;br /&gt;
* [[ESAPI Adoption Strategy]]&lt;br /&gt;
* [[ESAPI Framework Strategy]]&lt;br /&gt;
* [[ESAPI Assurance]]&lt;br /&gt;
* [[ESAPI Documentation]]&lt;br /&gt;
* [[ESAPI Marketing]]&lt;br /&gt;
* [[ESAPI Tooling]]&lt;br /&gt;
* [[ESAPI Static Analysis Support]]&lt;br /&gt;
* [[ESAPI Performance]]&lt;br /&gt;
* [[ESAPI Internationalization]]&lt;br /&gt;
* [[ESAPI Installation]]&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
* [[ESAPI API]]&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
* [[ESAPI Validation]]&lt;br /&gt;
* [[ESAPI Canonicalization]]&lt;br /&gt;
* [[ESAPI Encoding]]&lt;br /&gt;
* [[ESAPI Authentication]]&lt;br /&gt;
* [[ESAPI Session Management]]&lt;br /&gt;
* [[ESAPI Access Control]]&lt;br /&gt;
* [[ESAPI Encryption]]&lt;br /&gt;
* [[ESAPI Randomizer]]&lt;br /&gt;
* [[ESAPI Error Handling]]&lt;br /&gt;
* [[ESAPI Logging]]&lt;br /&gt;
* [[ESAPI Intrusion Detection]]&lt;br /&gt;
* [[ESAPI HTTP Protection]]&lt;br /&gt;
* [[ESAPI Utilities]]&lt;br /&gt;
* [[ESAPI Filters]]&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
[[Category:OWASP Enterprise Security API]]&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55567</id>
		<title>ESAPI Access Control</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55567"/>
				<updated>2009-02-26T20:53:01Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: /* ACR: Access Control Matrix */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Access Control 2.0=&lt;br /&gt;
At the ESAPI summit, we discussed changing Access Control 2.0 to use the command pattern. The following are the current design goals for Access Control 2.0. Enough proof of concept development has been completed for me to believe that these goals are achievable. I’d appreciate your input as to whether they are both desirable and sufficient. Below the goals are the answers to outstanding questions, the sequence of execution and some code snippets to give a better feel for the current direction. Feedback is welcome. I’m happy to make changes.&amp;lt;br&amp;gt;&lt;br /&gt;
==Current Design Goals:==&lt;br /&gt;
# Allow developers to implement access control rules (ACR) using arbitrary java code.&lt;br /&gt;
#:Benefit: Allowing arbitrary java code gives ACR developers as much flexibility to write ACRs as they do throughout the normal code base. &lt;br /&gt;
# Facilitate integration with frameworks to enforce ACRs automatically and default to deny access.&lt;br /&gt;
#:Benefit: Automatically making the call reduces developer error, because both the call will be made correctly and the developer is forced to provide the security check. &lt;br /&gt;
# Allow developers to call ACRs for evaluation or enforcement manually.&lt;br /&gt;
#:Benefit: Allowing manual calls for both uses increases flexibility and facilitates reuse for access control and flow control.&lt;br /&gt;
# Allow ACRs to make decisions based on arbitrary runtime parameters and deployment parameters.&lt;br /&gt;
#:Benefit: The policy file stores deployment parameters. Accepting an arbitrary runtime parameter allows stateless ACRs, which decreases object creation costs.&lt;br /&gt;
==Proposed Additional Design Goals==&lt;br /&gt;
The following were not in the original set of goals, but I would like us to consider whether they should be included:&lt;br /&gt;
# Keep the Access Control Matrix (ACM) synchronized throughout the SDLC by making the ACM specification drive the integration framework that calls the ACRs.&lt;br /&gt;
#:Benefit: Understanding of permissions is clearer and more accurate throughout requirements and test phases. &lt;br /&gt;
# Allow resource names to be grouped and ensure that ACR selection is deterministic.&lt;br /&gt;
#:Benefit: Grouping similar resources makes the ACM clearer and easier to manage.&lt;br /&gt;
# Integration with Struts 2, Struts 1, JSR 115, Spring ?.?, JBoss Seam, JBossAop, Aspect J. I’m currently using the Struts2Spring2JtaJpa quickstart for the integration tests.  &lt;br /&gt;
==Outstanding Questions from the ESAPI Summit and their Answers:==&lt;br /&gt;
'''Question''': Can the runtimeParameter AccessController.isAuthorized(“Resource”, runtimeParameter) be strongly typed in the ACR definition class? &amp;lt;br&amp;gt;&lt;br /&gt;
'''Answer''': Yes. Java versions 1.5 and above can leverage Generics. Commands written for 1.4 and below will need to use Object as parameters and then cast appropriately. The current version of Access Control 2.0 is written without generics for backwards compatibility, but I plan to add generics compatible version.&lt;br /&gt;
&lt;br /&gt;
==Sequence:==&lt;br /&gt;
IntegrationComponent -&amp;gt; AccessController -&amp;gt; ACR -&amp;gt; Access is granted or an AccessControlException is thrown.&lt;br /&gt;
# When the system starts, the ACM is read and resources are linked to an ACR.  &lt;br /&gt;
# The IntegrationComponent (e.g. a Struts2 Interceptor) calls AccessController.enforceAuthorization(key, runtimeParameter).&lt;br /&gt;
# AccessController maps the key to an ACR and passes it the runtime parameters and static policy file parameters.&lt;br /&gt;
# The ACR executes Java code to evaluate an arbitrarily complex rule set. Note that an ACR could evaluate unusually complex role requirements by assigning it to all roles for a given resource. Also note that ACRs can delegate to other ACRs or even a rules engine.&lt;br /&gt;
==Code Samples:==&lt;br /&gt;
What follows is a partial strawman implementation from some proof of concept code that I’ve been working on. Code has been removed to help focus on the critical path. I’d appreciate any feedback and I’m looking especially interested in feedback on usability from a developer’s point of view. Would this help you to implement Access Control for large projects? What can I do to make it safer and easier for developers? &lt;br /&gt;
To help illustrate the mappings, I’ve used &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''bold red'''&amp;lt;/span&amp;gt; to represent the resource identifier and &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''bold green''&amp;lt;/span&amp;gt; to represent the ACR throughout the files. Only the first 3 files (ACM, Policy file and ACR) are implemented by the developer. The rest are provided by the AccessController infrastructure. &lt;br /&gt;
===ACM: Access Control Matrix===&lt;br /&gt;
This table is (roughly) what the Access Control Matrix looks like. It would probably be a .csv file or database file and would have options to group resources using regular expressions, String.startsWith, etc. The ACM and Policy File (below) combine to define which ACR is executed by AccessController. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!         !!Role1!!Role2!!Role3&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''Resource1'''&amp;lt;/span&amp;gt;||Deny ||Grant||&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''SpecialCaseAccessControlRule'''&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Resource2||Grant||Deny	||Deny&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Policy File===&lt;br /&gt;
This xml file is (roughly) what the ACR definitions would look like. It handles what would normally be “footnotes” in an ACM requirements specification document. The name correlates to an ACM cell. The AccessControlRule.class specifies the Java code that will execute. The parameters are passed to the ACR at runtime. Note that this shows the default name-value pair parameter loader, but other parameter loaders (not shown) can be specified. An enhancement would be to allow ACRs to be tagged using annotations so that the Policy file isn't required.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;AccessControlPolicy&amp;gt;&lt;br /&gt;
      &amp;lt;AccessControlRules&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would not implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Grant&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always granted&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysTrueACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Deny&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always denied&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysFalseACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''SpecialCaseAccessControlRule'''&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access depends on the value of the policy parameter: isTrue&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.policy.&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''EchoDynaBeanPolicyParameterACR'''&amp;lt;/span&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;Parameters&amp;gt;&lt;br /&gt;
                        &amp;lt;Parameter name=&amp;quot;isTrue&amp;quot; type=&amp;quot;Boolean&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
                  &amp;lt;/Parameters&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
      &amp;lt;/AccessControlRules&amp;gt;&lt;br /&gt;
 &amp;lt;/AccessControlPolicy&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ACR: Access Control Rule===&lt;br /&gt;
The following class is (roughly) what a simple ACR could look like. Note that the runtimeParameter can leverage generics for type safety. Developers would implement this.&lt;br /&gt;
&lt;br /&gt;
 public class &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''EchoDynaBeanPolicyParameterACR'''&amp;lt;/span&amp;gt; extends DynaBeanPolicyBaseACR {&lt;br /&gt;
      /**&lt;br /&gt;
       * @return true iff policyParameter isTrue is a Boolean set to true.&lt;br /&gt;
       * throws ClassCastException if runtimeParameter is not a Boolean.&lt;br /&gt;
       */&lt;br /&gt;
      public boolean isAuthorized(Object runtimeParameter) throws ClassCastException{           &lt;br /&gt;
            return getPolicyParameters().getBoolean(&amp;quot;isTrue&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===IntegrationComponent===&lt;br /&gt;
This class is (roughly) what a framework integration using a Struts2 interceptor would look like. This is part of the framework, developers don’t implement this. However, if a developer wants to execute an ACR, they can do so as demonstrated in the intercept method.&lt;br /&gt;
&lt;br /&gt;
 public class AccessControlEnforcementInterceptor extends AbstractInterceptor {&lt;br /&gt;
    public String intercept(ActionInvocation invocation) throws Exception {&lt;br /&gt;
          ESAPI.accessController().enforceAuthorization(&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''invocation.getAction()'''&amp;lt;/span&amp;gt;, //assume that getAction() returns “Resource1”&lt;br /&gt;
                  invocation.getInvocationContext()); //Note that this line may change to facilitate &lt;br /&gt;
                                                      //mappings between Framework Integrations and multi-purpose ACRs&lt;br /&gt;
       return invocation.invoke();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===AccessController===&lt;br /&gt;
This class is (roughly) what the enforceAuthorization method in AccessController could look like. The key is the resource. In our example “Resource1.” This method will need to be enhanced to handle resource groups. This is part of the framework, developers don’t implement this. This doesn’t currently take the user’s role into account, but could.&lt;br /&gt;
&lt;br /&gt;
 public void enforceAuthorization(Object &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''key'''&amp;lt;/span&amp;gt;, Object runtimeParameter)&lt;br /&gt;
      throws org.owasp.esapi.errors.AccessControlException {&lt;br /&gt;
      boolean isAuthorized = false;&lt;br /&gt;
      try {&lt;br /&gt;
            AccessControlRule &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''rule'''&amp;lt;/span&amp;gt; = (AccessControlRule)ruleMap.get(&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''key'''&amp;lt;/span&amp;gt;);&lt;br /&gt;
            if(rule == null) {&lt;br /&gt;
                  throw new AccessControlException(&lt;br /&gt;
                              &amp;quot;AccessControlRule was not found for key: &amp;quot; + key,&lt;br /&gt;
                              &amp;quot;&amp;quot;); &lt;br /&gt;
            }&lt;br /&gt;
            System.out.println(&amp;quot;Enforcing Authorization Rule \&amp;quot;&amp;quot; + key + &amp;quot;\&amp;quot; Using class: &amp;quot; + rule.getClass().getCanonicalName());&lt;br /&gt;
            isAuthorized = &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''rule'''&amp;lt;/span&amp;gt;.isAuthorized(runtimeParameter);&lt;br /&gt;
      } catch(Exception e) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;An unhandled Exception was &amp;quot; +&lt;br /&gt;
                        &amp;quot;caught, so we are recasting it as an &amp;quot; +&lt;br /&gt;
                        &amp;quot;AccessControlException.&amp;quot;, &lt;br /&gt;
                        &amp;quot;&amp;quot;,&lt;br /&gt;
                        e);&lt;br /&gt;
      }&lt;br /&gt;
      if(!isAuthorized) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;Access Denied for key: &amp;quot; + key +&lt;br /&gt;
                        &amp;quot; runtimeParameter: &amp;quot; + runtimeParameter, &amp;quot;&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55566</id>
		<title>ESAPI Access Control</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55566"/>
				<updated>2009-02-26T20:52:35Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: /* ACM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Access Control 2.0=&lt;br /&gt;
At the ESAPI summit, we discussed changing Access Control 2.0 to use the command pattern. The following are the current design goals for Access Control 2.0. Enough proof of concept development has been completed for me to believe that these goals are achievable. I’d appreciate your input as to whether they are both desirable and sufficient. Below the goals are the answers to outstanding questions, the sequence of execution and some code snippets to give a better feel for the current direction. Feedback is welcome. I’m happy to make changes.&amp;lt;br&amp;gt;&lt;br /&gt;
==Current Design Goals:==&lt;br /&gt;
# Allow developers to implement access control rules (ACR) using arbitrary java code.&lt;br /&gt;
#:Benefit: Allowing arbitrary java code gives ACR developers as much flexibility to write ACRs as they do throughout the normal code base. &lt;br /&gt;
# Facilitate integration with frameworks to enforce ACRs automatically and default to deny access.&lt;br /&gt;
#:Benefit: Automatically making the call reduces developer error, because both the call will be made correctly and the developer is forced to provide the security check. &lt;br /&gt;
# Allow developers to call ACRs for evaluation or enforcement manually.&lt;br /&gt;
#:Benefit: Allowing manual calls for both uses increases flexibility and facilitates reuse for access control and flow control.&lt;br /&gt;
# Allow ACRs to make decisions based on arbitrary runtime parameters and deployment parameters.&lt;br /&gt;
#:Benefit: The policy file stores deployment parameters. Accepting an arbitrary runtime parameter allows stateless ACRs, which decreases object creation costs.&lt;br /&gt;
==Proposed Additional Design Goals==&lt;br /&gt;
The following were not in the original set of goals, but I would like us to consider whether they should be included:&lt;br /&gt;
# Keep the Access Control Matrix (ACM) synchronized throughout the SDLC by making the ACM specification drive the integration framework that calls the ACRs.&lt;br /&gt;
#:Benefit: Understanding of permissions is clearer and more accurate throughout requirements and test phases. &lt;br /&gt;
# Allow resource names to be grouped and ensure that ACR selection is deterministic.&lt;br /&gt;
#:Benefit: Grouping similar resources makes the ACM clearer and easier to manage.&lt;br /&gt;
# Integration with Struts 2, Struts 1, JSR 115, Spring ?.?, JBoss Seam, JBossAop, Aspect J. I’m currently using the Struts2Spring2JtaJpa quickstart for the integration tests.  &lt;br /&gt;
==Outstanding Questions from the ESAPI Summit and their Answers:==&lt;br /&gt;
'''Question''': Can the runtimeParameter AccessController.isAuthorized(“Resource”, runtimeParameter) be strongly typed in the ACR definition class? &amp;lt;br&amp;gt;&lt;br /&gt;
'''Answer''': Yes. Java versions 1.5 and above can leverage Generics. Commands written for 1.4 and below will need to use Object as parameters and then cast appropriately. The current version of Access Control 2.0 is written without generics for backwards compatibility, but I plan to add generics compatible version.&lt;br /&gt;
&lt;br /&gt;
==Sequence:==&lt;br /&gt;
IntegrationComponent -&amp;gt; AccessController -&amp;gt; ACR -&amp;gt; Access is granted or an AccessControlException is thrown.&lt;br /&gt;
# When the system starts, the ACM is read and resources are linked to an ACR.  &lt;br /&gt;
# The IntegrationComponent (e.g. a Struts2 Interceptor) calls AccessController.enforceAuthorization(key, runtimeParameter).&lt;br /&gt;
# AccessController maps the key to an ACR and passes it the runtime parameters and static policy file parameters.&lt;br /&gt;
# The ACR executes Java code to evaluate an arbitrarily complex rule set. Note that an ACR could evaluate unusually complex role requirements by assigning it to all roles for a given resource. Also note that ACRs can delegate to other ACRs or even a rules engine.&lt;br /&gt;
==Code Samples:==&lt;br /&gt;
What follows is a partial strawman implementation from some proof of concept code that I’ve been working on. Code has been removed to help focus on the critical path. I’d appreciate any feedback and I’m looking especially interested in feedback on usability from a developer’s point of view. Would this help you to implement Access Control for large projects? What can I do to make it safer and easier for developers? &lt;br /&gt;
To help illustrate the mappings, I’ve used &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''bold red'''&amp;lt;/span&amp;gt; to represent the resource identifier and &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''bold green''&amp;lt;/span&amp;gt; to represent the ACR throughout the files. Only the first 3 files (ACM, Policy file and ACR) are implemented by the developer. The rest are provided by the AccessController infrastructure. &lt;br /&gt;
===ACM: Access Control Matrix===&lt;br /&gt;
This table is (roughly) what the Access Control Matrix looks like. It would probably be a .csv file or database file and would have options to group resources using regular expressions, String.startsWith, etc. The ACM and Policy File (below) combine to define which ACR is executed by AccessController. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!         !!Role1!!Role2!!Role3&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''Resource1'''&amp;lt;/span&amp;gt;||Deny ||Grant||&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''SpecialCaseAccessControlRule'''&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Resource2||Grant||Deny	||Deny&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Policy File===&lt;br /&gt;
This xml file is (roughly) what the ACR definitions would look like. It handles what would normally be “footnotes” in an ACM requirements specification document. The name correlates to an ACM cell. The AccessControlRule.class specifies the Java code that will execute. The parameters are passed to the ACR at runtime. Note that this shows the default name-value pair parameter loader, but other parameter loaders (not shown) can be specified. An enhancement would be to allow ACRs to be tagged using annotations so that the Policy file isn't required.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;AccessControlPolicy&amp;gt;&lt;br /&gt;
      &amp;lt;AccessControlRules&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would not implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Grant&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always granted&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysTrueACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Deny&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always denied&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysFalseACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''SpecialCaseAccessControlRule'''&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access depends on the value of the policy parameter: isTrue&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.policy.&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''EchoDynaBeanPolicyParameterACR'''&amp;lt;/span&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;Parameters&amp;gt;&lt;br /&gt;
                        &amp;lt;Parameter name=&amp;quot;isTrue&amp;quot; type=&amp;quot;Boolean&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
                  &amp;lt;/Parameters&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
      &amp;lt;/AccessControlRules&amp;gt;&lt;br /&gt;
 &amp;lt;/AccessControlPolicy&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ACR: Access Control Matrix===&lt;br /&gt;
The following class is (roughly) what a simple ACR could look like. Note that the runtimeParameter can leverage generics for type safety. Developers would implement this.&lt;br /&gt;
&lt;br /&gt;
 public class &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''EchoDynaBeanPolicyParameterACR'''&amp;lt;/span&amp;gt; extends DynaBeanPolicyBaseACR {&lt;br /&gt;
      /**&lt;br /&gt;
       * @return true iff policyParameter isTrue is a Boolean set to true.&lt;br /&gt;
       * throws ClassCastException if runtimeParameter is not a Boolean.&lt;br /&gt;
       */&lt;br /&gt;
      public boolean isAuthorized(Object runtimeParameter) throws ClassCastException{           &lt;br /&gt;
            return getPolicyParameters().getBoolean(&amp;quot;isTrue&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===IntegrationComponent===&lt;br /&gt;
This class is (roughly) what a framework integration using a Struts2 interceptor would look like. This is part of the framework, developers don’t implement this. However, if a developer wants to execute an ACR, they can do so as demonstrated in the intercept method.&lt;br /&gt;
&lt;br /&gt;
 public class AccessControlEnforcementInterceptor extends AbstractInterceptor {&lt;br /&gt;
    public String intercept(ActionInvocation invocation) throws Exception {&lt;br /&gt;
          ESAPI.accessController().enforceAuthorization(&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''invocation.getAction()'''&amp;lt;/span&amp;gt;, //assume that getAction() returns “Resource1”&lt;br /&gt;
                  invocation.getInvocationContext()); //Note that this line may change to facilitate &lt;br /&gt;
                                                      //mappings between Framework Integrations and multi-purpose ACRs&lt;br /&gt;
       return invocation.invoke();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===AccessController===&lt;br /&gt;
This class is (roughly) what the enforceAuthorization method in AccessController could look like. The key is the resource. In our example “Resource1.” This method will need to be enhanced to handle resource groups. This is part of the framework, developers don’t implement this. This doesn’t currently take the user’s role into account, but could.&lt;br /&gt;
&lt;br /&gt;
 public void enforceAuthorization(Object &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''key'''&amp;lt;/span&amp;gt;, Object runtimeParameter)&lt;br /&gt;
      throws org.owasp.esapi.errors.AccessControlException {&lt;br /&gt;
      boolean isAuthorized = false;&lt;br /&gt;
      try {&lt;br /&gt;
            AccessControlRule &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''rule'''&amp;lt;/span&amp;gt; = (AccessControlRule)ruleMap.get(&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''key'''&amp;lt;/span&amp;gt;);&lt;br /&gt;
            if(rule == null) {&lt;br /&gt;
                  throw new AccessControlException(&lt;br /&gt;
                              &amp;quot;AccessControlRule was not found for key: &amp;quot; + key,&lt;br /&gt;
                              &amp;quot;&amp;quot;); &lt;br /&gt;
            }&lt;br /&gt;
            System.out.println(&amp;quot;Enforcing Authorization Rule \&amp;quot;&amp;quot; + key + &amp;quot;\&amp;quot; Using class: &amp;quot; + rule.getClass().getCanonicalName());&lt;br /&gt;
            isAuthorized = &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''rule'''&amp;lt;/span&amp;gt;.isAuthorized(runtimeParameter);&lt;br /&gt;
      } catch(Exception e) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;An unhandled Exception was &amp;quot; +&lt;br /&gt;
                        &amp;quot;caught, so we are recasting it as an &amp;quot; +&lt;br /&gt;
                        &amp;quot;AccessControlException.&amp;quot;, &lt;br /&gt;
                        &amp;quot;&amp;quot;,&lt;br /&gt;
                        e);&lt;br /&gt;
      }&lt;br /&gt;
      if(!isAuthorized) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;Access Denied for key: &amp;quot; + key +&lt;br /&gt;
                        &amp;quot; runtimeParameter: &amp;quot; + runtimeParameter, &amp;quot;&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55565</id>
		<title>ESAPI Access Control</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55565"/>
				<updated>2009-02-26T20:51:46Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: /* ACR */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Access Control 2.0=&lt;br /&gt;
At the ESAPI summit, we discussed changing Access Control 2.0 to use the command pattern. The following are the current design goals for Access Control 2.0. Enough proof of concept development has been completed for me to believe that these goals are achievable. I’d appreciate your input as to whether they are both desirable and sufficient. Below the goals are the answers to outstanding questions, the sequence of execution and some code snippets to give a better feel for the current direction. Feedback is welcome. I’m happy to make changes.&amp;lt;br&amp;gt;&lt;br /&gt;
==Current Design Goals:==&lt;br /&gt;
# Allow developers to implement access control rules (ACR) using arbitrary java code.&lt;br /&gt;
#:Benefit: Allowing arbitrary java code gives ACR developers as much flexibility to write ACRs as they do throughout the normal code base. &lt;br /&gt;
# Facilitate integration with frameworks to enforce ACRs automatically and default to deny access.&lt;br /&gt;
#:Benefit: Automatically making the call reduces developer error, because both the call will be made correctly and the developer is forced to provide the security check. &lt;br /&gt;
# Allow developers to call ACRs for evaluation or enforcement manually.&lt;br /&gt;
#:Benefit: Allowing manual calls for both uses increases flexibility and facilitates reuse for access control and flow control.&lt;br /&gt;
# Allow ACRs to make decisions based on arbitrary runtime parameters and deployment parameters.&lt;br /&gt;
#:Benefit: The policy file stores deployment parameters. Accepting an arbitrary runtime parameter allows stateless ACRs, which decreases object creation costs.&lt;br /&gt;
==Proposed Additional Design Goals==&lt;br /&gt;
The following were not in the original set of goals, but I would like us to consider whether they should be included:&lt;br /&gt;
# Keep the Access Control Matrix (ACM) synchronized throughout the SDLC by making the ACM specification drive the integration framework that calls the ACRs.&lt;br /&gt;
#:Benefit: Understanding of permissions is clearer and more accurate throughout requirements and test phases. &lt;br /&gt;
# Allow resource names to be grouped and ensure that ACR selection is deterministic.&lt;br /&gt;
#:Benefit: Grouping similar resources makes the ACM clearer and easier to manage.&lt;br /&gt;
# Integration with Struts 2, Struts 1, JSR 115, Spring ?.?, JBoss Seam, JBossAop, Aspect J. I’m currently using the Struts2Spring2JtaJpa quickstart for the integration tests.  &lt;br /&gt;
==Outstanding Questions from the ESAPI Summit and their Answers:==&lt;br /&gt;
'''Question''': Can the runtimeParameter AccessController.isAuthorized(“Resource”, runtimeParameter) be strongly typed in the ACR definition class? &amp;lt;br&amp;gt;&lt;br /&gt;
'''Answer''': Yes. Java versions 1.5 and above can leverage Generics. Commands written for 1.4 and below will need to use Object as parameters and then cast appropriately. The current version of Access Control 2.0 is written without generics for backwards compatibility, but I plan to add generics compatible version.&lt;br /&gt;
&lt;br /&gt;
==Sequence:==&lt;br /&gt;
IntegrationComponent -&amp;gt; AccessController -&amp;gt; ACR -&amp;gt; Access is granted or an AccessControlException is thrown.&lt;br /&gt;
# When the system starts, the ACM is read and resources are linked to an ACR.  &lt;br /&gt;
# The IntegrationComponent (e.g. a Struts2 Interceptor) calls AccessController.enforceAuthorization(key, runtimeParameter).&lt;br /&gt;
# AccessController maps the key to an ACR and passes it the runtime parameters and static policy file parameters.&lt;br /&gt;
# The ACR executes Java code to evaluate an arbitrarily complex rule set. Note that an ACR could evaluate unusually complex role requirements by assigning it to all roles for a given resource. Also note that ACRs can delegate to other ACRs or even a rules engine.&lt;br /&gt;
==Code Samples:==&lt;br /&gt;
What follows is a partial strawman implementation from some proof of concept code that I’ve been working on. Code has been removed to help focus on the critical path. I’d appreciate any feedback and I’m looking especially interested in feedback on usability from a developer’s point of view. Would this help you to implement Access Control for large projects? What can I do to make it safer and easier for developers? &lt;br /&gt;
To help illustrate the mappings, I’ve used &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''bold red'''&amp;lt;/span&amp;gt; to represent the resource identifier and &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''bold green''&amp;lt;/span&amp;gt; to represent the ACR throughout the files. Only the first 3 files (ACM, Policy file and ACR) are implemented by the developer. The rest are provided by the AccessController infrastructure. &lt;br /&gt;
===ACM===&lt;br /&gt;
This table is (roughly) what the Access Control Matrix looks like. It would probably be a .csv file or database file and would have options to group resources using regular expressions, String.startsWith, etc. The ACM and Policy File (below) combine to define which ACR is executed by AccessController. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!         !!Role1!!Role2!!Role3&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''Resource1'''&amp;lt;/span&amp;gt;||Deny ||Grant||&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''SpecialCaseAccessControlRule'''&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Resource2||Grant||Deny	||Deny&lt;br /&gt;
|}&lt;br /&gt;
===Policy File===&lt;br /&gt;
This xml file is (roughly) what the ACR definitions would look like. It handles what would normally be “footnotes” in an ACM requirements specification document. The name correlates to an ACM cell. The AccessControlRule.class specifies the Java code that will execute. The parameters are passed to the ACR at runtime. Note that this shows the default name-value pair parameter loader, but other parameter loaders (not shown) can be specified. An enhancement would be to allow ACRs to be tagged using annotations so that the Policy file isn't required.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;AccessControlPolicy&amp;gt;&lt;br /&gt;
      &amp;lt;AccessControlRules&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would not implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Grant&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always granted&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysTrueACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Deny&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always denied&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysFalseACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''SpecialCaseAccessControlRule'''&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access depends on the value of the policy parameter: isTrue&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.policy.&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''EchoDynaBeanPolicyParameterACR'''&amp;lt;/span&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;Parameters&amp;gt;&lt;br /&gt;
                        &amp;lt;Parameter name=&amp;quot;isTrue&amp;quot; type=&amp;quot;Boolean&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
                  &amp;lt;/Parameters&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
      &amp;lt;/AccessControlRules&amp;gt;&lt;br /&gt;
 &amp;lt;/AccessControlPolicy&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ACR: Access Control Matrix===&lt;br /&gt;
The following class is (roughly) what a simple ACR could look like. Note that the runtimeParameter can leverage generics for type safety. Developers would implement this.&lt;br /&gt;
&lt;br /&gt;
 public class &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''EchoDynaBeanPolicyParameterACR'''&amp;lt;/span&amp;gt; extends DynaBeanPolicyBaseACR {&lt;br /&gt;
      /**&lt;br /&gt;
       * @return true iff policyParameter isTrue is a Boolean set to true.&lt;br /&gt;
       * throws ClassCastException if runtimeParameter is not a Boolean.&lt;br /&gt;
       */&lt;br /&gt;
      public boolean isAuthorized(Object runtimeParameter) throws ClassCastException{           &lt;br /&gt;
            return getPolicyParameters().getBoolean(&amp;quot;isTrue&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===IntegrationComponent===&lt;br /&gt;
This class is (roughly) what a framework integration using a Struts2 interceptor would look like. This is part of the framework, developers don’t implement this. However, if a developer wants to execute an ACR, they can do so as demonstrated in the intercept method.&lt;br /&gt;
&lt;br /&gt;
 public class AccessControlEnforcementInterceptor extends AbstractInterceptor {&lt;br /&gt;
    public String intercept(ActionInvocation invocation) throws Exception {&lt;br /&gt;
          ESAPI.accessController().enforceAuthorization(&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''invocation.getAction()'''&amp;lt;/span&amp;gt;, //assume that getAction() returns “Resource1”&lt;br /&gt;
                  invocation.getInvocationContext()); //Note that this line may change to facilitate &lt;br /&gt;
                                                      //mappings between Framework Integrations and multi-purpose ACRs&lt;br /&gt;
       return invocation.invoke();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===AccessController===&lt;br /&gt;
This class is (roughly) what the enforceAuthorization method in AccessController could look like. The key is the resource. In our example “Resource1.” This method will need to be enhanced to handle resource groups. This is part of the framework, developers don’t implement this. This doesn’t currently take the user’s role into account, but could.&lt;br /&gt;
&lt;br /&gt;
 public void enforceAuthorization(Object &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''key'''&amp;lt;/span&amp;gt;, Object runtimeParameter)&lt;br /&gt;
      throws org.owasp.esapi.errors.AccessControlException {&lt;br /&gt;
      boolean isAuthorized = false;&lt;br /&gt;
      try {&lt;br /&gt;
            AccessControlRule &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''rule'''&amp;lt;/span&amp;gt; = (AccessControlRule)ruleMap.get(&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''key'''&amp;lt;/span&amp;gt;);&lt;br /&gt;
            if(rule == null) {&lt;br /&gt;
                  throw new AccessControlException(&lt;br /&gt;
                              &amp;quot;AccessControlRule was not found for key: &amp;quot; + key,&lt;br /&gt;
                              &amp;quot;&amp;quot;); &lt;br /&gt;
            }&lt;br /&gt;
            System.out.println(&amp;quot;Enforcing Authorization Rule \&amp;quot;&amp;quot; + key + &amp;quot;\&amp;quot; Using class: &amp;quot; + rule.getClass().getCanonicalName());&lt;br /&gt;
            isAuthorized = &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''rule'''&amp;lt;/span&amp;gt;.isAuthorized(runtimeParameter);&lt;br /&gt;
      } catch(Exception e) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;An unhandled Exception was &amp;quot; +&lt;br /&gt;
                        &amp;quot;caught, so we are recasting it as an &amp;quot; +&lt;br /&gt;
                        &amp;quot;AccessControlException.&amp;quot;, &lt;br /&gt;
                        &amp;quot;&amp;quot;,&lt;br /&gt;
                        e);&lt;br /&gt;
      }&lt;br /&gt;
      if(!isAuthorized) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;Access Denied for key: &amp;quot; + key +&lt;br /&gt;
                        &amp;quot; runtimeParameter: &amp;quot; + runtimeParameter, &amp;quot;&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55564</id>
		<title>ESAPI Access Control</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55564"/>
				<updated>2009-02-26T20:50:29Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: /* Policy File */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Access Control 2.0=&lt;br /&gt;
At the ESAPI summit, we discussed changing Access Control 2.0 to use the command pattern. The following are the current design goals for Access Control 2.0. Enough proof of concept development has been completed for me to believe that these goals are achievable. I’d appreciate your input as to whether they are both desirable and sufficient. Below the goals are the answers to outstanding questions, the sequence of execution and some code snippets to give a better feel for the current direction. Feedback is welcome. I’m happy to make changes.&amp;lt;br&amp;gt;&lt;br /&gt;
==Current Design Goals:==&lt;br /&gt;
# Allow developers to implement access control rules (ACR) using arbitrary java code.&lt;br /&gt;
#:Benefit: Allowing arbitrary java code gives ACR developers as much flexibility to write ACRs as they do throughout the normal code base. &lt;br /&gt;
# Facilitate integration with frameworks to enforce ACRs automatically and default to deny access.&lt;br /&gt;
#:Benefit: Automatically making the call reduces developer error, because both the call will be made correctly and the developer is forced to provide the security check. &lt;br /&gt;
# Allow developers to call ACRs for evaluation or enforcement manually.&lt;br /&gt;
#:Benefit: Allowing manual calls for both uses increases flexibility and facilitates reuse for access control and flow control.&lt;br /&gt;
# Allow ACRs to make decisions based on arbitrary runtime parameters and deployment parameters.&lt;br /&gt;
#:Benefit: The policy file stores deployment parameters. Accepting an arbitrary runtime parameter allows stateless ACRs, which decreases object creation costs.&lt;br /&gt;
==Proposed Additional Design Goals==&lt;br /&gt;
The following were not in the original set of goals, but I would like us to consider whether they should be included:&lt;br /&gt;
# Keep the Access Control Matrix (ACM) synchronized throughout the SDLC by making the ACM specification drive the integration framework that calls the ACRs.&lt;br /&gt;
#:Benefit: Understanding of permissions is clearer and more accurate throughout requirements and test phases. &lt;br /&gt;
# Allow resource names to be grouped and ensure that ACR selection is deterministic.&lt;br /&gt;
#:Benefit: Grouping similar resources makes the ACM clearer and easier to manage.&lt;br /&gt;
# Integration with Struts 2, Struts 1, JSR 115, Spring ?.?, JBoss Seam, JBossAop, Aspect J. I’m currently using the Struts2Spring2JtaJpa quickstart for the integration tests.  &lt;br /&gt;
==Outstanding Questions from the ESAPI Summit and their Answers:==&lt;br /&gt;
'''Question''': Can the runtimeParameter AccessController.isAuthorized(“Resource”, runtimeParameter) be strongly typed in the ACR definition class? &amp;lt;br&amp;gt;&lt;br /&gt;
'''Answer''': Yes. Java versions 1.5 and above can leverage Generics. Commands written for 1.4 and below will need to use Object as parameters and then cast appropriately. The current version of Access Control 2.0 is written without generics for backwards compatibility, but I plan to add generics compatible version.&lt;br /&gt;
&lt;br /&gt;
==Sequence:==&lt;br /&gt;
IntegrationComponent -&amp;gt; AccessController -&amp;gt; ACR -&amp;gt; Access is granted or an AccessControlException is thrown.&lt;br /&gt;
# When the system starts, the ACM is read and resources are linked to an ACR.  &lt;br /&gt;
# The IntegrationComponent (e.g. a Struts2 Interceptor) calls AccessController.enforceAuthorization(key, runtimeParameter).&lt;br /&gt;
# AccessController maps the key to an ACR and passes it the runtime parameters and static policy file parameters.&lt;br /&gt;
# The ACR executes Java code to evaluate an arbitrarily complex rule set. Note that an ACR could evaluate unusually complex role requirements by assigning it to all roles for a given resource. Also note that ACRs can delegate to other ACRs or even a rules engine.&lt;br /&gt;
==Code Samples:==&lt;br /&gt;
What follows is a partial strawman implementation from some proof of concept code that I’ve been working on. Code has been removed to help focus on the critical path. I’d appreciate any feedback and I’m looking especially interested in feedback on usability from a developer’s point of view. Would this help you to implement Access Control for large projects? What can I do to make it safer and easier for developers? &lt;br /&gt;
To help illustrate the mappings, I’ve used &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''bold red'''&amp;lt;/span&amp;gt; to represent the resource identifier and &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''bold green''&amp;lt;/span&amp;gt; to represent the ACR throughout the files. Only the first 3 files (ACM, Policy file and ACR) are implemented by the developer. The rest are provided by the AccessController infrastructure. &lt;br /&gt;
===ACM===&lt;br /&gt;
This table is (roughly) what the Access Control Matrix looks like. It would probably be a .csv file or database file and would have options to group resources using regular expressions, String.startsWith, etc. The ACM and Policy File (below) combine to define which ACR is executed by AccessController. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!         !!Role1!!Role2!!Role3&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''Resource1'''&amp;lt;/span&amp;gt;||Deny ||Grant||&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''SpecialCaseAccessControlRule'''&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Resource2||Grant||Deny	||Deny&lt;br /&gt;
|}&lt;br /&gt;
===Policy File===&lt;br /&gt;
This xml file is (roughly) what the ACR definitions would look like. It handles what would normally be “footnotes” in an ACM requirements specification document. The name correlates to an ACM cell. The AccessControlRule.class specifies the Java code that will execute. The parameters are passed to the ACR at runtime. Note that this shows the default name-value pair parameter loader, but other parameter loaders (not shown) can be specified. An enhancement would be to allow ACRs to be tagged using annotations so that the Policy file isn't required.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;AccessControlPolicy&amp;gt;&lt;br /&gt;
      &amp;lt;AccessControlRules&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would not implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Grant&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always granted&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysTrueACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Deny&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always denied&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysFalseACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''SpecialCaseAccessControlRule'''&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access depends on the value of the policy parameter: isTrue&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.policy.&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''EchoDynaBeanPolicyParameterACR'''&amp;lt;/span&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;Parameters&amp;gt;&lt;br /&gt;
                        &amp;lt;Parameter name=&amp;quot;isTrue&amp;quot; type=&amp;quot;Boolean&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
                  &amp;lt;/Parameters&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
      &amp;lt;/AccessControlRules&amp;gt;&lt;br /&gt;
 &amp;lt;/AccessControlPolicy&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ACR===&lt;br /&gt;
The following class is (roughly) what a simple ACR could look like. Note that the runtimeParameter can leverage generics for type safety. Developers would implement this.&lt;br /&gt;
&lt;br /&gt;
 public class &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''EchoDynaBeanPolicyParameterACR'''&amp;lt;/span&amp;gt; extends DynaBeanPolicyBaseACR {&lt;br /&gt;
      /**&lt;br /&gt;
       * @return true iff policyParameter isTrue is a Boolean set to true.&lt;br /&gt;
       * throws ClassCastException if runtimeParameter is not a Boolean.&lt;br /&gt;
       */&lt;br /&gt;
      public boolean isAuthorized(Object runtimeParameter) throws ClassCastException{           &lt;br /&gt;
            return getPolicyParameters().getBoolean(&amp;quot;isTrue&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===IntegrationComponent===&lt;br /&gt;
This class is (roughly) what a framework integration using a Struts2 interceptor would look like. This is part of the framework, developers don’t implement this. However, if a developer wants to execute an ACR, they can do so as demonstrated in the intercept method.&lt;br /&gt;
&lt;br /&gt;
 public class AccessControlEnforcementInterceptor extends AbstractInterceptor {&lt;br /&gt;
    public String intercept(ActionInvocation invocation) throws Exception {&lt;br /&gt;
          ESAPI.accessController().enforceAuthorization(&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''invocation.getAction()'''&amp;lt;/span&amp;gt;, //assume that getAction() returns “Resource1”&lt;br /&gt;
                  invocation.getInvocationContext()); //Note that this line may change to facilitate &lt;br /&gt;
                                                      //mappings between Framework Integrations and multi-purpose ACRs&lt;br /&gt;
       return invocation.invoke();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===AccessController===&lt;br /&gt;
This class is (roughly) what the enforceAuthorization method in AccessController could look like. The key is the resource. In our example “Resource1.” This method will need to be enhanced to handle resource groups. This is part of the framework, developers don’t implement this. This doesn’t currently take the user’s role into account, but could.&lt;br /&gt;
&lt;br /&gt;
 public void enforceAuthorization(Object &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''key'''&amp;lt;/span&amp;gt;, Object runtimeParameter)&lt;br /&gt;
      throws org.owasp.esapi.errors.AccessControlException {&lt;br /&gt;
      boolean isAuthorized = false;&lt;br /&gt;
      try {&lt;br /&gt;
            AccessControlRule &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''rule'''&amp;lt;/span&amp;gt; = (AccessControlRule)ruleMap.get(&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''key'''&amp;lt;/span&amp;gt;);&lt;br /&gt;
            if(rule == null) {&lt;br /&gt;
                  throw new AccessControlException(&lt;br /&gt;
                              &amp;quot;AccessControlRule was not found for key: &amp;quot; + key,&lt;br /&gt;
                              &amp;quot;&amp;quot;); &lt;br /&gt;
            }&lt;br /&gt;
            System.out.println(&amp;quot;Enforcing Authorization Rule \&amp;quot;&amp;quot; + key + &amp;quot;\&amp;quot; Using class: &amp;quot; + rule.getClass().getCanonicalName());&lt;br /&gt;
            isAuthorized = &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''rule'''&amp;lt;/span&amp;gt;.isAuthorized(runtimeParameter);&lt;br /&gt;
      } catch(Exception e) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;An unhandled Exception was &amp;quot; +&lt;br /&gt;
                        &amp;quot;caught, so we are recasting it as an &amp;quot; +&lt;br /&gt;
                        &amp;quot;AccessControlException.&amp;quot;, &lt;br /&gt;
                        &amp;quot;&amp;quot;,&lt;br /&gt;
                        e);&lt;br /&gt;
      }&lt;br /&gt;
      if(!isAuthorized) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;Access Denied for key: &amp;quot; + key +&lt;br /&gt;
                        &amp;quot; runtimeParameter: &amp;quot; + runtimeParameter, &amp;quot;&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55563</id>
		<title>ESAPI Access Control</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55563"/>
				<updated>2009-02-26T20:41:43Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: /* Code Samples: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Access Control 2.0=&lt;br /&gt;
At the ESAPI summit, we discussed changing Access Control 2.0 to use the command pattern. The following are the current design goals for Access Control 2.0. Enough proof of concept development has been completed for me to believe that these goals are achievable. I’d appreciate your input as to whether they are both desirable and sufficient. Below the goals are the answers to outstanding questions, the sequence of execution and some code snippets to give a better feel for the current direction. Feedback is welcome. I’m happy to make changes.&amp;lt;br&amp;gt;&lt;br /&gt;
==Current Design Goals:==&lt;br /&gt;
# Allow developers to implement access control rules (ACR) using arbitrary java code.&lt;br /&gt;
#:Benefit: Allowing arbitrary java code gives ACR developers as much flexibility to write ACRs as they do throughout the normal code base. &lt;br /&gt;
# Facilitate integration with frameworks to enforce ACRs automatically and default to deny access.&lt;br /&gt;
#:Benefit: Automatically making the call reduces developer error, because both the call will be made correctly and the developer is forced to provide the security check. &lt;br /&gt;
# Allow developers to call ACRs for evaluation or enforcement manually.&lt;br /&gt;
#:Benefit: Allowing manual calls for both uses increases flexibility and facilitates reuse for access control and flow control.&lt;br /&gt;
# Allow ACRs to make decisions based on arbitrary runtime parameters and deployment parameters.&lt;br /&gt;
#:Benefit: The policy file stores deployment parameters. Accepting an arbitrary runtime parameter allows stateless ACRs, which decreases object creation costs.&lt;br /&gt;
==Proposed Additional Design Goals==&lt;br /&gt;
The following were not in the original set of goals, but I would like us to consider whether they should be included:&lt;br /&gt;
# Keep the Access Control Matrix (ACM) synchronized throughout the SDLC by making the ACM specification drive the integration framework that calls the ACRs.&lt;br /&gt;
#:Benefit: Understanding of permissions is clearer and more accurate throughout requirements and test phases. &lt;br /&gt;
# Allow resource names to be grouped and ensure that ACR selection is deterministic.&lt;br /&gt;
#:Benefit: Grouping similar resources makes the ACM clearer and easier to manage.&lt;br /&gt;
# Integration with Struts 2, Struts 1, JSR 115, Spring ?.?, JBoss Seam, JBossAop, Aspect J. I’m currently using the Struts2Spring2JtaJpa quickstart for the integration tests.  &lt;br /&gt;
==Outstanding Questions from the ESAPI Summit and their Answers:==&lt;br /&gt;
'''Question''': Can the runtimeParameter AccessController.isAuthorized(“Resource”, runtimeParameter) be strongly typed in the ACR definition class? &amp;lt;br&amp;gt;&lt;br /&gt;
'''Answer''': Yes. Java versions 1.5 and above can leverage Generics. Commands written for 1.4 and below will need to use Object as parameters and then cast appropriately. The current version of Access Control 2.0 is written without generics for backwards compatibility, but I plan to add generics compatible version.&lt;br /&gt;
&lt;br /&gt;
==Sequence:==&lt;br /&gt;
IntegrationComponent -&amp;gt; AccessController -&amp;gt; ACR -&amp;gt; Access is granted or an AccessControlException is thrown.&lt;br /&gt;
# When the system starts, the ACM is read and resources are linked to an ACR.  &lt;br /&gt;
# The IntegrationComponent (e.g. a Struts2 Interceptor) calls AccessController.enforceAuthorization(key, runtimeParameter).&lt;br /&gt;
# AccessController maps the key to an ACR and passes it the runtime parameters and static policy file parameters.&lt;br /&gt;
# The ACR executes Java code to evaluate an arbitrarily complex rule set. Note that an ACR could evaluate unusually complex role requirements by assigning it to all roles for a given resource. Also note that ACRs can delegate to other ACRs or even a rules engine.&lt;br /&gt;
==Code Samples:==&lt;br /&gt;
What follows is a partial strawman implementation from some proof of concept code that I’ve been working on. Code has been removed to help focus on the critical path. I’d appreciate any feedback and I’m looking especially interested in feedback on usability from a developer’s point of view. Would this help you to implement Access Control for large projects? What can I do to make it safer and easier for developers? &lt;br /&gt;
To help illustrate the mappings, I’ve used &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''bold red'''&amp;lt;/span&amp;gt; to represent the resource identifier and &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''bold green''&amp;lt;/span&amp;gt; to represent the ACR throughout the files. Only the first 3 files (ACM, Policy file and ACR) are implemented by the developer. The rest are provided by the AccessController infrastructure. &lt;br /&gt;
===ACM===&lt;br /&gt;
This table is (roughly) what the Access Control Matrix looks like. It would probably be a .csv file or database file and would have options to group resources using regular expressions, String.startsWith, etc. The ACM and Policy File (below) combine to define which ACR is executed by AccessController. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!         !!Role1!!Role2!!Role3&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''Resource1'''&amp;lt;/span&amp;gt;||Deny ||Grant||&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''SpecialCaseAccessControlRule'''&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Resource2||Grant||Deny	||Deny&lt;br /&gt;
|}&lt;br /&gt;
===Policy File===&lt;br /&gt;
This xml file is (roughly) what the ACR definitions would look like. It handles what would normally be “footnotes” in an ACM requirements specification document. The name correlates to an ACM cell. The AccessControlRule.class specifies the Java code that will execute. The parameters are passed to the ACR at runtime. Note that this shows the default name-value pair parameter loader, but other parameter loaders (not shown) can be specified.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;AccessControlPolicy&amp;gt;&lt;br /&gt;
      &amp;lt;AccessControlRules&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would not implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Grant&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always granted&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysTrueACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Deny&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always denied&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysFalseACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''SpecialCaseAccessControlRule'''&amp;lt;/span&amp;gt;&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access depends on the value of the policy parameter: isTrue&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.policy.&amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''EchoDynaBeanPolicyParameterACR'''&amp;lt;/span&amp;gt;&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;Parameters&amp;gt;&lt;br /&gt;
                        &amp;lt;Parameter name=&amp;quot;isTrue&amp;quot; type=&amp;quot;Boolean&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
                  &amp;lt;/Parameters&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
      &amp;lt;/AccessControlRules&amp;gt;&lt;br /&gt;
 &amp;lt;/AccessControlPolicy&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ACR===&lt;br /&gt;
The following class is (roughly) what a simple ACR could look like. Note that the runtimeParameter can leverage generics for type safety. Developers would implement this.&lt;br /&gt;
&lt;br /&gt;
 public class &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''EchoDynaBeanPolicyParameterACR'''&amp;lt;/span&amp;gt; extends DynaBeanPolicyBaseACR {&lt;br /&gt;
      /**&lt;br /&gt;
       * @return true iff policyParameter isTrue is a Boolean set to true.&lt;br /&gt;
       * throws ClassCastException if runtimeParameter is not a Boolean.&lt;br /&gt;
       */&lt;br /&gt;
      public boolean isAuthorized(Object runtimeParameter) throws ClassCastException{           &lt;br /&gt;
            return getPolicyParameters().getBoolean(&amp;quot;isTrue&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===IntegrationComponent===&lt;br /&gt;
This class is (roughly) what a framework integration using a Struts2 interceptor would look like. This is part of the framework, developers don’t implement this. However, if a developer wants to execute an ACR, they can do so as demonstrated in the intercept method.&lt;br /&gt;
&lt;br /&gt;
 public class AccessControlEnforcementInterceptor extends AbstractInterceptor {&lt;br /&gt;
    public String intercept(ActionInvocation invocation) throws Exception {&lt;br /&gt;
          ESAPI.accessController().enforceAuthorization(&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''invocation.getAction()'''&amp;lt;/span&amp;gt;, //assume that getAction() returns “Resource1”&lt;br /&gt;
                  invocation.getInvocationContext()); //Note that this line may change to facilitate &lt;br /&gt;
                                                      //mappings between Framework Integrations and multi-purpose ACRs&lt;br /&gt;
       return invocation.invoke();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===AccessController===&lt;br /&gt;
This class is (roughly) what the enforceAuthorization method in AccessController could look like. The key is the resource. In our example “Resource1.” This method will need to be enhanced to handle resource groups. This is part of the framework, developers don’t implement this. This doesn’t currently take the user’s role into account, but could.&lt;br /&gt;
&lt;br /&gt;
 public void enforceAuthorization(Object &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''key'''&amp;lt;/span&amp;gt;, Object runtimeParameter)&lt;br /&gt;
      throws org.owasp.esapi.errors.AccessControlException {&lt;br /&gt;
      boolean isAuthorized = false;&lt;br /&gt;
      try {&lt;br /&gt;
            AccessControlRule &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''rule'''&amp;lt;/span&amp;gt; = (AccessControlRule)ruleMap.get(&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''key'''&amp;lt;/span&amp;gt;);&lt;br /&gt;
            if(rule == null) {&lt;br /&gt;
                  throw new AccessControlException(&lt;br /&gt;
                              &amp;quot;AccessControlRule was not found for key: &amp;quot; + key,&lt;br /&gt;
                              &amp;quot;&amp;quot;); &lt;br /&gt;
            }&lt;br /&gt;
            System.out.println(&amp;quot;Enforcing Authorization Rule \&amp;quot;&amp;quot; + key + &amp;quot;\&amp;quot; Using class: &amp;quot; + rule.getClass().getCanonicalName());&lt;br /&gt;
            isAuthorized = &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;'''rule'''&amp;lt;/span&amp;gt;.isAuthorized(runtimeParameter);&lt;br /&gt;
      } catch(Exception e) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;An unhandled Exception was &amp;quot; +&lt;br /&gt;
                        &amp;quot;caught, so we are recasting it as an &amp;quot; +&lt;br /&gt;
                        &amp;quot;AccessControlException.&amp;quot;, &lt;br /&gt;
                        &amp;quot;&amp;quot;,&lt;br /&gt;
                        e);&lt;br /&gt;
      }&lt;br /&gt;
      if(!isAuthorized) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;Access Denied for key: &amp;quot; + key +&lt;br /&gt;
                        &amp;quot; runtimeParameter: &amp;quot; + runtimeParameter, &amp;quot;&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55562</id>
		<title>ESAPI Access Control</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55562"/>
				<updated>2009-02-26T20:24:54Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: /* Code Samples: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Access Control 2.0=&lt;br /&gt;
At the ESAPI summit, we discussed changing Access Control 2.0 to use the command pattern. The following are the current design goals for Access Control 2.0. Enough proof of concept development has been completed for me to believe that these goals are achievable. I’d appreciate your input as to whether they are both desirable and sufficient. Below the goals are the answers to outstanding questions, the sequence of execution and some code snippets to give a better feel for the current direction. Feedback is welcome. I’m happy to make changes.&amp;lt;br&amp;gt;&lt;br /&gt;
==Current Design Goals:==&lt;br /&gt;
# Allow developers to implement access control rules (ACR) using arbitrary java code.&lt;br /&gt;
#:Benefit: Allowing arbitrary java code gives ACR developers as much flexibility to write ACRs as they do throughout the normal code base. &lt;br /&gt;
# Facilitate integration with frameworks to enforce ACRs automatically and default to deny access.&lt;br /&gt;
#:Benefit: Automatically making the call reduces developer error, because both the call will be made correctly and the developer is forced to provide the security check. &lt;br /&gt;
# Allow developers to call ACRs for evaluation or enforcement manually.&lt;br /&gt;
#:Benefit: Allowing manual calls for both uses increases flexibility and facilitates reuse for access control and flow control.&lt;br /&gt;
# Allow ACRs to make decisions based on arbitrary runtime parameters and deployment parameters.&lt;br /&gt;
#:Benefit: The policy file stores deployment parameters. Accepting an arbitrary runtime parameter allows stateless ACRs, which decreases object creation costs.&lt;br /&gt;
==Proposed Additional Design Goals==&lt;br /&gt;
The following were not in the original set of goals, but I would like us to consider whether they should be included:&lt;br /&gt;
# Keep the Access Control Matrix (ACM) synchronized throughout the SDLC by making the ACM specification drive the integration framework that calls the ACRs.&lt;br /&gt;
#:Benefit: Understanding of permissions is clearer and more accurate throughout requirements and test phases. &lt;br /&gt;
# Allow resource names to be grouped and ensure that ACR selection is deterministic.&lt;br /&gt;
#:Benefit: Grouping similar resources makes the ACM clearer and easier to manage.&lt;br /&gt;
# Integration with Struts 2, Struts 1, JSR 115, Spring ?.?, JBoss Seam, JBossAop, Aspect J. I’m currently using the Struts2Spring2JtaJpa quickstart for the integration tests.  &lt;br /&gt;
==Outstanding Questions from the ESAPI Summit and their Answers:==&lt;br /&gt;
'''Question''': Can the runtimeParameter AccessController.isAuthorized(“Resource”, runtimeParameter) be strongly typed in the ACR definition class? &amp;lt;br&amp;gt;&lt;br /&gt;
'''Answer''': Yes. Java versions 1.5 and above can leverage Generics. Commands written for 1.4 and below will need to use Object as parameters and then cast appropriately. The current version of Access Control 2.0 is written without generics for backwards compatibility, but I plan to add generics compatible version.&lt;br /&gt;
&lt;br /&gt;
==Sequence:==&lt;br /&gt;
IntegrationComponent -&amp;gt; AccessController -&amp;gt; ACR -&amp;gt; Access is granted or an AccessControlException is thrown.&lt;br /&gt;
# When the system starts, the ACM is read and resources are linked to an ACR.  &lt;br /&gt;
# The IntegrationComponent (e.g. a Struts2 Interceptor) calls AccessController.enforceAuthorization(key, runtimeParameter).&lt;br /&gt;
# AccessController maps the key to an ACR and passes it the runtime parameters and static policy file parameters.&lt;br /&gt;
# The ACR executes Java code to evaluate an arbitrarily complex rule set. Note that an ACR could evaluate unusually complex role requirements by assigning it to all roles for a given resource. Also note that ACRs can delegate to other ACRs or even a rules engine.&lt;br /&gt;
==Code Samples:==&lt;br /&gt;
What follows is a partial strawman implementation from some proof of concept code that I’ve been working on. Code has been removed to help focus on the critical path. I’d appreciate any feedback and I’m looking especially interested in feedback on usability from a developer’s point of view. Would this help you to implement Access Control for large projects? What can I do to make it safer and easier for developers? &lt;br /&gt;
To help illustrate the mappings, I’ve used {{fontcolor|red|bold red}} to represent the resource identifier and bold green to represent the ACR throughout the files. Only the first 3 files (ACM, Policy file and ACR) are implemented by the developer. The rest are provided by the AccessController infrastructure. &lt;br /&gt;
===ACM===&lt;br /&gt;
This table is (roughly) what the Access Control Matrix looks like. It would probably be a .csv file or database file and would have options to group resources using regular expressions, String.startsWith, etc. The ACM and Policy File (below) combine to define which ACR is executed by AccessController. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!         !!Role1!!Role2!!Role3&lt;br /&gt;
|-&lt;br /&gt;
|Resource1||Deny ||Grant||SpecialCaseAccessControlRule&lt;br /&gt;
|-&lt;br /&gt;
|Resource2||Grant||Deny	||Deny&lt;br /&gt;
|}&lt;br /&gt;
===Policy File===&lt;br /&gt;
This xml file is (roughly) what the ACR definitions would look like. It handles what would normally be “footnotes” in an ACM requirements specification document. The name correlates to an ACM cell. The AccessControlRule.class specifies the Java code that will execute. The parameters are passed to the ACR at runtime. Note that this shows the default name-value pair parameter loader, but other parameter loaders (not shown) can be specified.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;AccessControlPolicy&amp;gt;&lt;br /&gt;
      &amp;lt;AccessControlRules&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would not implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Grant&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always granted&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysTrueACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Deny&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always denied&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysFalseACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot; SpecialCaseAccessControlRule&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access depends on the value of the policy parameter: isTrue&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.policy.EchoDynaBeanPolicyParameterACR&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;Parameters&amp;gt;&lt;br /&gt;
                        &amp;lt;Parameter name=&amp;quot;isTrue&amp;quot; type=&amp;quot;Boolean&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
                  &amp;lt;/Parameters&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
      &amp;lt;/AccessControlRules&amp;gt;&lt;br /&gt;
 &amp;lt;/AccessControlPolicy&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ACR===&lt;br /&gt;
The following class is (roughly) what a simple ACR could look like. Note that the runtimeParameter can leverage generics for type safety. Developers would implement this.&lt;br /&gt;
&lt;br /&gt;
 public class EchoDynaBeanPolicyParameterACR extends DynaBeanPolicyBaseACR {&lt;br /&gt;
      /**&lt;br /&gt;
       * @return true iff policyParameter isTrue is a Boolean set to true.&lt;br /&gt;
       * throws ClassCastException if runtimeParameter is not a Boolean.&lt;br /&gt;
       */&lt;br /&gt;
      public boolean isAuthorized(Object runtimeParameter) throws ClassCastException{           &lt;br /&gt;
            return getPolicyParameters().getBoolean(&amp;quot;isTrue&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===IntegrationComponent===&lt;br /&gt;
This class is (roughly) what a framework integration using a Struts2 interceptor would look like. This is part of the framework, developers don’t implement this. However, if a developer wants to execute an ACR, they can do so as demonstrated in the intercept method.&lt;br /&gt;
&lt;br /&gt;
 public class AccessControlEnforcementInterceptor extends AbstractInterceptor {&lt;br /&gt;
    public String intercept(ActionInvocation invocation) throws Exception {&lt;br /&gt;
          ESAPI.accessController().enforceAuthorization(invocation.getAction(), //assume that getAction() returns “Resource1”&lt;br /&gt;
                  invocation.getInvocationContext()); //Note that this line may change to facilitate &lt;br /&gt;
                                                      //mappings between Framework Integrations and multi-purpose ACRs&lt;br /&gt;
       return invocation.invoke();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===AccessController===&lt;br /&gt;
This class is (roughly) what the enforceAuthorization method in AccessController could look like. The key is the resource. In our example “Resource1.” This method will need to be enhanced to handle resource groups. This is part of the framework, developers don’t implement this. This doesn’t currently take the user’s role into account, but could.&lt;br /&gt;
&lt;br /&gt;
 public void enforceAuthorization(Object key, Object runtimeParameter)&lt;br /&gt;
      throws org.owasp.esapi.errors.AccessControlException {&lt;br /&gt;
      boolean isAuthorized = false;&lt;br /&gt;
      try {&lt;br /&gt;
            AccessControlRule rule = (AccessControlRule)ruleMap.get(key);&lt;br /&gt;
            if(rule == null) {&lt;br /&gt;
                  throw new AccessControlException(&lt;br /&gt;
                              &amp;quot;AccessControlRule was not found for key: &amp;quot; + key,&lt;br /&gt;
                              &amp;quot;&amp;quot;); &lt;br /&gt;
            }&lt;br /&gt;
            System.out.println(&amp;quot;Enforcing Authorization Rule \&amp;quot;&amp;quot; + key + &amp;quot;\&amp;quot; Using class: &amp;quot; + rule.getClass().getCanonicalName());&lt;br /&gt;
            isAuthorized = rule.isAuthorized(runtimeParameter);&lt;br /&gt;
      } catch(Exception e) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;An unhandled Exception was &amp;quot; +&lt;br /&gt;
                        &amp;quot;caught, so we are recasting it as an &amp;quot; +&lt;br /&gt;
                        &amp;quot;AccessControlException.&amp;quot;, &lt;br /&gt;
                        &amp;quot;&amp;quot;,&lt;br /&gt;
                        e);&lt;br /&gt;
      }&lt;br /&gt;
      if(!isAuthorized) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;Access Denied for key: &amp;quot; + key +&lt;br /&gt;
                        &amp;quot; runtimeParameter: &amp;quot; + runtimeParameter, &amp;quot;&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55561</id>
		<title>ESAPI Access Control</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55561"/>
				<updated>2009-02-26T20:18:29Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: /* Feature Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Access Control 2.0=&lt;br /&gt;
At the ESAPI summit, we discussed changing Access Control 2.0 to use the command pattern. The following are the current design goals for Access Control 2.0. Enough proof of concept development has been completed for me to believe that these goals are achievable. I’d appreciate your input as to whether they are both desirable and sufficient. Below the goals are the answers to outstanding questions, the sequence of execution and some code snippets to give a better feel for the current direction. Feedback is welcome. I’m happy to make changes.&amp;lt;br&amp;gt;&lt;br /&gt;
==Current Design Goals:==&lt;br /&gt;
# Allow developers to implement access control rules (ACR) using arbitrary java code.&lt;br /&gt;
#:Benefit: Allowing arbitrary java code gives ACR developers as much flexibility to write ACRs as they do throughout the normal code base. &lt;br /&gt;
# Facilitate integration with frameworks to enforce ACRs automatically and default to deny access.&lt;br /&gt;
#:Benefit: Automatically making the call reduces developer error, because both the call will be made correctly and the developer is forced to provide the security check. &lt;br /&gt;
# Allow developers to call ACRs for evaluation or enforcement manually.&lt;br /&gt;
#:Benefit: Allowing manual calls for both uses increases flexibility and facilitates reuse for access control and flow control.&lt;br /&gt;
# Allow ACRs to make decisions based on arbitrary runtime parameters and deployment parameters.&lt;br /&gt;
#:Benefit: The policy file stores deployment parameters. Accepting an arbitrary runtime parameter allows stateless ACRs, which decreases object creation costs.&lt;br /&gt;
==Proposed Additional Design Goals==&lt;br /&gt;
The following were not in the original set of goals, but I would like us to consider whether they should be included:&lt;br /&gt;
# Keep the Access Control Matrix (ACM) synchronized throughout the SDLC by making the ACM specification drive the integration framework that calls the ACRs.&lt;br /&gt;
#:Benefit: Understanding of permissions is clearer and more accurate throughout requirements and test phases. &lt;br /&gt;
# Allow resource names to be grouped and ensure that ACR selection is deterministic.&lt;br /&gt;
#:Benefit: Grouping similar resources makes the ACM clearer and easier to manage.&lt;br /&gt;
# Integration with Struts 2, Struts 1, JSR 115, Spring ?.?, JBoss Seam, JBossAop, Aspect J. I’m currently using the Struts2Spring2JtaJpa quickstart for the integration tests.  &lt;br /&gt;
==Outstanding Questions from the ESAPI Summit and their Answers:==&lt;br /&gt;
'''Question''': Can the runtimeParameter AccessController.isAuthorized(“Resource”, runtimeParameter) be strongly typed in the ACR definition class? &amp;lt;br&amp;gt;&lt;br /&gt;
'''Answer''': Yes. Java versions 1.5 and above can leverage Generics. Commands written for 1.4 and below will need to use Object as parameters and then cast appropriately. The current version of Access Control 2.0 is written without generics for backwards compatibility, but I plan to add generics compatible version.&lt;br /&gt;
&lt;br /&gt;
==Sequence:==&lt;br /&gt;
IntegrationComponent -&amp;gt; AccessController -&amp;gt; ACR -&amp;gt; Access is granted or an AccessControlException is thrown.&lt;br /&gt;
# When the system starts, the ACM is read and resources are linked to an ACR.  &lt;br /&gt;
# The IntegrationComponent (e.g. a Struts2 Interceptor) calls AccessController.enforceAuthorization(key, runtimeParameter).&lt;br /&gt;
# AccessController maps the key to an ACR and passes it the runtime parameters and static policy file parameters.&lt;br /&gt;
# The ACR executes Java code to evaluate an arbitrarily complex rule set. Note that an ACR could evaluate unusually complex role requirements by assigning it to all roles for a given resource. Also note that ACRs can delegate to other ACRs or even a rules engine.&lt;br /&gt;
==Code Samples:==&lt;br /&gt;
What follows is a partial strawman implementation from some proof of concept code that I’ve been working on. Code has been removed to help focus on the critical path. I’d appreciate any feedback and I’m looking especially interested in feedback on usability from a developer’s point of view. Would this help you to implement Access Control for large projects? What can I do to make it safer and easier for developers? &lt;br /&gt;
To help illustrate the mappings, I’ve used bold red to represent the resource identifier and bold green to represent the ACR throughout the files. Only the first 3 files (ACM, Policy file and ACR) are implemented by the developer. The rest are provided by the AccessController infrastructure. &lt;br /&gt;
===ACM===&lt;br /&gt;
This table is (roughly) what the Access Control Matrix looks like. It would probably be a .csv file or database file and would have options to group resources using regular expressions, String.startsWith, etc. The ACM and Policy File (below) combine to define which ACR is executed by AccessController. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! !! Role1 !! Role2 !! Role3&lt;br /&gt;
|-&lt;br /&gt;
|Resource1||Deny	||Grant	||SpecialCaseAccessControlRule&lt;br /&gt;
|-&lt;br /&gt;
|Resource2	||Grant	||Deny	||Deny&lt;br /&gt;
|}&lt;br /&gt;
===Policy File===&lt;br /&gt;
This xml file is (roughly) what the ACR definitions would look like. It handles what would normally be “footnotes” in an ACM requirements specification document. The name correlates to an ACM cell. The AccessControlRule.class specifies the Java code that will execute. The parameters are passed to the ACR at runtime. Note that this shows the default name-value pair parameter loader, but other parameter loaders (not shown) can be specified.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;AccessControlPolicy&amp;gt;&lt;br /&gt;
      &amp;lt;AccessControlRules&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would not implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Grant&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always granted&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysTrueACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Deny&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always denied&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysFalseACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot; SpecialCaseAccessControlRule&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access depends on the value of the policy parameter: isTrue&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.policy.EchoDynaBeanPolicyParameterACR&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;Parameters&amp;gt;&lt;br /&gt;
                        &amp;lt;Parameter name=&amp;quot;isTrue&amp;quot; type=&amp;quot;Boolean&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
                  &amp;lt;/Parameters&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
      &amp;lt;/AccessControlRules&amp;gt;&lt;br /&gt;
 &amp;lt;/AccessControlPolicy&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ACR===&lt;br /&gt;
The following class is (roughly) what a simple ACR could look like. Note that the runtimeParameter can leverage generics for type safety. Developers would implement this.&lt;br /&gt;
&lt;br /&gt;
 public class EchoDynaBeanPolicyParameterACR extends DynaBeanPolicyBaseACR {&lt;br /&gt;
      /**&lt;br /&gt;
       * @return true iff policyParameter isTrue is a Boolean set to true.&lt;br /&gt;
       * throws ClassCastException if runtimeParameter is not a Boolean.&lt;br /&gt;
       */&lt;br /&gt;
      public boolean isAuthorized(Object runtimeParameter) throws ClassCastException{           &lt;br /&gt;
            return getPolicyParameters().getBoolean(&amp;quot;isTrue&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===IntegrationComponent===&lt;br /&gt;
This class is (roughly) what a framework integration using a Struts2 interceptor would look like. This is part of the framework, developers don’t implement this. However, if a developer wants to execute an ACR, they can do so as demonstrated in the intercept method.&lt;br /&gt;
&lt;br /&gt;
 public class AccessControlEnforcementInterceptor extends AbstractInterceptor {&lt;br /&gt;
    public String intercept(ActionInvocation invocation) throws Exception {&lt;br /&gt;
          ESAPI.accessController().enforceAuthorization(invocation.getAction(), //assume that getAction() returns “Resource1”&lt;br /&gt;
                  invocation.getInvocationContext()); //Note that this line may change to facilitate &lt;br /&gt;
                                                      //mappings between Framework Integrations and multi-purpose ACRs&lt;br /&gt;
       return invocation.invoke();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===AccessController===&lt;br /&gt;
This class is (roughly) what the enforceAuthorization method in AccessController could look like. The key is the resource. In our example “Resource1.” This method will need to be enhanced to handle resource groups. This is part of the framework, developers don’t implement this. This doesn’t currently take the user’s role into account, but could.&lt;br /&gt;
&lt;br /&gt;
 public void enforceAuthorization(Object key, Object runtimeParameter)&lt;br /&gt;
      throws org.owasp.esapi.errors.AccessControlException {&lt;br /&gt;
      boolean isAuthorized = false;&lt;br /&gt;
      try {&lt;br /&gt;
            AccessControlRule rule = (AccessControlRule)ruleMap.get(key);&lt;br /&gt;
            if(rule == null) {&lt;br /&gt;
                  throw new AccessControlException(&lt;br /&gt;
                              &amp;quot;AccessControlRule was not found for key: &amp;quot; + key,&lt;br /&gt;
                              &amp;quot;&amp;quot;); &lt;br /&gt;
            }&lt;br /&gt;
            System.out.println(&amp;quot;Enforcing Authorization Rule \&amp;quot;&amp;quot; + key + &amp;quot;\&amp;quot; Using class: &amp;quot; + rule.getClass().getCanonicalName());&lt;br /&gt;
            isAuthorized = rule.isAuthorized(runtimeParameter);&lt;br /&gt;
      } catch(Exception e) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;An unhandled Exception was &amp;quot; +&lt;br /&gt;
                        &amp;quot;caught, so we are recasting it as an &amp;quot; +&lt;br /&gt;
                        &amp;quot;AccessControlException.&amp;quot;, &lt;br /&gt;
                        &amp;quot;&amp;quot;,&lt;br /&gt;
                        e);&lt;br /&gt;
      }&lt;br /&gt;
      if(!isAuthorized) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;Access Denied for key: &amp;quot; + key +&lt;br /&gt;
                        &amp;quot; runtimeParameter: &amp;quot; + runtimeParameter, &amp;quot;&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55560</id>
		<title>ESAPI Access Control</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55560"/>
				<updated>2009-02-26T20:17:19Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: /* Outstanding Questions from the ESAPI Summit and their Answers: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Feature Overview ==&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=Access Control 2.0=&lt;br /&gt;
At the ESAPI summit, we discussed changing Access Control 2.0 to use the command pattern. The following are the current design goals for Access Control 2.0. Enough proof of concept development has been completed for me to believe that these goals are achievable. I’d appreciate your input as to whether they are both desirable and sufficient. Below the goals are the answers to outstanding questions, the sequence of execution and some code snippets to give a better feel for the current direction. Feedback is welcome. I’m happy to make changes.&amp;lt;br&amp;gt;&lt;br /&gt;
==Current Design Goals:==&lt;br /&gt;
# Allow developers to implement access control rules (ACR) using arbitrary java code.&lt;br /&gt;
#:Benefit: Allowing arbitrary java code gives ACR developers as much flexibility to write ACRs as they do throughout the normal code base. &lt;br /&gt;
# Facilitate integration with frameworks to enforce ACRs automatically and default to deny access.&lt;br /&gt;
#:Benefit: Automatically making the call reduces developer error, because both the call will be made correctly and the developer is forced to provide the security check. &lt;br /&gt;
# Allow developers to call ACRs for evaluation or enforcement manually.&lt;br /&gt;
#:Benefit: Allowing manual calls for both uses increases flexibility and facilitates reuse for access control and flow control.&lt;br /&gt;
# Allow ACRs to make decisions based on arbitrary runtime parameters and deployment parameters.&lt;br /&gt;
#:Benefit: The policy file stores deployment parameters. Accepting an arbitrary runtime parameter allows stateless ACRs, which decreases object creation costs.&lt;br /&gt;
==Proposed Additional Design Goals==&lt;br /&gt;
The following were not in the original set of goals, but I would like us to consider whether they should be included:&lt;br /&gt;
# Keep the Access Control Matrix (ACM) synchronized throughout the SDLC by making the ACM specification drive the integration framework that calls the ACRs.&lt;br /&gt;
#:Benefit: Understanding of permissions is clearer and more accurate throughout requirements and test phases. &lt;br /&gt;
# Allow resource names to be grouped and ensure that ACR selection is deterministic.&lt;br /&gt;
#:Benefit: Grouping similar resources makes the ACM clearer and easier to manage.&lt;br /&gt;
# Integration with Struts 2, Struts 1, JSR 115, Spring ?.?, JBoss Seam, JBossAop, Aspect J. I’m currently using the Struts2Spring2JtaJpa quickstart for the integration tests.  &lt;br /&gt;
==Outstanding Questions from the ESAPI Summit and their Answers:==&lt;br /&gt;
'''Question''': Can the runtimeParameter AccessController.isAuthorized(“Resource”, runtimeParameter) be strongly typed in the ACR definition class? &amp;lt;br&amp;gt;&lt;br /&gt;
'''Answer''': Yes. Java versions 1.5 and above can leverage Generics. Commands written for 1.4 and below will need to use Object as parameters and then cast appropriately. The current version of Access Control 2.0 is written without generics for backwards compatibility, but I plan to add generics compatible version.&lt;br /&gt;
&lt;br /&gt;
==Sequence:==&lt;br /&gt;
IntegrationComponent -&amp;gt; AccessController -&amp;gt; ACR -&amp;gt; Access is granted or an AccessControlException is thrown.&lt;br /&gt;
# When the system starts, the ACM is read and resources are linked to an ACR.  &lt;br /&gt;
# The IntegrationComponent (e.g. a Struts2 Interceptor) calls AccessController.enforceAuthorization(key, runtimeParameter).&lt;br /&gt;
# AccessController maps the key to an ACR and passes it the runtime parameters and static policy file parameters.&lt;br /&gt;
# The ACR executes Java code to evaluate an arbitrarily complex rule set. Note that an ACR could evaluate unusually complex role requirements by assigning it to all roles for a given resource. Also note that ACRs can delegate to other ACRs or even a rules engine.&lt;br /&gt;
==Code Samples:==&lt;br /&gt;
What follows is a partial strawman implementation from some proof of concept code that I’ve been working on. Code has been removed to help focus on the critical path. I’d appreciate any feedback and I’m looking especially interested in feedback on usability from a developer’s point of view. Would this help you to implement Access Control for large projects? What can I do to make it safer and easier for developers? &lt;br /&gt;
To help illustrate the mappings, I’ve used bold red to represent the resource identifier and bold green to represent the ACR throughout the files. Only the first 3 files (ACM, Policy file and ACR) are implemented by the developer. The rest are provided by the AccessController infrastructure. &lt;br /&gt;
===ACM===&lt;br /&gt;
This table is (roughly) what the Access Control Matrix looks like. It would probably be a .csv file or database file and would have options to group resources using regular expressions, String.startsWith, etc. The ACM and Policy File (below) combine to define which ACR is executed by AccessController. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! !! Role1 !! Role2 !! Role3&lt;br /&gt;
|-&lt;br /&gt;
|Resource1||Deny	||Grant	||SpecialCaseAccessControlRule&lt;br /&gt;
|-&lt;br /&gt;
|Resource2	||Grant	||Deny	||Deny&lt;br /&gt;
|}&lt;br /&gt;
===Policy File===&lt;br /&gt;
This xml file is (roughly) what the ACR definitions would look like. It handles what would normally be “footnotes” in an ACM requirements specification document. The name correlates to an ACM cell. The AccessControlRule.class specifies the Java code that will execute. The parameters are passed to the ACR at runtime. Note that this shows the default name-value pair parameter loader, but other parameter loaders (not shown) can be specified.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;AccessControlPolicy&amp;gt;&lt;br /&gt;
      &amp;lt;AccessControlRules&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would not implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Grant&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always granted&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysTrueACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Deny&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always denied&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysFalseACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot; SpecialCaseAccessControlRule&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access depends on the value of the policy parameter: isTrue&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.policy.EchoDynaBeanPolicyParameterACR&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;Parameters&amp;gt;&lt;br /&gt;
                        &amp;lt;Parameter name=&amp;quot;isTrue&amp;quot; type=&amp;quot;Boolean&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
                  &amp;lt;/Parameters&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
      &amp;lt;/AccessControlRules&amp;gt;&lt;br /&gt;
 &amp;lt;/AccessControlPolicy&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ACR===&lt;br /&gt;
The following class is (roughly) what a simple ACR could look like. Note that the runtimeParameter can leverage generics for type safety. Developers would implement this.&lt;br /&gt;
&lt;br /&gt;
 public class EchoDynaBeanPolicyParameterACR extends DynaBeanPolicyBaseACR {&lt;br /&gt;
      /**&lt;br /&gt;
       * @return true iff policyParameter isTrue is a Boolean set to true.&lt;br /&gt;
       * throws ClassCastException if runtimeParameter is not a Boolean.&lt;br /&gt;
       */&lt;br /&gt;
      public boolean isAuthorized(Object runtimeParameter) throws ClassCastException{           &lt;br /&gt;
            return getPolicyParameters().getBoolean(&amp;quot;isTrue&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===IntegrationComponent===&lt;br /&gt;
This class is (roughly) what a framework integration using a Struts2 interceptor would look like. This is part of the framework, developers don’t implement this. However, if a developer wants to execute an ACR, they can do so as demonstrated in the intercept method.&lt;br /&gt;
&lt;br /&gt;
 public class AccessControlEnforcementInterceptor extends AbstractInterceptor {&lt;br /&gt;
    public String intercept(ActionInvocation invocation) throws Exception {&lt;br /&gt;
          ESAPI.accessController().enforceAuthorization(invocation.getAction(), //assume that getAction() returns “Resource1”&lt;br /&gt;
                  invocation.getInvocationContext()); //Note that this line may change to facilitate &lt;br /&gt;
                                                      //mappings between Framework Integrations and multi-purpose ACRs&lt;br /&gt;
       return invocation.invoke();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===AccessController===&lt;br /&gt;
This class is (roughly) what the enforceAuthorization method in AccessController could look like. The key is the resource. In our example “Resource1.” This method will need to be enhanced to handle resource groups. This is part of the framework, developers don’t implement this. This doesn’t currently take the user’s role into account, but could.&lt;br /&gt;
&lt;br /&gt;
 public void enforceAuthorization(Object key, Object runtimeParameter)&lt;br /&gt;
      throws org.owasp.esapi.errors.AccessControlException {&lt;br /&gt;
      boolean isAuthorized = false;&lt;br /&gt;
      try {&lt;br /&gt;
            AccessControlRule rule = (AccessControlRule)ruleMap.get(key);&lt;br /&gt;
            if(rule == null) {&lt;br /&gt;
                  throw new AccessControlException(&lt;br /&gt;
                              &amp;quot;AccessControlRule was not found for key: &amp;quot; + key,&lt;br /&gt;
                              &amp;quot;&amp;quot;); &lt;br /&gt;
            }&lt;br /&gt;
            System.out.println(&amp;quot;Enforcing Authorization Rule \&amp;quot;&amp;quot; + key + &amp;quot;\&amp;quot; Using class: &amp;quot; + rule.getClass().getCanonicalName());&lt;br /&gt;
            isAuthorized = rule.isAuthorized(runtimeParameter);&lt;br /&gt;
      } catch(Exception e) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;An unhandled Exception was &amp;quot; +&lt;br /&gt;
                        &amp;quot;caught, so we are recasting it as an &amp;quot; +&lt;br /&gt;
                        &amp;quot;AccessControlException.&amp;quot;, &lt;br /&gt;
                        &amp;quot;&amp;quot;,&lt;br /&gt;
                        e);&lt;br /&gt;
      }&lt;br /&gt;
      if(!isAuthorized) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;Access Denied for key: &amp;quot; + key +&lt;br /&gt;
                        &amp;quot; runtimeParameter: &amp;quot; + runtimeParameter, &amp;quot;&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55559</id>
		<title>ESAPI Access Control</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=ESAPI_Access_Control&amp;diff=55559"/>
				<updated>2009-02-26T20:15:43Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: Access Control 2.0 Inception&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Feature Overview ==&lt;br /&gt;
&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=Access Control 2.0=&lt;br /&gt;
At the ESAPI summit, we discussed changing Access Control 2.0 to use the command pattern. The following are the current design goals for Access Control 2.0. Enough proof of concept development has been completed for me to believe that these goals are achievable. I’d appreciate your input as to whether they are both desirable and sufficient. Below the goals are the answers to outstanding questions, the sequence of execution and some code snippets to give a better feel for the current direction. Feedback is welcome. I’m happy to make changes.&amp;lt;br&amp;gt;&lt;br /&gt;
==Current Design Goals:==&lt;br /&gt;
# Allow developers to implement access control rules (ACR) using arbitrary java code.&lt;br /&gt;
#:Benefit: Allowing arbitrary java code gives ACR developers as much flexibility to write ACRs as they do throughout the normal code base. &lt;br /&gt;
# Facilitate integration with frameworks to enforce ACRs automatically and default to deny access.&lt;br /&gt;
#:Benefit: Automatically making the call reduces developer error, because both the call will be made correctly and the developer is forced to provide the security check. &lt;br /&gt;
# Allow developers to call ACRs for evaluation or enforcement manually.&lt;br /&gt;
#:Benefit: Allowing manual calls for both uses increases flexibility and facilitates reuse for access control and flow control.&lt;br /&gt;
# Allow ACRs to make decisions based on arbitrary runtime parameters and deployment parameters.&lt;br /&gt;
#:Benefit: The policy file stores deployment parameters. Accepting an arbitrary runtime parameter allows stateless ACRs, which decreases object creation costs.&lt;br /&gt;
==Proposed Additional Design Goals==&lt;br /&gt;
The following were not in the original set of goals, but I would like us to consider whether they should be included:&lt;br /&gt;
# Keep the Access Control Matrix (ACM) synchronized throughout the SDLC by making the ACM specification drive the integration framework that calls the ACRs.&lt;br /&gt;
#:Benefit: Understanding of permissions is clearer and more accurate throughout requirements and test phases. &lt;br /&gt;
# Allow resource names to be grouped and ensure that ACR selection is deterministic.&lt;br /&gt;
#:Benefit: Grouping similar resources makes the ACM clearer and easier to manage.&lt;br /&gt;
# Integration with Struts 2, Struts 1, JSR 115, Spring ?.?, JBoss Seam, JBossAop, Aspect J. I’m currently using the Struts2Spring2JtaJpa quickstart for the integration tests.  &lt;br /&gt;
==Outstanding Questions from the ESAPI Summit and their Answers:==&lt;br /&gt;
Question: Can the runtimeParameter AccessController.isAuthorized(“Resource”, runtimeParameter) be strongly typed in the ACR definition class? &amp;lt;br&amp;gt;&lt;br /&gt;
Answer: Yes. Java versions 1.5 and above can leverage Generics. Commands written for 1.4 and below will need to use Object as parameters and then cast appropriately. The current version of Access Control 2.0 is written without generics for backwards compatibility, but I plan to add generics compatible version. &lt;br /&gt;
==Sequence:==&lt;br /&gt;
IntegrationComponent -&amp;gt; AccessController -&amp;gt; ACR -&amp;gt; Access is granted or an AccessControlException is thrown.&lt;br /&gt;
# When the system starts, the ACM is read and resources are linked to an ACR.  &lt;br /&gt;
# The IntegrationComponent (e.g. a Struts2 Interceptor) calls AccessController.enforceAuthorization(key, runtimeParameter).&lt;br /&gt;
# AccessController maps the key to an ACR and passes it the runtime parameters and static policy file parameters.&lt;br /&gt;
# The ACR executes Java code to evaluate an arbitrarily complex rule set. Note that an ACR could evaluate unusually complex role requirements by assigning it to all roles for a given resource. Also note that ACRs can delegate to other ACRs or even a rules engine.&lt;br /&gt;
==Code Samples:==&lt;br /&gt;
What follows is a partial strawman implementation from some proof of concept code that I’ve been working on. Code has been removed to help focus on the critical path. I’d appreciate any feedback and I’m looking especially interested in feedback on usability from a developer’s point of view. Would this help you to implement Access Control for large projects? What can I do to make it safer and easier for developers? &lt;br /&gt;
To help illustrate the mappings, I’ve used bold red to represent the resource identifier and bold green to represent the ACR throughout the files. Only the first 3 files (ACM, Policy file and ACR) are implemented by the developer. The rest are provided by the AccessController infrastructure. &lt;br /&gt;
===ACM===&lt;br /&gt;
This table is (roughly) what the Access Control Matrix looks like. It would probably be a .csv file or database file and would have options to group resources using regular expressions, String.startsWith, etc. The ACM and Policy File (below) combine to define which ACR is executed by AccessController. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! !! Role1 !! Role2 !! Role3&lt;br /&gt;
|-&lt;br /&gt;
|Resource1||Deny	||Grant	||SpecialCaseAccessControlRule&lt;br /&gt;
|-&lt;br /&gt;
|Resource2	||Grant	||Deny	||Deny&lt;br /&gt;
|}&lt;br /&gt;
===Policy File===&lt;br /&gt;
This xml file is (roughly) what the ACR definitions would look like. It handles what would normally be “footnotes” in an ACM requirements specification document. The name correlates to an ACM cell. The AccessControlRule.class specifies the Java code that will execute. The parameters are passed to the ACR at runtime. Note that this shows the default name-value pair parameter loader, but other parameter loaders (not shown) can be specified.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;ISO-8859-1&amp;quot; ?&amp;gt;&lt;br /&gt;
 &amp;lt;AccessControlPolicy&amp;gt;&lt;br /&gt;
      &amp;lt;AccessControlRules&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would not implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Grant&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always granted&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysTrueACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot;Deny&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access is always denied&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.AlwaysFalseACR&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
            &amp;lt;!-- Developers would implement this --&amp;gt;&lt;br /&gt;
            &amp;lt;AccessControlRule&lt;br /&gt;
                  name=&amp;quot; SpecialCaseAccessControlRule&amp;quot;&lt;br /&gt;
                  description=&amp;quot;Access depends on the value of the policy parameter: isTrue&amp;quot;&lt;br /&gt;
                  class=&amp;quot;org.owasp.esapi.accesscontrol.policy.EchoDynaBeanPolicyParameterACR&amp;quot;&amp;gt;&lt;br /&gt;
                  &amp;lt;Parameters&amp;gt;&lt;br /&gt;
                        &amp;lt;Parameter name=&amp;quot;isTrue&amp;quot; type=&amp;quot;Boolean&amp;quot; value=&amp;quot;true&amp;quot;/&amp;gt;&lt;br /&gt;
                  &amp;lt;/Parameters&amp;gt;&lt;br /&gt;
            &amp;lt;/AccessControlRule&amp;gt;&lt;br /&gt;
      &amp;lt;/AccessControlRules&amp;gt;&lt;br /&gt;
 &amp;lt;/AccessControlPolicy&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ACR===&lt;br /&gt;
The following class is (roughly) what a simple ACR could look like. Note that the runtimeParameter can leverage generics for type safety. Developers would implement this.&lt;br /&gt;
&lt;br /&gt;
 public class EchoDynaBeanPolicyParameterACR extends DynaBeanPolicyBaseACR {&lt;br /&gt;
      /**&lt;br /&gt;
       * @return true iff policyParameter isTrue is a Boolean set to true.&lt;br /&gt;
       * throws ClassCastException if runtimeParameter is not a Boolean.&lt;br /&gt;
       */&lt;br /&gt;
      public boolean isAuthorized(Object runtimeParameter) throws ClassCastException{           &lt;br /&gt;
            return getPolicyParameters().getBoolean(&amp;quot;isTrue&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===IntegrationComponent===&lt;br /&gt;
This class is (roughly) what a framework integration using a Struts2 interceptor would look like. This is part of the framework, developers don’t implement this. However, if a developer wants to execute an ACR, they can do so as demonstrated in the intercept method.&lt;br /&gt;
&lt;br /&gt;
 public class AccessControlEnforcementInterceptor extends AbstractInterceptor {&lt;br /&gt;
    public String intercept(ActionInvocation invocation) throws Exception {&lt;br /&gt;
          ESAPI.accessController().enforceAuthorization(invocation.getAction(), //assume that getAction() returns “Resource1”&lt;br /&gt;
                  invocation.getInvocationContext()); //Note that this line may change to facilitate &lt;br /&gt;
                                                      //mappings between Framework Integrations and multi-purpose ACRs&lt;br /&gt;
       return invocation.invoke();&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
===AccessController===&lt;br /&gt;
This class is (roughly) what the enforceAuthorization method in AccessController could look like. The key is the resource. In our example “Resource1.” This method will need to be enhanced to handle resource groups. This is part of the framework, developers don’t implement this. This doesn’t currently take the user’s role into account, but could.&lt;br /&gt;
&lt;br /&gt;
 public void enforceAuthorization(Object key, Object runtimeParameter)&lt;br /&gt;
      throws org.owasp.esapi.errors.AccessControlException {&lt;br /&gt;
      boolean isAuthorized = false;&lt;br /&gt;
      try {&lt;br /&gt;
            AccessControlRule rule = (AccessControlRule)ruleMap.get(key);&lt;br /&gt;
            if(rule == null) {&lt;br /&gt;
                  throw new AccessControlException(&lt;br /&gt;
                              &amp;quot;AccessControlRule was not found for key: &amp;quot; + key,&lt;br /&gt;
                              &amp;quot;&amp;quot;); &lt;br /&gt;
            }&lt;br /&gt;
            System.out.println(&amp;quot;Enforcing Authorization Rule \&amp;quot;&amp;quot; + key + &amp;quot;\&amp;quot; Using class: &amp;quot; + rule.getClass().getCanonicalName());&lt;br /&gt;
            isAuthorized = rule.isAuthorized(runtimeParameter);&lt;br /&gt;
      } catch(Exception e) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;An unhandled Exception was &amp;quot; +&lt;br /&gt;
                        &amp;quot;caught, so we are recasting it as an &amp;quot; +&lt;br /&gt;
                        &amp;quot;AccessControlException.&amp;quot;, &lt;br /&gt;
                        &amp;quot;&amp;quot;,&lt;br /&gt;
                        e);&lt;br /&gt;
      }&lt;br /&gt;
      if(!isAuthorized) {&lt;br /&gt;
            throw new AccessControlException(&amp;quot;Access Denied for key: &amp;quot; + key +&lt;br /&gt;
                        &amp;quot; runtimeParameter: &amp;quot; + runtimeParameter, &amp;quot;&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=User:Mikehfauzy&amp;diff=55558</id>
		<title>User:Mikehfauzy</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=User:Mikehfauzy&amp;diff=55558"/>
				<updated>2009-02-26T19:43:57Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: New page: Mike Fauzy is a CISSP and Sr. Security Engineer at Aspect Security. He has a background in JEE architecture/development, web application security testing and application security risk mana...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Mike Fauzy is a CISSP and Sr. Security Engineer at Aspect Security. He has a background in JEE architecture/development, web application security testing and application security risk management. He has built 2 application security organizations and helped lead another. He is currently leading OWASP's ESAPI Access Control 2.0.&lt;br /&gt;
&lt;br /&gt;
He lives in Sacramento, CA where he enjoys swing dancing, hiking and road trips.&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=File:API_Design.docx&amp;diff=48362</id>
		<title>File:API Design.docx</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=File:API_Design.docx&amp;diff=48362"/>
				<updated>2008-12-11T14:35:47Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: uploaded a new version of &amp;quot;Image:API Design.docx&amp;quot;: Completed Stateful implication.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Two strawman ideas on how the API can be designed and some of the implications to start a discussion.&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=File:API_Design.docx&amp;diff=48353</id>
		<title>File:API Design.docx</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=File:API_Design.docx&amp;diff=48353"/>
				<updated>2008-12-11T14:26:39Z</updated>
		
		<summary type="html">&lt;p&gt;Mikehfauzy: Two strawman ideas on how the API can be designed and some of the implications to start a discussion.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Two strawman ideas on how the API can be designed and some of the implications to start a discussion.&lt;/div&gt;</summary>
		<author><name>Mikehfauzy</name></author>	</entry>

	</feed>