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

Pattern for pulling user from JWT #305

Open
goldcaddy77 opened this issue Mar 22, 2020 · 2 comments
Open

Pattern for pulling user from JWT #305

goldcaddy77 opened this issue Mar 22, 2020 · 2 comments
Milestone

Comments

@goldcaddy77
Copy link
Owner

If consumers follow JWT standards, Warthog should make things really easy. For instance:

  • If using JWTs
  • ...and JWT comes in through authorization header
  • ...and the header is of form Bearer <token>
  • ...and we assume the JWT has an id field in it that is the user's ID

Then we should be able to:

  • Pull the token out and put it in context
  • Pull the user ID out and put it in context
  • Provide middleware to grab the token
  • Provide middleware to grab the user Id
  • Provide middleware that will pull the full user record from the DB
  • Provide JWTRequired middleware that will kill a request with no JWT
@arscan
Copy link

arscan commented Mar 22, 2020

You could go one step further and support OpenID Connect tokens.

@goldcaddy77
Copy link
Owner Author

Good suggestion. Have you set this up in Node before?

@goldcaddy77 goldcaddy77 added this to the V3 milestone May 8, 2021
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

No branches or pull requests

2 participants