Java Code Examples for org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer#allowFormAuthenticationForClients()

The following examples show how to use org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer#allowFormAuthenticationForClients() . 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: AuthorizationServerConfig.java    From java-tutorial with MIT License 5 votes vote down vote up
@Override
public void configure(AuthorizationServerSecurityConfigurer security) {
    security.allowFormAuthenticationForClients();
    // 获取 token 的策略
    security.tokenKeyAccess("permitAll()");
    security.checkTokenAccess("isAuthenticated()");
}
 
Example 2
Source File: AuthorizationServerConfig.java    From SpringCloud with Apache License 2.0 5 votes vote down vote up
@Override
public void configure(AuthorizationServerSecurityConfigurer oauthServer) {
    // 支持将client参数放在header或body中
    oauthServer.allowFormAuthenticationForClients();
    oauthServer.tokenKeyAccess("isAuthenticated()")
            .checkTokenAccess("permitAll()");
}
 
Example 3
Source File: AuthorizationServerConfiguration.java    From onetwo with Apache License 2.0 5 votes vote down vote up
@Override
	public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
//		security.and().requestMatchers()
		AuthorizationServerProps authProps = oauth2Properties.getAuthorizationServer();
		if(authProps.isAllowFormAuthenticationForClients()){
			security.allowFormAuthenticationForClients();
			//FIX: AuthorizationServerSecurityConfigurer创建form验证filter的时,没有使用配置的oauth2AuthenticationEntryPoint
			security.addObjectPostProcessor(new ClientCredentialsTokenEndpointFilterPostProcessor());
		}
		
		if(authProps.isSslOnly()){
			security.sslOnly();
		}
		if(StringUtils.isNotBlank(authProps.getRealm())){
			security.realm(authProps.getRealm());
		}
		if(StringUtils.isNotBlank(authProps.getCheckTokenAccess())){
			security.checkTokenAccess(authProps.getCheckTokenAccess());
		}
		if(StringUtils.isNotBlank(authProps.getTokenKeyAccess())){
			security.tokenKeyAccess(authProps.getTokenKeyAccess());
		}
		
		if(oauth2AuthenticationEntryPoint!=null){
			security.authenticationEntryPoint(oauth2AuthenticationEntryPoint);
		}
		if(oauth2AccessDeniedHandler!=null){
			security.accessDeniedHandler(oauth2AccessDeniedHandler);
		}
		if(passwordEncoder!=null){
			security.passwordEncoder(passwordEncoder);
		}
	}
 
Example 4
Source File: AuthorizationServerConfig.java    From spring-boot-demo with MIT License 4 votes vote down vote up
@Override
public void configure(AuthorizationServerSecurityConfigurer oauthServer) {
    oauthServer.allowFormAuthenticationForClients();
}
 
Example 5
Source File: AuthorizationServerConfig.java    From cloud-service with MIT License 4 votes vote down vote up
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
    security.allowFormAuthenticationForClients(); // 允许表单形式的认证
}
 
Example 6
Source File: OAuth2Config.java    From spring-cloud-study with Apache License 2.0 4 votes vote down vote up
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
    security.allowFormAuthenticationForClients();
    security.checkTokenAccess("isAuthenticated()");
    security.tokenKeyAccess("isAuthenticated()");
}
 
Example 7
Source File: OAuth2Config.java    From spring-cloud-study with Apache License 2.0 4 votes vote down vote up
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
    security.allowFormAuthenticationForClients();
    security.checkTokenAccess("isAuthenticated()");
    security.tokenKeyAccess("isAuthenticated()");
}
 
Example 8
Source File: AuthorizationServerConfig.java    From mall with Apache License 2.0 4 votes vote down vote up
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
    //允许表单认证
    security.allowFormAuthenticationForClients();
}
 
Example 9
Source File: AuthorizationServerConfiguration.java    From watchdog-spring-boot-starter with MIT License 4 votes vote down vote up
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
    security.allowFormAuthenticationForClients();
}
 
Example 10
Source File: OAuth2AuthorizationServerConfig.java    From oauth-boot with MIT License 4 votes vote down vote up
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {


    // 允许表单登录
    security.allowFormAuthenticationForClients();



    // 自定义异常处理端口
    security.authenticationEntryPoint(authenticationEntryPoint);

    // 客户端认证之前的过滤器
    BootBasicAuthenticationFilter filter = new BootBasicAuthenticationFilter(this.clientDetailsService,this.passwordEncoder);
    security.addTokenEndpointAuthenticationFilter(filter);

    security.tokenKeyAccess("permitAll()").checkTokenAccess("isAuthenticated()");

}
 
Example 11
Source File: _OAuth2ServerConfiguration.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception {
    oauthServer.allowFormAuthenticationForClients();
}
 
Example 12
Source File: OAuth2AuthorizationServerConfig.java    From osiam with MIT License 4 votes vote down vote up
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
    security.allowFormAuthenticationForClients();
}
 
Example 13
Source File: PcAuthorizationServerConfig.java    From paascloud-master with Apache License 2.0 2 votes vote down vote up
/**
 * Configure.
 *
 * @param security the security
 *
 * @throws Exception the exception
 */
@Override
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
	security.tokenKeyAccess("permitAll()");
	security.allowFormAuthenticationForClients();
}