Skip to content

Commit 66c24f8

Browse files
committed
Sync documentation of main branch
1 parent 5617908 commit 66c24f8

File tree

8 files changed

+155
-38
lines changed

8 files changed

+155
-38
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62865,6 +62865,8 @@ a| [[quarkus-quartz_quarkus-quartz-thread-count]] [.property-path]##link:#quarku
6286562865
--
6286662866
The size of scheduler thread pool. This will initialize the number of worker threads in the pool.
6286762867

62868+
It's important to bear in mind that Quartz threads are not used to execute scheduled methods, instead the regular Quarkus thread pool is used by default. See also `quarkus.quartz.run-blocking-scheduled-method-on-quartz-thread`.
62869+
6286862870

6286962871
ifdef::add-copy-button-to-env-var[]
6287062872
Environment variable: env_var_with_copy_button:+++QUARKUS_QUARTZ_THREAD_COUNT+++[]
@@ -62874,7 +62876,7 @@ Environment variable: `+++QUARKUS_QUARTZ_THREAD_COUNT+++`
6287462876
endif::add-copy-button-to-env-var[]
6287562877
--
6287662878
|int
62877-
|`25`
62879+
|`10`
6287862880

6287962881
a| [[quarkus-quartz_quarkus-quartz-thread-priority]] [.property-path]##link:#quarkus-quartz_quarkus-quartz-thread-priority[`quarkus.quartz.thread-priority`]##
6288062882

@@ -72399,6 +72401,23 @@ endif::add-copy-button-to-env-var[]
7239972401
|boolean
7240072402
|`true`
7240172403

72404+
a|icon:lock[title=Fixed at build time] [[quarkus-smallrye-openapi_quarkus-smallrye-openapi-auto-add-operation-summary]] [.property-path]##link:#quarkus-smallrye-openapi_quarkus-smallrye-openapi-auto-add-operation-summary[`quarkus.smallrye-openapi.auto-add-operation-summary`]##
72405+
72406+
[.description]
72407+
--
72408+
This will automatically add a summary to operations based on the Java method name.
72409+
72410+
72411+
ifdef::add-copy-button-to-env-var[]
72412+
Environment variable: env_var_with_copy_button:+++QUARKUS_SMALLRYE_OPENAPI_AUTO_ADD_OPERATION_SUMMARY+++[]
72413+
endif::add-copy-button-to-env-var[]
72414+
ifndef::add-copy-button-to-env-var[]
72415+
Environment variable: `+++QUARKUS_SMALLRYE_OPENAPI_AUTO_ADD_OPERATION_SUMMARY+++`
72416+
endif::add-copy-button-to-env-var[]
72417+
--
72418+
|boolean
72419+
|`true`
72420+
7240272421
a|icon:lock[title=Fixed at build time] [[quarkus-smallrye-openapi_quarkus-smallrye-openapi-auto-add-server]] [.property-path]##link:#quarkus-smallrye-openapi_quarkus-smallrye-openapi-auto-add-server[`quarkus.smallrye-openapi.auto-add-server`]##
7240372422

7240472423
[.description]

_generated-doc/main/config/quarkus-quartz.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ a| [[quarkus-quartz_quarkus-quartz-thread-count]] [.property-path]##link:#quarku
247247
--
248248
The size of scheduler thread pool. This will initialize the number of worker threads in the pool.
249249

250+
It's important to bear in mind that Quartz threads are not used to execute scheduled methods, instead the regular Quarkus thread pool is used by default. See also `quarkus.quartz.run-blocking-scheduled-method-on-quartz-thread`.
251+
250252

251253
ifdef::add-copy-button-to-env-var[]
252254
Environment variable: env_var_with_copy_button:+++QUARKUS_QUARTZ_THREAD_COUNT+++[]
@@ -256,7 +258,7 @@ Environment variable: `+++QUARKUS_QUARTZ_THREAD_COUNT+++`
256258
endif::add-copy-button-to-env-var[]
257259
--
258260
|int
259-
|`25`
261+
|`10`
260262

