Sunday, August 12, 2018

Spring Boot 2 upgrade. permit All works with .anonymous().and() .. but why?

Leave a Comment

I had migrated Oauth2 code from Spring Boot 1.3.2 T Spring Boot 2.0.2.

The below code to permit "/auth" endpoint is not working in springBoot 2

public void configure(HttpSecurity httpSecurity) throws Exception {         httpSecurity                                 .exceptionHandling()                 .authenticationEntryPoint(customAuthenticationEntryPoint)                 .and()                 .antMatchers("/auth/**").permitAll()                 .anyRequest()                 .authenticated();      } 

/auth endpoint return 401 response.

After research I hadd added

.anonymous().and()

and it working as expected now. /auth return result with out token.

I am not able to figure out the reason, what changed in spring boot 2. ?

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment