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

Method searchCredential

auth.go:32–42  ·  view source on GitHub ↗
(authValue string)

Source from the content-addressed store, hash-verified

30type authPairs []authPair
31
32func (a authPairs) searchCredential(authValue string) (string, bool) {
33 if authValue == "" {
34 return "", false
35 }
36 for _, pair := range a {
37 if subtle.ConstantTimeCompare(bytesconv.StringToBytes(pair.value), bytesconv.StringToBytes(authValue)) == 1 {
38 return pair.user, true
39 }
40 }
41 return "", false
42}
43
44// BasicAuthForRealm returns a Basic HTTP Authorization middleware. It takes as arguments a map[string]string where
45// the key is the user name and the value is the password, as well as the name of the Realm.

Callers 3

BasicAuthForRealmFunction · 0.80
BasicAuthForProxyFunction · 0.80

Calls 1

StringToBytesFunction · 0.92

Tested by 1