Package org.jboss.security.plugins

Examples of org.jboss.security.plugins.JBossSecurityContext


   }
  
   public void testLoginConfigStackHolder() throws Exception
   {
      String securityDomain = "conf-jaspi";
      JBossSecurityContext jsc = new JBossSecurityContext(securityDomain);
      SecurityContextAssociation.setSecurityContext(jsc);

      String configFile = "config/jaspi-config.xml";
      loadConfig(configFile);
     
View Full Code Here


  
   protected JBossSecurityContext getSC(String domain)
   {
      if(domain == null)
         domain = securityDomain;
      return new JBossSecurityContext(securityDomain);
   }
View Full Code Here

  
   public void testSubjectInfo()
   {
      Subject sub = new Subject();
     
      JBossSecurityContext sc = getSC(securityDomain);
      assertNotNull("SubjectInfo is not null", sc.getSubjectInfo());
      sc.getUtil().createSubjectInfo(principal, cred, sub);
      
      assertEquals("Subject is equal",sc.getSubjectInfo().getAuthenticatedSubject(),sub);
      assertEquals("Principal is equal",sc.getUtil().getUserPrincipal(),principal);
      assertEquals("Credential is equal",sc.getUtil().getCredential(),cred);
   }
View Full Code Here

      assertEquals("Credential is equal",sc.getUtil().getCredential(),cred);
   }
  
   public void testMappingContext()
   {  
      JBossSecurityContext sc = getSC(securityDomain);
      ISecurityManagement ism = sc.getSecurityManagement();
      assertNotNull("Security Management is not null", ism);
      MappingContext<RoleGroup> mc = sc.getMappingManager().getMappingContext(RoleGroup.class);
      assertNotNull("Mapping Context is not null", mc);
      List<?> modules = mc.getModules();
      assertNotNull("Mapping modules not null", modules);
      assertEquals("Module size == 1", modules.size(),1);
      assertTrue("Deployment Roles Provider is present",
View Full Code Here

      assertTrue("Instance of TestSecurityContext", sc instanceof TestSecurityContext);     
   }
  
   public void testManagersFromJBossSecurityContext() throws Exception
   {
      JBossSecurityContext sc = this.getSC("other");
      ISecurityManagement ism = sc.getSecurityManagement();
      assertNotNull("Security Management is not null", ism);
      AuthenticationManager authManager = sc.getAuthenticationManager();
      assertNotNull("AuthenticationManager is not null", authManager);
      AuthorizationManager authorizationMgr = sc.getAuthorizationManager();
      assertNotNull("AuthorizationManager is not null", authorizationMgr);
      AuditManager auditManager = sc.getAuditManager();
      assertNotNull("AuditManager is not null", auditManager);
      IdentityTrustManager itm = sc.getIdentityTrustManager();
      assertNotNull("IdentityTrustManager is not null", itm);
   }
View Full Code Here

      assertNotNull("IdentityTrustManager is not null", itm);
   }
  
   public void testRoles()
   {
      JBossSecurityContext sc = this.getSC("other");
      SimpleRoleGroup roleGroup = new SimpleRoleGroup("Roles");
      roleGroup.addRole(new SimpleRole("testRole"));
      sc.getUtil().setRoles(roleGroup);
     
      //Retrieve the roles
      RoleGroup scRoles = sc.getUtil().getRoles();
      assertNotNull(scRoles);
      assertTrue(scRoles.containsAll(new SimpleRole("testRole")));
   }
View Full Code Here

   }
  
   //Validates JBossSecurityContext is serializable
   public void testJBossSecurityContextSerialization() throws Exception
   {
      JBossSecurityContext jsc = new JBossSecurityContext("other");
     
      // Serialize to a byte array
      ByteArrayOutputStream bos = new ByteArrayOutputStream() ;
      ObjectOutputStream out = new ObjectOutputStream(bos) ;
      out.writeObject(jsc);
      out.close();
    
      //Deserialize from a byte array
      JBossSecurityContext otherSC = null;
      ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray()));
      otherSC = (JBossSecurityContext) in.readObject();
      in.close();
      assertNotNull("The deserialized security context is not null:", otherSC);
      assertEquals("other", otherSC.getSecurityDomain());
   }
View Full Code Here

   @Override
   protected void setUp() throws Exception
   {
      super.setUp();
      JBossSecurityContext jsc = new JBossSecurityContext(securityDomain);
      SecurityContextAssociation.setSecurityContext(jsc);
      establishSecurityConfiguration();
   }
View Full Code Here

        RequestSecurityToken request = new RequestSecurityToken();
        request.setLifetime(WSTrustUtil.createDefaultLifetime(3600000));
        request.setAppliesTo(WSTrustUtil.createAppliesTo("http://services.testcorp.org/provider2"));
        request.setTokenType(URI.create(SAMLUtil.SAML2_TOKEN_TYPE));

        SecurityContext securityContext = new JBossSecurityContext("jmx-console");
        SecurityContextAssociation.setSecurityContext(securityContext);

        Principal principal = new SimplePrincipal("bmozaffa");
        SimpleGroup group = new SimpleGroup(SAML20TokenRoleAttributeProvider.JBOSS_ROLE_PRINCIPAL_NAME);
        group.addMember(new SimplePrincipal("myTestRole"));
View Full Code Here

TOP

Related Classes of org.jboss.security.plugins.JBossSecurityContext

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.