Skip to content

Commit 1982ee4

Browse files
committed
Sync documentation of main branch
1 parent 9f8d810 commit 1982ee4

7 files changed

+142
-60
lines changed

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

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14346,27 +14346,6 @@ endif::add-copy-button-to-env-var[]
1434614346
|boolean
1434714347
|`false`
1434814348

14349-
a|icon:lock[title=Fixed at build time] [[quarkus-vertx-http_quarkus-http-auth-form-post-location]] [.property-path]##link:#quarkus-vertx-http_quarkus-http-auth-form-post-location[`quarkus.http.auth.form.post-location`]##
14350-
ifdef::add-copy-button-to-config-props[]
14351-
config_property_copy_button:+++quarkus.http.auth.form.post-location+++[]
14352-
endif::add-copy-button-to-config-props[]
14353-
14354-
14355-
[.description]
14356-
--
14357-
The post location.
14358-
14359-
14360-
ifdef::add-copy-button-to-env-var[]
14361-
Environment variable: env_var_with_copy_button:+++QUARKUS_HTTP_AUTH_FORM_POST_LOCATION+++[]
14362-
endif::add-copy-button-to-env-var[]
14363-
ifndef::add-copy-button-to-env-var[]
14364-
Environment variable: `+++QUARKUS_HTTP_AUTH_FORM_POST_LOCATION+++`
14365-
endif::add-copy-button-to-env-var[]
14366-
--
14367-
|string
14368-
|`/j_security_check`
14369-
1437014349
a|icon:lock[title=Fixed at build time] [[quarkus-vertx-http_quarkus-http-auth-proactive]] [.property-path]##link:#quarkus-vertx-http_quarkus-http-auth-proactive[`quarkus.http.auth.proactive`]##
1437114350
ifdef::add-copy-button-to-config-props[]
1437214351
config_property_copy_button:+++quarkus.http.auth.proactive+++[]
@@ -16595,6 +16574,27 @@ endif::add-copy-button-to-env-var[]
1659516574
|link:https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html[Duration] link:#duration-note-anchor-all-config[icon:question-circle[title=More information about the Duration format]]
1659616575
|
1659716576

16577+
a| [[quarkus-vertx-http_quarkus-http-auth-form-post-location]] [.property-path]##link:#quarkus-vertx-http_quarkus-http-auth-form-post-location[`quarkus.http.auth.form.post-location`]##
16578+
ifdef::add-copy-button-to-config-props[]
16579+
config_property_copy_button:+++quarkus.http.auth.form.post-location+++[]
16580+
endif::add-copy-button-to-config-props[]
16581+
16582+
16583+
[.description]
16584+
--
16585+
The post location.
16586+
16587+
16588+
ifdef::add-copy-button-to-env-var[]
16589+
Environment variable: env_var_with_copy_button:+++QUARKUS_HTTP_AUTH_FORM_POST_LOCATION+++[]
16590+
endif::add-copy-button-to-env-var[]
16591+
ifndef::add-copy-button-to-env-var[]
16592+
Environment variable: `+++QUARKUS_HTTP_AUTH_FORM_POST_LOCATION+++`
16593+
endif::add-copy-button-to-env-var[]
16594+
--
16595+
|string
16596+
|`/j_security_check`
16597+
1659816598
a| [[quarkus-vertx-http_quarkus-http-auth-inclusive]] [.property-path]##link:#quarkus-vertx-http_quarkus-http-auth-inclusive[`quarkus.http.auth.inclusive`]##
1659916599
ifdef::add-copy-button-to-config-props[]
1660016600
config_property_copy_button:+++quarkus.http.auth.inclusive+++[]

_generated-doc/main/config/quarkus-vertx-http_quarkus.http.adoc

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -72,27 +72,6 @@ endif::add-copy-button-to-env-var[]
7272
|boolean
7373
|`false`
7474

