Miscellaneous and options
This section guides you through the usage of each class or component within the integrations section. It offers brief explanations of their features to enhance your understanding and improve flexibility and customization options to meet future needs.
Service Providers
The PPIOAuthServiceProvider class is responsible for registering our Guard and User Providers class into the
Laravel ecosystem that will allow us to utilize it later on in the application.
Guards protection
The PPIOAuthGuard class is responsible for protecting and authenticating users. It ensures that whenever a request is
made from the client to protected routes, the requested JWT token is valid for accessing the protected data.
User Providers
The PPIUserProvider class is responsible for fetching user information and populating it into the User model attributes.
This information is then utilized to access logged-in data across the application.
Auth controller
The OAuthController class manages the OAuth authorization code flow by handling user redirection for login, logout,
and state management during the authorization process.
API services
The OAuthApiService class handles communication with the Auth server, including tasks such as JWT token validation,
retrieval of the Machine-to-Machine client token, and configuration of client identification parameters like client_id
and client_secret.
Middleware
The following statement illustrates a real scenario that has already been carried out.
We automate the execution of the CheckPermissions middleware, it's a bridge to communicate with Auth Server to check
for the required permissions, to prevent user to perform unauthorized tasks.
Trait helpers
The HasVerifyRolePermission helper function is injected into the User model. It performs HTTP requests to the Auth
Server to verify a set of permissions. The function returns true or false based on whether the user's permissions
satisfy the predefined permissions in the resource controller constructor.
