Package org.jboss.security.config

Examples of org.jboss.security.config.MappingInfo


      Assert.assertEquals("value3", options.get("aclOption3"));
      Assert.assertTrue("Option aclOption4 was not found", options.containsKey("aclOption4"));
      Assert.assertEquals("value4", options.get("aclOption4"));

      // Mapping
      MappingInfo mappingInfo = completeConfig.getMappingInfo(MappingType.PRINCIPAL.toString());
      assertNotNull("MappingInfo is not null", mappingInfo);
      MappingModuleEntry[] mappingEntries = mappingInfo.getMappingModuleEntry();
      assertEquals("Invalid number of entries", 1, mappingEntries.length);
      MappingModuleEntry mappingEntry = mappingEntries[0];
      assertEquals("org.jboss.test.mapping.MappingModule1", mappingEntry.getMappingModuleName());
      Map<String, ?> mappingOptions = mappingEntry.getOptions();
      assertEquals("Invalid number of options", 1, mappingOptions.size());
      Assert.assertTrue("Option option1 was not found", mappingOptions.containsKey("option1"));
      assertEquals("value1", mappingOptions.get("option1"));

      // Role Mapping
      mappingInfo = completeConfig.getMappingInfo(MappingType.ROLE.toString());
      assertNotNull("MappingInfo is not null", mappingInfo);
      MappingModuleEntry[] mmearr = mappingInfo.getMappingModuleEntry();
      assertEquals("Mapping entry length=1", 1, mmearr.length);
      MappingModuleEntry mme = mmearr[0];
      assertEquals("TestMappingModule", "org.jboss.test.TestMappingModule", mme.getMappingModuleName());
      Map<String, ?> mmOptions = mme.getOptions();
      assertEquals("Number of options = 2", 2, mmOptions.size());
View Full Code Here


      ACLInfo aclInfo = completeConfig.getAclInfo();
      assertNotNull("Unexpected null ACLInfo", aclInfo);
      assertEquals("Unexpected number of acl modules", 3, aclInfo.getModuleEntries().size());

      // Role Mapping
      MappingInfo mappingInfo = completeConfig.getMappingInfo(MappingType.ROLE.toString());
      assertNotNull("MappingInfo is not null", mappingInfo);
      // we expect 2 modules because one has been configured as a mapping of type "role"
      assertEquals("2 map modules", 2, mappingInfo.getModuleEntries().size());

      // Mapping
      mappingInfo = completeConfig.getMappingInfo(MappingType.PRINCIPAL.toString());
      assertNotNull("MappingInfo is not null", mappingInfo);
      MappingModuleEntry[] mappingEntries = mappingInfo.getMappingModuleEntry();
      assertEquals("Invalid number of entries", 2, mappingEntries.length);
      assertEquals("org.jboss.test.mapping.MappingModule1", mappingEntries[0].getMappingModuleName());
      assertEquals("org.jboss.test.mapping.MappingModule3", mappingEntries[1].getMappingModuleName());
      // same test as above: we expect 2 role-mapping modules: 1 from rolemapping and 1 from mapping with type "role".
      mappingInfo = completeConfig.getMappingInfo(MappingType.ROLE.toString());
      assertNotNull("MappingInfo is not null", mappingInfo);
      mappingEntries = mappingInfo.getMappingModuleEntry();
      assertEquals("Invalid number of entries", 2, mappingEntries.length);
      assertEquals("org.jboss.test.TestMappingModule", mappingEntries[0].getMappingModuleName());
      assertEquals("org.jboss.test.mapping.MappingModule2", mappingEntries[1].getMappingModuleName());

      // Audit
View Full Code Here

      if(aPolicy == null )
         throw new IllegalStateException("Application Policy is null for the security domain:"
               + securityDomain);
     
      MappingContext<T> mc = null;
      MappingInfo rmi = aPolicy.getMappingInfo(mappingType)

      if( rmi != null)
         mc = generateMappingContext(mc, rmi);
     
      return mc;
View Full Code Here

      if(aPolicy == null )
         throw new IllegalStateException("Application Policy is null for the security domain:"
               + securityDomain);
     
      MappingContext<T> mc = null;
      MappingInfo rmi = aPolicy.getMappingInfo(mappingType);
      if( rmi != null)
        mc = generateMappingContext(mc, rmi);
     
      return mc;
   }
View Full Code Here

  
   public void testX509() throws Exception
  
      ApplicationPolicy ap = SecurityConfiguration.getApplicationPolicy("test");
      MappingModuleEntry mme = new MappingModuleEntry(SubjectDNMapper.class.getName());
      MappingInfo principalMappingInfo = new MappingInfo();
      principalMappingInfo.add(mme);
      ap.setPrincipalMappingInfo(principalMappingInfo);
    
      String issuerDN = "CN=Fedora,OU=JBoss,O=Red Hat,C=US";
      String subjectDN = "CN=Anil,OU=JBoss,O=Red Hat,C=US";
     
