Skip to content

Fix: Preserve federated field when creating PrincipalRole (#2966)#3749

Open
AryanPatel226 wants to merge 1 commit intoapache:mainfrom
AryanPatel226:fix-principal-role-federated-field
Open

Fix: Preserve federated field when creating PrincipalRole (#2966)#3749
AryanPatel226 wants to merge 1 commit intoapache:mainfrom
AryanPatel226:fix-principal-role-federated-field

Conversation

@AryanPatel226
Copy link
Copy Markdown
Contributor

Summary

Fixes the bug where the federated field 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

  • Bug Fix: Added .setFederated(request.getPrincipalRole().getFederated()) to PolarisServiceImpl.createPrincipalRole() to properly preserve the federated flag from the request
  • Test Enhancement: Updated testCreateFederatedPrincipalRoleSucceeds to actually verify the federated field value in the response, not just the HTTP 201 status code

Testing

Manual Testing

Verified the fix by running a Polaris server and executing API calls:

  1. Created a principal role with federated: true → correctly returned federated: true
  2. Created a principal role with federated: false → correctly returned federated: false
  3. Verified federated roles cannot be assigned to principals (correct validation behavior) ✅

Checklist

@github-actions
Copy link
Copy Markdown

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.

@github-actions github-actions bot added the stale label Mar 20, 2026
@github-actions github-actions bot closed this Apr 12, 2026
@github-project-automation github-project-automation bot moved this from PRs In Progress to Done in Basic Kanban Board Apr 12, 2026
@dimas-b dimas-b reopened this Apr 13, 2026
@github-project-automation github-project-automation bot moved this from Done to PRs In Progress in Basic Kanban Board Apr 13, 2026
Copy link
Copy Markdown
Contributor

@dimas-b dimas-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 !

@github-project-automation github-project-automation bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Apr 13, 2026
@dimas-b dimas-b requested a review from flyrain April 13, 2026 13:48
@flyrain
Copy link
Copy Markdown
Contributor

flyrain commented Apr 13, 2026

I think this PR aligns with the intention in #1353.

Adds a FEDERATED_ENTITY property, which can be defined in Principals and PrincipalRoles. FEDERATED Principals cannot be created via the API, but FEDERATED roles can be. This allows for creating roles which can be assigned privileges, while actual principal creation is delegated to the JIT creation mechanism (not in this PR).

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

  • Federated roles are infrastructure for future external auth support
  • They cannot currently be used without additional implementation
  • When/how they're intended to be activated

another option is to block federated role creation until the feature is complete.

This PR is good to go though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] federated property is ignore for PrincipalRole object in CreatePrincipalRoleRequest

3 participants