261263
a| [[quarkus-quartz_quarkus-quartz-thread-priority]] [.property-path]##link:#quarkus-quartz_quarkus-quartz-thread-priority[`quarkus.quartz.thread-priority`]##
262264

_generated-doc/main/config/quarkus-quartz_quarkus.quartz.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ a| [[quarkus-quartz_quarkus-quartz-thread-count]] [.property-path]##link:#quarku
247247
--
248248
The size of scheduler thread pool. This will initialize the number of worker threads in the pool.
249249

250+
It's important to bear in mind that Quartz threads are not used to execute scheduled methods, instead the regular Quarkus thread pool is used by default. See also `quarkus.quartz.run-blocking-scheduled-method-on-quartz-thread`.
251+
250252

251253
ifdef::add-copy-button-to-env-var[]
252254
Environment variable: env_var_with_copy_button:+++QUARKUS_QUARTZ_THREAD_COUNT+++[]
@@ -256,7 +258,7 @@ Environment variable: `+++QUARKUS_QUARTZ_THREAD_COUNT+++`
256258
endif::add-copy-button-to-env-var[]
257259
--
258260
|int
259-
|`25`
261+
|`10`
260262

261263
a| [[quarkus-quartz_quarkus-quartz-thread-priority]] [.property-path]##link:#quarkus-quartz_quarkus-quartz-thread-priority[`quarkus.quartz.thread-priority`]##
262264

_generated-doc/main/config/quarkus-smallrye-openapi.adoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,23 @@ endif::add-copy-button-to-env-var[]
211211
|boolean
212212
|`true`
213213

214+
a|icon:lock[title=Fixed at build time] [[quarkus-smallrye-openapi_quarkus-smallrye-openapi-auto-add-operation-summary]] [.property-path]##link:#quarkus-smallrye-openapi_quarkus-smallrye-openapi-auto-add-operation-summary[`quarkus.smallrye-openapi.auto-add-operation-summary`]##
215+
216+
[.description]
217+
--
218+
This will automatically add a summary to operations based on the Java method name.
219+
220+
221+
ifdef::add-copy-button-to-env-var[]
222+
Environment variable: env_var_with_copy_button:+++QUARKUS_SMALLRYE_OPENAPI_AUTO_ADD_OPERATION_SUMMARY+++[]
223+
endif::add-copy-button-to-env-var[]
224+
ifndef::add-copy-button-to-env-var[]
225+
Environment variable: `+++QUARKUS_SMALLRYE_OPENAPI_AUTO_ADD_OPERATION_SUMMARY+++`
226+
endif::add-copy-button-to-env-var[]
227+
--
228+
|boolean
229+
|`true`
230+
214231
a|icon:lock[title=Fixed at build time] [[quarkus-smallrye-openapi_quarkus-smallrye-openapi-auto-add-server]] [.property-path]##link:#quarkus-smallrye-openapi_quarkus-smallrye-openapi-auto-add-server[`quarkus.smallrye-openapi.auto-add-server`]##
215232

216233
[.description]

_generated-doc/main/config/quarkus-smallrye-openapi_quarkus.smallrye-openapi.adoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,23 @@ endif::add-copy-button-to-env-var[]
211211
|boolean
212212
|`true`
213213

