mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-18 23:12:17 +08:00
rename var
This commit is contained in:
parent
5b17ae8def
commit
0f29b0145c
6
auth.go
6
auth.go
@ -69,13 +69,13 @@ func BasicAuth(accounts Accounts) HandlerFunc {
|
|||||||
func processAccounts(accounts Accounts) authKVMap {
|
func processAccounts(accounts Accounts) authKVMap {
|
||||||
length := len(accounts)
|
length := len(accounts)
|
||||||
assert1(length > 0, "Empty list of authorized credentials")
|
assert1(length > 0, "Empty list of authorized credentials")
|
||||||
pairMap := make(authKVMap)
|
authMap := make(authKVMap)
|
||||||
for user, password := range accounts {
|
for user, password := range accounts {
|
||||||
assert1(user != "", "User can not be empty")
|
assert1(user != "", "User can not be empty")
|
||||||
value := authorizationHeader(user, password)
|
value := authorizationHeader(user, password)
|
||||||
pairMap[value]=user
|
authMap[value]=user
|
||||||
}
|
}
|
||||||
return pairMap
|
return authMap
|
||||||
}
|
}
|
||||||
|
|
||||||
func authorizationHeader(user, password string) string {
|
func authorizationHeader(user, password string) string {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user