Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
keycloak-proxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
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
Janne Mareike Koschinski
keycloak-proxy
Commits
fa57d3fb
Commit
fa57d3fb
authored
8 years ago
by
Rohith
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
- switching to using set headers rather than adding (#139)
parent
24db1ed4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
middleware.go
+9
-9
9 additions, 9 deletions
middleware.go
with
9 additions
and
9 deletions
middleware.go
+
9
−
9
View file @
fa57d3fb
...
...
@@ -414,19 +414,19 @@ func (r *oauthProxy) headersMiddleware(custom []string) gin.HandlerFunc {
return
func
(
cx
*
gin
.
Context
)
{
// step: add any custom headers to the request
for
k
,
v
:=
range
r
.
config
.
Headers
{
cx
.
Request
.
Header
.
Add
(
k
,
v
)
cx
.
Request
.
Header
.
Set
(
k
,
v
)
}
// step: retrieve the user context if any
if
user
,
found
:=
cx
.
Get
(
userContextName
);
found
{
id
:=
user
.
(
*
userContext
)
cx
.
Request
.
Header
.
Add
(
"X-Auth-Userid"
,
id
.
name
)
cx
.
Request
.
Header
.
Add
(
"X-Auth-Subject"
,
id
.
id
)
cx
.
Request
.
Header
.
Add
(
"X-Auth-Username"
,
id
.
name
)
cx
.
Request
.
Header
.
Add
(
"X-Auth-Email"
,
id
.
email
)
cx
.
Request
.
Header
.
Add
(
"X-Auth-ExpiresIn"
,
id
.
expiresAt
.
String
())
cx
.
Request
.
Header
.
Add
(
"X-Auth-Token"
,
id
.
token
.
Encode
())
cx
.
Request
.
Header
.
Add
(
"X-Auth-Roles"
,
strings
.
Join
(
id
.
roles
,
","
))
cx
.
Request
.
Header
.
Set
(
"X-Auth-Userid"
,
id
.
name
)
cx
.
Request
.
Header
.
Set
(
"X-Auth-Subject"
,
id
.
id
)
cx
.
Request
.
Header
.
Set
(
"X-Auth-Username"
,
id
.
name
)
cx
.
Request
.
Header
.
Set
(
"X-Auth-Email"
,
id
.
email
)
cx
.
Request
.
Header
.
Set
(
"X-Auth-ExpiresIn"
,
id
.
expiresAt
.
String
())
cx
.
Request
.
Header
.
Set
(
"X-Auth-Token"
,
id
.
token
.
Encode
())
cx
.
Request
.
Header
.
Set
(
"X-Auth-Roles"
,
strings
.
Join
(
id
.
roles
,
","
))
// step: add the authorization header if requested
if
r
.
config
.
EnableAuthorizationHeader
{
...
...
@@ -436,7 +436,7 @@ func (r *oauthProxy) headersMiddleware(custom []string) gin.HandlerFunc {
// step: inject any custom claims
for
claim
,
header
:=
range
customClaims
{
if
claim
,
found
:=
id
.
claims
[
claim
];
found
{
cx
.
Request
.
Header
.
Add
(
header
,
fmt
.
Sprintf
(
"%v"
,
claim
))
cx
.
Request
.
Header
.
Set
(
header
,
fmt
.
Sprintf
(
"%v"
,
claim
))
}
}
}
...
...
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