Skip to content

Conversation

@jajaramillo24
Copy link
Collaborator

This pull request adds support for activating and deactivating API applications, enhances authentication logic to distinguish between API key and Basic Auth, and introduces relevant database and API changes. It also improves type casting and adds new admin endpoints for managing application status.

Authentication and middleware improvements:

  • Updated ApiAuthMiddleware to support both API key and Basic Auth authentication, with clear error messages for missing or invalid credentials, and checks for application active status before allowing access. (app/Http/Middleware/ApiAuthMiddleware.php [1] [2]

Database and model updates:

  • Added a new is_active boolean column to the applications table via a migration, defaulting to true. (database/migrations/2025_09_12_162459_add_is_active_to_aplications_table.php database/migrations/2025_09_12_162459_add_is_active_to_aplications_table.phpR1-R32)
  • Updated the Application model to include is_active in fillable fields, cast it as a boolean, and added an active query scope. Also enabled timestamps and fixed key generation to use Str::random. (app/Models/Application.php [1] [2] [3]

API and routing changes:

  • Added new API routes for activating, deactivating, and retrieving all applications for admin purposes. (routes/api.php routes/api.phpR67-R71)

Dependency management:

  • Added overrides for cipher-base and sha.js in package.json to ensure secure and up-to-date cryptography dependencies. (package.json package.jsonR21-R24)

l-dufour and others added 6 commits June 5, 2025 11:08
Introduces an is_active boolean column to the applications table with a migration, updates the Application model with an active scope and proper casting, and refactors ApplicationController to support activation/deactivation, filtering by active status, and improved validation. The API routes are extended to include endpoints for activating, deactivating, and listing all applications for admins. The ApiAuthMiddleware now checks the is_active status for API key authentication and returns appropriate error responses for inactive applications.
Copy link
Collaborator

@joseganora joseganora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Many comments in spanish
  • Methods to reach database must be in the repository
  • Keep dependence inyection
  • Keep private $tenantId = 1; as a variable in the class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants