Summary
In this chapter you have learned what a passport is and strategies to configure the different parts of the passport in order to authenticate the user and store it into the request. You have also seen how to implement the different modules,
AuthenticationModule
and the UserModule
, in order to be logged into the user and provide some endpoints accessible by the user. Of course, we have restricted the access to some data that applies the AuthenticationMiddleware
and the CheckLoggedInUserGuard
for more security.
You have also seen the new @nestjs/passport
package, which allows you to implement in faster ways a few classes as AuthenticationService
and JwtStrategy
, and be able to authenticate any user on any controller method using the AuthGuard
provided by the package.
In the next chapter you will learn about the Dependency Injection pattern.