Authentication Development Details
Developer Architecture Notes#
Authentication Architecture#
Polaris separates authentication into two logical phases using Quarkus Security:
- Credential extraction – parsing headers and tokens
- Credential authentication – validating identity and assigning roles
Key Interfaces#
Authenticator: A core interface used to authenticate credentials and resolve principal and principal roles. Roles may be derived from OIDC claims or internal mappings.InternalPolarisToken: Used in internal auth and inherits fromPrincipalCredential.The
DefaultAuthenticatoris used to implement realm-specific logic based on these abstractions.
Token Broker Configuration#
When internal authentication is enabled, Polaris uses TokenBroker to handle the decoding and validation of authentication tokens. These brokers are request-scoped and can be configured per realm. Each realm may use its own strategy, such as RSA key pairs or shared secrets, depending on security requirements.
See Token Broker description for configuration details.
Developer Authentication Workflows#
Internal Authentication#
InternalAuthenticationMechanismparses the auth header.- Uses
TokenBrokerto decode the token. - Builds
InternalAuthenticationRequestand generatesSecurityIdentity(Quarkus). Authenticator.authenticate()validates the credential, resolves the principal and principal roles, then creates thePolarisPrincipal.
External Authentication#
OidcAuthenticationMechanism(Quarkus) processes the auth header.OidcTenantResolvingAugmentorselects the OIDC tenant.OidcPolarisCredentialAugmentorextracts JWT claims.Authenticator.authenticate()validates the claims, resolves the principal and principal roles, then creates thePolarisPrincipal.
Mixed Authentication#
InternalAuthenticationMechanismtries decoding.- If successful, proceed with internal authentication.
- Otherwise, fall back to external (OIDC) authentication.
OIDC Configuration Reference#
Principal Mapping#
Interface:
PrincipalMapperThe
PrincipalMapperis responsible for extracting the Polaris principal ID and display name from OIDC tokens.Implementation selector:
This property selects the implementation of the
PrincipalMapperinterface. The default implementation extracts fields from specific claim paths.polaris.oidc.principal-mapper.type=defaultConfiguration properties for the default implementation:
polaris.oidc.principal-mapper.id-claim-path=polaris/principal_id polaris.oidc.principal-mapper.name-claim-path=polaris/principal_nameIt can be overridden per OIDC tenant.
Roles Mapping#
Interface:
PrincipalRolesMapperPolaris uses this component to transform role claims from OIDC tokens into Polaris roles.
Quarkus OIDC configuration:
This setting instructs Quarkus on where to locate roles within the OIDC token.
quarkus.oidc.roles.role-claim-path=polaris/rolesImplementation selector:
This property selects the implementation of
PrincipalRolesMapper. Thedefaultimplementation applies regular expression (regex) transformations to OIDC roles.polaris.oidc.principal-roles-mapper.type=defaultConfiguration properties for the default implementation:
polaris.oidc.principal-roles-mapper.filter=^(?!profile$|email$).* polaris.oidc.principal-roles-mapper.mappings[0].regex=^.*$ polaris.oidc.principal-roles-mapper.mappings[0].replacement=PRINCIPAL_ROLE:$0