Fix: add auth headers and body to multitenancy token request#908
Conversation
Pull Request Test Coverage Report for Build 19772814756Details
💛 - Coveralls |
5bb27f0 to
0531ff3
Compare
0531ff3 to
060295c
Compare
|
rebased |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where the OIDC controller failed to authenticate with secured ACA-Py instances when requesting wallet tokens. The fix adds proper authentication headers and the required wallet_key parameter to the multitenancy token request endpoint.
Key Changes:
- Modified
MultiTenantAcapy.get_wallet_tokento include Admin API key headers when configured and addwallet_keyto the request body - Refactored error handling from
assertstatements to explicitExceptionraising with improved logging - Updated
SingleTenantAcapy.get_headersto return empty dict instead of dict withNonevalues when API key is not configured
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| oidc-controller/api/core/acapy/config.py | Added authentication header logic and request body payload to get_wallet_token, improved error handling with explicit exceptions, and modified SingleTenantAcapy.get_headers to handle missing credentials gracefully |
| oidc-controller/api/core/acapy/tests/test_config.py | Added comprehensive tests for authenticated and unauthenticated scenarios, updated existing error test to expect Exception instead of AssertionError, and added test for SingleTenantAcapy with missing API key |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Tested out locally with our usual single tenant/no-key setup and that's still working for me. Some minor Copilot suggestions that could be looked at. Didn't try out any mult-tenant setup but implementation makes sense to me |
esune
left a comment
There was a problem hiding this comment.
Tested locally, everything works as expected on a multi-tenant instance of ACA-Py. I think addressing the couple comments from Copilot is beneficial, then we can merge.
Signed-off-by: Yuki I <omoge.real@gmail.com>
Signed-off-by: Yuki I <omoge.real@gmail.com>
060295c to
68c4e6b
Compare
Description:
MultiTenantAcapy.get_wallet_tokento include Admin API key headers when configured.wallet_keyto the request body payload as required by the endpoint.SingleTenantAcapy.get_headersto return an empty dict instead ofNonevalues when keys are missing.MultiTenantAcapyto raiseExceptioninstead ofAssertionErrorfor better error handling.401 Unauthorizederrors when the controller attempts to get a wallet token from a secured ACA-Py agent instance.