assertEquals("dummy=dr", "dr", itieOptions.get("dummy"));
}
public void testApplicationPolicyExtension()
{
ApplicationPolicy completeConfig = config.get("conf-jaas-extend");
assertNotNull("conf-jaas-extend is not null", completeConfig);
BaseAuthenticationInfo bai = completeConfig.getAuthenticationInfo();
assertNotNull("BaseAuthenticationInfo is not null", bai);
assertEquals("3 login modules", 3, bai.getModuleEntries().size());
// Authorization
AuthorizationInfo azi = completeConfig.getAuthorizationInfo();
assertNotNull("AuthorizationInfo is not null", azi);
assertEquals("3 authz modules", 3, azi.getModuleEntries().size());
// ACL
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
AuditInfo ai = completeConfig.getAuditInfo();
assertNotNull("AuditInfo", ai);
AuditProviderEntry[] apelist = ai.getAuditProviderEntry();
assertEquals("Audit entry length=1", 1, apelist.length);
// Identity Trust
IdentityTrustInfo iti = completeConfig.getIdentityTrustInfo();
assertNotNull("IdentityTrustInfo", iti);
IdentityTrustModuleEntry[] itilist = iti.getIdentityTrustModuleEntry();
assertEquals("IdentityTrustModuleEntry length=1", 1, itilist.length);
// JASPI authentication policy extension
ApplicationPolicy jaspiPolicy = config.get("conf-jaspi-extend");
assertNotNull("Unexpected null conf-jaspi-extend application policy", jaspiPolicy);
BaseAuthenticationInfo authInfo = jaspiPolicy.getAuthenticationInfo();
assertNotNull("Unexpected null jaspi configuration", authInfo);
List<?> entries = authInfo.getModuleEntries();
assertEquals("Invalid number of auth modules", 3, entries.size());
}