Canonical Principals

Canonical principals provide a stable identity for a person or service independently of the authentication mechanism used to sign in. A principal owns authentication identities, server authorities, and independently addressable preferences. An identity identifies the principal through one provider; a native password credential authenticates only a dodeca-native identity. Password hashes are stored separately from principals and identities, and tokens are not stored.

Principals are deliberately separate from legacy Dodeca users in USERS. There is no user mapping in this release and no principal relationship is assumed to be one-to-one. A future PRINCIPAL_USERS table can add ID, PRINCIPAL_ID, USER_ID, RELATIONSHIP, and CREATED_DATE without changing the principal tables.

Create the first native administrator

The Server administration UI and native sign-in form are available by default. No default account or password is created. Bootstrap a persistent native administrator with one command:

principal-native-admin-create --username admin --name "Server Administrator"

The Shell prompts twice with masked input and atomically creates an active person principal, the canonical dodeca-native identity, its encoded password credential, and ROLE_ADMIN. The display name is optional and defaults to the supplied username:

principal-native-admin-create --username admin

Passwords are intentionally not command options. The resulting principal and credential are stored in the Dodeca repository and survive Server restarts. Use the existing individual principal commands when more control is required.

Native authentication can be disabled for an external-authentication-only deployment:

dodeca.security.native.enabled=false

The older configured bootstrap administrator (dodeca.admin.*) remains separate and available according to its existing configuration. Once an administrator is signed in, the Server administration interface also provides Principals > New Principal for creating a person principal and native credential. The form requires an explicit choice between ROLE_ADMIN access and authentication without server authority.

Native usernames are case-insensitive: surrounding whitespace and control characters are rejected, and accepted names are canonicalized with locale-independent lowercase rules. Passwords must contain 12 through 128 characters, may contain spaces, and are stored with Spring Security’s delegating encoder (currently {bcrypt}). Passwords are never printed by list/show commands.

Native-login management

principal-native-login-list --id <principal-uuid>
principal-native-login-set-password --id <principal-uuid> --username <username>
principal-native-login-lock --id <principal-uuid> --username <username>
principal-native-login-unlock --id <principal-uuid> --username <username>
principal-native-login-require-password-change --id <principal-uuid> --username <username>
principal-native-login-remove --id <principal-uuid> --username <username>

ACTIVE credentials can sign in normally. LOCKED credentials cannot sign in. CHANGE_REQUIRED credentials can authenticate only to the mandatory password-change page and become active after a successful change. Native users may also change their own password at /account/password; the current password is required unless a change is already required.

Resetting a password does not implicitly unlock a locked credential. Removing or locking a native login leaves the principal, its authorities, preferences, and external identities intact. Disabling the principal blocks all of its mapped native and external identities. If every native credential is unavailable, connect with Dodeca Shell to reset and unlock one, or use an independently configured external or bootstrap administrator.

Passwords are never accepted as literal command-line values. Interactive use defaults to a masked, confirmed prompt. For scripts, use --secret-source env:NAME or --secret-source file:PATH; the reference is visible in the command, but the secret is not placed in shell history or process arguments. Environment-derived values are not printed.

External identities and explicit linking

Attach each external identity to the same principal explicitly:

principal-identity-add --id <principal-uuid> \
  --provider oidc:https://issuer.example \
  --subject 00u123456

OIDC provider identifiers are oidc:<issuer> and OAuth2 identifiers are oauth2:<registration-id>. External subjects retain provider-defined case and normalization. Identities are never linked or merged by email address, username, or display name. An external identity mapped to a principal receives that principal’s authorities and preferences; an existing unmapped external login retains the deployment’s configured group mapping. External login never creates a native identity or credential.

Server authority is explicit. A successful native login alone grants no administrator or tenant access and creates no legacy USER. Use principal-authority-add for server authorities. Tenant access remains governed by the existing tenant authorization facilities; native identities are not linked directly to tenant-scoped USERS.

Web preferences

The administration interface uses web/color-theme and web/color-scheme. The packaged PicoCSS 2.1.1 themes are amber, blue, cyan, fuchsia, green, grey, indigo, jade, lime, orange, pink, pumpkin, purple, red, sand, slate, violet, yellow, and zinc. Color schemes are auto, light, and dark.

For a mapped administrator, the principal preference is authoritative and follows the principal across browsers and devices. The application default (pink and Pico/OS automatic scheme) is used when the principal has no saved value. An unmapped administrator has no server-side preference owner, so only that fallback case uses dodeca.web.color-theme and dodeca.web.color-scheme in browser local storage. Browser-local values are ignored after an identity is mapped to a principal.

Login throttling and limitations

Native failures are client-visible only as “Invalid username or password.” The Server applies an in-process, per-canonical-username throttle: by default 10 failures in 5 minutes cause a one-minute delay. Configure it with:

dodeca.security.native.maximum-attempts=10
dodeca.security.native.attempt-window=5m
dodeca.security.native.throttle-duration=1m

This deliberately does not claim distributed rate limiting in a cluster. Internet-facing deployments should also rate-limit POST /login at the load balancer or reverse proxy and monitor Spring Security authentication-failure events. MFA, email reset, recovery questions, automatic identity linking, and legacy USERS migration are not implemented.