75-
a|icon:lock[title=Fixed at build time] [[quarkus-vertx-http_quarkus-http-auth-form-post-location]] [.property-path]##link:#quarkus-vertx-http_quarkus-http-auth-form-post-location[`quarkus.http.auth.form.post-location`]##
76-
ifdef::add-copy-button-to-config-props[]
77-
config_property_copy_button:+++quarkus.http.auth.form.post-location+++[]
78-
endif::add-copy-button-to-config-props[]
79-
80-
81-
[.description]
82-
--
83-
The post location.
84-
85-
86-
ifdef::add-copy-button-to-env-var[]
87-
Environment variable: env_var_with_copy_button:+++QUARKUS_HTTP_AUTH_FORM_POST_LOCATION+++[]
88-
endif::add-copy-button-to-env-var[]
89-
ifndef::add-copy-button-to-env-var[]
90-
Environment variable: `+++QUARKUS_HTTP_AUTH_FORM_POST_LOCATION+++`
91-
endif::add-copy-button-to-env-var[]
92-
--
93-
|string
94-
|`/j_security_check`
95-
9675
a|icon:lock[title=Fixed at build time] [[quarkus-vertx-http_quarkus-http-auth-proactive]] [.property-path]##link:#quarkus-vertx-http_quarkus-http-auth-proactive[`quarkus.http.auth.proactive`]##
9776
ifdef::add-copy-button-to-config-props[]
9877
config_property_copy_button:+++quarkus.http.auth.proactive+++[]
@@ -2321,6 +2300,27 @@ endif::add-copy-button-to-env-var[]
23212300
|link:https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html[Duration] link:#duration-note-anchor-quarkus-vertx-http_quarkus-http[icon:question-circle[title=More information about the Duration format]]
23222301
|
23232302

2303+
a| [[quarkus-vertx-http_quarkus-http-auth-form-post-location]] [.property-path]##link:#quarkus-vertx-http_quarkus-http-auth-form-post-location[`quarkus.http.auth.form.post-location`]##
2304+
ifdef::add-copy-button-to-config-props[]
2305+
config_property_copy_button:+++quarkus.http.auth.form.post-location+++[]
2306+
endif::add-copy-button-to-config-props[]
2307+
2308+
2309+
[.description]
2310+
--
2311+
The post location.
2312+
2313+
2314+
ifdef::add-copy-button-to-env-var[]
2315+
Environment variable: env_var_with_copy_button:+++QUARKUS_HTTP_AUTH_FORM_POST_LOCATION+++[]
2316+
endif::add-copy-button-to-env-var[]
2317+
ifndef::add-copy-button-to-env-var[]
2318+
Environment variable: `+++QUARKUS_HTTP_AUTH_FORM_POST_LOCATION+++`
2319+
endif::add-copy-button-to-env-var[]
2320+
--
2321+
|string
2322+
|`/j_security_check`
2323+
23242324
a| [[quarkus-vertx-http_quarkus-http-auth-inclusive]] [.property-path]##link:#quarkus-vertx-http_quarkus-http-auth-inclusive[`quarkus.http.auth.inclusive`]##
23252325
ifdef::add-copy-button-to-config-props[]
23262326
config_property_copy_button:+++quarkus.http.auth.inclusive+++[]

_generated-doc/main/config/quarkus-vertx-http_quarkus.http.auth.adoc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,27 @@ endif::add-copy-button-to-env-var[]
649649
|link:https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/time/Duration.html[Duration] link:#duration-note-anchor-quarkus-vertx-http_quarkus-http-auth[icon:question-circle[title=More information about the Duration format]]
650650
|
651651

652+
a| [[quarkus-vertx-http_quarkus-http-auth_quarkus-http-auth-form-post-location]] [.property-path]##link:#quarkus-vertx-http_quarkus-http-auth_quarkus-http-auth-form-post-location[`quarkus.http.auth.form.post-location`]##
653+
ifdef::add-copy-button-to-config-props[]
654+
config_property_copy_button:+++quarkus.http.auth.form.post-location+++[]
655+
endif::add-copy-button-to-config-props[]
656+
657+
658+
[.description]
659+
--
660+
The post location.
661+
662+
663+
ifdef::add-copy-button-to-env-var[]
664+
Environment variable: env_var_with_copy_button:+++QUARKUS_HTTP_AUTH_FORM_POST_LOCATION+++[]
665+
endif::add-copy-button-to-env-var[]
666+
ifndef::add-copy-button-to-env-var[]
667+
Environment variable: `+++QUARKUS_HTTP_AUTH_FORM_POST_LOCATION+++`
668+
endif::add-copy-button-to-env-var[]
669+
--
670+
|string
671+
|`/j_security_check`
672+
652673
a| [[quarkus-vertx-http_quarkus-http-auth_quarkus-http-auth-inclusive]] [.property-path]##link:#quarkus-vertx-http_quarkus-http-auth_quarkus-http-auth-inclusive[`quarkus.http.auth.inclusive`]##
653674
ifdef::add-copy-button-to-config-props[]
654675
config_property_copy_button:+++quarkus.http.auth.inclusive+++[]

