AuthMicroservice is boilerplate code for REST service that handles authentication and authorization for users. The service provides the following functionality, provided as API endpoints:
Authentication:
- Authenticate a user (with a password), create a session and return a session token (should be a JWT token)
- Validate a session token
- Close a session
Authorization:
- Retrieve permissions for a user + session combination
- Grant and revoke permissions for users
- Authorize endpoint that responds to "can user X execute action Y"
- PHP framework Lumen
- MySQL with Eloquent as a ORM
- Each distinct functionality as a separate API endpoint
- Sessions (and their tokens) as well as granted permissions are be saved in a database
- Scripts for creating database
- Scripts for quick database seeding
The Lumen framework is open-sourced software licensed under the MIT license JWT for Lumen implementation from tymondesigns/jwt-auth
For now, all endpoint test are stored within AuthMicroservice Postman collection. These examples are mapped to local environment setup at localhost:8000 with api prefix "api/v1".
- Clone this repository to your development/server machine
- Update /vendor directory with "composer update -vvv"
- Create .env file (from .env.example)
- Update .env file with APP_KEY
- Update .env file with DB_DATABASE, DB_USERNAME, DB_PASSWORD
- Generate JWT_SECRET with "php artisan jwt:secret"
- Generate required databases with "php artisan migrate"
- Generate example data with "php artisan db:seed"
- Run application with "php -S localhost:8000 -t public" or other IP:PORT combination.