Class PkiHttpsServer
java.lang.Object
zeroecho.pki.server.PkiHttpsServer
- All Implemented Interfaces:
AutoCloseable
Lifecycle owner for one bounded administrative mutual-TLS HTTPS server.
One instance owns one long-lived ServerRealmContext and therefore
one long-lived PKI session. It is thread-safe for lifecycle inspection and
idempotent close. HTTP handlers never construct sessions or execute operations
outside ServerOperationGateway.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionReturns the actual ACME listener address when enabled.address()Returns the actual bound administrative address, including an allocated ephemeral port.voidclose()Quiesces admission, terminates the listener and bounded executors, then closes realm and authentication resources.Returns the actual CMP listener address when enabled.Returns the actual EST listener address when enabled.voidInstalls the sole finite process-shutdown bridge for the packaged launcher.Returns the actual public listener address when the repository listener is enabled.realm()Returns the one lifecycle-owned realm context.Returns the actual SCEP listener address when enabled.static PkiHttpsServerstart(PkiServerConfiguration configuration, PkiSessionRuntimeDependencies runtimeDependencies) Starts one production HTTPS server using explicitly configured capabilities.static PkiHttpsServerstart(PkiServerConfiguration configuration, PkiSessionRuntimeDependencies runtimeDependencies, Optional<BackupTransferConfiguration> transfer) Starts the server with optional, explicitly budgeted backup transfer.static PkiHttpsServerstart(PkiServerConfiguration configuration, PkiSessionRuntimeDependencies runtimeDependencies, Optional<BackupTransferConfiguration> transfer, Optional<EnrollmentRuntimeConfiguration> enrollment) Starts a server with explicit independent backup and enrollment capabilities.state()Returns the current lifecycle state.
-
Method Details
-
start
public static PkiHttpsServer start(PkiServerConfiguration configuration, PkiSessionRuntimeDependencies runtimeDependencies) Starts one production HTTPS server using explicitly configured capabilities.- Parameters:
configuration- validated server configurationruntimeDependencies- process-local PKI capabilities- Returns:
- fully ready lifecycle owner
-
start
public static PkiHttpsServer start(PkiServerConfiguration configuration, PkiSessionRuntimeDependencies runtimeDependencies, Optional<BackupTransferConfiguration> transfer) Starts the server with optional, explicitly budgeted backup transfer.- Parameters:
configuration- validated schema-8 server settingsruntimeDependencies- process-local PKI capabilitiestransfer- optional separately validated transfer settings- Returns:
- fully ready server lifecycle owner
-
start
public static PkiHttpsServer start(PkiServerConfiguration configuration, PkiSessionRuntimeDependencies runtimeDependencies, Optional<BackupTransferConfiguration> transfer, Optional<EnrollmentRuntimeConfiguration> enrollment) Starts a server with explicit independent backup and enrollment capabilities.- Parameters:
configuration- schema-8 server settingsruntimeDependencies- process-local unlock and runtime capabilitiestransfer- optional backup transfer budgetsenrollment- mandatory companion for enabled enrollment listeners- Returns:
- fully ready server owning all opened resources
-
state
-
address
Returns the actual bound administrative address, including an allocated ephemeral port.- Returns:
- administrative listener address
- Throws:
IllegalStateException- if the server is terminated
-
publicAddress
Returns the actual public listener address when the repository listener is enabled.- Returns:
- bound public address, or empty when disabled
- Throws:
IllegalStateException- if the server is terminated
-
acmeAddress
Returns the actual ACME listener address when enabled.- Returns:
- bound ACME address, or empty when disabled
- Throws:
IllegalStateException- if the server is terminated
-
estAddress
Returns the actual EST listener address when enabled.- Returns:
- bound EST address, or empty when disabled
- Throws:
IllegalStateException- if the server is terminated
-
scepAddress
Returns the actual SCEP listener address when enabled.- Returns:
- bound SCEP address, or empty when disabled
- Throws:
IllegalStateException- if the server is terminated
-
cmpAddress
Returns the actual CMP listener address when enabled.- Returns:
- bound CMP address, or empty when disabled
- Throws:
IllegalStateException- if the server is terminated
-
realm
Returns the one lifecycle-owned realm context.- Returns:
- the open realm context
- Throws:
IllegalStateException- unless the server is ready
-
installShutdownHook
public void installShutdownHook()Installs the sole finite process-shutdown bridge for the packaged launcher. Tests and embedded integrations may instead close the server directly. -
close
Quiesces admission, terminates the listener and bounded executors, then closes realm and authentication resources. Repeated calls are harmless. Concurrent callers share one attempt's failure. Other checked failures are translated to I/O failures with their original cause and suppression graph; interruption is restored for every caller. A failed worker join keeps dependent realm resources open for a later external retry.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException- if checked shutdown or resource closure fails
-