File tree 2 files changed +1
-6
lines changed
2 files changed +1
-6
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ const StatusHeader = "JwtPxy-Token-Status"
17
17
const RequireTokenModeHeader = "JwtPxy-Require-Token-Mode"
18
18
const SignatureHeader = "JwtPxy-Signature"
19
19
20
- // Proxy
21
20
type Proxy struct {
22
21
Target * url.URL
23
22
Proxy * httputil.ReverseProxy
@@ -29,19 +28,16 @@ type Proxy struct {
29
28
TokenMappings []TokenMapping
30
29
}
31
30
32
- // JWTConfig
33
31
type JWTConfig struct {
34
32
PublicKey * rsa.PublicKey `json:"public_key"`
35
33
}
36
34
37
- // Pmx
38
35
type Pmx struct {
39
36
Requests prometheus.Counter
40
37
Latency prometheus.Summary
41
38
AuthFails prometheus.Counter
42
39
}
43
40
44
- // handle requests
45
41
func (p * Proxy ) Handle (w http.ResponseWriter , r * http.Request ) {
46
42
47
43
var admit = true
@@ -81,6 +77,7 @@ func (p *Proxy) Handle(w http.ResponseWriter, r *http.Request) {
81
77
// not a token we check requireTokenMode for "false"
82
78
authHeader := r .Header .Get ("Authorization" )
83
79
tokenString := strings .TrimPrefix (authHeader , "Bearer " )
80
+
84
81
if tokenString != "" {
85
82
err := p .ProxyTokenHandler (r )
86
83
if err != nil {
Original file line number Diff line number Diff line change @@ -12,14 +12,12 @@ import (
12
12
"go.uber.org/zap"
13
13
)
14
14
15
- // TokenMapping
16
15
type TokenMapping struct {
17
16
Header string
18
17
TokenKey string
19
18
TokenValue interface {}
20
19
}
21
20
22
- // ProxyTokenHandler
23
21
func (p * Proxy ) ProxyTokenHandler (r * http.Request ) error {
24
22
25
23
// process JWT
You can’t perform that action at this time.
0 commit comments