Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement Clone for HeaderAndClaims #12

Merged
merged 1 commit into from
May 30, 2024

Conversation

bittrance
Copy link
Contributor

In my Axum JWT verification middleware, I want to pass the validated JWT on to successive middlewares and handlers. This is done by adding it to the request.extensions() type map. However, it requires T: Clone and HeaderAndClaims<_> currently does not implement Clone so this is not directly possible.

This PR implements the relevant Clone which spares the minor inconvenience of having to put the JWT in an Arc. A quick test indicates that this will grow the release rlib by 4 kbytes (current rlib is c:a 1.1 Mbytes). Not sure if this is a reasonable trade-off, but since I wrote and tested the code, I thought I'd put it up for consideration.

@bittrance bittrance changed the title Implement Clone for HeaderAndClaims Allow JWT to be stored in Axum extensions May 29, 2024
@blckngm blckngm changed the title Allow JWT to be stored in Axum extensions feat: implement Clone for HeaderAndClaims May 30, 2024
@blckngm blckngm merged commit 9cd5cc1 into blckngm:main May 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants