Skip to content

Commit af8a383

Browse files
committed
further debugging (TOKEN LEAK)
1 parent 853e252 commit af8a383

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

internals/proxy/middlewares/auth.go

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ func (data AuthMiddleware) Use() http.Handler {
5353

5454
authQuery := req.URL.Query().Get("@authorization")
5555

56-
log.Debug("AuthQuery: ", authQuery)
57-
5856
var authType authType = None
5957

6058
success := false
@@ -66,34 +64,34 @@ func (data AuthMiddleware) Use() http.Handler {
6664
authToken := authBody[1]
6765

6866
switch authType {
69-
case Bearer:
70-
if isValidToken(tokens, authToken) {
71-
success = true
72-
}
67+
case Bearer:
68+
if isValidToken(tokens, authToken) {
69+
success = true
70+
}
7371

74-
case Basic:
75-
basicAuthBody, err := base64.StdEncoding.DecodeString(authToken)
72+
case Basic:
73+
basicAuthBody, err := base64.StdEncoding.DecodeString(authToken)
7674

77-
if err != nil {
78-
log.Error("Could not decode Basic Auth Payload: ", err.Error())
79-
}
75+
if err != nil {
76+
log.Error("Could not decode Basic Auth Payload: ", err.Error())
77+
}
8078

81-
basicAuth := string(basicAuthBody)
82-
basicAuthParams := strings.Split(basicAuth, ":")
79+
basicAuth := string(basicAuthBody)
80+
basicAuthParams := strings.Split(basicAuth, ":")
8381

84-
user := "api"
82+
user := "api"
8583

86-
if basicAuthParams[0] == user && isValidToken(tokens, basicAuthParams[1]) {
87-
success = true
88-
}
84+
if basicAuthParams[0] == user && isValidToken(tokens, basicAuthParams[1]) {
85+
success = true
86+
}
8987
}
9088

9189
} else if authQuery != "" {
9290
authType = Query
9391

9492
authToken, _ := url.QueryUnescape(authQuery)
9593

96-
log.Debug("AuthToken: ", authToken)
94+
log.Debug(tokens...)
9795

9896
if isValidToken(tokens, authToken) {
9997
success = true

0 commit comments

Comments
 (0)