Package org.apache.jackrabbit.core.security.principal

Examples of org.apache.jackrabbit.core.security.principal.ProviderRegistryImpl


        // most simple principal provider registry, that does not read anything
        // from configuration
        PrincipalProvider principalProvider = new SimplePrincipalProvider();
        // skip init of provider (nop)
        principalProviderRegistry = new ProviderRegistryImpl(principalProvider);
        // register all configured principal providers.
        for (Properties aModuleConfig : moduleConfig) {
            principalProviderRegistry.registerProvider(aModuleConfig);
        }
View Full Code Here


        // initialize principal-provider registry
        // 1) create default
        PrincipalProvider defaultPP = createDefaultPrincipalProvider();
        // 2) create registry instance
        principalProviderRegistry = new ProviderRegistryImpl(defaultPP);
        // 3) register all configured principal providers.
        for (Properties props : moduleConfig) {
            principalProviderRegistry.registerProvider(props);
        }
View Full Code Here

    private static final String APP_NAME = LoginModuleTest.class.getName();

    public void testMultipleModules() throws Exception {

        CallbackHandler ch = new CallbackHandlerImpl(new SimpleCredentials("user", "pass".toCharArray()),
                superuser, new ProviderRegistryImpl(new FallbackPrincipalProvider()),
                "admin", "anonymous");
        LoginContext context = new LoginContext(
                APP_NAME, new Subject(), ch, new TestConfiguration());
        context.login();
        assertFalse("no principal set", context.getSubject().getPrincipals().isEmpty());
View Full Code Here

        }
    }

    private AuthContext getAuthContext(Credentials creds, String config) throws RepositoryException {
        CallbackHandler ch = new CallbackHandlerImpl(creds,
                securitySession, new ProviderRegistryImpl(new FallbackPrincipalProvider()),
                "admin", "anonymous");
        return new LocalAuthContext(getLoginModuleConfig(config), ch, null);
    }
View Full Code Here

        return new LocalAuthContext(getLoginModuleConfig(config), ch, null);
    }

    private AuthContext getJAASAuthContext(Credentials creds, String appName) {
        CallbackHandler ch = new CallbackHandlerImpl(creds,
                securitySession, new ProviderRegistryImpl(new FallbackPrincipalProvider()),
                "admin", "anonymous");
        return new JAASAuthContext(appName, ch, null);
    }
View Full Code Here

    /**
     *
     * @throws Exception
     */
    public void testPrincipalProviderConfig() throws Exception {
        PrincipalProviderRegistry ppr = new ProviderRegistryImpl(null);

        // standard config
        Element xml = parseXML(new InputSource(new StringReader(PRINCIPAL_PROVIDER_CONFIG)), true);
        LoginModuleConfig lmc = parser.parseSecurityConfig(xml).getLoginModuleConfig();       
        PrincipalProvider pp = ppr.registerProvider(lmc.getParameters());
        assertEquals(pp, ppr.getProvider(pp.getClass().getName()));
        assertEquals("org.apache.jackrabbit.core.security.principal.FallbackPrincipalProvider", pp.getClass().getName());

        // config specifying an extra name
        xml = parseXML(new InputSource(new StringReader(PRINCIPAL_PROVIDER_CONFIG1)), true);
        lmc = parser.parseSecurityConfig(xml).getLoginModuleConfig();
        pp = ppr.registerProvider(lmc.getParameters());
        assertEquals(pp, ppr.getProvider("test"));
        assertEquals("org.apache.jackrabbit.core.security.principal.FallbackPrincipalProvider", pp.getClass().getName());

        // use alternative class config
        xml = parseXML(new InputSource(new StringReader(PRINCIPAL_PROVIDER_CONFIG2)), true);
        lmc = parser.parseSecurityConfig(xml).getLoginModuleConfig();
        pp = ppr.registerProvider(lmc.getParameters());
        assertEquals(pp, ppr.getProvider("test2"));
        assertEquals("org.apache.jackrabbit.core.security.principal.FallbackPrincipalProvider", pp.getClass().getName());

        // all 3 providers must be registered despite the fact the all configs
        // specify the same provider class
        assertEquals(3, ppr.getProviders().length);

    }
View Full Code Here

        // initialize principal-provider registry
        // 1) create default
        PrincipalProvider defaultPP = new DefaultPrincipalProvider(securitySession, (UserManagerImpl) systemUserManager);
        defaultPP.init(new Properties());
        // 2) create registry instance
        principalProviderRegistry = new ProviderRegistryImpl(defaultPP);
        // 3) register all configured principal providers.
        for (Properties props : moduleConfig) {
            principalProviderRegistry.registerProvider(props);
        }
View Full Code Here

        // initialize principal-provider registry
        // 1) create default
        PrincipalProvider defaultPP = createDefaultPrincipalProvider();
        // 2) create registry instance
        principalProviderRegistry = new ProviderRegistryImpl(defaultPP);
        // 3) register all configured principal providers.
        for (Properties props : moduleConfig) {
            principalProviderRegistry.registerProvider(props);
        }
View Full Code Here

        // most simple principal provider registry, that does not read anything
        // from configuration
        PrincipalProvider principalProvider = new SimplePrincipalProvider();
        // skip init of provider (nop)
        principalProviderRegistry = new ProviderRegistryImpl(principalProvider);
        // register all configured principal providers.
        for (int i = 0; i < moduleConfig.length; i++) {
            principalProviderRegistry.registerProvider(moduleConfig[i]);
        }
View Full Code Here

        // initialize principa-provider registry
        // 1) create default
        PrincipalProvider defaultPP = new DefaultPrincipalProvider(securitySession, (UserManagerImpl) systemUserManager);
        defaultPP.init(new Properties());
        // 2) create registry instance
        principalProviderRegistry = new ProviderRegistryImpl(defaultPP);
        // 3) register all configured principal providers.
        for (int i = 0; i < moduleConfig.length; i++) {
            principalProviderRegistry.registerProvider(moduleConfig[i]);
        }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.security.principal.ProviderRegistryImpl

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.