google / go-safeweb

Secure-by-default HTTP servers in Go.
Apache License 2.0
1.43k stars 81 forks source link

Support Interceptor Wrapping #307

Open empijei opened 3 years ago

empijei commented 3 years ago

For various reasons (e.g. experiments) it might be useful to wrap interceptors.

The problem is that once an interceptor gets wrapped, it will not be matched to its configurations anymore.

I propose to add the following feature:

When a Mux is constructed we match configs with their interceptor, but we also check if the the interceptor has a

Unwrap() Interceptor

method on it.

If so, we recursively check configs against the inner interceptors.

kele commented 3 years ago

Is my understanding correct that we don't need anything extra to support this case? Maybe just a GoDoc example?