1

Currently, I am using Spring Boot 2.2.5 Release. Documentation looks incomplete. What is the replacement for @EnableOAuth2Client or @EnableOAuth2Sso.enter image description here

Ralf Wagner
  • 1,467
  • 11
  • 19
Samanta
  • 73
  • 2
  • 4

1 Answers1

10

You do it via the WebSecurityConfigurerAdapter's configure method, instead of annotations.

  1. EnableOAuth2Sso is now this:

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
         .anyRequest().authenticated()
         .and()
         .oauth2Login(); // sso           
    }
    
  2. @EnableOAuth2Client is now this (for full examples and config options, see Spring's migration guide):

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .oauth2Client();
    }
    
Marco Behler
  • 3,627
  • 2
  • 17
  • 19