_versions/main/guides/security-authentication-mechanisms.adoc

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,29 +194,59 @@ code to destroy the cookie.
194194

195195
[source,java]
196196
----
197-
import io.quarkus.security.identity.CurrentIdentityAssociation;
197+
import io.quarkus.security.identity.SecurityIdentity;
198198
import io.quarkus.vertx.http.runtime.security.FormAuthenticationMechanism;
199199
import jakarta.ws.rs.core.Response;
200200
import jakarta.ws.rs.POST;
201201
202202
@Inject
203-
CurrentIdentityAssociation identity;
203+
SecurityIdentity identity;
204204
205205
@POST
206206
public Response logout() {
207-
if (identity.getIdentity().isAnonymous()) {
207+
if (identity.isAnonymous()) {
208208
throw new UnauthorizedException("Not authenticated");
209209
}
210-
FormAuthenticationMechanism.logout(identity.getIdentity()); <1>
210+
FormAuthenticationMechanism.logout(identity); <1>
211211
return Response.noContent().build();
212212
}
213213
----
214214
<1> Perform the logout by removing the session cookie.
215215

216+
[[form-configuration-properties]]
217+
==== Form-based authentication configuration reference
218+
216219
The following properties can be used to configure form-based authentication:
217220

218221
include::{generated-dir}/config/quarkus-vertx-http_quarkus.http.auth.adoc[opts=optional, leveloffset=+1]
219222

223+
[[form-based-auth-programmatic-set-up]]
224+
==== Set up Form-based authentication programmatically
225+
226+
In addition to the configuration properties listed in the <<form-configuration-properties>> section, Quarkus supports a programmatic set up during the runtime as in the example below:
227+
228+
[source,java]
229+
----
230+
package org.acme.http.security;
231+
232+
import io.quarkus.vertx.http.security.Form;
233+
import io.quarkus.vertx.http.security.HttpSecurity;
234+
import jakarta.enterprise.event.Observes;
235+
236+
public class FormConfiguration {
237+
238+
void configure(@Observes HttpSecurity httpSecurity) { <1>
239+
httpSecurity.mechanism(Form.builder()
240+
.httpOnlyCookie()
241+
.loginPage("/my-login.html")
242+
.errorPage("/my-error.html")
243+
.build());
244+
}
245+
246+
}
247+
----
248+
<1> Observe the `io.quarkus.vertx.http.security.HttpSecurity` CDI event and configure Form authentication mechanism programmatically.
249+
220250
[[mutual-tls]]
221251
=== Mutual TLS authentication
222252

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

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ quarkus.http.auth.permission.roles3.policy=role-policy3
506506
<2> The `/secured/*` path can only be accessed by authenticated users. This way, you have secured the `/secured/all` path and so on.
507507
<3> Shared permissions are always applied before unshared ones, therefore a `SecurityIdentity` with the `root` role will have the `user` role as well.
508508

509+
[[path-specific-authz-programmatic-set-up]]
509510
=== Set up path-specific authorization programmatically
510511

511512
You can also configure the authorization policies presented by this guide so far programmatically.
@@ -562,12 +563,10 @@ public class HttpSecurityConfiguration {
562563
void configure(@Observes HttpSecurity httpSecurity, CustomHttpSecurityPolicy customHttpSecurityPolicy,
563564
@ConfigProperty(name = "secured-path") String securedPath) {
564565
565-
httpSecurity.path("/api/*").authenticatedWith(new CustomAuthenticationMechanism()); <1>
566-
567-
httpSecurity.path("/other/*").basic().policy(customHttpSecurityPolicy); <2>
566+
httpSecurity.path("/other/*").basic().policy(customHttpSecurityPolicy); <1>
568567
569568
httpSecurity.path("/roles-secured/*").bearer().authorization()
570-
.policy(identity -> identity.hasRole("user") || "root".equals(identity.getPrincipal().getName())); <3>
569+
.policy(identity -> identity.hasRole("user") || "root".equals(identity.getPrincipal().getName())); <2>
571570
572571
httpSecurity.path("/other/administration").authorizationCodeFlow()
573572
.authorization().policy((identity, routingContext) -> {
@@ -576,22 +575,27 @@ public class HttpSecurityConfiguration {
576575
return yourCustomAuthorizationCheck(customAuthorization);
577576
}
578577
return false;
579-
}); <4>
578+
}); <3>
580579
581-
httpSecurity.path(securedPath).form(); <5>
580+
httpSecurity.path(securedPath).form(); <4>
582581
583-
httpSecurity.path("/user-info").bearer().authorization().permissions("openid", "email", "profile"); <6>
582+
httpSecurity.path("/user-info").bearer().authorization().permissions("openid", "email", "profile"); <5>
584583
}
585584
}
586585
----
587-
<1> Authenticate all the '/api/' sub-paths with your own `HttpAuthenticationMechanism` instance.
588-
<2> Use the Basic authentication and authorize the requests with a custom `io.quarkus.vertx.http.runtime.security.HttpSecurityPolicy`.
589-
<3> Use the Bearer token authentication and authorize the `SecurityIdentity` with your own policy.
590-
<4> Use Authorization Code Flow mechanism and write your own policy based on incoming request headers.
591-
<5> When Quarkus fires the `HttpSecurity` CDI event, the runtime configuration is ready.
592-
<6> Require that all the requests to the `/user-info` path have string permissions `openid`, `email` and `profile`.
586+
<1> Use the Basic authentication and authorize the requests with a custom `io.quarkus.vertx.http.runtime.security.HttpSecurityPolicy`.
587+
<2> Use the Bearer token authentication and authorize the `SecurityIdentity` with your own policy.
588+
<3> Use Authorization Code Flow mechanism and write your own policy based on incoming request headers.
589+
<4> When Quarkus fires the `HttpSecurity` CDI event, the runtime configuration is ready.
590+
<5> Require that all the requests to the `/user-info` path have string permissions `openid`, `email` and `profile`.
593591
The same authorization can be required with the `@PermissionsAllowed(value = { "openid", "email", "profile" }, inclusive = true)` annotation instance placed on an endpoint.
594592

