mirror of
https://github.com/gin-gonic/gin.git
synced 2025-05-20 08:55:53 +08:00
Merge branch 'develop' into performance
Conflicts: context.go context_test.go gin_test.go recovery_test.go utils.go
This commit is contained in:
5
auth.go
5
auth.go
@ -9,7 +9,6 @@ import (
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"sort"
|
||||
)
|
||||
|
||||
@ -62,12 +61,12 @@ func BasicAuth(accounts Accounts) HandlerFunc {
|
||||
|
||||
func processAccounts(accounts Accounts) authPairs {
|
||||
if len(accounts) == 0 {
|
||||
log.Panic("Empty list of authorized credentials")
|
||||
panic("Empty list of authorized credentials")
|
||||
}
|
||||
pairs := make(authPairs, 0, len(accounts))
|
||||
for user, password := range accounts {
|
||||
if len(user) == 0 {
|
||||
log.Panic("User can not be empty")
|
||||
panic("User can not be empty")
|
||||
}
|
||||
base := user + ":" + password
|
||||
value := "Basic " + base64.StdEncoding.EncodeToString([]byte(base))
|
||||
|
Reference in New Issue
Block a user