Skip to content

Commit fd49bcf

Browse files
committed
return Auth Required Headers
1 parent 801c0ce commit fd49bcf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internals/proxy/proxy.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const (
2121
Bearer AuthType = "Bearer"
2222
Basic AuthType = "Basic"
2323
Query AuthType = "Query"
24-
None AuthType = ""
24+
None AuthType = "None"
2525
)
2626

2727
func getAuthType(str string) AuthType {
@@ -62,7 +62,7 @@ func AuthMiddleware(next http.Handler) http.Handler {
6262

6363
authQuery := req.URL.Query().Get("authorization")
6464

65-
var authType AuthType
65+
var authType AuthType = None
6666

6767
success := false
6868

@@ -104,6 +104,8 @@ func AuthMiddleware(next http.Handler) http.Handler {
104104
}
105105

106106
if !success {
107+
w.Header().Set("WWW-Authenticate", "Basic realm=\"Login Required\", Bearer realm=\"Access Token Required\"")
108+
107109
log.Warn("User failed ", string(authType), " Auth")
108110
http.Error(w, "Unauthorized", http.StatusUnauthorized)
109111
return

0 commit comments

Comments
 (0)