diff --git a/Makefile b/Makefile index 0afcb7f3d0b2ce4ecfa983ebb0caaa02c84defad..d86dd2ebe7dfdcef8e79c6e4ad3b495d7d0829b5 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 c6031dc45d9d8ee1f70c3b7c840d97a35dec3161..92e253dcfae016cbe836c95e2fb0d5576d18634b 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 17397c38af3df2ae198f4f2fe5c119e87b1ccdef..1aaa6bd6af95724bae7a83c21b178815a98c5a91 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