MCPcopy Create free account
hub / github.com/MG-RAST/Shock / Authenticate

Function Authenticate

shock-server/request/request.go:59–67  ·  view source on GitHub ↗
(req *http.Request)

Source from the content-addressed store, hash-verified

57}
58
59func Authenticate(req *http.Request) (u *user.User, err error) {
60 if _, ok := req.Header["Authorization"]; !ok {
61 err = errors.New(e.NoAuth)
62 return
63 }
64 header := req.Header.Get("Authorization")
65 u, err = auth.Authenticate(header)
66 return
67}
68
69func AuthError(err error, ctx context.Context) error {
70 if err.Error() == e.InvalidAuth {

Callers

nothing calls this directly

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected