go-auth0
go-auth0 copied to clipboard
Add Organizations for Client Credentials
🔧 Changes
- Added new field called
default_organizationto GET/PATCH endpoints/api/v2/clients/{id} - Added new field called
default_organizationto POST endpoints/api/v2/clients/ - Support query param
qfor GET/api/v2/clients- q=client_grant.organization_id:org_sampleorgid213
- q=client_grant.allow_any_organization:true
- Support query param
identifiersfor GET/api/v2/organizations/{org_id}/client-grants- identifiers=https%3A%2F%2Fmy-api.example.com
- Support query param
grant_idsfor 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)
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.