Authenticating our requests
Throughout this book, we have been intercepting the HTTP requests before they can hit the view in order to inspect the header and extract the token. If the token couldn't be verified when we interacted with to-do item views, we rejected the request and gave an unauthorized response to the user.
In Actix, we built middleware that inspected the requests before they hit the server view. In Rocket, we implemented request guards to reject the request if it did not have the authentication needed to make the request.
With Warp, we are going to follow a different approach: we are going to add another filter to our view. In this section, we are going to apply this filter to our GET view in order to get the to-do items that belong to the user. We can achieve this by doing the following:
- Adding a header extraction filter to our view.
- Configuring our own JWT to check whether the token that's been supplied is correct.
- Using the token to...