Examples of PrincipalProvider


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

        public PrincipalProvider getDefault() {
            return defaultPrincipalProvider;
        }

        public PrincipalProvider getProvider(String className) {
            PrincipalProvider p = getPrincipalProviderRegistry().getProvider(className);
            if (p == null && defaultPrincipalProvider.getClass().getName().equals(className)) {
                p = defaultPrincipalProvider;
            }
            return p;
        }
View Full Code Here

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

        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

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

        }
        workspaceAccessManager.init(securitySession);

        // 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

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

                    systemSession = repo.getSystemSession(wspName);
                    // TODO: review again... this workaround is used in several places.
                    repo.markWorkspaceActive(wspName);
                }

                PrincipalProvider defaultPP = new DefaultPrincipalProvider(systemSession, (UserManagerImpl) getUserManager(systemSession));
                defaultPP.init(new Properties());

                p = new WorkspaceBasedPrincipalProviderRegistry(defaultPP);
                ppRegistries.put(wspName, p);
            }
            return p;
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.principal.PrincipalProvider

    //---------------------------------------------< PrincipalConfiguration >---
    @Nonnull
    @Override
    public PrincipalManager getPrincipalManager(Root root, NamePathMapper namePathMapper) {
        PrincipalProvider principalProvider = getPrincipalProvider(root, namePathMapper);
        return new PrincipalManagerImpl(principalProvider);
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.principal.PrincipalProvider

     *
     * @return A instance of {@code PrincipalProvider} or {@code null}.
     */
    @CheckForNull
    protected PrincipalProvider getPrincipalProvider() {
        PrincipalProvider principalProvider = null;
        SecurityProvider sp = getSecurityProvider();
        Root r = getRoot();
        if (r != null && sp != null) {
            PrincipalConfiguration pc = sp.getConfiguration(PrincipalConfiguration.class);
            principalProvider = pc.getPrincipalProvider(r, NamePathMapper.DEFAULT);
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.principal.PrincipalProvider

     * @return The set of principals associated with the given {@code userId}.
     * @see #getPrincipalProvider()
     */
    @Nonnull
    protected Set<? extends Principal> getPrincipals(String userId) {
        PrincipalProvider principalProvider = getPrincipalProvider();
        if (principalProvider == null) {
            log.debug("Cannot retrieve principals. No principal provider configured.");
            return Collections.emptySet();
        } else {
            return principalProvider.getPrincipals(userId);
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.principal.PrincipalProvider

     *
     * @return A instance of {@code PrincipalProvider} or {@code null}.
     */
    @CheckForNull
    protected PrincipalProvider getPrincipalProvider() {
        PrincipalProvider principalProvider = null;
        SecurityProvider sp = getSecurityProvider();
        Root root = getRoot();
        if (root != null && sp != null) {
            PrincipalConfiguration pc = sp.getConfiguration(PrincipalConfiguration.class);
            principalProvider = pc.getPrincipalProvider(root, NamePathMapper.DEFAULT);
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.principal.PrincipalProvider

     * @return The set of principals associated with the given {@code userId}.
     * @see #getPrincipalProvider()
     */
    @Nonnull
    protected Set<? extends Principal> getPrincipals(String userId) {
        PrincipalProvider principalProvider = getPrincipalProvider();
        if (principalProvider == null) {
            log.debug("Cannot retrieve principals. No principal provider configured.");
            return Collections.emptySet();
        } else {
            return principalProvider.getPrincipals(userId);
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.principal.PrincipalProvider

    //---------------------------------------------< PrincipalConfiguration >---
    @Nonnull
    @Override
    public PrincipalManager getPrincipalManager(Root root, NamePathMapper namePathMapper) {
        PrincipalProvider principalProvider = getPrincipalProvider(root, namePathMapper);
        return new PrincipalManagerImpl(principalProvider);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.