add header for basic auth
This commit is contained in:
parent
c959fc2f73
commit
262ac0e9a5
@ -36,6 +36,7 @@ func mwBasicAuth(auther auth.Authenticator) gin.HandlerFunc {
|
|||||||
}
|
}
|
||||||
u, p, _ := c.Request.BasicAuth()
|
u, p, _ := c.Request.BasicAuth()
|
||||||
if _, ok := auther.Authenticate(c, u, p); !ok {
|
if _, ok := auther.Authenticate(c, u, p); !ok {
|
||||||
|
c.Writer.Header().Set("WWW-Authenticate", "Basic")
|
||||||
c.AbortWithStatus(http.StatusUnauthorized)
|
c.AbortWithStatus(http.StatusUnauthorized)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user