Skip to content

Implement custom token extractor #49

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

blablacio
Copy link
Contributor

I've been working on a websocket API for some time and just realized that browsers still don't support setting headers like Authorization (or anything else other than Sec-WebSocket-Protocol), which makes things a little bit more complicated.

So, now I'm wondering what would be the most straightforward and flexible way to allow for custom token extraction?

I was thinking that probably adding a new token_extractor field on Authorizer and AuthorizerBuilder along with a method on the builder to allow passing an extractor function would be the easiest way to extend token extraction without touching the JwtSource enum.

Might be a good idea to skip setting the token_extractor entirely if jwt_source is passed, but not sure about that.

Let me know what you think and if there's a better way to go about this.

@blablacio blablacio force-pushed the custom-token-extractors branch 2 times, most recently from c654d9c to b9e7066 Compare July 9, 2024 07:52
@blablacio blablacio force-pushed the custom-token-extractors branch from c18e129 to 9f94a3e Compare January 1, 2025 20:03
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.

1 participant