Skip to content

Commit 7110f62

Browse files
committed
Sync documentation of main branch
1 parent caf7d18 commit 7110f62

File tree

7 files changed

+204
-2
lines changed

7 files changed

+204
-2
lines changed

_generated-doc/main/infra/quarkus-all-build-items.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ _No Javadoc found_
3232
a| https://github.com/quarkusio/quarkus/blob/main/core/deployment/src/main/java/io/quarkus/deployment/builditem/AdditionalClassLoaderResourcesBuildItem.java[`io.quarkus.deployment.builditem.AdditionalClassLoaderResourcesBuildItem`, window="_blank"]
3333
[.description]
3434
--
35-
_No Javadoc found_
35+
A build item that allows extensions to register additional resources that should be available from the ClassLoader at runtime.
36+
These resources are typically generated or discovered during the build process and are not located in the standard `src/main/resources` directory. Multiple instances of this build item can be produced, and all registered resources will be aggregated.
37+
The key of the map represents the resource path (e.g., `META-INF/my-config.properties` ), and the value is the byte content of the resource.
3638
-- a|`java.util.Map<String,byte[]> resources`
3739
38-
_No Javadoc found_
40+
A map where keys are resource paths and values are the corresponding resource content as byte arrays.
3941
4042
4143

_versions/main/guides/apicurio-registry-dev-services.adoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,19 @@ You can select any 2.x version from https://hub.docker.com/r/apicurio/apicurio-r
7979
----
8080
quarkus.apicurio-registry.devservices.image-name=apicurio/apicurio-registry-mem:latest-snapshot
8181
----
82+
83+
[[Compose]]
84+
== Compose
85+
86+
The Apicurio Dev Services supports xref:compose-dev-services.adoc[Compose Dev Services].
87+
It relies on a `compose-devservices.yml`, such as:
88+
89+
[source,yaml]
90+
----
91+
name: <application name>
92+
services:
93+
apicurio:
94+
image: apicurio/apicurio-registry-mem:2.4.2.Final
95+
ports:
96+
- "8080"
97+
----

_versions/main/guides/compose-dev-services.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ In the example above:
558558
The mapped properties will contain the host port that is mapped to the container port,
559559
which may be different from the container port if you're using dynamic port mapping (e.g., `- '5432'` instead of `- '7432:5432'`).
560560

561+
[[exposing-port-mappings-to-running-containers]]
561562
==== Exposing port mappings to running containers
562563

563564
In some cases, containers need to know the host ports they're mapped to at runtime.

_versions/main/guides/databases-dev-services.adoc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,43 @@ In the labels tab, we see that Quarkus added the datasource label, which can be
294294
Dev Services have been started.
295295
====
296296

297+
[[Compose]]
298+
== Compose
299+
300+
The Database Dev Services supports xref:compose-dev-services.adoc[Compose Dev Services].
301+
It relies on a `compose-devservices.yml`, such as:
302+
303+
[source,yaml]
304+
----
305+
name: <application name>
306+
services:
307+
postgresql:
308+
image: docker.io/postgres:17
309+
ports:
310+
- "5432"
311+
environment:
312+
POSTGRES_USER: quarkus
313+
POSTGRES_PASSWORD: quarkus
314+
POSTGRES_DB: quarkus
315+
oracle:
316+
image: docker.io/gvenzl/oracle-free:23-slim-faststart
317+
ports:
318+
- "1521"
319+
environment:
320+
ORACLE_PASSWORD: quarkus
321+
ORACLE_DATABASE: quarkus
322+
APP_USER: quarkus
323+
APP_USER_PASSWORD: quarkus
324+
mssql:
325+
image: mcr.microsoft.com/mssql/server:2022-latest
326+
ports:
327+
- "1433"
328+
environment:
329+
ACCEPT_EULA: "Y"
330+
MSSQL_SA_PASSWORD: Quarkus123
331+
labels:
332+
io.quarkus.devservices.compose.jdbc.parameters: trustServerCertificate=true
333+
----
297334

298335
[[configuration-reference]]
299336
== Configuration Reference

_versions/main/guides/kafka-dev-services.adoc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,41 @@ quarkus.kafka.devservices.redpanda.transaction-enabled=false
122122

123123
NOTE: Redpanda transactions does not support exactly-once processing.
124124

125+
[[Compose]]
126+
== Compose
127+
128+
The Kafka Dev Services supports xref:compose-dev-services.adoc[Compose Dev Services].
129+
It relies on a `compose-devservices.yml`, such as:
130+
131+
[source,yaml]
132+
----
133+
name: <application name>
134+
services:
135+
kafka:
136+
image: apache/kafka-native:3.9.0
137+
restart: "no"
138+
ports:
139+
- '9092'
140+
labels:
141+
io.quarkus.devservices.compose.exposed_ports: /etc/kafka/docker/ports
142+
environment:
143+
KAFKA_NODE_ID: 1
144+
KAFKA_PROCESS_ROLES: broker,controller
145+
KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
146+
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
147+
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@localhost:9093
148+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
149+
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
150+
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
151+
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
152+
KAFKA_NUM_PARTITIONS: 3
153+
command: "/kafka.sh"
154+
volumes:
155+
- './kafka.sh:/kafka.sh'
156+
----
157+
158+
For the broker to advertise its externally accessible address to clients, it requires an additional file `kafka.sh` as described in xref:compose-dev-services.adoc#exposing-port-mappings-to-running-containers[Exposing port mappings to running containers].
159+
125160
[[configuration-reference-devservices]]
126161
== Configuration reference
127162

