spring-attic/spring-cloud-security

spring oauth2.0 login page unauthorized

godpit opened this issue · 8 comments

wx20180321-105137 2x

spring cloud + security oauth 2.0, login-page url is unauthorized,i needn't the url that is authorized. When the login is successful, get token, and authorized successfully.

@godpit please provide more information. What is your configuration, what version of spring cloud are you using?

Can you provide a complete, minimal, verifiable sample that reproduces the problem?

spring cloud Finchley.M7,
wx20180321-111526 2x
wx20180321-111453 2x
class WebSecurityConfig extends WebSecurityConfigurerAdapter,

Please don't past screenshots.

Can you provide a complete, minimal, verifiable sample that reproduces the problem?

A little difficult to provide,Please tell me if I can enter the login page without authorization.

i enter the url of 'http://localhost:9060/oauth/authorize', it redirect to http://localhost:9060/login.but it show me unauthorized

i got it, by adding the matcher of url '/login'.

@configuration
@EnableResourceServer
public class ResourceServerConfig extends ResourceServerConfigurerAdapter {

@Override
public void configure(HttpSecurity http) throws Exception {
    http.csrf().disable()
            .exceptionHandling()
            .authenticationEntryPoint((request, response, authException) ->
                    response.sendError(HttpServletResponse.SC_UNAUTHORIZED)
            ).and()
            .authorizeRequests().antMatchers("/login").permitAll()
            .anyRequest().authenticated()
            .and()
            .httpBasic();
}

}

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.