Examples of EJBResource


Examples of org.jboss.security.authorization.resources.EJBResource

      RoleGroup principalRole = SecurityTestUtil.getRoleGroup(new String[] {"roleA"});
     
      //Create a ContextMap
      Map<String,Object> cmap = new HashMap<String,Object>();  
     
      EJBResource ejbResource = new EJBResource(cmap);
      ejbResource.setPrincipal(new SimplePrincipal("AuthenticatedPrincipal"));
      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

Examples of org.jboss.security.authorization.resources.EJBResource

      RoleGroup principalRole = SecurityTestUtil.getRoleGroup(new String[] {"badRole"});
      
      //Create a ContextMap
      Map<String,Object> cmap = new HashMap<String,Object>()
     
      EJBResource ejbResource = new EJBResource(cmap);
      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
      {
View Full Code Here

Examples of org.jboss.security.authorization.resources.EJBResource

      RoleGroup principalRole = SecurityTestUtil.getRoleGroup(new String[] {"roleA"});
     
      //Create a ContextMap
      Map<String,Object> cmap = new HashMap<String,Object>()
     
      EJBResource ejbResource = new EJBResource(cmap);
      ejbResource.setEjbName("TestEJB");
      ejbResource.setEjbMethod(DummyClass.class.getMethod("someMethod", new Class[0]));
      ejbResource.setEjbMethodInterface("void someMethod");
      ejbResource.setEjbMethodRoles(SecurityTestUtil.getRoleGroup(new String[]{"roleA"}));
      //For Security Role Refs, we check that there is a principal
      ejbResource.setPrincipal(new SimplePrincipal("SomePrincipal"));
    
      //Additional entries needed for role ref
      Set<SecurityRoleRef> roleRefSet = new HashSet<SecurityRoleRef>();
      SecurityRoleRef srr = new SecurityRoleRef( "roleLink", "roleA", "something");
      roleRefSet.add(srr);
      ejbResource.setSecurityRoleReferences(roleRefSet);
     
      cmap.put(ResourceKeys.ROLEREF_PERM_CHECK, Boolean.TRUE);
      cmap.put(ResourceKeys.ROLENAME, "roleLink");
     
      AuthorizationContext ac = new JBossAuthorizationContext("test",
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.