_versions/main/guides/mongodb-dev-services.adoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ The default service name is `mongodb`.
2929
Sharing is enabled by default in dev mode, but disabled in test mode.
3030
You can disable the sharing with `quarkus.mongodb.devservices.shared=false`.
3131

32+
[[Compose]]
33+
== Compose
34+
35+
The MongoDB Dev Services supports xref:compose-dev-services.adoc[Compose Dev Services].
36+
It relies on a `compose-devservices.yml`, such as:
37+
38+
[source,yaml]
39+
----
40+
name: <application name>
41+
services:
42+
mongo:
43+
image: docker.io/mongo:7.0
44+
ports:
45+
- "27017"
46+
----
47+
3248
== Configuration reference
3349

3450
include::{generated-dir}/config/quarkus-mongodb-client_quarkus.mongodb.devservices.adoc[opts=optional, leveloffset=+1]

_versions/main/guides/websockets-next-reference.adoc

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,101 @@ When you plan to use bearer access tokens during the opening WebSocket handshake
10701070
* Use a custom WebSocket ticket system which supplies a random token with the HTML page which hosts the JavaScript WebSockets client which must provide this token during the initial handshake request as a query parameter.
10711071
====
10721072

1073+
Before the bearer access token sent on the initial HTTP request expires, you can send a new bearer access token as part of a message and update current `SecurityIdentity` attached to the WebSocket server connection:
1074+
1075+
[source, java]
1076+
----
1077+
package io.quarkus.websockets.next.test.security;
1078+
1079+
import io.quarkus.security.Authenticated;
1080+
import io.quarkus.security.identity.SecurityIdentity;
1081+
import io.quarkus.websockets.next.OnTextMessage;
1082+
import io.quarkus.websockets.next.WebSocket;
1083+
import io.quarkus.websockets.next.WebSocketSecurity;
1084+
import jakarta.inject.Inject;
1085+
1086+
@Authenticated
1087+
@WebSocket(path = "/end")
1088+
public class Endpoint {
1089+
1090+
record Metadata(String token) {}
1091+
record RequestDto(Metadata metadata, String message) {}
1092+
1093+
@Inject
1094+
SecurityIdentity securityIdentity;
1095+
1096+
@Inject
1097+
WebSocketSecurity webSocketSecurity;
1098+
1099+
@OnTextMessage
1100+
String echo(RequestDto request) {
1101+
if (request.metadata != null && request.metadata.token != null) {
1102+
webSocketSecurity.updateSecurityIdentity(request.metadata.token); <1>
1103+
}
1104+
String principalName = securityIdentity.getPrincipal().getName(); <2>
1105+
return request.message + " " + principalName;
1106+
}
1107+
1108+
}
1109+
----
1110+
<1> Asynchronously update the `SecurityIdentity` attached to the WebSocket server connection.
1111+
<2> The current `SecurityIdentity` instance is still available and can be used during the `SecurityIdentity` update.
1112+
1113+
The xref:security-oidc-bearer-token-authentication.adoc[OIDC Bearer token authentication] mechanism has builtin support for the `SecurityIdentity` update.
1114+
If you use other authentication mechanisms, you must implement the `io.quarkus.security.identity.IdentityProvider` provider that supports the `io.quarkus.websockets.next.runtime.spi.security.WebSocketIdentityUpdateRequest` authentication request.
1115+
1116+
[IMPORTANT]
1117+
====
1118+
The new bearer access token must have the same `sub` claim value as the token used during the initial HTTP request.
1119+
Please also make sure the `SecurityIdentity` is only updated when necessary and the WebSocket message with credentials do not appear in your application logs.
1120+
Always use the `wss` protocol to enforce encrypted HTTP connection via TLS when sending credentials as part of the WebSocket message.
1121+
====
1122+
1123+
WebSocket client application have to send a new access token before previous one expires:
1124+
1125+
[source,html]
1126+
----
1127+
<script type="module">
1128+
import Keycloak from 'https://cdn.jsdelivr.net/npm/[email protected]/lib/keycloak.js'
1129+
const keycloak = new Keycloak({
1130+
url: 'http://localhost:39245',
1131+
realm: 'quarkus',
1132+
clientId: 'websockets-js-client'
1133+
});
1134+
function getToken() {
1135+
return keycloak.token
1136+
}
1137+
1138+
await keycloak
1139+
.init({onLoad: 'login-required'})
1140+
.then(() => console.log('User is now authenticated.'))
1141+
.catch(err => console.log('User is NOT authenticated.', err));
1142+
1143+
// open Web socket - reduced for brevity
1144+
let connectionOpened = true;
1145+
const subprotocols = [ "quarkus", encodeURI("quarkus-http-upgrade" + "#Authorization#Bearer " + getToken()) ]
1146+
const socket = new WebSocket("wss://" + location.host + "/chat/username", subprotocols);
1147+
1148+
setInterval(() => {
1149+
keycloak
1150+
.updateToken(15)
1151+
.then(result => {
1152+
if (result && connectionOpened) {
1153+
console.log('Token updated, sending new token to the server')
1154+
socket.send(JSON.stringify({
1155+
metadata: {
1156+
token: `${getToken()}`
1157+
}
1158+
}));
1159+
}
1160+
})
1161+
.catch(err => console.error(err))
1162+
}, 10000);
1163+
</script>
1164+
----
1165+
1166+
Complete example is located in the `security-openid-connect-websockets-next-quickstart` link:{quickstarts-tree-url}/security-openid-connect-websockets-next-quickstart[directory].
1167+
10731168
=== Inspect and/or reject HTTP upgrade
10741169

10751170
To inspect an HTTP upgrade, you must provide a CDI bean implementing the `io.quarkus.websockets.next.HttpUpgradeCheck` interface.

0 commit comments

Comments
 (0)