Skip to content

Commit 16c80be

Browse files
committed
encode auth header
1 parent f1170b1 commit 16c80be

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

auth.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"context"
5+
"encoding/base64"
56
"errors"
67
"net/http"
78
"slices"
@@ -26,10 +27,11 @@ func AuthHandler(subjects []string, verifier Verifier) http.Handler {
2627
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
2728
log.Trace().Func(func(e *zerolog.Event) {
2829
headers := r.Header.Clone()
29-
// headers.Del("Authorization")
30-
// if r.Header.Get("Authorization") != "" {
31-
// headers.Set("Authorization", "!REMOVED!")
32-
// }
30+
headers.Del("Authorization")
31+
if authHeader := r.Header.Get("Authorization"); authHeader != "" {
32+
authHeader = base64.StdEncoding.EncodeToString([]byte(authHeader))
33+
headers.Set("Authorization", authHeader)
34+
}
3335
e.Interface("headers", headers)
3436
}).Msg("Request details")
3537
t := time.Now()

0 commit comments

Comments
 (0)