Class ServerRealmContext
java.lang.Object
zeroecho.pki.server.ServerRealmContext
- All Implemented Interfaces:
AutoCloseable
Lifecycle owner for one server realm, one long-lived PKI session, and one
dedicated durable server-control authority.
The context is transport-neutral and synchronous. It creates no execution
lane, queue, thread, scheduler, retry loop, HTTP type, or ACME object. A future
transport can retain one instance for its process lifetime and submit existing
typed operations through gateway().
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionReturns typed ACME records in the realm's sole durable control authority.Returns durable approval service.voidassignRole(RoleTemplateCatalog.Assignment assignment, String actorPrincipalId) Creates one scoped role assignment; templates remain non-authoritative alone.Returns explicit auditor projection service.voidRecords one transport-safe lifecycle or request classification through the shared realm audit authority.Returns deterministic authorization engine.authorizeOcspQuery(String principalId, OcspResponderService.Responder responder) Evaluates the protocol-only OCSP query permission for one exact responder and issuer generation.Returns explicitly installed binary transfer settings.Returns durable break-glass service.voidclose()Quiesces the realm and releases resources through one retryable shared attempt.Returns exact realm configuration without rendering provider values.voidcreatePrincipal(SecurityPrincipal principal, String actorPrincipalId) Creates a principal and records only safe administrative audit metadata.Returns synchronous authoritative credential publication gate.Returns durable disclosure decision service.Returns the coordinator installed for this realm's enrollment services.Returns the realm-owned durable enrollment endpoint authority.Returns the realm-owned durable enrollment policy authority.Returns explicitly installed enrollment custody and resource limits.gateway()Returns authorized typed-operation gateway.voidgrant(Permission.Grant grant, String actorPrincipalId) Creates one explicit scoped direct grant.Returns durable exact OCSP responder bindings.static ServerRealmContextopen(ServerRealmConfiguration configuration, PkiSessionRuntimeDependencies dependencies) Opens one production realm using explicit process-local capabilities.Resolves one persisted principal for transport authentication.Returns read-only disclosed public repository gateway.voidRecords an administrative HTTP request upon handler entry, including rejected requests.Returns durable non-authoritative public repository alias service.Returns immutable built-in role template catalog.session()Returns the one long-lived PKI session.setPrincipalEnabled(String principalId, boolean enabled, String actorPrincipalId) Changes only the enabled state of an existing principal.state()Returns current lifecycle state.
-
Method Details
-
open
public static ServerRealmContext open(ServerRealmConfiguration configuration, PkiSessionRuntimeDependencies dependencies) Opens one production realm using explicit process-local capabilities.- Parameters:
configuration- validated immutable realm configurationdependencies- key-access capabilities, never secret values- Returns:
- fully recovered realm context
- Throws:
IllegalArgumentException- if a restore coordinator exists and server-control storage is nested inside the replaceable PKI root
-
enrollmentRuntime
Returns explicitly installed enrollment custody and resource limits.- Returns:
- empty when the server has no enrollment companion
-
enrollmentCoordinator
Returns the coordinator installed for this realm's enrollment services.- Returns:
- installed durable coordinator, empty for deployments without enrollment
-
backupTransferConfiguration
Returns explicitly installed binary transfer settings.- Returns:
- empty when remote backup transfer is disabled
-
configuration
Returns exact realm configuration without rendering provider values.- Returns:
- exact realm configuration without rendering provider values
-
session
Returns the one long-lived PKI session.- Returns:
- the one long-lived PKI session
-
roleTemplates
Returns immutable built-in role template catalog.- Returns:
- immutable built-in role template catalog
-
authorization
Returns deterministic authorization engine.- Returns:
- deterministic authorization engine
-
approvals
Returns durable approval service.- Returns:
- durable approval service
-
breakGlass
Returns durable break-glass service.- Returns:
- durable break-glass service
-
disclosure
Returns durable disclosure decision service.- Returns:
- durable disclosure decision service
-
credentialPublication
Returns synchronous authoritative credential publication gate.- Returns:
- synchronous authoritative credential publication gate
-
repositoryAliases
Returns durable non-authoritative public repository alias service.- Returns:
- durable non-authoritative public repository alias service
-
acmeControl
Returns typed ACME records in the realm's sole durable control authority.- Returns:
- typed ACME records in the realm's sole durable control authority
-
ocspResponders
Returns durable exact OCSP responder bindings.- Returns:
- durable exact OCSP responder bindings
-
publicRepository
Returns read-only disclosed public repository gateway.- Returns:
- read-only disclosed public repository gateway
-
auditorViews
Returns explicit auditor projection service.- Returns:
- explicit auditor projection service
-
gateway
Returns authorized typed-operation gateway.- Returns:
- authorized typed-operation gateway
-
enrollmentEndpoints
Returns the realm-owned durable enrollment endpoint authority.- Returns:
- shared thread-safe registry, usable only while this realm is open
-
enrollmentProfiles
Returns the realm-owned durable enrollment policy authority.- Returns:
- shared thread-safe policy registry, usable only while this realm is open
-
principal
Resolves one persisted principal for transport authentication.- Parameters:
principalId- canonical principal identity- Returns:
- persisted identity metadata without credentials or grants
- Throws:
IllegalArgumentException- when the principal is unavailableIllegalStateException- when this realm is not open
-
authorizeOcspQuery
public AuthorizationEngine.Decision authorizeOcspQuery(String principalId, OcspResponderService.Responder responder) Evaluates the protocol-only OCSP query permission for one exact responder and issuer generation. The signed-request identity remains independent of administrative and transport authentication.- Parameters:
principalId- cryptographically mapped requester principalresponder- exact active responder binding- Returns:
- default-deny authorization decision
-
auditTransport
Records one transport-safe lifecycle or request classification through the shared realm audit authority.- Parameters:
action- stable transport actionprincipalId- authenticated principal orsystemsafeDetails- finite pre-redacted details
-
recordAdminRequest
public void recordAdminRequest()Records an administrative HTTP request upon handler entry, including rejected requests. -
state
Returns current lifecycle state.- Returns:
- current lifecycle state
-
createPrincipal
Creates a principal and records only safe administrative audit metadata.- Parameters:
principal- validated principal to createactorPrincipalId- authenticated administrative actor
-
setPrincipalEnabled
public SecurityPrincipal setPrincipalEnabled(String principalId, boolean enabled, String actorPrincipalId) Changes only the enabled state of an existing principal.- Parameters:
principalId- stable principal identifierenabled- desired enabled stateactorPrincipalId- authenticated administrative actor- Returns:
- durably updated principal
-
assignRole
Creates one scoped role assignment; templates remain non-authoritative alone.- Parameters:
assignment- validated scoped role assignmentactorPrincipalId- authenticated administrative actor
-
grant
Creates one explicit scoped direct grant.- Parameters:
grant- validated scoped permission grantactorPrincipalId- authenticated administrative actor
-
close
Quiesces the realm and releases resources through one retryable shared attempt. Checked failures retain their original cause and suppression when translated to I/O failures; I/O and unchecked identities are unchanged. Interruption is restored for each caller, and incomplete shutdown may be retried.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException- if checked resource closure fails
-