214+
a|icon:lock[title=Fixed at build time] [[quarkus-smallrye-openapi_quarkus-smallrye-openapi-auto-add-operation-summary]] [.property-path]##link:#quarkus-smallrye-openapi_quarkus-smallrye-openapi-auto-add-operation-summary[`quarkus.smallrye-openapi.auto-add-operation-summary`]##
215+
216+
[.description]
217+
--
218+
This will automatically add a summary to operations based on the Java method name.
219+
220+
221+
ifdef::add-copy-button-to-env-var[]
222+
Environment variable: env_var_with_copy_button:+++QUARKUS_SMALLRYE_OPENAPI_AUTO_ADD_OPERATION_SUMMARY+++[]
223+
endif::add-copy-button-to-env-var[]
224+
ifndef::add-copy-button-to-env-var[]
225+
Environment variable: `+++QUARKUS_SMALLRYE_OPENAPI_AUTO_ADD_OPERATION_SUMMARY+++`
226+
endif::add-copy-button-to-env-var[]
227+
--
228+
|boolean
229+
|`true`
230+
214231
a|icon:lock[title=Fixed at build time] [[quarkus-smallrye-openapi_quarkus-smallrye-openapi-auto-add-server]] [.property-path]##link:#quarkus-smallrye-openapi_quarkus-smallrye-openapi-auto-add-server[`quarkus.smallrye-openapi.auto-add-server`]##
215232

216233
[.description]

_versions/main/guides/datasource.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ Read <<in-memory-databases,Testing with in-memory databases>> for suggestions re
213213
* PostgreSQL - `quarkus-jdbc-postgresql`
214214
ifndef::no-quarkiverse[]
215215
* Other JDBC extensions, such as link:https://github.com/quarkiverse/quarkus-jdbc-sqlite[SQLite] and its link:https://docs.quarkiverse.io/quarkus-jdbc-sqlite/dev/index.html[documentation], can be found in the https://github.com/quarkiverse[Quarkiverse].
216-
ifndef::no-quarkiverse[]
216+
endif::no-quarkiverse[]
217217
+
218218
For example, to add the PostgreSQL driver dependency:
219219
+

_versions/main/guides/dev-ui.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ import 'qui-ide-link';
747747
<qui-ide-link title='Source full class name'
748748
class='text-source'
749749
fileName='${sourceClassNameFull}'
750-
lineNumber=${sourceLineNumber}>[${sourceClassNameFull}]</qui-ide-link>;
750+
lineNumber='${sourceLineNumber}'>[${sourceClassNameFull}]</qui-ide-link>;
751751
----
752752

753753
https://github.com/quarkusio/quarkus/blob/582f1f78806d2268885faea7aa8f5a4d2b3f5b98/extensions/vertx-http/dev-ui-resources/src/main/resources/dev-ui/qwc/qwc-server-log.js#L315[Example code]

_versions/main/guides/security-authorize-web-endpoints-reference.adoc

Lines changed: 93 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,8 +1055,85 @@ Because `MediaLibrary` is the `TvLibrary` class parent, a user with the `admin`
10551055

10561056
CAUTION: Annotation-based permissions do not work with custom xref:security-customization.adoc#jaxrs-security-context[Jakarta REST SecurityContexts] because there are no permissions in `jakarta.ws.rs.core.SecurityContext`.
10571057

