Browse Source

Document OAuth2 Client behind proxy and redirect_uri

Fixes gh-7312
Ivo Smid 6 years ago
parent
commit
a11e61432e

+ 3 - 0
docs/manual/src/docs/asciidoc/_includes/reactive/oauth2/login.adoc

@@ -42,6 +42,9 @@ TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registra
 The *_registrationId_* is a unique identifier for the <<jc-oauth2login-client-registration,ClientRegistration>>.
 The *_registrationId_* is a unique identifier for the <<jc-oauth2login-client-registration,ClientRegistration>>.
 For our example, the `registrationId` is `google`.
 For our example, the `registrationId` is `google`.
 
 
+IMPORTANT: If the OAuth Client is running behind a proxy server, it is recommended to check <<appendix-proxy-server, Proxy Server Configuration>> to ensure the application is correctly configured.
+Also, see the supported <<oauth2Client-auth-code-redirect-uri, `URI` template variables>> for `redirect-uri`.
+
 [[webflux-oauth2-login-sample-config]]
 [[webflux-oauth2-login-sample-config]]
 === Configure `application.yml`
 === Configure `application.yml`
 
 

+ 3 - 0
docs/manual/src/docs/asciidoc/_includes/servlet/appendix/proxy-server.adoc

@@ -9,3 +9,6 @@ To fix this you can use https://tools.ietf.org/html/rfc7239[RFC 7239] to specify
 To make the application aware of this, you need to either configure your application server aware of the X-Forwarded headers.
 To make the application aware of this, you need to either configure your application server aware of the X-Forwarded headers.
 For example Tomcat uses the https://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/valves/RemoteIpValve.html[RemoteIpValve] and Jetty uses https://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/server/ForwardedRequestCustomizer.html[ForwardedRequestCustomizer].
 For example Tomcat uses the https://tomcat.apache.org/tomcat-8.0-doc/api/org/apache/catalina/valves/RemoteIpValve.html[RemoteIpValve] and Jetty uses https://download.eclipse.org/jetty/stable-9/apidocs/org/eclipse/jetty/server/ForwardedRequestCustomizer.html[ForwardedRequestCustomizer].
 Alternatively, Spring 4.3+ users can leverage https://github.com/spring-projects/spring-framework/blob/v4.3.3.RELEASE/spring-web/src/main/java/org/springframework/web/filter/ForwardedHeaderFilter.java[ForwardedHeaderFilter].
 Alternatively, Spring 4.3+ users can leverage https://github.com/spring-projects/spring-framework/blob/v4.3.3.RELEASE/spring-web/src/main/java/org/springframework/web/filter/ForwardedHeaderFilter.java[ForwardedHeaderFilter].
+
+Spring Boot users may use the `server.use-forward-headers` property to configure the application.
+See the https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-use-tomcat-behind-a-proxy-server[Spring Boot documentation] for further details.

+ 1 - 0
docs/manual/src/docs/asciidoc/_includes/servlet/oauth2/oauth2-client.adoc

