Hi JB, The middle ground you are suggesting makes sense to me. It is somewhat similar to the "Federated" mode that we've been talking about for a long time [1], but with 2 differences: only roles are persisted ahead-of-time, not principals; and principals are not JIT-persisted (they remain external).
I think we should move forward with the idea, since it enables the usage of internal RBAC with external principals. One thing that we should maybe settle on is whether this mode requires the federated flag to be present on the principal role entity? I think that was Mike Collado's original intent - it would be good if he could chime in. This restricts which roles can be assumed in this new credential mode. To your questions: 1. Naming and config shape: a third credential-mode value is OK, although maybe we can reshape the enum names and adopt the "federated" terminology for this new use case? E.g. internal | federated | external. 2. Unknown roles: ignored is fine imho. 3. PRINCIPAL_ROLE:ALL: reject is imho the only choice; we cannot grant every possible principal role available. 4. #5439 is imho orthogonal: resolveAll() should never be called in external or external-with-internal-roles mode; as long as it doesn't, it should work with the new mode. IOW I don't think the new mode requires a synthetic caller principal entity. 5. Trust model: I'm fine with that: role attribution is the IDPs responsibility, and RBAC is Polaris'. I'd note that this model still requires principal roles to be synchronized between IDP and Polaris before the principal can actually be used. This is a limitation that should be documented. Thanks, Alex [1]: https://docs.google.com/document/d/1VSoN1-QsAJGaM40oWTxeLIoYTp-XlfQM9nG-jqfb_-E/edit? On Thu, Nov 12, 2026 at 1:50 PM Jean-Baptiste Onofré <[email protected]> wrote: > > Hi folks, > > Following an informal "Polaris users discussion" I had last week in France, > a couple of users shared a common use case that we currently do not support. > > Let me share the context :) > With credential-mode=external, a principal is authenticated entirely from > its token: it doesn't need to exist in Polaris, so there's nothing to sync > from the IdP. But its roles are taken verbatim from the token and have no > grants in the metastore. So this mode requires an external authorizer (OPA, > Ranger), and startup is refused with the default authorizer. > > The users have asked for a middle ground. The IdP stays the source of truth > for users and their group or role membership. But they want Polaris RBAC > (principal roles, catalog roles and grants, managed with the Management > API) to remain the source of truth for authorization, without deploying an > external authorizer. > > Today, the only way to get that is internal credential mode. There, every > principal and every principal-role assignment must exist in Polaris, and > the token can only activate roles that are already granted. In practice, > that means syncing users and group membership from the IdP. This is a bit > similar to the use case discussed in #441 ("Federated Users and Federated > Roles"). > > I would like to propose a third credential mode: > polaris.authentication.credential-mode=external-with-internal-roles > > In this mode: > - As with external principals, the caller is authenticated from the token > only. There is no principal lookup, and principals are never created in > Polaris. > - The roles emitted by the role mapper name principal roles managed in > Polaris, using the usual PRINCIPAL_ROLE:<name> convention. Each existing > principal role is activated, along with the catalog roles granted to it. > Roles that don't exist in Polaris are ignored. > - Role membership comes from the token. Principal roles are never assigned > to external principals in Polaris. > - The default authorizer works. As with external principals, the > authentication type must not be internal. > - PRINCIPAL_ROLE:ALL is rejected (401), since an external principal has no > grants to expand. > - In mixed authentication, tokens issued by Polaris itself still resolve to > internal principals, as today. > > Here's an example: the IdP group "polaris_analyst" maps to the Polaris > principal role "analyst": > > polaris.authentication.type=external > polaris.authentication.credential-mode=external-with-internal-roles > polaris.oidc.principal-mapper.name-claim-path=preferred_username > quarkus.oidc.roles.role-claim-path=groups > polaris.oidc.principal-roles-mapper.filter=polaris_.* > polaris.oidc.principal-roles-mapper.mappings[0].regex=polaris_(.*) > > polaris.oidc.principal-roles-mapper.mappings[0].replacement=PRINCIPAL_ROLE:$1 > > Administrators are simply users whose roles map to the service_admin > principal role created at bootstrap. > > I created a draft PR to illustrate the impl: > https://github.com/apache/polaris/pull/6066 > > The change is small and doesn't touch the PolarisAuthorizer SPI or > PolarisCredential. It adds a new CredentialMode value and a new > INTERNAL_PRINCIPAL_ROLES attribute key in PolarisPrincipalAttributes. With > that attribute set, the Resolver loads an external principal's roles by > name from the metastore, with their grants, instead of creating stand-in > roles, so the default authorizer works unchanged. > > Since an external principal's name is asserted by the IdP, the PR also > makes sure an external principal is never treated as the root principal, > whatever its name. The details are in the PR description. > > I have a few open questions for you: > 1. Naming and config shape: a third credential-mode value (as I propose in > the PR) or a separate option, e.g. > polaris.authentication.external-principal-roles=internal|external? > 2. Unknown roles: should roles that don't exist in Polaris be ignored (my > current proposal which tolerates unrelated IdP groups) or rejected? > 3. PRINCIPAL_ROLE:ALL: reject (my current proposal) or ignore? > 4. #5439 plans to remove the stand-in principal and roles from the > Resolver. This mode still needs a caller principal, because the default > authorizer calls resolveAll(). I think the two are compatible, but it > should be taken into account there. > 5. Trust model: the IdP decides who holds which principal role, including > service_admin. That is inherent to the feature and documented, with a > recommendation to restrict roles using the role mapper filter. I'm > interested in other suggestions. > > Thoughts? Feedback is welcome on this thread or the PR. > > Thanks! > > Regards > JB
