Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
krogon-dp committed Sep 27, 2017
1 parent 7b26256 commit 981aba7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions oauthproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ func (p *OAuthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code
if redirect_url == p.SignInPath {
redirect_url = "/"
}
redirect_url = strings.Replace(redirect_url, fmt.Sprintf("%s?rd=", p.SignInPath), "", 1)

t := struct {
ProviderName string
Expand Down
15 changes: 15 additions & 0 deletions oauthproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,21 @@ func TestSignInPageDirectAccessRedirectsToRoot(t *testing.T) {
}
}

func TestSignInPageDirectAccessRedirectsToRdGetParam(t *testing.T) {
sip_test := NewSignInPageTest(false)
code, body := sip_test.GetEndpoint("/oauth2/sign_in?rd=/example/path")
assert.Equal(t, 200, code)

match := sip_test.sign_in_regexp.FindStringSubmatch(body)
if match == nil {
t.Fatal("Did not find pattern in body: " +
signInRedirectPattern + "\nBody:\n" + body)
}
if match[1] != "/example/path" {
t.Fatal(`expected redirect to "/example/path", but was "` + match[1] + `"`)
}
}

func TestSignInPageSkipProvider(t *testing.T) {
sip_test := NewSignInPageTest(true)
const endpoint = "/some/random/endpoint"
Expand Down

0 comments on commit 981aba7

Please sign in to comment.