From bf764c2b17ca0db39993303fef5279a9edfe4236 Mon Sep 17 00:00:00 2001 From: Milo Schwartz Date: Wed, 27 Nov 2024 14:36:10 -0500 Subject: [PATCH] remove query param --- .traefik.yml | 1 - main.go | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.traefik.yml b/.traefik.yml index 1d661dc..2a062e7 100644 --- a/.traefik.yml +++ b/.traefik.yml @@ -7,6 +7,5 @@ summary: Middleware auth bouncer for Pangolin testData: apiBaseUrl: http://localhost:3001/api/v1 - sessionQueryParameter: __pang_sess userSessionCookieName: session resourceSessionCookieName: resource_session diff --git a/main.go b/main.go index f3e8980..b1c1fc7 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,6 @@ import ( type Config struct { APIBaseUrl string `json:"apiBaseUrl"` - SessionQueryParameter string `json:"sessionQueryParameter"` UserSessionCookieName string `json:"userSessionCookieName"` ResourceSessionCookieName string `json:"resourceSessionCookieName"` } @@ -41,7 +40,6 @@ type Badger struct { next http.Handler name string apiBaseUrl string - sessionQueryParameter string userSessionCookieName string resourceSessionCookieName string } @@ -51,7 +49,6 @@ func New(ctx context.Context, next http.Handler, config *Config, name string) (h next: next, name: name, apiBaseUrl: config.APIBaseUrl, - sessionQueryParameter: config.SessionQueryParameter, userSessionCookieName: config.UserSessionCookieName, resourceSessionCookieName: config.ResourceSessionCookieName, }, nil @@ -105,12 +102,12 @@ func (p *Badger) ServeHTTP(rw http.ResponseWriter, req *http.Request) { return } - if !result.Data.Valid { // only do this if for some reason the API doesn't return a redirect and it's not valid + if !result.Data.Valid { http.Error(rw, "Unauthorized", http.StatusUnauthorized) return } - fmt.Println("serving authorized") + fmt.Println("authorized") p.next.ServeHTTP(rw, req) }