Skip to content

Commit

Permalink
The CDI event fired after a successful update of certificates was wro…
Browse files Browse the repository at this point in the history
…ng in the documentation.

Fix quarkusio#43135
  • Loading branch information
cescoffier committed Sep 9, 2024
1 parent fa483ae commit cbfd4c0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/src/main/asciidoc/tls-registry-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ The `reload` method returns a `boolean` indicating whether the reload was succes
A value of `true` means the reload operation was successful, not necessarily that there were updates to the certificates.

After a `TlsConfiguration` has been reloaded, servers and clients using this configuration may need to perform specific actions to apply the new certificates.
The recommended approach is to fire a CDI event (`CertificateReloadedEvent`) that servers and clients can listen to and make the necessary changes:
The recommended approach is to fire a CDI event (`CertificateUpdatedEvent`) that servers and clients can listen to and make the necessary changes:

[source, java]
----
Expand All @@ -570,12 +570,12 @@ TlsConfigurationRegistry registry;
public void reload() {
TlsConfiguration config = registry.get("name").orElseThrow();
if (config.reload()) {
event.fire(new CertificateReloadedEvent("name", config));
event.fire(new CertificateUpdatedEvent("name", config));
}
}
// In the server or client code
public void onReload(@Observes CertificateReloadedEvent event) {
public void onReload(@Observes CertificateUpdatedEvent event) {
if ("name".equals(event.getName())) {
server.updateSSLOptions(event.tlsConfiguration().getSSLOptions());
// Or update the SSLContext.
Expand All @@ -589,7 +589,7 @@ These APIs provide a way to implement custom certificate reloading.

The TLS registry includes a built-in mechanism for periodically checking the file system for changes and reloading certificates.
You can configure periodic certificate reloading by using properties.
The `reload-period` property specifies the interval for reloading certificates and will emit a `CertificateReloadedEvent` each time certificates are reloaded.
The `reload-period` property specifies the interval for reloading certificates and will emit a `CertificateUpdatedEvent` each time certificates are reloaded.

[source, properties]
----
Expand All @@ -607,7 +607,7 @@ quarkus.tls.http.key-store.pem.0.cert=tls.crt
quarkus.tls.http.key-store.pem.0.key=tls.key
----

Remember that the impacted server and client may need to listen to the `CertificateReloadedEvent` to apply the new certificates.
Remember that the impacted server and client may need to listen to the `CertificateUpdatedEvent` to apply the new certificates.
This is automatically done for the Quarkus HTTP server, including the management interface if it is enabled.

== Using Kubernetes secrets or cert-manager
Expand Down

0 comments on commit cbfd4c0

Please sign in to comment.