Handler will parse the bearer token, introspect it, and put the token and other relevant information back in the context.
(next http.Handler)
| 31 | // Handler will parse the bearer token, introspect it, and put the token and other |
| 32 | // relevant information back in the context. |
| 33 | func (m *Middleware) Handler(next http.Handler) http.Handler { |
| 34 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 35 | ctx, isOk := introspectRequest(r, w, m.Backend) |
| 36 | if !isOk { |
| 37 | return |
| 38 | } |
| 39 | next.ServeHTTP(w, r.WithContext(ctx)) |
| 40 | }) |
| 41 | } |
| 42 | |
| 43 | type token struct { |
| 44 | value string |