Package org.jboss.security.plugins.authorization

Examples of org.jboss.security.plugins.authorization.JBossAuthorizationContext


      assertEquals(AuthorizationContext.PERMIT, result);
   }
  
   public void testInvalidWebAccess() throws Exception
   {
      AuthorizationContext ac = new JBossAuthorizationContext("test",
            new Subject(), new AppCallbackHandler("a","b".toCharArray()));
      int result = ac.authorize(webResource, new Subject(),
            SecurityTestUtil.getRoleGroup(new String[]{"roleA"}));
      assertEquals(AuthorizationContext.PERMIT, result);
   }
View Full Code Here


   {
      lock.lock();
      try
      {
         if(this.authorizationContext == null)
            this.authorizationContext = new JBossAuthorizationContext(this.securityDomain);
         return this.authorizationContext.authorize(resource, subject, role);
      }
      finally
      {
         lock.unlock();
View Full Code Here

      catch (PolicyContextException e)
      {
         log.error("Error obtaining AuthenticatedSubject:",e);
      }
      if(this.authorizationContext == null)
         this.authorizationContext = new JBossAuthorizationContext(this.securityDomain,subject,
                                          this.callbackHandler );
      return this.authorizationContext.authorize(resource);
  
View Full Code Here

/*     */     catch (PolicyContextException e)
/*     */     {
/* 112 */       log.error("Error obtaining AuthenticatedSubject:", e);
/*     */     }
/* 114 */     if (this.authorizationContext == null) {
/* 115 */       this.authorizationContext = new JBossAuthorizationContext(this.securityDomain, subject, this.callbackHandler);
/*     */     }
/* 117 */     return this.authorizationContext.authorize(resource);
/*     */   }
View Full Code Here

   {
      lock.lock();
      try
      {
         if(this.authorizationContext == null)
            this.authorizationContext = new JBossAuthorizationContext(this.securityDomain);
         return this.authorizationContext.authorize(resource, subject, role);
      }
      finally
      {
         lock.unlock();
View Full Code Here

      ejbResource.setEjbName("TestEJB");
      ejbResource.setEjbMethod(DummyClass.class.getMethod("someMethod", new Class[0]));
      ejbResource.setEjbMethodInterface("void someMethod");
      ejbResource.setEjbMethodRoles(SecurityTestUtil.getRoleGroup(new String[]{"roleA", "roleC"}));     
     
      AuthorizationContext ac = new JBossAuthorizationContext("test",
            new AppCallbackHandler("a","b".toCharArray()));
      int result = ac.authorize(ejbResource, new Subject(), principalRole);
      assertEquals(AuthorizationContext.PERMIT, result)
   }
View Full Code Here

      ejbResource.setEjbName("TestEJB");
      ejbResource.setEjbMethod(DummyClass.class.getMethod("someMethod", new Class[0]));
      ejbResource.setEjbMethodInterface("void someMethod");
      ejbResource.setEjbMethodRoles(SecurityTestUtil.getRoleGroup(new String[]{"roleA", "roleC"}));
     
      AuthorizationContext ac = new JBossAuthorizationContext("test",
             new AppCallbackHandler("a","b".toCharArray()));
      try
      {
         ac.authorize(ejbResource, new Subject(), principalRole);
         fail("Should have failed");
      }
      catch(AuthorizationException ignore)
      {  
      }
View Full Code Here

      ejbResource.setSecurityRoleReferences(roleRefSet);
     
      cmap.put(ResourceKeys.ROLEREF_PERM_CHECK, Boolean.TRUE);
      cmap.put(ResourceKeys.ROLENAME, "roleLink");
     
      AuthorizationContext ac = new JBossAuthorizationContext("test",
            new AppCallbackHandler("a","b".toCharArray()));
      int result = ac.authorize(ejbResource, new Subject(), principalRole);
      assertEquals(AuthorizationContext.PERMIT, result);
   }
View Full Code Here

   private int getResult(String policyName) throws Exception
   {
      int result = AuthorizationContext.DENY;

      JBossAuthorizationContext aContext = new JBossAuthorizationContext(policyName,
            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

      assertEquals(AuthorizationContext.PERMIT, jam.authorize(testResource, subject, getRoleGroup()));
   }
    
   private AuthorizationContext getTestAuthorizationContext(String name,Subject subject)
   {
      JBossAuthorizationContext jac = new JBossAuthorizationContext(name,subject,
            new AppCallbackHandler("anil", "anilpass".toCharArray()));
      jac.setApplicationPolicy(getTestApplicationPolicy());
      return jac;
   }
View Full Code Here

TOP

Related Classes of org.jboss.security.plugins.authorization.JBossAuthorizationContext

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.