1058+
[[permission-checker]]
1059+
==== Create permission checkers
1060+
1061+
By default, `SecurityIdentity` must be configured with permissions which can be used to check if this identity passes `@PermissionAllowed` authorization restrictions.
1062+
Alternatively, you can use a `@PermissionChecker` annotation to mark any CDI bean method as a permission checker.
1063+
The `@PermissionChecker` annotation value should match required permission declared by the `@PermissionsAllowed` annotation value.
1064+
For example, a permission checker can be created like this:
1065+
1066+
[source,java]
1067+
----
1068+
package org.acme.security.rest.resource;
1069+
1070+
import io.quarkus.security.PermissionChecker;
1071+
import io.quarkus.security.PermissionsAllowed;
1072+
import io.quarkus.security.identity.SecurityIdentity;
1073+
import jakarta.ws.rs.POST;
1074+
import jakarta.ws.rs.Path;
1075+
1076+
import org.jboss.resteasy.reactive.RestForm;
1077+
import org.jboss.resteasy.reactive.RestPath;
1078+
1079+
@Path("/project")
1080+
public class ProjectResource {
1081+
1082+
@PermissionsAllowed("rename-project") <1>
1083+
@POST
1084+
public void renameProject(@RestPath String projectName, @RestForm String newName) {
1085+
Project project = Project.findByName(projectName);
1086+
project.name = newName;
1087+
}
1088+
1089+
@PermissionChecker("rename-project") <2>
1090+
boolean canRenameProject(SecurityIdentity identity, String projectName) { <3> <4>
1091+
var principalName = identity.getPrincipal().getName();
1092+
var user = User.getUserByName(principalName);
1093+
return userOwnsProject(projectName, user);
1094+
}
1095+
}
1096+
----
1097+
<1> The permission required to access the `ProjectResource#renameProject` is the `rename-project` permission.
1098+
<2> The `ProjectResource#canRenameProject` method authorizes access to the `ProjectResource#renameProject` endpoint.
1099+
<3> The `SecurityIdentity` instance can be injected into any permission checker method.
1100+
<4> In this example, the `rename-project` permission checker is declared on the same resource.
1101+
However, there is no restriction on where this permission checker can be declared as demonstrated in the next example.
1102+
1103+
NOTE: Permission checker methods can be declared on a normal scoped CDI bean or on a `@Singleton` bean.
1104+
The `@Dependent` CDI bean scope is currently not supported.
1105+
1106+
The permission checker above requires the `SecurityIdentity` instance to authorize the `renameProject` endpoint.
1107+
Instead of declaring the `rename-project` permission checker directly on the resource, you can declare it on any CDI bean like in this example:
1108+
1109+
[source,java]
1110+
----
1111+
package org.acme.security.rest.resource;
1112+
1113+
import io.quarkus.security.PermissionChecker;
1114+
import jakarta.enterprise.context.ApplicationScoped;
1115+
import jakarta.inject.Inject;
1116+
1117+
@ApplicationScoped <1>
1118+
public class ProjectPermissionChecker {
1119+
1120+
@PermissionChecker("rename-project")
1121+
boolean canRenameProject(String projectName, SecurityIdentity identity) { <2>
1122+
var principalName = identity.getPrincipal().getName();
1123+
var user = User.getUserByName(principalName);
1124+
return userOwnsProject(projectName, user);
1125+
}
1126+
1127+
}
1128+
----
1129+
<1> A CDI bean with the permission checker must be either a normal scoped bean or a `@Singleton` bean.
1130+
<2> The permission checker method must return either `boolean` or `Uni<Boolean>`. Private checker methods are not supported.
1131+
1132+
TIP: Permission checks run by default on event loops whenever possible.
1133+
Annotate a permission checker method with the `io.smallrye.common.annotation.Blocking` annotation if you want to run the check on a worker thread.
1134+
10581135
[[permission-meta-annotation]]
1059-
=== Create permission meta-annotations
1136+
==== Create permission meta-annotations
10601137

