Skip to content

Commit

Permalink
housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
cjimti committed Jul 5, 2021
1 parent d711c5c commit 3de44ca
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 1 addition & 4 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions token.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3de44ca

Please sign in to comment.