org.springframework.security.authentication.AuthenticationManager Java Examples

The following examples show how to use org.springframework.security.authentication.AuthenticationManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OpenIdOAuth2Configuration.java    From cola with MIT License 5 votes vote down vote up
@Bean
@ConditionalOnBean({AuthenticationManager.class, AuthorizationServerTokenServices.class, ClientDetailsService.class})
public OpenIdTokenGranter openIdTokenGranter(AuthenticationManager authenticationManager,
											 AuthorizationServerTokenServices tokenServices,
											 ClientDetailsService clientDetailsService) {
	return new OpenIdTokenGranter(authenticationManager, tokenServices, clientDetailsService, new DefaultOAuth2RequestFactory(clientDetailsService));
}
 
Example #2
Source File: JwtSsoBasedAuthenticationFilter.java    From wecube-platform with Apache License 2.0 5 votes vote down vote up
public JwtSsoBasedAuthenticationFilter(AuthenticationManager authenticationManager,
        AuthServerProperties authServerProperties) {
    super(authenticationManager);
    if (log.isDebugEnabled()) {
        log.debug("Filter:{} applied", this.getClass().getSimpleName());
    }

    this.authServerProperties = authServerProperties;

    jwtBuilder = new DefaultJwtBuilder(this.authServerProperties.getJwtToken());
}
 
Example #3
Source File: TokenLoginConfigurer.java    From ChengFeng1.5 with MIT License 5 votes vote down vote up
@Override
public void configure(B http) throws Exception {
	authFilter.setAuthenticationManager(http.getSharedObject(AuthenticationManager.class));
	authFilter.setAuthenticationFailureHandler(new TokenRefreshFailureHandler());

	TokenAuthenticationFilter filter = postProcess(authFilter);
	http.addFilterBefore(filter, LogoutFilter.class);
}
 
Example #4
Source File: UserLoginConfigurer.java    From ChengFeng1.5 with MIT License 5 votes vote down vote up
@Override
public void configure(B http) throws Exception {
    authFilter.setAuthenticationManager(http.getSharedObject(AuthenticationManager.class));
    authFilter.setAuthenticationFailureHandler(new UserLoginFailureHandler());
    authFilter.setSessionAuthenticationStrategy(new NullAuthenticatedSessionStrategy());

    UserInfoAuthenticationFilter filter = postProcess(authFilter);
    http.addFilterAfter(filter, LogoutFilter.class);
}
 
Example #5
Source File: JwtLoginFilter.java    From SpringSecurity-JWT-Vue-Deom with MIT License 5 votes vote down vote up
/**
 * @param defaultFilterProcessesUrl 配置要过滤的地址,即登陆地址
 * @param authenticationManager 认证管理器,校验身份时会用到
 * @param loginCountService */
public JwtLoginFilter(String defaultFilterProcessesUrl, AuthenticationManager authenticationManager,
                      VerifyCodeService verifyCodeService, LoginCountService loginCountService) {
    super(new AntPathRequestMatcher(defaultFilterProcessesUrl));
    this.loginCountService = loginCountService;
    // 为 AbstractAuthenticationProcessingFilter 中的属性赋值
    setAuthenticationManager(authenticationManager);
    this.verifyCodeService = verifyCodeService;
}
 
Example #6
Source File: SecurityConfig.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
@Bean
public TenantUsernamePasswordAuthenticationFilter tenantAuthenticationFilter(AuthenticationManager authenticationManager) {
	TenantUsernamePasswordAuthenticationFilter filter = new TenantUsernamePasswordAuthenticationFilter();
	filter.setAuthenticationManager(authenticationManager);
	filter.setFilterProcessesUrl(SecurityConstants.OAUTH_LOGIN_PRO_URL);
	filter.setAuthenticationSuccessHandler(authenticationSuccessHandler);
	filter.setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler(SecurityConstants.LOGIN_FAILURE_PAGE));
	return filter;
}
 
