spring - If .antMatcher is the first method after http then default login gives 404 but why? -


using spring-boot v2.0.0m3, want use default login page provided spring-security , want have 2 different end points different security config explained here: http://docs.spring.io/spring-security/site/docs/5.0.0.m3/reference/htmlsingle/#multiple-httpsecurity

my full security configuration follows:

@configuration @order(1) @enablewebsecurity class apisecurityconfigurationadapter extends websecurityconfigureradapter {      private final jwtauthenticationfilter jwtauthenticationfilter;      public apisecurityconfigurationadapter(jwtauthenticationfilter jwtauthenticationfilter) {         this.jwtauthenticationfilter = jwtauthenticationfilter;     }      @override     protected void configure(httpsecurity http) throws exception {         http.antmatcher("/v1/**")             .csrf()             .disable()             .authorizerequests()             .anyrequest()             .authenticated()             .and()             .exceptionhandling()             .authenticationentrypoint(this::commence)             .and()             .sessionmanagement()             .sessioncreationpolicy(sessioncreationpolicy.stateless)             .and()             .addfilterbefore(jwtauthenticationfilter, usernamepasswordauthenticationfilter.class);     }  }  @configuration @order(2) class nonapisecurityconfigurationadapter extends websecurityconfigureradapter {      @override     protected void configure(httpsecurity http) throws exception {         http             .authorizerequests()             .antmatchers("/manage/**")             .hasrole("user")             .and().formlogin();     }  } 

for second part: following config works , redirects users login page , default login page shown:

http     .authorizerequests()     .antmatchers("/manage/**")     .hasrole("user")     .and().formlogin(); 

however following config gives 404 /login after redirecting user login:

http     .antmatcher("/manage/**")     .authorizerequests()     .anyrequest()     .hasrole("user")     .and().formlogin(); 

why that? think both combination should work, can't find in docs hints not work.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -