tower-rs / tower-rs/tower-http

Allow multiple valid bearer keys for ValidateRequestHeaderLayer

Open
#485 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
913
Forks
231
Avg merge
1d 20h
Merged PRs (30d)
8

Description

  • 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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at tower_http::validate_request::ValidateRequestHeaderLayer::bearer to understand the existing single-key behavior. Decide whether the feature should accept a dynamically changing lookup closure or a new trait, and consider how completion would demonstrate that multiple bearer tokens are accepted and invalid tokens rejected.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
authentication
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.