spring-attic / spring-security-oauth

Support for adding OAuth1(a) and OAuth2 features (consumer and provider) for Spring web applications.
http://github.com/spring-projects/spring-security-oauth
Apache License 2.0
4.69k stars 4.04k forks source link

Support custom OAuth2AuthenticationEntryPoint #1963

Closed xuxiaowei-com-cn closed 2 years ago

xuxiaowei-com-cn commented 2 years ago

Support custom OAuth2AuthenticationEntryPoint when accessing "/oauth/token"

xuxiaowei-com-cn commented 2 years ago

This function is used to customize the handling of exceptions in password mode

xuxiaowei-com-cn commented 2 years ago

How to use

    @Override
    public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {

        // Customize OAuth2AuthenticationEntryPoint
        OAuth2AuthenticationEntryPoint authenticationEntryPoint = new TokenOAuth2AuthenticationEntryPoint();

        // Set OAuth2AuthenticationEntryPoint
        security.setOauth2AuthenticationEntryPoint(authenticationEntryPoint);

        security.allowFormAuthenticationForClients();

    }
jgrandja commented 2 years ago

@xuxiaowei-com-cn This project has reached it's end-of-life. Please see latest announcement.