Example #7
Source File: WxSecurityConfigurer.java    From spring-microservice-exam with MIT License 5 votes vote down vote up
@Override
public void configure(HttpSecurity http) {
    // 微信登录过滤器
    WxAuthenticationFilter wxAuthenticationFilter = new WxAuthenticationFilter();
    wxAuthenticationFilter.setAuthenticationManager(http.getSharedObject(AuthenticationManager.class));
    wxAuthenticationFilter.setAuthenticationSuccessHandler(wxLoginSuccessHandler);
    wxAuthenticationFilter.setEventPublisher(defaultAuthenticationEventPublisher);
    WxAuthenticationProvider wxAuthenticationProvider = new WxAuthenticationProvider();
    wxAuthenticationProvider.setCustomUserDetailsService(userDetailsService);
    // 增加微信登录的过滤器
    http.authenticationProvider(wxAuthenticationProvider).addFilterAfter(wxAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
}
 
Example #8
Source File: JwtUsernameAndPasswordAuthenticationFilter.java    From microservices-spring-boot with MIT License 5 votes vote down vote up
public JwtUsernameAndPasswordAuthenticationFilter(AuthenticationManager authManager, JwtConfig jwtConfig) {
	this.authManager = authManager;
	this.jwtConfig = jwtConfig;
	
	// By default, UsernamePasswordAuthenticationFilter listens to "/login" path. 
	// In our case, we use "/auth". So, we need to override the defaults.
	this.setRequiresAuthenticationRequestMatcher(new AntPathRequestMatcher(jwtConfig.getUri(), "POST"));
}
 
Example #9
Source File: SecurityConfig.java    From RuoYi-Vue with MIT License 5 votes vote down vote up
/**
 * 解决 无法直接注入 AuthenticationManager
 *
 * @return
 * @throws Exception
 */
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception
{
    return super.authenticationManagerBean();
}
 
Example #10
Source File: WebSecurityConfig.java    From Hacktoberfest2019 with Apache License 2.0 5 votes vote down vote up
@Bean
public SpnegoAuthenticationProcessingFilter spnegoAuthenticationProcessingFilter(
        AuthenticationManager authenticationManager) {
    SpnegoAuthenticationProcessingFilter filter = new SpnegoAuthenticationProcessingFilter();
    filter.setAuthenticationManager(authenticationManager);
    return filter;
}
 
Example #11
Source File: SmsCodeAuthenticationSecurityConfig.java    From pre with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void configure(HttpSecurity http) throws Exception {
    super.configure(http);
    //自定义SmsCodeAuthenticationFilter过滤器
    SmsCodeAuthenticationFilter smsCodeAuthenticationFilter = new SmsCodeAuthenticationFilter();
    smsCodeAuthenticationFilter.setAuthenticationManager(http.getSharedObject(AuthenticationManager.class));
    smsCodeAuthenticationFilter.setAuthenticationSuccessHandler(preAuthenticationSuccessHandler);
    smsCodeAuthenticationFilter.setAuthenticationFailureHandler(preAuthenticationFailureHandler);
    //设置自定义SmsCodeAuthenticationProvider的认证器userDetailsService
    SmsCodeAuthenticationProvider smsCodeAuthenticationProvider = new SmsCodeAuthenticationProvider();
    smsCodeAuthenticationProvider.setUserDetailService(userDetailsService);
    //在UsernamePasswordAuthenticationFilter过滤前执行
    http.authenticationProvider(smsCodeAuthenticationProvider).addFilterAfter(smsCodeAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
}
 
Example #12
Source File: JwtAuthorizationFilter.java    From jwt-security with MIT License 4 votes vote down vote up
public JwtAuthorizationFilter(AuthenticationManager authenticationManager) {
    super(authenticationManager);
}
 
Example #13
Source File: SecurityConfig.java    From mall-learning with Apache License 2.0 4 votes vote down vote up
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example #14
Source File: SsoWebSecurityConfig.java    From syhthems-platform with MIT License 4 votes vote down vote up
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example #15
Source File: GlobalSecurityConfig.java    From airsonic-advanced with GNU General Public License v3.0 4 votes vote down vote up
@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example #16
Source File: OauthWebServerSecurityConfig.java    From codeway_service with GNU General Public License v3.0 4 votes vote down vote up
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
	AuthenticationManager manager = super.authenticationManagerBean();
	return manager;
}
 
Example #17
Source File: WebSecurityConfigurer.java    From smaker with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
	return super.authenticationManagerBean();
}
 
Example #18
Source File: SecurityConfig.java    From ChengFeng1.5 with MIT License 4 votes vote down vote up
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example #19
Source File: TokenAuthenticationFilter.java    From ChengFeng1.5 with MIT License 4 votes vote down vote up
protected AuthenticationManager getAuthenticationManager() {
	return authenticationManager;
}
 
Example #20
Source File: SecurityConfiguration.java    From fw-spring-cloud with Apache License 2.0 4 votes vote down vote up
@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example #21
Source File: WebSecurityConfig.java    From Mastering-Microservices-with-Java-Third-Edition with MIT License 4 votes vote down vote up
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
  return super.authenticationManagerBean();
}
 
Example #22
Source File: AuthorizeAutoConfiguration.java    From authmore-framework with Apache License 2.0 4 votes vote down vote up
@Bean
public AuthenticationManager authenticationManager() {
    return authentication -> null;
}
 
Example #23
Source File: SecurityConfiguration.java    From gemini with Apache License 2.0 4 votes vote down vote up
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example #24
Source File: SecurityConfig.java    From BigDataPlatform with GNU General Public License v3.0 4 votes vote down vote up
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example #25
Source File: SecurityConfig.java    From MovieApp with MIT License 4 votes vote down vote up
@Bean(BeanIds.AUTHENTICATION_MANAGER)
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example #26
Source File: UaaWebSecurityConfiguration.java    From cubeai with Apache License 2.0 4 votes vote down vote up
@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example #27
Source File: SecurityConfig.java    From mall-learning with Apache License 2.0 4 votes vote down vote up
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example #28
Source File: SophiaWebSecurityConfig.java    From sophia_scaffolding with Apache License 2.0 4 votes vote down vote up
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example #29
Source File: SecurityConfig.java    From spring-boot-demo with MIT License 4 votes vote down vote up
@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example #30
Source File: SmsTokenGranter.java    From cola with MIT License 4 votes vote down vote up
public SmsTokenGranter(AuthenticationManager authenticationManager, AuthorizationServerTokenServices tokenServices, ClientDetailsService clientDetailsService, OAuth2RequestFactory requestFactory) {
	super(tokenServices, clientDetailsService, requestFactory, GRANT_TYPE);
	this.authenticationManager = authenticationManager;
}