filter.setAuthenticationManager(getSecurityManager().authenticationManager());
@Bean public UsernamePasswordAuthenticationFilter filter() { UsernamePasswordAuthenticationFilter filter = new UsernamePasswordAuthenticationFilter(); filter.setAuthenticationManager(providerManager()); return filter; }
@Bean public ProviderManager providerManager() { List<AuthenticationProvider> list = new ArrayList<AuthenticationProvider>(); list.add(daoAuthenticationProvider()); return new ProviderManager(list); } //If you use this filter (I think so, because you've defined 'username' and 'password' in 'configure' method) @Bean public UsernamePasswordAuthenticationFilter filter() { UsernamePasswordAuthenticationFilter filter = new UsernamePasswordAuthenticationFilter(); filter.setAuthenticationManager(providerManager()); return filter; }
); authFilter .setAuthenticationManager(authenticationManager()); authFilter .setAuthenticationSuccessHandler(
@Override public void configure(HttpSecurity http) throws Exception { PortMapper portMapper = http.getSharedObject(PortMapper.class); if (portMapper != null) { authenticationEntryPoint.setPortMapper(portMapper); } authFilter.setAuthenticationManager(http.getSharedObject(AuthenticationManager.class)); authFilter.setAuthenticationSuccessHandler(successHandler); authFilter.setAuthenticationFailureHandler(failureHandler); if (authenticationDetailsSource != null) { authFilter.setAuthenticationDetailsSource(authenticationDetailsSource); } SessionAuthenticationStrategy sessionAuthenticationStrategy = http .getSharedObject(SessionAuthenticationStrategy.class); if (sessionAuthenticationStrategy != null) { authFilter.setSessionAuthenticationStrategy(sessionAuthenticationStrategy); } RememberMeServices rememberMeServices = http.getSharedObject(RememberMeServices.class); if (rememberMeServices != null) { authFilter.setRememberMeServices(rememberMeServices); } UsernamePasswordAuthenticationFilter filter = postProcess(authFilter); http.addFilter(filter); }
UsernamePasswordAuthenticationFilter usernamePasswordAuthenticationFilter = new UsernamePasswordAuthenticationFilter(); usernamePasswordAuthenticationFilter .setAuthenticationManager(authenticationManager()); usernamePasswordAuthenticationFilter.setAllowSessionCreation(true); SimpleUrlAuthenticationSuccessHandler successHandler = new SimpleUrlAuthenticationSuccessHandler(