From the course: Microservices Security Workshop: From Build to Production

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Always use a framework

Always use a framework

- [Instructor] Now, let's head over to the lesson five branch to talk about how we can redesign this authentication system correctly using the FastAPI framework. First, at a high level, the important thing to understand here is not the intricacy of how this works in FastAPI, it's to understand that when we try to build things from scratch, we tend to create security issues along the way. Instead, you should look at whatever framework your development team is currently using. Some common ones are Spring and FastAPI, and look at the documentation for how to handle authentication and just make sure that you're building within those specifications. However, it's worth highlighting a couple of common patterns across how authentication works in these different frameworks. First, you can notice that I'm importing a bunch of security libraries and Middleware here in order to intercept every request that goes to the backend. This new authentication service is sitting in between every other…

Contents