MCPcopy Index your code
hub / github.com/ContentSquare/chproxy / getUser

Method getUser

proxy.go:823–842  ·  view source on GitHub ↗

find user, cluster and clusterUser in case of wildcarded user, cluster user is crafted to use original credentials

(name string, password string)

Source from the content-addressed store, hash-verified

821// find user, cluster and clusterUser
822// in case of wildcarded user, cluster user is crafted to use original credentials
823func (rp *reverseProxy) getUser(name string, password string) (found bool, u *user, c *cluster, cu *clusterUser) {
824 rp.lock.RLock()
825 defer rp.lock.RUnlock()
826 found = false
827 u = rp.users[name]
828 switch {
829 case u != nil:
830 found = (u.password == password)
831 // existence of c and cu for toCluster is guaranteed by applyConfig
832 c = rp.clusters[u.toCluster]
833 cu = c.users[u.toUser]
834 case name == "" || name == defaultUser:
835 // default user can't work with the wildcarded feature for security reasons
836 found = false
837 case rp.hasWildcarded:
838 // checking if we have wildcarded users and if username matches one 3 possibles patterns
839 found, u, c, cu = rp.findWildcardedUserInformation(name, password)
840 }
841 return found, u, c, cu
842}
843
844func (rp *reverseProxy) findWildcardedUserInformation(name string, password string) (found bool, u *user, c *cluster, cu *clusterUser) {
845 // cf a validation in config.go, the names must contains either a prefix, a suffix or a wildcard

Callers 1

getScopeMethod · 0.95

Calls 1

Tested by

no test coverage detected