Skip to content

Auth

See also → Authentication for token endpoints, APTs, and the strict flag · Authorization for ABAC, grants, scopes, and the AuthorityInterceptor

Port: REST :3020 · gRPC :5020

Handles all authentication flows, token management, personal API keys, and OAuth permission grants. Unlike every other service, auth does not follow the standard CRUD pattern for its primary endpoint.

Collections

CollectionPathPurpose
--/authToken issuance, verification, logout, health check, and ABAC policy evaluation
APTs/auth/aptsLong-lived Auth Personal Tokens (API keys)
Grants/auth/grantsOAuth permission grants

auth — Token Endpoint

The primary auth endpoint is not a CRUD collection. It exposes named operations:

OperationHTTPDescription
tokenPOST /auth/tokenIssue a JWT (public — no auth header required)
verifyGET /auth/verifyDecode the current token (JWT or APT) and return its claims
logoutGET /auth/logoutInvalidate the current session (blacklists it)
checkPOST /auth/checkValidate a TOTP (one-time password) code
canPOST /auth/canABAC policy evaluation via abacl

POST /auth/token is @IsPublic() — no Authorization header required.

auth/apts — Auth Personal Tokens

Long-lived API keys scoped to a set of OAuth scopes. Use for service-to-service authentication or CI/CD automation.

Create Fields

Only name is required; the rest are optional. See Authentication → APT fields reference for the full list.

FieldRequiredTypeDescription
namestringHuman-readable label (e.g. ci-bot)
scopesstring[]OAuth scopes this APT is authorized to use
subjectsstring[]ABAC subjects for the token
strictbooleanRequire a valid x-api-key header (default false)
expires_atnumberExpiry as Unix milliseconds
coworkersstring[]Additional coworker client IDs

Key Behaviors

  • APTs are revocable — delete the record to invalidate immediately.
  • Always create APTs with the minimum required scopes.
  • APTs appear in Authorization: Bearer <apt> headers, the same as JWTs.

auth/grants — Permission Grants

OAuth permission grants define what actions a subject (user or role) may perform on a resource within a domain.

Required Grant Fields

FieldRequiredTypeDescription
actionAction enumread, write, manage, or a custom action
subjectstringSubject identifier — {username}@{domain} (e.g. guest@example.com)
objectResourceResource identifier (e.g. identity:users or identity:*)

Grant Behaviors

  • Grants are evaluated by PolicyGuard on every authenticated request.
  • Subject format: {username}@{domain} — the domain suffix is required in grants but not stored in identity/users.subjects.
  • Use POST /auth/can to test whether a subject has a specific grant before making changes.