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

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


        try {
            log.debug("Initalize LoginModule: ");
            RepositoryCallback repositoryCb = new RepositoryCallback();
            callbackHandler.handle(new Callback[]{repositoryCb});

            PrincipalProviderRegistry registry = repositoryCb.getPrincipalProviderRegistry();
            // check if the class name of a PrincipalProvider implementation
            // is present with the module configuration.
            if (options.containsKey(LoginModuleConfig.PARAM_PRINCIPAL_PROVIDER_CLASS)) {
                Object pcOption = options.get(LoginModuleConfig.PARAM_PRINCIPAL_PROVIDER_CLASS);
                if (pcOption != null) {
                    principalProviderClassName = pcOption.toString();
                }
            }
            if (principalProviderClassName != null) {
                principalProvider = registry.getProvider(principalProviderClassName);
            }
            if (principalProvider == null) {
                principalProvider = registry.getDefault();
                if (principalProvider == null) {
                    return; // abort. not even a default principal provider
                }
            }
            log.debug("- PrincipalProvider -> '" + principalProvider.getClass().getName() + "'");
View Full Code Here


     */
    private final List<String> systemUsersInitialized = new ArrayList<String>();

    private PrincipalProviderRegistry getPrincipalProviderRegistry(SessionImpl s) throws RepositoryException {
        String wspName = s.getWorkspace().getName();
        PrincipalProviderRegistry p = ppRegistries.get(wspName);
        if (p == null) {
            SystemSession systemSession;
            if (s instanceof SystemSession) {
                systemSession = (SystemSession) s;
            } else {
View Full Code Here

     */
    @Override
    public void dispose(String workspaceName) {
        super.dispose(workspaceName);
        synchronized (ppRegistries) {
            PrincipalProviderRegistry reg = ppRegistries.remove(workspaceName);
            if (reg != null) {
                reg.getDefault().close();
            }
        }
    }
View Full Code Here

        try {
            log.debug("Initalize LoginModule: ");
            RepositoryCallback repositoryCb = new RepositoryCallback();
            callbackHandler.handle(new Callback[]{repositoryCb});

            PrincipalProviderRegistry registry = repositoryCb.getPrincipalProviderRegistry();
            // check if the class name of a PrincipalProvider implementation
            // is present with the module configuration.
            if (options.containsKey(LoginModuleConfig.PARAM_PRINCIPAL_PROVIDER_CLASS)) {
                Object pcOption = options.get(LoginModuleConfig.PARAM_PRINCIPAL_PROVIDER_CLASS);
                if (pcOption != null) {
                    principalProviderClassName = pcOption.toString();
                }
            }
            if (principalProviderClassName != null) {
                principalProvider = registry.getProvider(principalProviderClassName);
            }
            if (principalProvider == null) {
                principalProvider = registry.getDefault();
                if (principalProvider == null) {
                    return; // abort. not even a default principal provider
                }
            }
            log.debug("- PrincipalProvider -> '" + principalProvider.getClass().getName() + "'");
View Full Code Here

        try {
            log.debug("Initalize LoginModule: ");
            RepositoryCallback repositoryCb = new RepositoryCallback();
            callbackHandler.handle(new Callback[]{repositoryCb});

            PrincipalProviderRegistry registry = repositoryCb.getPrincipalProviderRegistry();
            // check if the class name of a PrincipalProvider implementation
            // is present with the module configuration.
            if (options.containsKey(LoginModuleConfig.PARAM_PRINCIPAL_PROVIDER_CLASS)) {
                Object pcOption = options.get(LoginModuleConfig.PARAM_PRINCIPAL_PROVIDER_CLASS);
                if (pcOption != null) {
                    principalProviderClassName = pcOption.toString();
                }
            }
            if (principalProviderClassName != null) {
                principalProvider = registry.getProvider(principalProviderClassName);
            }
            if (principalProvider == null) {
                principalProvider = registry.getDefault();
                if (principalProvider == null) {
                    return; // abort. not even a default principal provider
                }
            }
            log.debug("- PrincipalProvider -> '" + principalProvider.getClass().getName() + "'");
View Full Code Here

        try {
            log.debug("Initalize LoginModule: ");
            RepositoryCallback repositoryCb = new RepositoryCallback();
            callbackHandler.handle(new Callback[]{repositoryCb});

            PrincipalProviderRegistry registry = repositoryCb.getPrincipalProviderRegistry();
            // check if the class name of a PrincipalProvider implementation
            // is present with the module configuration.
            if (options.containsKey(LoginModuleConfig.PARAM_PRINCIPAL_PROVIDER_CLASS)) {
                Object pcOption = options.get(LoginModuleConfig.PARAM_PRINCIPAL_PROVIDER_CLASS);
                if (pcOption != null) {
                    principalProviderClassName = pcOption.toString();
                }
            }
            if (principalProviderClassName != null) {
                principalProvider = registry.getProvider(principalProviderClassName);
            }
            if (principalProvider == null) {
                principalProvider = registry.getDefault();
                if (principalProvider == null) {
                    return; // abort. not even a default principal provider
                }
            }
            log.debug("- PrincipalProvider -> '" + principalProvider.getClass().getName() + "'");
View Full Code Here

        try {
            log.debug("Initalize LoginModule: ");
            RepositoryCallback repositoryCb = new RepositoryCallback();
            callbackHandler.handle(new Callback[]{repositoryCb});

            PrincipalProviderRegistry registry = repositoryCb.getPrincipalProviderRegistry();
            // check if the class name of a PrincipalProvider implementation
            // is present with the module configuration.
            if (options.containsKey(LoginModuleConfig.PARAM_PRINCIPAL_PROVIDER_CLASS)) {
                Object pcOption = options.get(LoginModuleConfig.PARAM_PRINCIPAL_PROVIDER_CLASS);
                if (pcOption != null) {
                    principalProviderClassName = pcOption.toString();
                }
            }
            if (principalProviderClassName == null) {
                // try compatibility parameters
                if (options.containsKey(LoginModuleConfig.COMPAT_PRINCIPAL_PROVIDER_NAME)) {
                    principalProviderClassName = options.get(LoginModuleConfig.COMPAT_PRINCIPAL_PROVIDER_NAME).toString();
                } else if (options.containsKey(LoginModuleConfig.COMPAT_PRINCIPAL_PROVIDER_CLASS)) {
                    principalProviderClassName = options.get(LoginModuleConfig.COMPAT_PRINCIPAL_PROVIDER_CLASS).toString();
                }
            }
            if (principalProviderClassName != null) {
                principalProvider = registry.getProvider(principalProviderClassName);
            }
            if (principalProvider == null) {
                principalProvider = registry.getDefault();
                if (principalProvider == null) {
                    return; // abort. not even a default principal provider
                }
            }
            log.debug("- PrincipalProvider -> '" + principalProvider.getClass().getName() + "'");
View Full Code Here

    private final List<String> systemUsersInitialized = new ArrayList<String>();

    private PrincipalProviderRegistry getPrincipalProviderRegistry(SessionImpl s) throws RepositoryException {
        String wspName = s.getWorkspace().getName();
        synchronized (monitor) {
            PrincipalProviderRegistry p = ppRegistries.get(wspName);
            if (p == null) {
                SystemSession systemSession;
                if (s instanceof SystemSession) {
                    systemSession = (SystemSession) s;
                } else {
View Full Code Here

     */
    @Override
    public void dispose(String workspaceName) {
        super.dispose(workspaceName);
        synchronized (monitor) {
            PrincipalProviderRegistry reg = ppRegistries.remove(workspaceName);
            if (reg != null) {
                reg.getDefault().close();
            }
        }
    }
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

TOP

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

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.