Skip to content
Snippets Groups Projects
Commit e124bf26 authored by ale's avatar ale
Browse files

Properly build the full URL for the 'd' parameter

parent e4a26106
Branches
No related tags found
No related merge requests found
......@@ -142,7 +142,7 @@ func (s *SSOWrapper) redirectToLogin(w http.ResponseWriter, req *http.Request, s
v := make(url.Values)
v.Set("s", service)
v.Set("d", req.URL.String())
v.Set("d", getFullURL(req, "https").String())
v.Set("n", nonce)
v.Set("g", strings.Join(groups, ","))
loginURL := s.serverURL + "?" + v.Encode()
......@@ -159,6 +159,16 @@ func pathFromService(service string) string {
return service[i:]
}
// Return a full URL from a HTTP request, assuming the given scheme
// (the URL field in net/http.Request normally only contains path and
// query args).
func getFullURL(req *http.Request, scheme string) *url.URL {
u := *req.URL
u.Scheme = scheme
u.Host = req.Host
return &u
}
func makeUniqueNonce() string {
var b [8]byte
if _, err := rand.Read(b[:]); err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment