Package org.springframework.security.authentication

Examples of org.springframework.security.authentication.ProviderManager$NullEventPublisher


    @Marker( SpringSecurityServices.class )
    public static AuthenticationManager buildAuthenticationManager( final List<AuthenticationProvider> providers )
            throws Exception {

        final ProviderManager manager = new ProviderManager(providers);
        manager.afterPropertiesSet();
        return manager;
    }
View Full Code Here


    @Marker( SpringSecurityServices.class )
    public static AuthenticationManager buildAuthenticationManager( final List<AuthenticationProvider> providers )
            throws Exception {

        final ProviderManager manager = new ProviderManager(providers);
        manager.afterPropertiesSet();
        return manager;
    }
View Full Code Here

    public void eventsArePublishedByDefault() throws Exception {
        setContext(CONTEXT);
        AuthListener listener = new AuthListener();
        appContext.addApplicationListener(listener);

        ProviderManager pm = (ProviderManager) appContext.getBeansOfType(ProviderManager.class).values().toArray()[0];
        Object eventPublisher = FieldUtils.getFieldValue(pm, "eventPublisher");
        assertNotNull(eventPublisher);
        assertTrue(eventPublisher instanceof DefaultAuthenticationEventPublisher);

        pm.authenticate(new UsernamePasswordAuthenticationToken("bob", "bobspassword"));
        assertEquals(1, listener.events.size());
    }
View Full Code Here

    }

    @Test
    public void credentialsAreClearedByDefault() throws Exception {
        setContext(CONTEXT);
        ProviderManager pm = (ProviderManager) appContext.getBeansOfType(ProviderManager.class).values().toArray()[0];
        assertTrue(pm.isEraseCredentialsAfterAuthentication());
    }
View Full Code Here

    }

    @Test
    public void clearCredentialsPropertyIsRespected() throws Exception {
        setContext("<authentication-manager erase-credentials='false'/>");
        ProviderManager pm = (ProviderManager) appContext.getBeansOfType(ProviderManager.class).values().toArray()[0];
        assertFalse(pm.isEraseCredentialsAfterAuthentication());
    }
View Full Code Here

    protected ProviderManager performBuild() throws Exception {
        if(!isConfigured()) {
            logger.debug("No authenticationProviders and no parentAuthenticationManager defined. Returning null.");
            return null;
        }
        ProviderManager providerManager = new ProviderManager(authenticationProviders, parentAuthenticationManager);
        if(eraseCredentials != null) {
            providerManager.setEraseCredentialsAfterAuthentication(eraseCredentials);
        }
        if(eventPublisher != null) {
            providerManager.setAuthenticationEventPublisher(eventPublisher);
        }
        providerManager = postProcess(providerManager);
        return providerManager;
    }
View Full Code Here

                "<authentication-manager>" +
                "  <authentication-provider>" +
                "    <jdbc-user-service cache-ref='userCache' data-source-ref='dataSource'/>" +
                "  </authentication-provider>" +
                "</authentication-manager>" + DATA_SOURCE + USER_CACHE_XML);
        ProviderManager mgr = (ProviderManager) appContext.getBean(BeanIds.AUTHENTICATION_MANAGER);
        DaoAuthenticationProvider provider = (DaoAuthenticationProvider) mgr.getProviders().get(0);
        assertSame(provider.getUserCache(), appContext.getBean("userCache"));
        provider.authenticate(new UsernamePasswordAuthenticationToken("rod","koala"));
        assertNotNull("Cache should contain user after authentication", provider.getUserCache().getUserFromCache("rod"));
    }
View Full Code Here

        ApplicationContext ctx =
                WebApplicationContextUtils.getRequiredWebApplicationContext(context);

        PasswordEncoder passwordEncoder = null;
        try {
            ProviderManager provider = (ProviderManager) ctx.getBean("org.springframework.security.authentication.ProviderManager#0");
            for (Object o : provider.getProviders()) {
                AuthenticationProvider p = (AuthenticationProvider) o;
                if (p instanceof RememberMeAuthenticationProvider) {
                    config.put("rememberMeEnabled", Boolean.TRUE);
                } else if (ctx.getBean("passwordEncoder") != null) {
                    passwordEncoder = (PasswordEncoder) ctx.getBean("passwordEncoder");
View Full Code Here

//                if (logger.isDebugEnabled()) {
//                    logger.debug("Previously Authenticated: " + authentication);
//                }
//                return authentication;
            }else{
              ProviderManager authenticationManager = (ProviderManager)StorageService.ctx.getBean("customAuthenticationManager");
              authentication = authenticationManager.authenticate(authentication);

                // We don't authenticated.setAuthentication(true), because each provider should do that
//                if (logger.isDebugEnabled()) {
//                    logger.debug("Successfully Authenticated: " + authentication);
//                }
View Full Code Here

            log.debug(bean);
        }*/

        PasswordEncoder passwordEncoder = null;
        try {
            ProviderManager provider = (ProviderManager) ctx.getBean("org.springframework.security.authentication.ProviderManager#0");
            for (Object o : provider.getProviders()) {
                AuthenticationProvider p = (AuthenticationProvider) o;
                if (p instanceof RememberMeAuthenticationProvider) {
                    config.put("rememberMeEnabled", Boolean.TRUE);
                } else if (ctx.getBean("passwordEncoder") != null) {
                    passwordEncoder = (PasswordEncoder) ctx.getBean("passwordEncoder");
View Full Code Here

TOP

Related Classes of org.springframework.security.authentication.ProviderManager$NullEventPublisher

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.