@@ -430,6 +430,7 @@ If the client is running in an untrusted environment (eg. native application or
 . `client-secret` is omitted (or empty)
 . `client-secret` is omitted (or empty)
 . `client-authentication-method` is set to "none" (`ClientAuthenticationMethod.NONE`)
 . `client-authentication-method` is set to "none" (`ClientAuthenticationMethod.NONE`)
 
 
+[[oauth2Client-auth-code-redirect-uri]]
 The `DefaultOAuth2AuthorizationRequestResolver` also supports `URI` template variables for the `redirect-uri` using `UriComponentsBuilder`.
 The `DefaultOAuth2AuthorizationRequestResolver` also supports `URI` template variables for the `redirect-uri` using `UriComponentsBuilder`.
 
 
 The following configuration uses all the supported `URI` template variables:
 The following configuration uses all the supported `URI` template variables:

+ 3 - 0
docs/manual/src/docs/asciidoc/_includes/servlet/oauth2/oauth2-login.adoc

@@ -42,6 +42,9 @@ In the "Set a redirect URI" sub-section, ensure that the *Authorized redirect UR
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
 The *_registrationId_* is a unique identifier for the <<oauth2Client-client-registration,ClientRegistration>>.
 The *_registrationId_* is a unique identifier for the <<oauth2Client-client-registration,ClientRegistration>>.
 
 
+IMPORTANT: If the OAuth Client is running behind a proxy server, it is recommended to check <<appendix-proxy-server, Proxy Server Configuration>> to ensure the application is correctly configured.
+Also, see the supported <<oauth2Client-auth-code-redirect-uri, `URI` template variables>> for `redirect-uri`.
+
 
 
 [[oauth2login-sample-application-config]]
 [[oauth2login-sample-application-config]]
 ==== Configure application.yml
 ==== Configure application.yml

+ 12 - 0
samples/boot/oauth2login-webflux/README.adoc

@@ -46,6 +46,9 @@ In the "Set a redirect URI" sub-section, ensure that the *Authorized redirect UR
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
 
 
+IMPORTANT: If the application is running behind a proxy server, it is recommended to check https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#appendix-proxy-server[Proxy Server Configuration] to ensure the application is correctly configured.
+Also, see the supported https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#oauth2Client-auth-code-redirect-uri[`URI` template variables] for `redirect-uri`.
+
 [[google-application-config]]
 [[google-application-config]]
 === Configure application.yml
 === Configure application.yml
 
 
@@ -110,6 +113,9 @@ and have granted access to the OAuth application on the _Authorize application_
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
 
 
+IMPORTANT: If the application is running behind a proxy server, it is recommended to check https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#appendix-proxy-server[Proxy Server Configuration] to ensure the application is correctly configured.
+Also, see the supported https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#oauth2Client-auth-code-redirect-uri[`URI` template variables] for `redirect-uri`.
+
 [[github-application-config]]
 [[github-application-config]]
 === Configure application.yml
 === Configure application.yml
 
 
@@ -185,6 +191,9 @@ and have granted access to the application on the _Authorize application_ page.
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
 
 
+IMPORTANT: If the application is running behind a proxy server, it is recommended to check https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#appendix-proxy-server[Proxy Server Configuration] to ensure the application is correctly configured.
+Also, see the supported https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#oauth2Client-auth-code-redirect-uri[`URI` template variables] for `redirect-uri`.
+
 [[facebook-application-config]]
 [[facebook-application-config]]
 === Configure application.yml
 === Configure application.yml
 
 
@@ -258,6 +267,9 @@ and have granted access to the application on the _Authorize application_ page.
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
 
 
+IMPORTANT: If the application is running behind a proxy server, it is recommended to check https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#appendix-proxy-server[Proxy Server Configuration] to ensure the application is correctly configured.
+Also, see the supported https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#oauth2Client-auth-code-redirect-uri[`URI` template variables] for `redirect-uri`.
+
 [[okta-assign-application-people]]
 [[okta-assign-application-people]]
 === Assign Application to People
 === Assign Application to People
 
 

+ 12 - 0
samples/boot/oauth2login/README.adoc

@@ -43,6 +43,9 @@ In the "Set a redirect URI" sub-section, ensure that the *Authorized redirect UR
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
 
 
+IMPORTANT: If the application is running behind a proxy server, it is recommended to check https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#appendix-proxy-server[Proxy Server Configuration] to ensure the application is correctly configured.
+Also, see the supported https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#oauth2Client-auth-code-redirect-uri[`URI` template variables] for `redirect-uri`.
+
 [[google-application-config]]
 [[google-application-config]]
 === Configure application.yml
 === Configure application.yml
 
 
@@ -107,6 +110,9 @@ and have granted access to the OAuth application on the _Authorize application_
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
 
 
+IMPORTANT: If the application is running behind a proxy server, it is recommended to check https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#appendix-proxy-server[Proxy Server Configuration] to ensure the application is correctly configured.
+Also, see the supported https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#oauth2Client-auth-code-redirect-uri[`URI` template variables] for `redirect-uri`.
+
 [[github-application-config]]
 [[github-application-config]]
 === Configure application.yml
 === Configure application.yml
 
 
@@ -182,6 +188,9 @@ and have granted access to the application on the _Authorize application_ page.
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
 
 
+IMPORTANT: If the application is running behind a proxy server, it is recommended to check https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#appendix-proxy-server[Proxy Server Configuration] to ensure the application is correctly configured.
+Also, see the supported https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#oauth2Client-auth-code-redirect-uri[`URI` template variables] for `redirect-uri`.
+
 [[facebook-application-config]]
 [[facebook-application-config]]
 === Configure application.yml
 === Configure application.yml
 
 
@@ -255,6 +264,9 @@ and have granted access to the application on the _Authorize application_ page.
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
 TIP: The default redirect URI template is `{baseUrl}/login/oauth2/code/{registrationId}`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
  The *_registrationId_* is a unique identifier for the `ClientRegistration`.
 
 
+IMPORTANT: If the application is running behind a proxy server, it is recommended to check https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#appendix-proxy-server[Proxy Server Configuration] to ensure the application is correctly configured.
+Also, see the supported https://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#oauth2Client-auth-code-redirect-uri[`URI` template variables] for `redirect-uri`.
+
 [[okta-assign-application-people]]
 [[okta-assign-application-people]]
 === Assign Application to People
 === Assign Application to People