anchor.diff:  }
   ----
   
  +.Kotlin
  +[source,kotlin,role="secondary"]
  +----
  +class OAuth2ClientController {
  +
  +    @Autowired
  +    private lateinit var authorizedClientManager: OAuth2AuthorizedClientManager
  +
  +    @GetMapping("/")
  +    fun index(authentication: Authentication?,
  +              servletRequest: HttpServletRequest,
  +              servletResponse: HttpServletResponse): String {
  +        val authorizeRequest: OAuth2AuthorizeRequest = OAuth2AuthorizeRequest.withClientRegistrationId("okta")
  +                .principal(authentication)
  +                .attributes(Consumer { attrs: MutableMap<String, Any> ->
  +                    attrs[HttpServletRequest::class.java.name] = servletRequest
  +                    attrs[HttpServletResponse::class.java.name] = servletResponse
  +                })
  +                .build()
  +        val authorizedClient = authorizedClientManager.authorize(authorizeRequest)
  +        val accessToken: OAuth2AccessToken = authorizedClient.accessToken
  +
  +        ...
  +
  +        return "index"
  +    }
  +}
  +----
  +====
  +
   [NOTE]
   `HttpServletRequest` and `HttpServletResponse` are both OPTIONAL attributes.
   If not provided, it will default to `ServletRequestAttributes` using `RequestContextHolder.getRequestAttributes()`.
  
positive.code: 	return "index";
  }
  ----
  <1> `clientRegistrationId()` is a `static` method in `ServletOAuth2AuthorizedClientExchangeFilterFunction`.
  
  
  
negative.code: }
  ----
  
  .Kotlin
  [source,kotlin,role="secondary"]
  ----
  @Bean
  fun webClient(authorizedClientManager: OAuth2AuthorizedClientManager?): WebClient {
      val oauth2Client = ServletOAuth2AuthorizedClientExchangeFilterFunction(authorizedClientManager)
      oauth2Client.setDefaultClientRegistrationId("okta")
      return WebClient.builder()
              .apply(oauth2Client.oauth2Configuration())
              .build()
  }
  ----
  ====
  
  [WARNING]
  It is recommended to be cautious with this feature since all HTTP requests will receive the access token.
  