mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-20 00:02:16 +08:00
rename pairMap to authMap
This commit is contained in:
parent
0f29b0145c
commit
072c71589f
4
auth.go
4
auth.go
@ -43,10 +43,10 @@ func BasicAuthForRealm(accounts Accounts, realm string) HandlerFunc {
|
|||||||
realm = "Authorization Required"
|
realm = "Authorization Required"
|
||||||
}
|
}
|
||||||
realm = "Basic realm=" + strconv.Quote(realm)
|
realm = "Basic realm=" + strconv.Quote(realm)
|
||||||
pairMap := processAccounts(accounts)
|
authMap := processAccounts(accounts)
|
||||||
return func(c *Context) {
|
return func(c *Context) {
|
||||||
// Search user in the slice of allowed credentials
|
// Search user in the slice of allowed credentials
|
||||||
user, found := pairMap.searchCredential(c.requestHeader("Authorization"))
|
user, found := authMap.searchCredential(c.requestHeader("Authorization"))
|
||||||
if !found {
|
if !found {
|
||||||
// Credentials doesn't match, we return 401 and abort handlers chain.
|
// Credentials doesn't match, we return 401 and abort handlers chain.
|
||||||
c.Header("WWW-Authenticate", realm)
|
c.Header("WWW-Authenticate", realm)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user