MCPcopy
hub / github.com/gin-gonic/gin / processAccounts

Function processAccounts

auth.go:76–89  ·  view source on GitHub ↗
(accounts Accounts)

Source from the content-addressed store, hash-verified

74}
75
76func processAccounts(accounts Accounts) authPairs {
77 length := len(accounts)
78 assert1(length > 0, "Empty list of authorized credentials")
79 pairs := make(authPairs, 0, length)
80 for user, password := range accounts {
81 assert1(user != "", "User can not be empty")
82 value := authorizationHeader(user, password)
83 pairs = append(pairs, authPair{
84 value: value,
85 user: user,
86 })
87 }
88 return pairs
89}
90
91func authorizationHeader(user, password string) string {
92 base := user + ":" + password

Callers 5

BasicAuthForRealmFunction · 0.85
BasicAuthForProxyFunction · 0.85
TestBasicAuthFunction · 0.85
TestBasicAuthFailsFunction · 0.85

Calls 2

assert1Function · 0.85
authorizationHeaderFunction · 0.85

Tested by 3

TestBasicAuthFunction · 0.68
TestBasicAuthFailsFunction · 0.68