MatterhornDev/matterhorn

Add authentication

Ethan-Arrowood opened this issue · 5 comments

Implement a JWT Auth system. I am envisioning an unprotected route and a protected route. Maybe add a middleware to test for valid header authorization tokens. Could even take it to the next level and create a full mini auth provider that issues tokens and stores them in some type of small db or in memory solution.

I would like to help you with this. This plugin https://github.com/fastify/fastify-jwt should do the job ! Do you want to add some functionality to configure routes to use auth or not ?

Hello @izanagi1995 yes go for it! And great idea using fastify-jwt. I imagine this feature will be implemented on a specific route and should act as an example of an authenticated route (leave some of the basic routes untouched). Make sure to add unit tests too. I don't know exactly how the 'token provider' half of this should work but I imagine you could do something like implement a POST route '/issue_token' that returns a new JWT token based on the body of the request.

Let me or @Alyssa-Cooper know if you need any help.

Hello @Ethan-Arrowood (CC @Alyssa-Cooper), I did a PR for this, the code could seem ugly, I did it today in 1 hour to have some POC so any comment about the structure is welcome !

Hi Team, is this completed or any help is needed here.

I think this is all set. Im working on completing @izanagi1995 pr now that will add this feature