Skip to content

[Blog] How to register authentication strategies #2725

@dhmlau

Description

@dhmlau

Description

The authentication package is being updated with

The shopping cart example will also be given an overhaul to utilize the new capabilities of the authentication package in loopbackio/loopback4-example-shopping#79 and will contain an example of a jwt authentication strategy being registered as an extension of the authentication strategy extension point.

Also #2312 will have light documentation on how to properly register authentication strategies.

So this blog would mention :

  • that our authentication package has been updated with these new capabilities
  • that we welcome community members to contribute new authentications strategies to the authenticate package
  • that our passport strategy adapter is still available and works in the updated design
  • links to documentation for understanding how strategies are registered
  • link to the shopping cart example
  • how the users/login endpoint in the shopping cart example wasn't decorated with a strategy, and the logic for validating user credentials occurred in the controller method, and a token service was used to create a JWT token
  • show how the JWTAuthenticationStrategy in the shopping cart example was registered as an authentication strategy extension , and how the users/me endpoint was decorated with @authenticate('jwt') and how the JWTAuthenticationStrategy.authenticate() method will determine if the user is authorized to access this endpoint or not.

Acceptance Criteria

  • Blog conforms to LoopBack team's blogging standards

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions