(req *http.Request)
| 126 | } |
| 127 | |
| 128 | func (a *API) tokenAuthn(req *http.Request) (string, error) { |
| 129 | user, pw, ok := req.BasicAuth() |
| 130 | if !ok { |
| 131 | return "", errors.New("no token") |
| 132 | } |
| 133 | return user, a.cachedTokenAuthnCheck(req.Context(), user, pw) |
| 134 | } |
| 135 | |
| 136 | func (a *API) tokenAuthnCheck(ctx context.Context, user, pw string) (bool, error) { |
| 137 | pwBytes, err := hex.DecodeString(pw) |
no test coverage detected