-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
server: fix registration redirect for non-root URLs #558
server: fix registration redirect for non-root URLs #558
Conversation
there's even a test! |
@@ -358,7 +358,7 @@ func handleAuthFunc(srv OIDCServer, idpcs []connector.Connector, tpl *template.T | |||
if ok { | |||
q := url.Values{} | |||
q.Set("code", key) | |||
ru := httpPathRegister + "?" + q.Encode() | |||
ru := strings.TrimRight(baseURL, "/") + "/" + strings.TrimLeft(httpPathRegister, "/") + "?" + q.Encode() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you maybe use path.Join
or url.Parse
instead? It should remove some of the need to trim, but is also more likely work correctly with joining paths together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll switch it to passing a URL and use path.Join
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it seems weird that you're having to pass the basePath through to so many different places. Is this a thing you only need to do here due to needing to set the Location
header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
e7c15a4
to
47a6a8b
Compare
updated |
woops, I have no idea what just happened there. one sec |
47a6a8b
to
00d5aa9
Compare
cc @chancez ready for another review |
00d5aa9
to
22e7377
Compare
@@ -210,6 +226,33 @@ func TestHandleAuthFuncResponsesSingleRedirectURL(t *testing.T) { | |||
}, | |||
wantCode: http.StatusBadRequest, | |||
}, | |||
|
|||
// reigstration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
LGTM after nits. |
22e7377
to
fa8f98a
Compare
Closes #553
cc @sym3tri @chancez