Java Code Examples for org.springframework.security.authentication.AuthenticationManager

The following examples show how to use org.springframework.security.authentication.AuthenticationManager. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: cola   Source File: OpenIdOAuth2Configuration.java    License: 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
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 Project: ChengFeng1.5   Source File: TokenLoginConfigurer.java    License: 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 Project: ChengFeng1.5   Source File: UserLoginConfigurer.java    License: 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 Project: SpringSecurity-JWT-Vue-Deom   Source File: JwtLoginFilter.java    License: 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 Project: microservices-platform   Source File: SecurityConfig.java    License: 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 Project: spring-microservice-exam   Source File: WxSecurityConfigurer.java    License: 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
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 Project: RuoYi-Vue   Source File: SecurityConfig.java    License: 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 Project: Hacktoberfest2019   Source File: WebSecurityConfig.java    License: 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
@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 Project: jwt-security   Source File: JwtAuthorizationFilter.java    License: MIT License 4 votes vote down vote up
public JwtAuthorizationFilter(AuthenticationManager authenticationManager) {
    super(authenticationManager);
}
 
Example 13
Source Project: mall-learning   Source File: SecurityConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example 14
Source Project: syhthems-platform   Source File: SsoWebSecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example 15
@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example 16
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
	AuthenticationManager manager = super.authenticationManagerBean();
	return manager;
}
 
Example 17
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
	return super.authenticationManagerBean();
}
 
Example 18
Source Project: ChengFeng1.5   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example 19
Source Project: ChengFeng1.5   Source File: TokenAuthenticationFilter.java    License: MIT License 4 votes vote down vote up
protected AuthenticationManager getAuthenticationManager() {
	return authenticationManager;
}
 
Example 20
Source Project: fw-spring-cloud   Source File: SecurityConfiguration.java    License: Apache License 2.0 4 votes vote down vote up
@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example 21
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
  return super.authenticationManagerBean();
}
 
Example 22
@Bean
public AuthenticationManager authenticationManager() {
    return authentication -> null;
}
 
Example 23
Source Project: gemini   Source File: SecurityConfiguration.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example 24
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example 25
Source Project: MovieApp   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean(BeanIds.AUTHENTICATION_MANAGER)
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example 26
Source Project: cubeai   Source File: UaaWebSecurityConfiguration.java    License: Apache License 2.0 4 votes vote down vote up
@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example 27
Source Project: mall-learning   Source File: SecurityConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example 28
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example 29
Source Project: spring-boot-demo   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
    return super.authenticationManagerBean();
}
 
Example 30
Source Project: cola   Source File: SmsTokenGranter.java    License: 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;
}