Skip to content

Engine Authentication & Identity Architecture

The Niksphere Engine features a multi-tiered, enterprise-grade identity and authentication architecture designed to seamlessly bridge standalone edge deployments and large-scale corporate enterprise federations.

This guide explains how authentication works in Niksphere from an administrator and developer perspective, covering Actors, Identity methods, Client governance, and integration workflows for both interactive users and automated services.


1. Architectural Foundations: Actors vs. Identities vs. Clients

To maintain a secure, decoupled architecture, Niksphere strictly separates three fundamental concepts:

Rendering diagram...

Core Definitions

  1. Actor (The Subject): The real-world entity (a human user or an autonomous service account) that owns data, holds permissions, and appears in audit trails.
  2. Identity (The Authentication Method): The specific credential or login provider (e.g., local password, Google SSO, Personal Access Token) used by an Actor to verify their identity.
  3. Client (The Application): The software application (CLI, Web frontend, VS Code, automated daemon) connecting to the Engine.

2. The Actor Model (User vs. Service)

Every operation performed in the Niksphere Engine is executed within the security context of an Actor. All authorization checks (RBAC) and database audit trails (system_created_by, system_modified_by) are linked directly to the Actor.

NOTE

Why Actor instead of Account?
In business applications and enterprise resource planning (ERP), Account specifically denotes financial accounts (General Ledger / Sachkonten). Actor provides a clean, domain-neutral term representing any entity capable of performing actions without colliding with accounting terminology.

Actor Types

Actors are uniformly managed and provisioned through the Web frontend or the CLI (nik env identity), regardless of their type:

Actor TypeDescriptionPrimary Use CasesManagement Interface
UserHuman individuals (developers, administrators, operators).Interactive terminal sessions, Web frontend management, IDE extensions.Web frontend & CLI (nik env identity)
ServiceAutonomous system accounts (daemons, ERP connectors, CI/CD runners).Background synchronization, SAP integration, automated deployments.Web frontend & CLI (nik env identity)

3. The Identity Layer (Authentication Methods)

An Actor can possess multiple authentication methods across different providers. For example, an administrator might log in via their corporate Microsoft Entra ID account, use a local password as an offline fallback, and create a Personal Access Token for command-line scripts—all mapped to the same underlying Actor profile.

Rendering diagram...

Supported Identity Types

1. Embedded Passwords (Local Login)

  • Description: Traditional username and password authentication managed directly by the Engine's embedded identity provider.
  • Security: Credentials are protected using salted password hashing (bcrypt / argon2) with automatic rate limiting against brute-force attacks.
  • Use Case: Standalone installations, offline edge environments, or local administrative fallbacks.

2. Personal Access Tokens (PATs)

  • Description: Static, scoped API tokens generated by users via the Web frontend or CLI for automated scripting, cURL, Postman, and CI/CD pipelines.
  • Security: Tokens are hashed on the server; the plaintext token is displayed only once upon creation. Tokens can be restricted to specific permission scopes (e.g., read-only data access) and configured with explicit expiration dates.
  • Use Case: Headless terminal commands, background scripts, and development testing.

3. External Single Sign-On (Enterprise OIDC)

  • Description: Delegated authentication through corporate identity providers such as Microsoft Entra ID (Azure AD), Google Workspace, Keycloak, or Okta.
  • Security: Enforces corporate compliance policies (e.g., mandatory MFA, conditional access). The Engine maps the verified external identity directly to the local Actor.
  • Use Case: Centralized enterprise user management and corporate Single Sign-On.

4. Client Governance & Application Profiles

A Client represents a software application that connects to the Niksphere Engine API. Clients are governed through two distinct classification models:

Rendering diagram...

4.1 Built-in vs. Custom Clients

