mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-22 09:34:33 +08:00
refactoring
This commit is contained in:
parent
331af2219c
commit
76d5e730f7
3
auth.go
3
auth.go
@ -7,6 +7,7 @@ package gin
|
||||
import (
|
||||
"crypto/subtle"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
@ -83,7 +84,7 @@ func processAccounts(accounts Accounts) authPairs {
|
||||
}
|
||||
|
||||
func authorizationHeader(user, password string) string {
|
||||
base := user + ":" + password
|
||||
base := fmt.Sprintf("%s:%s", user, password)
|
||||
return "Basic " + base64.StdEncoding.EncodeToString([]byte(base))
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user