Skip to content

Commit fab1e96

Browse files
committed
Sync documentation of main branch
1 parent e13fa22 commit fab1e96

File tree

6 files changed

+142
-17
lines changed

6 files changed

+142
-17
lines changed

_data/versioned/main/index/quarkus.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ types:
55
- title: Authorization of web endpoints
66
filename: security-authorize-web-endpoints-reference.adoc
77
summary: Quarkus has an integrated pluggable web security layer.
8-
categories: "web, security"
8+
categories: "security, web"
99
id: security-authorize-web-endpoints-reference
1010
type: reference
1111
url: /guides/security-authorize-web-endpoints-reference
@@ -30,7 +30,7 @@ types:
3030
- title: Configure data sources in Quarkus
3131
filename: datasource.adoc
3232
summary: Use a unified configuration model to define data sources for Java Database Connectivity (JDBC) and Reactive drivers.
33-
categories: "getting-started, data"
33+
categories: "data, getting-started"
3434
id: datasources
3535
type: reference
3636
url: /guides/datasource
@@ -55,7 +55,7 @@ types:
5555
- title: Logging configuration
5656
filename: logging.adoc
5757
summary: "Read about the use of logging API in Quarkus, configuring logging output, and using logging adapters to unify the output from other logging APIs."
58-
categories: "observability, getting-started, core"
58+
categories: "getting-started, core, observability"
5959
id: logging
6060
type: reference
6161
url: /guides/logging
@@ -159,21 +159,21 @@ types:
159159
- title: Authentication mechanisms in Quarkus
160160
filename: security-authentication-mechanisms.adoc
161161
summary: "The Quarkus Security framework supports multiple authentication mechanisms, which you can use to secure your applications."
162-
categories: "web, security"
162+
categories: "security, web"
163163
id: security-authentication-mechanisms
164164
type: concepts
165165
url: /guides/security-authentication-mechanisms
166166
- title: Basic authentication
167167
filename: security-basic-authentication.adoc
168168
summary: HTTP Basic authentication is one of the least resource-demanding techniques that enforce access controls to web resources.
169-
categories: "web, security"
169+
categories: "security, web"
170170
id: security-basic-authentication
171171
type: concepts
172172
url: /guides/security-basic-authentication
173173
- title: Configuring Well-Known OpenID Connect Providers
174174
filename: security-openid-connect-providers.adoc
175175
summary: This document explains how to configure well-known social OIDC and OAuth2 providers.
176-
categories: "web, security"
176+
categories: "security, web"
177177
id: security-openid-connect-providers
178178
type: concepts
179179
url: /guides/security-openid-connect-providers
@@ -194,21 +194,21 @@ types:
194194
- title: OpenID Connect (OIDC) Bearer token authentication
195195
filename: security-oidc-bearer-token-authentication.adoc
196196
summary: Secure HTTP access to Jakarta REST (formerly known as JAX-RS) endpoints in your application with Bearer token authentication by using the Quarkus OpenID Connect (OIDC) extension.
197-
categories: "web, security"
197+
categories: "security, web"
198198
id: security-oidc-bearer-token-authentication
199199
type: concepts
200200
url: /guides/security-oidc-bearer-token-authentication
201201
- title: OpenID Connect authorization code flow mechanism for protecting web applications
202202
filename: security-oidc-code-flow-authentication.adoc
203203
summary: "To protect your web applications, you can use the industry-standard OpenID Connect (OIDC) Authorization Code Flow mechanism provided by the Quarkus OIDC extension."
204-
categories: "web, security"
204+
categories: "security, web"
205205
id: security-oidc-code-flow-authentication
206206
type: concepts
207207
url: /guides/security-oidc-code-flow-authentication
208208
- title: Proactive authentication
209209
filename: security-proactive-authentication.adoc
210210
summary: Proactive authentication is enabled in Quarkus by default.
211-
categories: "web, security"
211+
categories: "security, web"
212212
id: security-proactive-authentication
213213
type: concepts
214214
url: /guides/security-proactive-authentication
@@ -312,7 +312,7 @@ types:
312312
- title: Protect a web application by using OpenID Connect (OIDC) authorization code flow
313313
filename: security-oidc-code-flow-authentication-tutorial.adoc
314314
summary: "With the Quarkus OpenID Connect (OIDC) extension, you can protect application HTTP endpoints by using the OIDC Authorization Code Flow mechanism."
315-
categories: "web, security"
315+
categories: "security, web"
316316
id: security-oidc-code-flow-authentication-tutorial
317317
type: tutorial
318318
url: /guides/security-oidc-code-flow-authentication-tutorial
@@ -338,7 +338,7 @@ types:
338338
- title: Your second Quarkus application
339339
filename: getting-started-dev-services.adoc
340340
summary: Discover some of the features that make developing with Quarkus a joyful experience.
341-
categories: "getting-started, data, core"
341+
categories: "data, getting-started, core"
342342
id: getting-started-dev-services-tutorial
343343
type: tutorial
344344
url: /guides/getting-started-dev-services
@@ -1033,7 +1033,7 @@ types:
10331033
- title: Simplified Hibernate ORM with Panache and Kotlin
10341034
filename: hibernate-orm-panache-kotlin.adoc
10351035
summary: This explains the specifics of using Hibernate ORM with Panache in a Kotlin project.
1036-
categories: "alt-languages, data"
1036+
categories: "data, alt-languages"
10371037
type: guide
10381038
url: /guides/hibernate-orm-panache-kotlin
10391039
- title: Simplified Hibernate Reactive with Panache
@@ -1051,7 +1051,7 @@ types:
10511051
- title: Simplified MongoDB with Panache and Kotlin
10521052
filename: mongodb-panache-kotlin.adoc
10531053
summary: This guide covers the usage of MongoDB using active records and repositories in a Kotlin project.
1054-
categories: "alt-languages, data"
1054+
categories: "data, alt-languages"
10551055
type: guide
10561056
url: /guides/mongodb-panache-kotlin
10571057
- title: SmallRye Fault Tolerance
@@ -1223,7 +1223,7 @@ types:
12231223
- title: Using SSL With Native Executables
12241224
filename: native-and-ssl.adoc
12251225
summary: "In this guide, we will discuss how you can get your native images to support SSL, as native images don't support it out of the box."
1226-
categories: "security, native, core"
1226+
categories: "native, security, core"
12271227
type: guide
12281228
url: /guides/native-and-ssl
12291229
- title: Using Security with .properties File
@@ -1336,13 +1336,13 @@ types:
13361336
- title: Validation with Hibernate Validator
13371337
filename: validation.adoc
13381338
summary: This guide covers how to use Hibernate Validator/Bean Validation in your REST services.
1339-
categories: "web, data"
1339+
categories: "data, web"
13401340
type: guide
13411341
url: /guides/validation
13421342
- title: Writing JSON REST Services
13431343
filename: rest-json.adoc
13441344
summary: JSON is now the lingua franca between microservices.
1345-
categories: "web, serialization"
1345+
categories: "serialization, web"
13461346
type: guide
13471347
url: /guides/rest-json
13481348
- title: Writing REST Services with RESTEasy Reactive

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ a| `String name` :: +++<i>No Javadoc found</i>+++
255255
256256
a| https://github.com/quarkusio/quarkus/blob/main/core/deployment/src/main/java/io/quarkus/deployment/builditem/GeneratedResourceBuildItem.java[`io.quarkus.deployment.builditem.GeneratedResourceBuildItem`, window="_blank"] :: +++<i>No Javadoc found</i>+++
257257
a| `String name` :: +++<i>No Javadoc found</i>+++
258-
`byte[] classData` :: +++<i>No Javadoc found</i>+++
258+
`byte[] data` :: +++<i>No Javadoc found</i>+++
259259
`boolean excludeFromDevCL` :: +++<i>No Javadoc found</i>+++
260260
261261
a| https://github.com/quarkusio/quarkus/blob/main/core/deployment/src/main/java/io/quarkus/deployment/builditem/HotDeploymentWatchedFileBuildItem.java[`io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem`, window="_blank"] :: +++Identifies a file from a that, if modified, may result in a hot redeployment when in the dev mode. <p> A file may be identified with an exact location or a matching predicate. See and . <p> If multiple build items match the same file then the final value of is computed as a logical OR of all the values.+++
72.7 KB
Loading
61.4 KB
Loading

