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

The following examples show how to use org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer#pathMapping() . 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: AuthorizationServerConfiguration.java    From open-cloud with MIT License 6 votes vote down vote up
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
    endpoints
            .allowedTokenEndpointRequestMethods(HttpMethod.GET, HttpMethod.POST)
            .authenticationManager(authenticationManager)
            .approvalStore(approvalStore())
            .userDetailsService(userDetailsService)
            .tokenServices(createDefaultTokenServices())
            .accessTokenConverter(OpenHelper.buildAccessTokenConverter())
            .authorizationCodeServices(authorizationCodeServices());
    // 自定义确认授权页面
    endpoints.pathMapping("/oauth/confirm_access", "/oauth/confirm_access");
    // 自定义错误页
    endpoints.pathMapping("/oauth/error", "/oauth/error");
    // 自定义异常转换类
    endpoints.exceptionTranslator(new OpenOAuth2WebResponseExceptionTranslator());
}
 
Example 2
Source File: AuthorizationServerConfiguration.java    From open-cloud with MIT License 6 votes vote down vote up
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
    endpoints
            .allowedTokenEndpointRequestMethods(HttpMethod.GET, HttpMethod.POST)
            .authenticationManager(authenticationManager)
            .approvalStore(approvalStore())
            .userDetailsService(userDetailsService)
            .tokenServices(createDefaultTokenServices())
            .accessTokenConverter(OpenHelper.buildAccessTokenConverter())
            .authorizationCodeServices(authorizationCodeServices());
    // 自定义确认授权页面
    endpoints.pathMapping("/oauth/confirm_access", "/oauth/confirm_access");
    // 自定义错误页
    endpoints.pathMapping("/oauth/error", "/oauth/error");
    // 自定义异常转换类
    endpoints.exceptionTranslator(new OpenOAuth2WebResponseExceptionTranslator());
}
 
Example 3
Source File: OAuth2AuthorizationServerConfig.java    From oauth-boot with MIT License 6 votes vote down vote up
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {

    endpoints
            // token 存储方式
            .tokenStore(tokenStore)
            .authenticationManager(authenticationManager)
            // 不配置会导致token无法刷新
            .userDetailsService(userDetailsService)
            .allowedTokenEndpointRequestMethods(HttpMethod.POST,HttpMethod.GET);

    // 判断当前是否使用jwt
    if(!(tokenStore instanceof RedisTokenStore) && this.converter!=null){
        endpoints.accessTokenConverter(converter);
    }


    // 处理 ExceptionTranslationFilter 抛出的异常
    endpoints.exceptionTranslator(bootWebResponseExceptionTranslator);

    endpoints.pathMapping("/oauth/confirm_access","/custom/confirm_access");
}
 
Example 4
Source File: AuthorizationServerConfig.java    From java-starthere with MIT License 5 votes vote down vote up
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception
{
    endpoints.tokenStore(tokenStore)
             .authenticationManager(authenticationManager);
    endpoints.pathMapping("/oauth/token",
                          "/login");
}
 
Example 5
Source File: AuthorizationServerConfiguration.java    From openapi-petstore with Apache License 2.0 4 votes vote down vote up
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
    super.configure(endpoints);
    endpoints.pathMapping("/oauth/authorize", "/api/oauth/dialog");
}