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
81b7defd
Commit
81b7defd
authored
9 years ago
by
Rohith
Browse files
Options
Downloads
Patches
Plain Diff
- using the next and fixing up the comments
- adding the 0.0.5 build
parent
6e112718
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+1
-1
1 addition, 1 deletion
Makefile
build.go
+1
-1
1 addition, 1 deletion
build.go
handlers.go
+10
-2
10 additions, 2 deletions
handlers.go
with
12 additions
and
4 deletions
Makefile
+
1
−
1
View file @
81b7defd
...
...
@@ -29,7 +29,7 @@ build: buildtags
mkdir
-p
bin
godep go build
-o
bin/
${
NAME
}
static
:
buildtags
deps
static
:
golang
deps
@
echo
"--> Compiling the static binary"
mkdir
-p
bin
CGO_ENABLED
=
0
GOOS
=
linux godep go build
-a
-tags
netgo
-ldflags
'-w'
-o
bin/
${
NAME
}
...
...
This diff is collapsed.
Click to expand it.
build.go
+
1
−
1
View file @
81b7defd
package
main
const
buildID
=
"v0.0.5, git+sha:
da9497
8"
const
buildID
=
"v0.0.5, git+sha:
4c3ee9
8"
This diff is collapsed.
Click to expand it.
handlers.go
+
10
−
2
View file @
81b7defd
...
...
@@ -80,6 +80,8 @@ func (r *KeycloakProxy) entrypointHandler() gin.HandlerFunc {
break
}
}
cx
.
Next
()
}
}
...
...
@@ -156,7 +158,7 @@ func (r *KeycloakProxy) authenticationHandler() gin.HandlerFunc {
log
.
WithFields
(
log
.
Fields
{
"username"
:
userContext
.
name
,
"expired_on"
:
userContext
.
expiresAt
.
String
(),
})
.
Errorf
(
"the session has expired
,
verification switch off"
)
})
.
Errorf
(
"the session has expired
and
verification switch off"
)
r
.
redirectToAuthorization
(
cx
)
}
...
...
@@ -198,6 +200,8 @@ func (r *KeycloakProxy) authenticationHandler() gin.HandlerFunc {
return
}
}
cx
.
Next
()
}
}
...
...
@@ -210,7 +214,7 @@ func (r *KeycloakProxy) authenticationHandler() gin.HandlerFunc {
// - if we have any roles requirements validate the roles exists in the access token
// - if er have any claim requirements validate the claims are the same
// - if everything is ok, we permit the request to pass through
//
func
(
r
*
KeycloakProxy
)
admissionHandler
()
gin
.
HandlerFunc
{
return
func
(
cx
*
gin
.
Context
)
{
// step: if authentication is required on this, grab the resource spec
...
...
@@ -295,10 +299,14 @@ func (r *KeycloakProxy) admissionHandler() gin.HandlerFunc {
"expires"
:
identity
.
expiresAt
.
Sub
(
time
.
Now
())
.
String
(),
"bearer"
:
identity
.
bearerToken
,
})
.
Debugf
(
"resource access permitted: %s"
,
cx
.
Request
.
RequestURI
)
cx
.
Next
()
}
}
//
// proxyHandler is responsible to proxy the requests on to the upstream endpoint
//
func
(
r
*
KeycloakProxy
)
proxyHandler
()
gin
.
HandlerFunc
{
return
func
(
cx
*
gin
.
Context
)
{
// step: retrieve the user context
...
...
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