git.iko.soy/typeable/oauth2-proxy
on master help sign in
Use OAuthProxy.GetRedirect in /sign_in, honoring the 'rd' query parameter (#405)
907de4eTimo Beckers
CHANGELOG.md+2−1
@@ -3,7 +3,7 @@
3## Release Hightlights
3## Release Hightlights
4
4
5## Important Notes
5## Important Notes
6−- [#335] The session expiry for the OIDC provider is now taken from the Token Response (expires_in) rather than from the id_token (exp)
6+- [#335] The session expiry for the OIDC provider is now taken from the Token Response (expires_in) rather than from the id_token (exp)
7
7
8## Breaking Changes
8## Breaking Changes
9
9
@@ -16,6 +16,7 @@
16- [#363](https://github.com/pusher/oauth2_proxy/pull/363) Extension of Redis Session Store to Support Redis Cluster (@yan-dblinf)
16- [#363](https://github.com/pusher/oauth2_proxy/pull/363) Extension of Redis Session Store to Support Redis Cluster (@yan-dblinf)
17- [#353](https://github.com/pusher/oauth2_proxy/pull/353) Fix login page fragment handling after soft reload on Firefox (@ffdybuster)
17- [#353](https://github.com/pusher/oauth2_proxy/pull/353) Fix login page fragment handling after soft reload on Firefox (@ffdybuster)
18- [#355](https://github.com/pusher/oauth2_proxy/pull/355) Add Client Secret File support for providers that rotate client secret via file system (@pasha-r)
18- [#355](https://github.com/pusher/oauth2_proxy/pull/355) Add Client Secret File support for providers that rotate client secret via file system (@pasha-r)
19+- [#405](https://github.com/pusher/oauth2_proxy/pull/405) The `/sign_in` page now honors the `rd` query parameter, fixing the redirect after a successful authentication (@ti-mo)
19
20
20# v5.0.0
21# v5.0.0
21
22
oauthproxy.go+9−6
@@ -446,12 +446,15 @@ func (p *OAuthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code
446 p.ClearSessionCookie(rw, req)
446 p.ClearSessionCookie(rw, req)
447 rw.WriteHeader(code)
447 rw.WriteHeader(code)
448
448
449− redirecURL := req.URL.RequestURI()
449+ redirectURL, err := p.GetRedirect(req)
450− if req.Header.Get("X-Auth-Request-Redirect") != "" {
450+ if err != nil {
451− redirecURL = req.Header.Get("X-Auth-Request-Redirect")
451+ logger.Printf("Error obtaining redirect: %s", err.Error())
452+ p.ErrorPage(rw, 500, "Internal Error", err.Error())
453+ return
452 }
454 }
455+
453− if redirecURL == p.SignInPath {
456+ if redirectURL == p.SignInPath {
454− redirecURL = "/"
457+ redirectURL = "/"
455 }
458 }
456
459
457 t := struct {
460 t := struct {
@@ -466,7 +469,7 @@ func (p *OAuthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code
466 ProviderName: p.provider.Data().ProviderName,
469 ProviderName: p.provider.Data().ProviderName,
467 SignInMessage: p.SignInMessage,
470 SignInMessage: p.SignInMessage,
468 CustomLogin: p.displayCustomLoginForm(),
471 CustomLogin: p.displayCustomLoginForm(),
469− Redirect: redirecURL,
472+ Redirect: redirectURL,
470 Version: VERSION,
473 Version: VERSION,
471 ProxyPrefix: p.ProxyPrefix,
474 ProxyPrefix: p.ProxyPrefix,
472 Footer: template.HTML(p.Footer),
475 Footer: template.HTML(p.Footer),