MCPcopy Create free account
hub / github.com/chain/Core / localhostAuthn

Method localhostAuthn

net/http/authn/authn.go:117–126  ·  view source on GitHub ↗

returns true if this request is coming from a loopback address

(req *http.Request)

Source from the content-addressed store, hash-verified

115
116// returns true if this request is coming from a loopback address
117func (a *API) localhostAuthn(req *http.Request) bool {
118 h, _, err := net.SplitHostPort(req.RemoteAddr)
119 if err != nil {
120 return false
121 }
122 if !net.ParseIP(h).IsLoopback() {
123 return false
124 }
125 return true
126}
127
128func (a *API) tokenAuthn(req *http.Request) (string, error) {
129 user, pw, ok := req.BasicAuth()

Callers 1

AuthenticateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected