Package org.jboss.security.authorization

Examples of org.jboss.security.authorization.Resource


            new Subject(),
            new TestCallbackHandler());
      aContext.setApplicationPolicy(policyConfig.get(policyName));
      try
      {
         result =  aContext.authorize(new Resource()
         {
            public ResourceType getLayer()
            {
               return ResourceType.WEB;
            }
View Full Code Here


            new Subject(),
            new TestCallbackHandler());
      aContext.setApplicationPolicy(policyConfig.get(policyName));
      try
      {
         result =  aContext.authorize(new Resource()
         {
            public ResourceType getLayer()
            {
               return ResourceType.WEB;
            }
View Full Code Here

   {
      ACL acl = this.strategy.getACL(resource);
      // if no ACL was found, try to find a parent ACL.
      if (acl == null)
      {
         Resource parent = (Resource) resource.getMap().get(ResourceKeys.PARENT_RESOURCE);
         if (parent != null)
            return getInitialPermissions(parent, identity);
         // no ACL was found and no parent resource exists - identity has all permissions as resource is not protected.
         return new CompositeACLPermission(BasicACLPermission.values());
      }
View Full Code Here

   {
      ACL acl = this.strategy.getACL(resource);
      // if no ACL was found, try to find a parent ACL.
      if (acl == null)
      {
         Resource parent = (Resource) resource.getMap().get(ResourceKeys.PARENT_RESOURCE);
         if (parent != null)
            return getInitialPermissions(parent, identityName);
         // no ACL was found and no parent resource exists - identity has all permissions as resource is not protected.
         return new CompositeACLPermission(BasicACLPermission.values());
      }
View Full Code Here

    *
    * @throws Exception if an error occurs while running the test.
    */
   public void testGetEntitlements() throws Exception
   {
      Resource resource1 = new ACLTestResource(10);
      Resource resource2 = new ACLTestResource(20);
      // for testing purposes, lets say resource2 is a child of resource1.
      Collection<Resource> childResources = new ArrayList<Resource>();
      // resource 1 has resource 2 as child.
      childResources.add(resource2);
      resource1.getMap().put(ResourceKeys.CHILD_RESOURCES, childResources);
      resource2.getMap().put(ResourceKeys.PARENT_RESOURCE, resource1);

      // using the authorization manager, check the entitlements assigned to some of the identities.
      JBossAuthorizationManager jam = new JBossAuthorizationManager("test-acl");

      // start with the Administrator identity.
View Full Code Here

    *
    * @throws Exception if an error occurs while running the test.
    */
   public void testAuthorize() throws Exception
   {
      Resource resource1 = new ACLTestResource(10);
      Resource resource2 = new ACLTestResource(20);

      // using the authorization manager, check if the identities have the expected permissions.
      JBossAuthorizationManager jam = new JBossAuthorizationManager("test-acl");

      // check that Administrator has all permissions on both resources.
View Full Code Here

            new Subject(),
            new TestCallbackHandler());
      aContext.setApplicationPolicy(policyConfig.get(policyName));
      try
      {
         result =  aContext.authorize(new Resource()
         {
            public ResourceType getLayer()
            {
               return ResourceType.WEB;
            }
View Full Code Here

      Subject subject = new Subject();
      subject.getPrincipals().add(new SimplePrincipal("anil"));
      jam.setAuthorizationContext(getTestAuthorizationContext("test", subject));
     
      final HashMap<String, Object> cmap = new HashMap<String,Object>();
      Resource testResource = new Resource()
      {
         public ResourceType getLayer()
         {
            return ResourceType.WEB;
         }
View Full Code Here

TOP

Related Classes of org.jboss.security.authorization.Resource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.