title: Zuul proxy and Spring OAuth redirection issue
body: <p>I'm trying to get a JWT token from third-party SSO server. It requires an additional parameter in the first authorization request, for example   </p>
  
  <p><code>https://[third-party-sso-server]/oauth2/authorize?client_id=[my-client-id]&amp;redirect_uri=http://localhost:8080/login&amp;response_type=code&amp;additional_param=[value]</code>  </p>
  
  <p>but Spring Security has the standard redirection URI:
  <code>https://[third-party-sso-server]/oauth2/authorize?client_id=[my-client-id]&amp;redirect_uri=http://localhost:8080/login&amp;response_type=code&amp;state=[state-value]</code><br>
  So i cannot add this additional parameter using any filter nor HeaderWriter. And i cannot change the redirect strategy using DefaultRedirectStrategy class.
  My code is based on this tutorial <a href="https://spring.io/guides/tutorials/spring-boot-oauth2/#_social_login_manual" rel="nofollow noreferrer">https://spring.io/guides/tutorials/spring-boot-oauth2/#_social_login_manual</a></p>
  
  <p>`</p>
  
  <pre><code>package hello;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
  import org.springframework.context.annotation.Bean;
  import hello.filters.pre.SimpleFilter;
  import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices;
  import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
  import org.springframework.security.oauth2.config.annotation.web.configuration.EnableOAuth2Client;
  import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
  import javax.servlet.Filter;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerProperties;
  import org.springframework.boot.context.properties.ConfigurationProperties;
  import org.springframework.security.oauth2.client.OAuth2ClientContext;
  import org.springframework.security.oauth2.client.OAuth2RestTemplate;
  import org.springframework.security.oauth2.client.token.grant.code.AuthorizationCodeResourceDetails;
  
  @SpringBootApplication
  @EnableZuulProxy
  @EnableOAuth2Client
  public class GatewayApplication extends WebSecurityConfigurerAdapter 
  {
      @Autowired
      OAuth2ClientContext oauth2ClientContext;
  
      public static void main(String[] args) {
          SpringApplication.run(GatewayApplication.class, args);
      }
  
      @Bean
      public SimpleFilter simpleFilter() {
          return new SimpleFilter();
      }
  
      private Filter ssoFilter() {
          OAuth2ClientAuthenticationProcessingFilter customFilter = new OAuth2ClientAuthenticationProcessingFilter("/login");
          OAuth2RestTemplate customTemplate = new OAuth2RestTemplate(thirdPartySso(), oauth2ClientContext);
          customFilter.setRestTemplate(customTemplate);
          customFilter.setTokenServices(new UserInfoTokenServices(myResource().getUserInfoUri(), thirdPartySso().getClientId()));
          return customFilter;
      }
  
      @Bean
      @ConfigurationProperties("security.oauth2.client")
      public AuthorizationCodeResourceDetails thirdPartySso() {
          return new AuthorizationCodeResourceDetails();
      }
  
      @Bean
      @ConfigurationProperties("security.oauth2.resource")
      public ResourceServerProperties myResource() {
          return new ResourceServerProperties();
      }
  
      @Override
      public void configure(HttpSecurity http) throws Exception {
          // It doesn't work
          //http.headers().addHeaderWriter(new StaticHeadersWriter("Location","new location"));
  
          http.antMatcher("/**").addFilterBefore(ssoFilter(), BasicAuthenticationFilter.class)
                  .authorizeRequests().antMatchers("/").authenticated();
      }
  }
  </code></pre>
  
  <p><code>
  Spring Boot configuration file:
  </code></p>
  
  <pre><code>server:
    port: 8090
  
  zuul:
      routes :
          admin :
              path: /api/admin/**
              url : http://localhost:2222/admin            
  
  security:
    oauth2:
      client:
        clientId: [clientid]
        clientSecret: [secret]
        accessTokenUri: https://[third-party-uri]/oauth2/token
        userAuthorizationUri: https://[third-party-uri]/adfs/oauth2/authorize
        useCurrentUri : false
        tokenName: accessToken
        authenticationScheme: query
        clientAuthenticationScheme: form
      resource:
        userInfoUri: http://localhost:5555/oauth2/token
  
  spring:
    application:
      name: zuul-server
  
  ribbon:
    eureka:
      enabled: false
  </code></pre>
  
  <p>`</p>