public PrincipalProvider[] getProviders() { List<PrincipalProvider> l = new ArrayList<PrincipalProvider>(); l.addAll(Arrays.asList(getPrincipalProviderRegistry().getProviders())); l.add(defaultPrincipalProvider); return l.toArray(new PrincipalProvider[l.size()]); } }
public PrincipalProvider[] getProviders() { List<PrincipalProvider> l = new ArrayList<PrincipalProvider>(); l.addAll(Arrays.asList(getPrincipalProviderRegistry().getProviders())); l.add(defaultPrincipalProvider); return l.toArray(new PrincipalProvider[l.size()]); } }
/** * @param session Session for the principal manager must be created. * @return A new instance of PrincipalManagerImpl. Note that this implementation * uses a workspace specific principal provider registry, that retrieves * the configured providers from the registry obtained through * {@link #getPrincipalProviderRegistry()} but has a workspace specific * default provider. * @throws RepositoryException */ @Override protected PrincipalManager createPrincipalManager(SessionImpl session) throws RepositoryException { return new PrincipalManagerImpl(session, getPrincipalProviderRegistry(session).getProviders()); }
/** * @param session The session used to create the principal manager. * @return A new instance of PrincipalManagerImpl * @throws javax.jcr.RepositoryException If an error occurs. */ protected PrincipalManager createPrincipalManager(SessionImpl session) throws RepositoryException { return new PrincipalManagerImpl(session, getPrincipalProviderRegistry().getProviders()); }
/** * @param session The session used to create the principal manager. * @return A new instance of PrincipalManagerImpl * @throws javax.jcr.RepositoryException If an error occurs. */ protected PrincipalManager createPrincipalManager(SessionImpl session) throws RepositoryException { return new PrincipalManagerImpl(session, getPrincipalProviderRegistry().getProviders()); }
/** * @param session Session for the principal manager must be created. * @return A new instance of PrincipalManagerImpl. Note that this implementation * uses a workspace specific principal provider registry, that retrieves * the configured providers from the registry obtained through * {@link #getPrincipalProviderRegistry()} but has a workspace specific * default provider. * @throws RepositoryException */ @Override protected PrincipalManager createPrincipalManager(SessionImpl session) throws RepositoryException { return new PrincipalManagerImpl(session, getPrincipalProviderRegistry(session).getProviders()); }
/** * @see JackrabbitSecurityManager#getPrincipalManager(Session) */ public synchronized PrincipalManager getPrincipalManager(Session session) throws RepositoryException { checkInitialized(); if (session instanceof SessionImpl) { SessionImpl sImpl = ((SessionImpl)session); return new PrincipalManagerImpl(sImpl, principalProviderRegistry.getProviders()); } else { throw new RepositoryException("Internal error: SessionImpl expected."); } }
/** * @see JackrabbitSecurityManager#getPrincipalManager(Session) */ public synchronized PrincipalManager getPrincipalManager(Session session) throws RepositoryException { checkInitialized(); if (session instanceof SessionImpl) { SessionImpl sImpl = ((SessionImpl)session); return new PrincipalManagerImpl(sImpl, principalProviderRegistry.getProviders()); } else { throw new RepositoryException("Internal error: SessionImpl expected."); } }
/** * * @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); }