docs/site/Authorization-overview.md
Wikipedia: Authorization is the function of specifying access rights/privileges to resources
LoopBack's highly extensible authorization package @loopback/authorization provides various features and provisions to check access rights of a client on a API endpoint.
API clients login to get a credential (can be a token, api-key, claim or cert). When the client calls an API endpoint, they pass the credential in the request to identify themselves (Authentication) as well as claim their access rights (Authorization).
LoopBack's authorization component checks if the permissions associated with the credential provided by the client satisfies the accessibility criteria defined by the users.
A Principal could be a User, Application or Device. The Principal is
identified from the credential provided by a client, by the configured
Authentication strategy of the endpoint
(see, LoopBack Authentication). Access
rights of the client is either associated with or included in the credential.
The Principal is then used by LoopBack's authorization mechanism to enforce
necessary privileges/access rights by using the permissions annotated by the
@authorize decorator on the controller methods.
The expectations from various stake holders (LoopBack, Architects, Developers) for implementation of the authorization features are given below in the Chain of Responsibility section.
LoopBack as a framework provides certain provisions and expects the developers to extend with their specific implementations. Architects or Security analysts generally provide security policies to clarify how the developers should approach authorization.
The framework provides,
@authorize decorator to provide authorization metadata and voterstypes and interfaces to declare user provided artifactsauthorizers as user provided functions and votersauthorizersArchitects should,
authorizersvotersauthorizers and
votersDevelopers need to,
authorizer and voter functions, see
Programming Access PoliciesBuilding RBAC system with @loopback/authorization: A tutorial for beginners to get started with the concepts and responsibilities.
Using component @loopback/authorization: The
instructions of how to apply component @loopback/authorization.