Search in sources :

Example 1 with DefaultSecurityManager

use of org.apache.jackrabbit.core.DefaultSecurityManager in project jackrabbit by apache.

the class SecurityConfigTest method testConfig2.

public void testConfig2() throws ConfigurationException {
    Element xml = parseXML(new InputSource(new StringReader(CONFIG_2)), true);
    SecurityConfig config = parser.parseSecurityConfig(xml);
    assertNotNull(config.getAppName());
    assertEquals("Jackrabbit", config.getAppName());
    SecurityManagerConfig smc = config.getSecurityManagerConfig();
    assertNotNull(smc);
    assertTrue(smc.newInstance(JackrabbitSecurityManager.class) instanceof DefaultSecurityManager);
    assertNull(smc.getWorkspaceAccessConfig());
    assertEquals("security", smc.getWorkspaceName());
    assertNull(smc.getUserManagerConfig());
    AccessManagerConfig amc = config.getAccessManagerConfig();
    assertNotNull(amc);
    assertTrue(amc.newInstance(AccessManager.class) instanceof DefaultAccessManager);
    LoginModuleConfig lmc = config.getLoginModuleConfig();
    assertNotNull(lmc);
    assertTrue(lmc.getLoginModule() instanceof DefaultLoginModule);
    Properties options = lmc.getParameters();
    assertNotNull(options);
    assertEquals("anonymous", options.getProperty("anonymousId"));
    assertEquals("admin", options.getProperty("adminId"));
    assertEquals("org.apache.jackrabbit.TestPrincipalProvider", options.getProperty("principalProvider"));
}
Also used : InputSource(org.xml.sax.InputSource) Element(org.w3c.dom.Element) StringReader(java.io.StringReader) DefaultSecurityManager(org.apache.jackrabbit.core.DefaultSecurityManager) DefaultLoginModule(org.apache.jackrabbit.core.security.authentication.DefaultLoginModule) Properties(java.util.Properties) DefaultAccessManager(org.apache.jackrabbit.core.security.DefaultAccessManager)

Aggregations

StringReader (java.io.StringReader)1 Properties (java.util.Properties)1 DefaultSecurityManager (org.apache.jackrabbit.core.DefaultSecurityManager)1 DefaultAccessManager (org.apache.jackrabbit.core.security.DefaultAccessManager)1 DefaultLoginModule (org.apache.jackrabbit.core.security.authentication.DefaultLoginModule)1 Element (org.w3c.dom.Element)1 InputSource (org.xml.sax.InputSource)1