-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve and refactor the authentication documentations #5294
Comments
I don't have any video tutorials as my disposal, but here's a quote from my previous response on a breakdown of the different concepts: Concept breakdownJust to quote from my response on Gitter: These concepts are the building blocks of lb4. They serve a specific purpose while following the OOP paradigm. It may look like a lot, but these are essentially the different extension points in LoopBack 4 (hence why lb4 is extremely extensible). Decorators (in general) The decorators in lb4 are no different to the standard decorators in TypeScript. They add metadata to classes, methods. properties, or parameters. They don't actually add any functionality, only metadata. Think of it like the file properties on your file system: It's not visible when interacting with the file normally, but those who want to access those properties will be able to via a standard interface. Sequence (in general) Sequences are a group of Actions. It simply indicates which actions should be used by the server to process the request. Sequence Actions (in general) Sequence Actions (or simply "Actions") are stateless, meaning that they only have the basic concept Converting into Express.js terminology; Think of an Action as an middleware. And think of an Element as the contents that a middleware receives. They work differently, but the high-level idea is about the same. They are unaware of other higher-level concepts such as Controllers, DataSource, Models, etc. Components (in general) When adding functionality to lb4, you'll usually need to add a combination of Providers, Booters, etc. This can tedious to manage. Hence, Components are registered once in the lb4 Application, which will then register the other stuff for you. @ authenticate Adds authentication metadata. AuthenticationComponent A component to register the necessary artifacts. AuthenticationActionProvider This is a Sequence Action. Essentially, it adds an "authentication" step to the Sequence. AuthenticationStrategyProvider This is a standard interface that the @loopback/authentiation package understands. Hence, any authentication strategy that adopts this interface can be used in @loopback/authentication. Think of it like the standard interface for Passport.js uses to interface with many different authentication strategies We also have an experimental JWT authentication extension that has built-in models, token service, etc. Though at least some customization is required as there isn't one-size-fits-all for everyone's use-case. |
@achrinza Thank you for providing the concise (but very accurate) summary of the key concepts in authentication 👍 Some of the authentication documentations were created early when team first worked on it. As time goes on we added new features, now it's a good opportunity to reorganize and improve them. @achrinza has a pretty good break down of the concepts, neat 👍 |
hi, I had jwt authentication working on my controller methods. I updgraded loopback/cli and ran lb4 update yesterday and now the methods don't authenticate any more. Is there something else I need to do to get authentication working again? |
ah solved - I had followed Raymonds instructions on updating sequence.ts at #5368 and had missed out my authentication sequence. All working now :) |
@jannyHou, could you please add acceptance criteria for estimation? Thanks. |
Hi everyone, I wrote a new layout for the authentication doc and updated the acceptance criteria accordingly. Feedback is welcomed! I would suggest we use this story to focus on authentication doc refactor, and use #5441 for authorization. |
@jannyHou, i'd suggest to make this an epic and break down the tasks into separate GH issues. It might also help if any community users would like to help as well. Thanks. |
An update: A few PRs are created to re-structure the authentication doc: |
Closing it as all PRs are merged :) |
Hello
Is there a better tutorial or video to demonstrate integration of authentication and authorization into Loopback 4 application.
The current tutorial on loopback.io is little confusing for me . Thanks for the pointers .
Updated by Janny
A plan for the layout of new authentication documentation:
@loopback/authentication
- what's provided out-of-the-box@loopback/authentication
's README file@loopback/authentication-jwt-extension
- what's provided out-of-the-box@loopback/authentication-passport
Acceptance Criteria
@loopback/authentication
's README file to have a concise usageThe text was updated successfully, but these errors were encountered: