Skip to content

Commit

Permalink
fix redirect url param handling (oauth2-proxy#10)
Browse files Browse the repository at this point in the history
* Added conditional to prevent user-supplied redirect URL getting
clobbered

Change-type: patch

* use redirectURL as OAuthCallbackURL (as it should be!)

Change-type: patch
  • Loading branch information
dt-rush authored and aigarius committed Mar 8, 2019
1 parent 46eab25 commit a64f89b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [#68](https://github.com/pusher/oauth2_proxy/pull/68) forward X-Auth-Access-Token header (@davidholsgrove)
- [#41](https://github.com/pusher/oauth2_proxy/pull/41) Added option to manually specify OIDC endpoints instead of relying on discovery
- [#83](https://github.com/pusher/oauth2_proxy/pull/83) Add `id_token` refresh to Google provider (@leki75)
- [#10](https://github.com/pusher/oauth2_proxy/pull/10) fix redirect url param handling (@dt-rush)

# v3.1.0

Expand Down
6 changes: 4 additions & 2 deletions oauthproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ func NewOAuthProxy(opts *Options, validator func(string) bool) *OAuthProxy {
}

redirectURL := opts.redirectURL
redirectURL.Path = fmt.Sprintf("%s/callback", opts.ProxyPrefix)
if redirectURL.String() == "" {
redirectURL.Path = fmt.Sprintf("%s/callback", opts.ProxyPrefix)
}

log.Printf("OAuthProxy configured for %s Client ID: %s", opts.provider.Data().ProviderName, opts.ClientID)
refresh := "disabled"
Expand Down Expand Up @@ -218,7 +220,7 @@ func NewOAuthProxy(opts *Options, validator func(string) bool) *OAuthProxy {
SignInPath: fmt.Sprintf("%s/sign_in", opts.ProxyPrefix),
SignOutPath: fmt.Sprintf("%s/sign_out", opts.ProxyPrefix),
OAuthStartPath: fmt.Sprintf("%s/start", opts.ProxyPrefix),
OAuthCallbackPath: fmt.Sprintf("%s/callback", opts.ProxyPrefix),
OAuthCallbackPath: redirectURL.Path,
AuthOnlyPath: fmt.Sprintf("%s/auth", opts.ProxyPrefix),

ProxyPrefix: opts.ProxyPrefix,
Expand Down

0 comments on commit a64f89b

Please sign in to comment.