AttributeBuilt-in Clients (First-Party)Custom Clients (Third-Party)
OriginShipped out of the box by Niksphere (e.g., Niksphere CLI, Web frontend).Created by administrators, partners, or external developers.
ProvisioningPre-configured automatically when the Engine starts.Registered dynamically via the Web frontend or CLI.
Trust ModelPre-trusted (users log in directly without extra consent screens).Shows an interactive authorization and consent screen during browser login.
AdministrationCan be disabled (e.g., to restrict developer access exclusively to the Web frontend), but cannot be deleted.Can be enabled, disabled, or permanently deleted at any time.

4.2 Technical Client Profiles (Public vs. Confidential)

Clients operate under one of two standard OAuth 2.0 security profiles:

1. Interactive Public Clients (CLI, Web frontend, Mobile, IDE)

  • Profile: Applications running directly on user workstations, mobile devices, or in web browsers where static secrets cannot be securely stored.
  • Security: Client secrets are not used. Instead, security is enforced dynamically through PKCE (RFC 7636) in web browsers and the Device Code Flow (RFC 8628) in terminal environments.
  • Redirect Protection: Restricted to authorized loopback addresses (http://127.0.0.1:*, http://localhost:*) or explicit web domains.

2. Non-Interactive Confidential Clients (Machine-to-Machine / M2M)

  • Profile: Backend daemons, ERP connectors, and automated server integrations running in secure hosting environments.
  • Security: Uses a secure Client ID and Client Secret to authenticate directly via the OAuth 2.0 Client Credentials Grant.
  • Actor Association: Directly associated with a designated Service Actor.

5. Authentication Matrix: Selecting the Right Method

Use the following reference matrix to determine the optimal authentication method for your use case:

Integration ScenarioRecommended MethodProtocol / FlowClient CategoryCredentials Required
Developer Workstation (CLI)nik auth loginOAuth 2.0 Device Code (RFC 8628)Built-in Public ClientBrowser confirmation (Passkey, SSO, or password)
Web frontend (Dashboard)Browser Single Sign-OnAuthorization Code + PKCE (RFC 7636)Built-in Public ClientUser credentials via local form or external IDP
Developer Testing & PostmanPersonal Access Token (PAT)Bearer Token (Authorization: Bearer nik_pat_...)N/AStatic personal token with custom scopes
Automated CI/CD (GitHub Actions)Environment VariableBearer Token (NIKSPHERE_TOKEN)N/AInjected repository secret (PAT or Service Token)
Production Daemon / ERP IntegrationClient CredentialsOAuth 2.0 Client Credentials (RFC 6749 § 4.4)Custom Confidential ClientClient ID + Client Secret
Realtime Monitoring WebSocketWebSocket Ticket HandshakeEmbedded IDP Ticket Extension (/auth/ws-ticket)Public / ConfidentialSingle-use short-lived ticket token

6. Deployment Topologies: Standalone vs. Enterprise Federation

The Niksphere Engine adapts to two primary operational topologies:

Rendering diagram...

Topology 1: Standalone / Edge Deployment (Zero External Dependencies)

  • How it works: The embedded identity provider manages user passwords, token generation, and cryptographic signing entirely on the local Engine instance.
  • Best for: Local developer machines, edge servers, air-gapped networks, and single-node setups.

Topology 2: Enterprise SSO Federation (Central Directory Integration)

  • How it works: Administrators register external identity providers (e.g., nik env idp external add). The Engine delegates login requests directly to Microsoft Entra ID, Google Workspace, or Keycloak, mapping authenticated corporate accounts to local Actor profiles.
  • Best for: Corporate environments requiring centralized user provisioning, corporate Multi-Factor Authentication (MFA), and automated employee offboarding.

7. Runtime Request Lifecycle

When a client makes a request to a protected API endpoint (such as /api/v1/admin/apps or application entity routes):

Rendering diagram...
  1. Bearer Token Submission: The client attaches either a temporary JWT access token or a static Personal Access Token to the Authorization header.
  2. Context Resolution: The Engine validates the signature or token hash, verifies permissions, and establishes the active Actor Context.
  3. Execution & Auditing: The request executes. Any created or modified records automatically log the Actor's ID in standard system audit fields (system_created_by, system_modified_by).