593+
==== Programmatic set up references
594+
595+
* xref:security-basic-authentication.adoc#basic-auth-programmatic-set-up[Set up Basic authentication programmatically]
596+
* xref:security-openid-connect-multitenancy.adoc#programmatic-startup[Programmatic OIDC start-up for multitenant application]
597+
* xref:security-authentication-mechanisms.adoc#form-based-auth-programmatic-set-up[Set up Form-based authentication programmatically]
598+
595599
[[standard-security-annotations]]
596600
== Authorization using annotations
597601

_versions/main/guides/security-basic-authentication.adoc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,33 @@ For more information about how you can secure your Quarkus applications by using
6969
{project-name} also includes built-in security to allow for role-based access control (RBAC) based on the common security annotations `@RolesAllowed`, `@DenyAll`, `@PermitAll` on REST endpoints and CDI beans.
7070
For more information, see the Quarkus xref:security-authorize-web-endpoints-reference.adoc[Authorization of web endpoints] guide.
7171

72+
[[basic-auth-programmatic-set-up]]
73+
== Set up Basic authentication programmatically
74+
75+
The `io.quarkus.vertx.http.security.HttpSecurity` CDI event allows to configure the Basic authentication mechanism programmatically like in the example below:
76+
77+
[source,java]
78+
----
79+
package org.acme.http.security;
80+
81+
import io.quarkus.vertx.http.security.HttpSecurity;
82+
import jakarta.enterprise.event.Observes;
83+
84+
public class HttpSecurityConfiguration {
85+
86+
void configure(@Observes HttpSecurity httpSecurity) {
87+
httpSecurity.basic("QuarkusTestRealm"); <1>
88+
}
89+
90+
}
91+
----
92+
<1> Enable the Basic authentication and use the `QuarkusTestRealm` authentication realm.
93+
94+
[NOTE]
95+
====
96+
If you generate an OpenAPI schema document with the SmallRye OpenAPI extension, the Basic authentication must be enabled during the build-time with the `quarkus.http.auth.basic` configuration property.
97+
====
98+
7299
== References
73100

74101
* xref:security-overview.adoc[Quarkus Security overview]

_versions/main/guides/security-openid-connect-client-reference.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ quarkus.oidc-client.credentials.secret=secret
13051305
quarkus.oidc-client.grant.type=exchange
13061306
quarkus.oidc-client.grant-options.exchange.audience=quarkus-app-exchange
13071307
1308-
quarkus.resteasy-client-oidc-token-propagation.exchange-token=true <1>
1308+
quarkus.rest-client-oidc-token-propagation.exchange-token=true <1>
13091309
----
13101310
<1> Please note that the `exchange-token` configuration property is ignored when the OidcClient name is set with the `io.quarkus.oidc.token.propagation.common.AccessToken#exchangeTokenClient` annotation attribute.
13111311

0 commit comments

Comments
 (0)