Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
go-sso
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
id
go-sso
Commits
e124bf26
Commit
e124bf26
authored
7 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Properly build the full URL for the 'd' parameter
parent
e4a26106
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
httpsso/handler.go
+11
-1
11 additions, 1 deletion
httpsso/handler.go
with
11 additions
and
1 deletion
httpsso/handler.go
+
11
−
1
View file @
e124bf26
...
...
@@ -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
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment