File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff 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
2727func 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
You can’t perform that action at this time.
0 commit comments