From 81b7defd9103fabd7f094229f1140d903d670e43 Mon Sep 17 00:00:00 2001 From: Rohith <gambol99@gmail.com> Date: Fri, 15 Jan 2016 12:14:11 +0000 Subject: [PATCH] - using the next and fixing up the comments - adding the 0.0.5 build --- Makefile | 2 +- build.go | 2 +- handlers.go | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0afcb7f..d86dd2e 100644 --- a/Makefile +++ b/Makefile @@ -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} diff --git a/build.go b/build.go index c6031dc..92e253d 100644 --- a/build.go +++ b/build.go @@ -1,3 +1,3 @@ package main -const buildID = "v0.0.5, git+sha: da94978" +const buildID = "v0.0.5, git+sha: 4c3ee98" diff --git a/handlers.go b/handlers.go index 17397c3..1aaa6bd 100644 --- a/handlers.go +++ b/handlers.go @@ -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 -- GitLab