10611138
`@PermissionsAllowed` can also be used in meta-annotations.
10621139
For example, a new `@CanWrite` security annotation can be created like this:
@@ -1080,7 +1157,7 @@ public @interface CanWrite {
10801157
<1> Any method or class annotated with the `@CanWrite` annotation is secured with this `@PermissionsAllowed` annotation instance.
10811158

10821159
[[permission-bean-params]]
1083-
=== Pass `@BeanParam` parameters into a custom permission
1160+
==== Pass `@BeanParam` parameters into a custom permission
10841161

10851162
Quarkus can map fields of a secured method parameters to a custom permission constructor parameters.
10861163
You can use this feature to pass `jakarta.ws.rs.BeanParam` parameters into your custom permission.
@@ -1096,20 +1173,19 @@ import jakarta.ws.rs.GET;
10961173
import jakarta.ws.rs.Path;
10971174
10981175
@Path("/hello")
1099-
public class SimpleResource {
1176+
public class HelloResource {
11001177
1101-
@PermissionsAllowed(value = "say:hello", permission = BeanParamPermission.class,
1102-
params = "beanParam.securityContext.userPrincipal.name") <1>
1178+
@PermissionsAllowed(value = "say-hello", params = "beanParam.securityContext.userPrincipal.name") <1>
11031179
@GET
11041180
public String sayHello(@BeanParam SimpleBeanParam beanParam) {
11051181
return "Hello from " + beanParam.uriInfo.getPath();
11061182
}
11071183
11081184
}
11091185
----
1110-
<1> The `params` annotation attribute specifies that user principal name should be passed to the `BeanParamPermission` constructor.
1111-
Other `BeanParamPermission` constructor parameters like `customAuthorizationHeader` and `query` are matched automatically.
1112-
Quarkus identifies the `BeanParamPermission` constructor parameters among `beanParam` fields and their public accessors.
1186+
<1> The `params` annotation attribute specifies that user principal name should be passed to the `BeanParamPermissionChecker#canSayHello` method.
1187+
Other `BeanParamPermissionChecker#canSayHello` method parameters like `customAuthorizationHeader` and `query` are matched automatically.
1188+
Quarkus identifies the `BeanParamPermissionChecker#canSayHello` method parameters among `beanParam` fields and their public accessors.
11131189
To avoid ambiguous resolution, automatic detection only works for the `beanParam` fields.
11141190
For that reason, we had to specify path to the user principal name explicitly.
11151191

@@ -1155,47 +1231,31 @@ public class SimpleBeanParam {
11551231
<3> The `customAuthorizationHeader` field is not public, therefore Quarkus access this field with the `customAuthorizationHeader` accessor.
11561232
That is particularly useful with Java records, where generated accessors are not prefixed with `get`.
11571233

1158-
Here is an example of the `BeanParamPermission` permission that checks user principal, custom header and query parameter:
1234+
Here is an example of a `@PermissionChecker` method that checks the `say-hello` permission based on a user principal, custom header and query parameter:
11591235

11601236
[source,java]
11611237
----
11621238
package org.acme.security.permission;
11631239
1164-
import java.security.Permission;
1165-
1166-
public class BeanParamPermission extends Permission {
1167-
1168-
private final String actions;
1169-
1170-
public BeanParamPermission(String permissionName, String customAuthorizationHeader, String name, String query) {
1171-
super(permissionName);
1172-
this.actions = computeActions(customAuthorizationHeader, name, query);
1173-
}
1240+
import jakarta.enterprise.context.ApplicationScoped;
1241+
import io.quarkus.security.PermissionChecker;
11741242
1175-
@Override
1176-
public boolean implies(Permission p) {
1177-
boolean nameMatches = getName().equals(p.getName());
1178-
boolean actionMatches = actions.equals(p.getActions());
1179-
return nameMatches && actionMatches;
1180-
}
1243+
@ApplicationScoped
1244+
public class BeanParamPermissionChecker {
11811245
1182-
private static String computeActions(String customAuthorizationHeader, String name, String query) {
1246+
@PermissionChecker("say-hello")
1247+
boolean canSayHello(String customAuthorizationHeader, String name, String query) {
11831248
boolean queryParamAllowedForPermissionName = checkQueryParams(query);
11841249
boolean usernameWhitelisted = isUserNameWhitelisted(name);
11851250
boolean customAuthorizationMatches = checkCustomAuthorization(customAuthorizationHeader);
1186-
var isAuthorized = queryParamAllowedForPermissionName && usernameWhitelisted && customAuthorizationMatches;
1187-
if (isAuthorized) {
1188-
return "hello";
1189-
} else {
1190-
return "goodbye";
1191-
}
1251+
return queryParamAllowedForPermissionName && usernameWhitelisted && customAuthorizationMatches;
11921252
}
11931253
11941254
...
11951255
}
11961256
----
11971257

1198-
NOTE: You can pass `@BeanParam` directly into a custom permission constructor and access its fields programmatically in the constructor instead.
1258+
NOTE: You can pass `@BeanParam` directly into a `@PermissionChecker` method and access its fields programmatically.
11991259
Ability to reference `@BeanParam` fields with the `@PermissionsAllowed#params` attribute is useful when you have multiple differently structured `@BeanParam` classes.
12001260

12011261
== References

0 commit comments

Comments
 (0)