Fix: Preserve federated field when creating PrincipalRole (#2966)#3749
Fix: Preserve federated field when creating PrincipalRole (#2966)#3749AryanPatel226 wants to merge 1 commit intoapache:mainfrom
Conversation
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
dimas-b
left a comment
There was a problem hiding this comment.
The fix looks pretty solid to me given the current codebase.
I'm going to merge tomorrow, unless there are objections.
Thanks for the contribution, @AryanPatel226 !
|
I think this PR aligns with the intention in #1353.
However, there is a gap that Federated principal roles currently cannot be used, see here, https://github-personal/polaris-catalog/polaris/blob/main/.worktrees/pr-4064/runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java#L1459-L1459. I think we should either complete the feature by finishing the JIT activation mechanism that allows federated roles to be activated based on external token claims, bypassing the grant check. Or documenting the limitations that
another option is to block federated role creation until the feature is complete. This PR is good to go though. |
Summary
Fixes the bug where the
federatedfield was being ignored when creating a PrincipalRole via the API, causing all principal roles to be created as non-federated regardless of the input value.Changes
.setFederated(request.getPrincipalRole().getFederated())toPolarisServiceImpl.createPrincipalRole()to properly preserve the federated flag from the requesttestCreateFederatedPrincipalRoleSucceedsto actually verify thefederatedfield value in the response, not just the HTTP 201 status codeTesting
Manual Testing
Verified the fix by running a Polaris server and executing API calls:
federated: true→ correctly returnedfederated: true✅federated: false→ correctly returnedfederated: false✅Checklist
federatedproperty is ignore for PrincipalRole object in CreatePrincipalRoleRequest #2966CHANGELOG.md(if needed)site/content/in-dev/unreleased(if needed)