libreconnect / backend

MIT License
12 stars 0 forks source link

Implement Authorization for Company Creation using Keycloak #7

Closed NathaelB closed 3 months ago

NathaelB commented 3 months ago

We need to implement authorization checks for the creation of companies within our application. The solution should use Keycloak to manage and verify permissions. Specifically, we need to:

  1. Define a create_company permission in Keycloak.
  2. Assign this permission to the appropriate role (e.g., admin, superuser).
  3. Ensure that our application checks this permission when a user attempts to create a company.

Tasks

  1. Configure Keycloak
    • [x] Create the create_company permission.
    • [x] Assign the permission to relevant roles.
  2. Create Policy
    • [x] Creation of a policy to ensure that the user has the authorisation to perform the action
    • [x] Apply this policy to the company creation endpoint.
  3. Testing
    • [x] Write tests to verify that unauthorized users cannot create companies.
    • [x] Write tests to verify that authorized users can create companies