go-auth0 icon indicating copy to clipboard operation
go-auth0 copied to clipboard

Add Organizations for Client Credentials

Open duedares-rvj opened this issue 1 year ago • 1 comments

🔧 Changes

  1. Added new field calleddefault_organization to GET/PATCH endpoints /api/v2/clients/{id}
  2. Added new field calleddefault_organization to POST endpoints /api/v2/clients/
  3. Support query param q for GET /api/v2/clients
    • q=client_grant.organization_id:org_sampleorgid213
    • q=client_grant.allow_any_organization:true
  4. Support query param identifiers for GET /api/v2/organizations/{org_id}/client-grants
    • identifiers=https%3A%2F%2Fmy-api.example.com
  5. Support query param grant_ids for GET /api/v2/resource-servers
    • grant_ids=cgr_123456789012,cgr_abcdefghijkl

📚 References

Required changes have been made in line with the documentation here Management API docs here

🔬 Testing

Relevant test cases and their recordings have been added to ensure changes as described above. All created resources are cleaned up after the assertions are completed.

make test FILTER=TestOrganizationManager_ClientGrantsWithOrg

  • Create an Organization and ResourceServer
  • Create a client with DefaultOrganization parameter and set the org.
  • Create a clientGrant under the client created before.
  • Associate the clientGrant with the Organization created before.
  • List clients filtered with query param and assert.
  • List clientGrants filtered with query param and assert.
  • Remove the associated ClientGrants.
  • Re-list clientGrants filtered with query param and ensure length is 0.
  • Delete the clientGrant.
  • Retrieve the clientGrant and ensure error is return since grant has been deleted.
  • Delete all pending resources as part of the cleanup process.

📝 Checklist

  • [x] All new/changed/fixed functionality is covered by tests (or N/A)
  • [x] I have added documentation for all new/changed functionality (or N/A)

duedares-rvj avatar Aug 13 '24 09:08 duedares-rvj

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.65%. Comparing base (e219463) to head (6c537e9). Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #432   +/-   ##
=======================================
  Coverage   95.64%   95.65%           
=======================================
  Files          49       49           
  Lines        8158     8172   +14     
=======================================
+ Hits         7803     7817   +14     
  Misses        238      238           
  Partials      117      117           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Aug 16 '24 07:08 codecov-commenter