(req *http.Request)
| 57 | } |
| 58 | |
| 59 | func 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 | |
| 69 | func AuthError(err error, ctx context.Context) error { |
| 70 | if err.Error() == e.InvalidAuth { |