tower-rs/tower-http

Allow multiple valid bearer keys for ValidateRequestHeaderLayer

ifsheldon opened this issue · 0 comments

  • I have looked for existing issues (including closed) about this

Feature Request

Motivation

I found tower_http::validate_request::ValidateRequestHeaderLayer::bearer very convenient, but it's a bit too simplistic. I am thinking maybe we can have a layer that checks a lookup table that is dynamically changing, which should cover most of the use cases.

Proposal

I think we can let developers pass a closure which checks if a bearer token passed in the closure is valid or not, this should give them max flexibility.

Alternatives

Or, we can allow them to pass an object that impl a new trait.