_versions/main/guides/security-openid-connect-providers.adoc

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,10 +542,68 @@ Finally, you need to configure the Google Calendar address and request the Goo
542542

543543
[source,properties]
544544
----
545+
quarkus.oidc.provider=google
546+
quarkus.oidc.client-id=<Client ID>
547+
quarkus.oidc.credentials.secret=<Secret>
548+
549+
# Add a required calendar scope
545550
quarkus.oidc.authentication.extra-params.scope=https://www.googleapis.com/auth/calendar
551+
552+
# Point REST client to Google Calendar endpoint
546553
quarkus.rest-client.google-calendar-api.url=https://www.googleapis.com/calendar/v3
547554
----
548555

556+
Now you are ready to have users authenticated with Google and support updating their `Google` calendars on their behalf, for example:
557+
558+
[source,java]
559+
----
560+
package org.acme.calendar;
561+
562+
import org.eclipse.microprofile.jwt.JsonWebToken;
563+
import org.eclipse.microprofile.rest.client.inject.RestClient;
564+
565+
import io.quarkus.oidc.IdToken;
566+
import io.quarkus.security.Authenticated;
567+
import io.smallrye.mutiny.Uni;
568+
import jakarta.inject.Inject;
569+
import jakarta.ws.rs.GET;
570+
import jakarta.ws.rs.Path;
571+
import jakarta.ws.rs.Produces;
572+
573+
@Path("/calendar")
574+
@Authenticated
575+
public class CalendarService {
576+
577+
@Inject
578+
@IdToken
579+
JsonWebToken jwt;
580+
581+
@Inject
582+
@RestClient
583+
GoogleCalendarClient calendarClient;
584+
585+
@GET
586+
@Path("/event")
587+
@Produces("text/plain")
588+
public Uni<String> get() {
589+
return calendarClient.addEvent(new Event()).onItem()
590+
.transform(c -> ("Hello " + jwt.getName() + ", new event: " + c));
591+
}
592+
}
593+
----
594+
595+
You must update the application registered with the xref:google[Google] provider to list `http://localhost:8080/calendar/event` as one of the authorized redirect URIs if you would like to test this endpoint on the local host, for example:
596+
597+
image::oidc-google-authorized-redirects.png[role="thumb"]
598+
599+
You might also have to register one or more test users:
600+
601+
image::oidc-google-test-users.png[role="thumb"]
602+
603+
Follow the same approach if the endpoint must access other Google services.
604+
605+
The pattern of authenticating with a given provider, where the endpoint uses either an ID token or UserInfo (especially if an OAuth2-only provider such as `GitHub` is used) to get some information about the currently authenticated user and using an access token to access some downstream services (provider or application specific ones) on behalf of this user can be universally applied, irrespectively of which provider is used to secure the application.
606+
549607
== HTTPS Redirect URL
550608

