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

Create a new auth implementation that validates a JWT token and attaches a user to the global context #2809

Closed
2 tasks
chouinar opened this issue Nov 12, 2024 · 0 comments · Fixed by #2959
Closed
2 tasks
Assignees

Comments

@chouinar
Copy link
Collaborator

Summary

TODO - some of the technical details.

We want a new auth approach that we can use as an alternative to our current:
@opportunity_blueprint.auth_required(api_key_auth)

Instead we should have a jwt auth that we can attach to our routes. This will do a few things:

  • Fetch a token from a header param
  • Validate that the token is one we generated in our API (see Setup logic to generate a JWT in our API #2808 )
  • Fetch a user from the DB with the given user ID
    • Attach this user object to the global context to be fetched elsewhere

Open questions:

  • How does this work with the DB session management, we should be able to get a DB session in other methods, but will the user itself be funky because of a detached session issue?

Acceptance criteria

  • Auth implementation created
  • Thorough unit tests written to verify edge case scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

1 participant