View Full Code Here

      mme.add(new ModuleOption("baseFilter","(uid={0})"));
      mme.add(new ModuleOption("java.naming.provider.url", "ldap://" + serverHost  + ":" + port));
      mme.add(new ModuleOption("baseCtxDN", "ou=People,dc=jboss,dc=org"));
      mme.add(new ModuleOption("attributeList", attributeList));

      MappingInfo attributeMappingInfo = new MappingInfo();
      attributeMappingInfo.add(mme);
      ap.setMappingInfo(MappingType.ATTRIBUTE.name(),attributeMappingInfo);
     
      SecurityContext sc = SecurityContextFactory.createSecurityContext("test");
      MappingManager mm = sc.getMappingManager();
      assertNotNull("MappingManager != null", mm);
View Full Code Here

        node = operation.get(Element.MAPPING.getLocalName());
        if (node.isDefined()) {
            modules = node.asList();
            String mappingType = null;
            for (ModelNode module : modules) {
                MappingInfo mappingInfo = new MappingInfo(securityDomain);
                String codeName = module.require(Attribute.CODE.getLocalName()).asString();
                if (module.hasDefined(Attribute.TYPE.getLocalName()))
                    mappingType = module.get(Attribute.TYPE.getLocalName()).asString();
                else
                    mappingType = MappingType.ROLE.toString();
                Map<String, Object> options = new HashMap<String, Object>();
                if (module.hasDefined(MODULE_OPTIONS)) {
                    for (Property prop : module.get(MODULE_OPTIONS).asPropertyList()) {
                        options.put(prop.getName(), prop.getValue().asString());
                    }
                }
                MappingModuleEntry entry = new MappingModuleEntry(codeName, options, mappingType);
                mappingInfo.add(entry);
                applicationPolicy.setMappingInfo(mappingType, mappingInfo);
            }
        }

        // authentication-jaspi
View Full Code Here

         child = new AuthorizationInfo(aPolicy.getName())
      }
      else
         if(child == null && "rolemapping".equals(localName))
         {
            MappingInfo mi = new MappingInfo();
            mi.setName(aPolicy.getName());
            child = mi; 
         }
         else
            if(child == null && "audit".equals(localName))
            {
View Full Code Here

            if (applicationPolicy == null)
                applicationPolicy = new ApplicationPolicy(securityDomain);
            modules = node.asList();
            String mappingType = null;
            for (ModelNode module : modules) {
                MappingInfo mappingInfo = new MappingInfo(securityDomain);
                String codeName = module.require(CODE).asString();
                if (ModulesMap.MAPPING_MAP.containsKey(codeName))
                    codeName = ModulesMap.MAPPING_MAP.get(codeName);
                if (module.hasDefined(TYPE))
                    mappingType = module.get(TYPE).asString();
                else
                    mappingType = MappingType.ROLE.toString();
                Map<String, Object> options = new HashMap<String, Object>();
                if (module.hasDefined(MODULE_OPTIONS)) {
                    for (Property prop : module.get(MODULE_OPTIONS).asPropertyList()) {
                        options.put(prop.getName(), prop.getValue().asString());
                    }
                }
                MappingModuleEntry entry = new MappingModuleEntry(codeName, options, mappingType);
                mappingInfo.add(entry);
                applicationPolicy.setMappingInfo(mappingType, mappingInfo);
            }
        }

        // authentication-jaspi
View Full Code Here

        node = operation.get(Element.MAPPING.getLocalName());
        if (node.isDefined()) {
            modules = node.asList();
            String mappingType = null;
            for (ModelNode module : modules) {
                MappingInfo mappingInfo = new MappingInfo(securityDomain);
                String codeName = module.require(Attribute.CODE.getLocalName()).asString();
                if (module.hasDefined(Attribute.TYPE.getLocalName()))
                    mappingType = module.get(Attribute.TYPE.getLocalName()).asString();
                else
                    mappingType = MappingType.ROLE.toString();
                Map<String, Object> options = new HashMap<String, Object>();
                if (module.hasDefined(MODULE_OPTIONS)) {
                    for (Property prop : module.get(MODULE_OPTIONS).asPropertyList()) {
                        options.put(prop.getName(), prop.getValue().asString());
                    }
                }
                MappingModuleEntry entry = new MappingModuleEntry(codeName, options, mappingType);
                mappingInfo.add(entry);
                applicationPolicy.setMappingInfo(mappingType, mappingInfo);
            }
        }

        // authentication-jaspi
View Full Code Here

TOP

Related Classes of org.jboss.security.config.MappingInfo

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.