551609
Some providers will only accept HTTPS-based redirect URLs. Tools such as https://ngrok.com/[ngrok] https://linuxhint.com/set-up-use-ngrok/[can be set up] to help testing such providers with Quarkus endpoints running on localhost in devmode.

_versions/main/guides/virtual-threads.adoc

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,73 @@ quarkus.virtual-threads.name-prefix=
462462
463463
----
464464

465+
== Testing virtual thread applications
466+
467+
As mentioned above, virtual threads have a few limitations that can drastically affect your application performance and memory usage.
468+
The _junit5-virtual-threads_ extension provides a way to detect pinned carrier threads while running your tests.
469+
Thus, you can eliminate one of the most prominent limitations or be aware of the problem.
470+
471+
To enable this detection:
472+
473+
* 1) Add the `junit5-virtual-threads` dependency to your project:
474+
[source, xml]
475+
----
476+
<dependency>
477+
<groupId>io.quarkus.junit5</groupId>
478+
<artifactId>junit5-virtual-threads</artifactId>
479+
<scope>test</scope>
480+
</dependency>
481+
----
482+
483+
* 2) In your test case, add the `io.quarkus.test.junit5.virtual.VirtualThreadUnit` and `io.quarkus.test.junit.virtual.ShouldNotPin` annotations:
484+
[source, java]
485+
----
486+
@QuarkusTest
487+
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
488+
@VirtualThreadUnit // Use the extension
489+
@ShouldNotPin // Detect pinned carrier thread
490+
class TodoResourceTest {
491+
// ...
492+
}
493+
----
494+
495+
When you run your test (remember to use Java 21+), Quarkus detects pinned carrier threads.
496+
When it happens, the test fails.
497+
498+
The `@ShouldNotPin` can also be used on methods directly.
499+
500+
The _junit5-virtual-threads_ also provides a `@ShouldPin` annotation for cases where pinning is unavoidable.
501+
The following snippet demonstrates the `@ShouldPin` annotation usage and the possibility to inject a `ThreadPinnedEvents` instance in your test to verify when the carrier thread was pinned manually.
502+
503+
[source, java]
504+
----
505+
@VirtualThreadUnit // Use the extension
506+
public class LoomUnitExampleTest {
507+
508+
CodeUnderTest codeUnderTest = new CodeUnderTest();
509+
510+
@Test
511+
@ShouldNotPin
512+
public void testThatShouldNotPin() {
513+
// ...
514+
}
515+
516+
@Test
517+
@ShouldPin(atMost = 1)
518+
public void testThatShouldPinAtMostOnce() {
519+
codeUnderTest.pin();
520+
}
521+
522+
@Test
523+
public void testThatShouldNotPin(ThreadPinnedEvents events) { // Inject an object to check the pin events
524+
Assertions.assertTrue(events.getEvents().isEmpty());
525+
codeUnderTest.pin();
526+
await().until(() -> events.getEvents().size() > 0);
527+
Assertions.assertEquals(events.getEvents().size(), 1);
528+
}
529+
530+
}
531+
----
465532

466533
== Additional references
467534

0 commit comments

Comments
 (0)