From 3de44ca3c327380d6c3433a5efeee21ad854c66b Mon Sep 17 00:00:00 2001 From: Craig Johnston Date: Mon, 5 Jul 2021 12:34:53 -0700 Subject: [PATCH] housekeeping --- proxy.go | 5 +---- token.go | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/proxy.go b/proxy.go index 219f0dd..c89670e 100644 --- a/proxy.go +++ b/proxy.go @@ -17,7 +17,6 @@ const StatusHeader = "JwtPxy-Token-Status" const RequireTokenModeHeader = "JwtPxy-Require-Token-Mode" const SignatureHeader = "JwtPxy-Signature" -// Proxy type Proxy struct { Target *url.URL Proxy *httputil.ReverseProxy @@ -29,19 +28,16 @@ type Proxy struct { TokenMappings []TokenMapping } -// JWTConfig type JWTConfig struct { PublicKey *rsa.PublicKey `json:"public_key"` } -// Pmx type Pmx struct { Requests prometheus.Counter Latency prometheus.Summary AuthFails prometheus.Counter } -// handle requests func (p *Proxy) Handle(w http.ResponseWriter, r *http.Request) { var admit = true @@ -81,6 +77,7 @@ func (p *Proxy) Handle(w http.ResponseWriter, r *http.Request) { // not a token we check requireTokenMode for "false" authHeader := r.Header.Get("Authorization") tokenString := strings.TrimPrefix(authHeader, "Bearer ") + if tokenString != "" { err := p.ProxyTokenHandler(r) if err != nil { diff --git a/token.go b/token.go index c7919b2..9b60737 100644 --- a/token.go +++ b/token.go @@ -12,14 +12,12 @@ import ( "go.uber.org/zap" ) -// TokenMapping type TokenMapping struct { Header string TokenKey string TokenValue interface{} } -// ProxyTokenHandler func (p *Proxy) ProxyTokenHandler(r *http.Request) error { // process JWT