Skip to content

Commit 70e90d3

Browse files
committed
Sync documentation of main branch
1 parent d05db3d commit 70e90d3

File tree

4 files changed

+63
-16
lines changed

4 files changed

+63
-16
lines changed

_data/versioned/main/index/quarkus.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1903,7 +1903,7 @@ types:
19031903
url: /guides/quarkus-reactive-architecture
19041904
- title: Quarkus Security with Jakarta Persistence
19051905
filename: security-jpa.adoc
1906-
summary: "Quarkus provides a Jakarta Persistence (formerly known as JPA) identity provider, similar to the JDBC identity provider, suitable for use with the Basic and Form-based Quarkus Security mechanisms, which require a combination of username and password credentials."
1906+
summary: This guide explains how your application can use Jakarta Persistence to store users identities.
19071907
categories: security
19081908
topics:
19091909
- security

_versions/main/guides/performance-measure.adoc

+22
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This guide covers:
1414
* how we measure memory usage
1515
* how we measure startup time
1616
* which additional flags will Quarkus apply to native-image by default
17+
* Coordinated omission Problem in Tools
1718
1819
All of our tests are run on the same hardware for a given batch.
1920
It goes without saying, but it's better when you say it.
@@ -237,3 +238,24 @@ circumstances one could observe non-negligible impact from the other flags too.
237238
If you're to investigate some differences in detail make sure to check what Quarkus is invoking exactly: when the build
238239
plugin is producing a native image, the full command lines are logged.
239240

241+
242+
== Coordinated Omission Problem in Tools
243+
244+
When measuring performance of a framework like Quarkus the latency experience by users are especially interesting and for that there are many different tools. Unfortunately, many fail to measure the latency correctly and instead fall short and create the Coordinate Omission problem. Meaning tools fails to acoomodate for delays to submit new requests when system is under load and aggregate these numbers making the latency and throughput numbers very misleading.
245+
246+
A good walkthrough of the issue is https://www.youtube.com/watch?v=lJ8ydIuPFeU[this video] where Gil Tene the author of wrk2 explains the issue and https://www.youtube.com/watch?v=xdG8b9iDYbE[Quarkus Insights #22] have John O'Hara from Quarkus performance team show how it can show up.
247+
248+
Although that video and related papers and articles date all back to 2015 then even today you will find tools that fall short with the coordinated oission problem
249+
250+
Tools that at current time of writing is known to excert the problem and should NOT be used for measuring latency/throughput (it may be used for other things):
251+
252+
* JMeter
253+
* wrk
254+
255+
Tools that are known to not be affected are:
256+
257+
* https://github.com/giltene/wrk2[wrk2]
258+
* https://hyperfoil.io[HyperFoil]
259+
260+
Mind you, the tools are not better than your own understanding of what they measure thus even when using `wrk2` or `hyperfoil` make sure you understand what the numbers mean.
261+

_versions/main/guides/security-architecture.adoc

+9-9
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ The primary mechanism for securing HTTP applications in Quarkus is the `HttpAuth
1515

1616
== Overview of the Quarkus Security architecture
1717

18-
When a client sends an HTTP request, Quarkus Security orchestrates security authentication and authorization by interacting with several built-in core components including `HttpAuthenticationMechanism`, `IdentityProvider`, and `SecurityIdentityAugmentor`.
18+
When a client sends an HTTP request, Quarkus Security orchestrates security authentication and authorization by interacting with several built-in core components, including `HttpAuthenticationMechanism`, `IdentityProvider`, and `SecurityIdentityAugmentor`.
1919

2020
The sequential security validation process results in one of three outcomes:
2121

22-
* The HTTP request gets authenticated and authorized and access to the Quarkus application gets granted.
23-
* The HTTP request authentication fails and the requester receives a challenge specific to the authentication mechanism, for example, a `401` error, a URL redirect to reauthenticate, or some other custom authentication challenge response.
24-
For some practical examples of challenge responses, see the Quarkus xref:security-customization.adoc[Security Tips and Tricks] guide.
25-
* The HTTP request authorization fails and the requester gets denied access to the Quarkus application.
22+
* The HTTP request gets authenticated and authorized, and access to the Quarkus application gets granted.
23+
* The HTTP request authentication fails, and the requester receives a challenge specific to the authentication mechanism, for example, a `401` error, a URL redirect to reauthenticate, or some other custom authentication challenge response.
24+
For practical examples of challenge responses, see the Quarkus xref:security-customization.adoc[Security Tips and Tricks] guide.
25+
* The HTTP request authorization fails, and the requester gets denied access to the Quarkus application.
2626

2727
The following diagram steps through the detailed process flow of the Quarkus Security architecture:
2828

@@ -35,9 +35,9 @@ image::security-architecture-overview.png[alt=Quarkus Security architecture proc
3535
Quarkus Security uses `HttpAuthenticationMechanism` to extract the authentication credentials from the HTTP request and delegates them to `IdentityProvider` to convert the credentials to `SecurityIdentity`.
3636
For example, the credentials can come from the `Authorization` header, client HTTPS certificates, or cookies.
3737

38-
When an authentication request is rejected by Quarkus Security, `HttpAuthenticationMechanism` sends an authentication challenge back to the client.
38+
When Quarkus Security rejects an authentication request, `HttpAuthenticationMechanism` returns an authentication challenge to the client.
3939
The type of challenge depends on the authentication mechanism.
40-
For example, with the OIDC OpenID Connect (OIDC) Authorization Code Flow mechanism, a redirect URL gets generated and the client is sent back to the OpenID Connect provider to authenticate.
40+
For example, with the OIDC OpenID Connect (OIDC) Authorization Code Flow mechanism, a redirect URL gets generated, and the client is returned to the OpenID Connect provider to authenticate.
4141

4242
=== `IdentityProvider`
4343
`IdentityProvider` verifies the authentication credentials and maps them to `SecurityIdentity`, which has the username, roles, original authentication credentials, and other attributes.
@@ -49,7 +49,7 @@ In other contexts, it is possible to have other parallel representations of the
4949
For more information, see the Quarkus xref:security-identity-providers.adoc[Identity providers] guide.
5050

5151
=== `SecurityIdentityAugmentor`
52-
Because Quarkus Security is customizable, for example, you can add authorization roles to `SecurityIdentity`, you can register and prioritize one or more custom security augmentors.
52+
Because Quarkus Security is customizable, you can, for example, add authorization roles to `SecurityIdentity` and register and prioritize one or more `SecurityAugmentor` implementations.
5353

5454
Registered instances of `SecurityIdentityAugmentor` are invoked during the final stage of the security authentication process.
5555
For more information, see the xref:security-customization.adoc#security-identity-customization[Security Identity Customization] section of the "Security Tips and Tricks" guide.
@@ -58,7 +58,7 @@ For more information, see the xref:security-customization.adoc#security-identity
5858
== Supported authentication mechanisms
5959

6060
The Quarkus Security framework supports multiple authentication mechanisms, which can also be combined.
61-
Some supported authentication mechanisms are built into Quarkus, while others require you to add an extension.
61+
Some supported authentication mechanisms are built into Quarkus, while others require you to add an extension.
6262

6363
To learn about security authentication in Quarkus and the supported mechanisms and protocols, see the Quarkus xref:security-authentication-mechanisms.adoc[Authentication mechanisms in Quarkus] guide.
6464

_versions/main/guides/security-jpa.adoc

+31-6
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ https://github.com/quarkusio/quarkus/tree/main/docs/src/main/asciidoc
77
= Quarkus Security with Jakarta Persistence
88
include::_attributes.adoc[]
99
:categories: security
10+
:summary: This guide explains how your application can use Jakarta Persistence to store users identities.
1011
:topics: security,identity-providers,sql,database,jpa,jdbc
1112
:extensions: io.quarkus:quarkus-security-jpa-reactive
1213

1314
Quarkus provides a Jakarta Persistence (formerly known as JPA) identity provider, similar to the xref:security-jdbc.adoc[JDBC identity provider], suitable for use with the xref:security-basic-authentication.adoc[Basic] and xref:security-authentication-mechanisms.adoc#form-auth[Form-based] Quarkus Security mechanisms, which require a combination of username and password credentials.
1415

1516
The Jakarta Persistence `IdentityProvider` creates a `SecurityIdentity` instance, which is used during user authentication to verify and authorize access requests making your Quarkus application secure.
1617

17-
For an example of practical use of Basic authentication and Jakarta Persistence, see the xref:security-basic-authentication-tutorial.adoc[Secure a Quarkus application with Basic authentication and Jakarta Persistence] tutorial.
18+
For an example of practical use of Basic authentication and Jakarta Persistence, see the xref:security-getting-started-tutorial.adoc[Getting Started with Security using Basic authentication and Jakarta Persistence] tutorial.
1819

1920

2021
== Jakarta Persistence entity specification
@@ -111,19 +112,24 @@ public class User extends PanacheEntity {
111112
public class Role extends PanacheEntity {
112113
113114
@ManyToMany(mappedBy = "roles")
114-
public List<ExternalRolesUserEntity> users;
115+
public List<User> users;
115116
116117
@RolesValue
117118
public String role;
118119
}
119120
----
120121

122+
[NOTE]
123+
====
124+
The example shows how to store and access the roles, but if there's a need to update the existing user or create a new user. There will be a need to annotate `public List<Role> roles` with `@Cascade(CascadeType.ALL)` or select the specific type of `CascadeType`.
125+
====
126+
121127
== Password storage and hashing
122128

123129
When developing applications with Quarkus, you can decide how to manage password storage and hashing. You can choose to keep the default password and hashing settings of Quarkus, or you can hash passwords manually.
124130

125131
With the default option, passwords are stored and hashed with https://en.wikipedia.org/wiki/Bcrypt[bcrypt] under the
126-
https://en.wikipedia.org/wiki/Crypt_(C)[Modular Crypt Format] (MCF).
132+
https://en.wikipedia.org/wiki/Crypt_\(C)[Modular Crypt Format] (MCF).
127133
While using MCF, the hashing algorithm, iteration count, and salt are stored as a part of the hashed value.
128134
As such, we do not need dedicated columns to keep them.
129135

@@ -132,14 +138,23 @@ As such, we do not need dedicated columns to keep them.
132138
In cryptography, a salt is a name for random data used as an additional input to a one-way function that hashes data, a password, or a passphrase.
133139
====
134140

135-
To represent passwords stored in the database which were hashed using different hashing algorithms, create a class that implements `org.wildfly.security.password.PasswordProvider` as shown in the example below.
141+
To represent passwords stored in the database which were hashed using different hashing algorithms, create a class that implements `io.quarkus.security.jpa.PasswordProvider` as shown in the example below.
136142

137143
The following snippet shows how to set a custom password provider that represents a password which was hashed with the SHA256 hashing algorithm.
138144

139145
[source,java]
140146
----
141-
import org.wildfly.security.password.Password;
142-
import org.wildfly.security.password.PasswordProvider;
147+
import jakarta.persistence.Column;
148+
import jakarta.persistence.Entity;
149+
import jakarta.persistence.GeneratedValue;
150+
import jakarta.persistence.Id;
151+
import jakarta.persistence.Table;
152+
153+
import io.quarkus.security.jpa.Password;
154+
import io.quarkus.security.jpa.PasswordType;
155+
import io.quarkus.security.jpa.Roles;
156+
import io.quarkus.security.jpa.UserDefinition;
157+
import io.quarkus.security.jpa.Username;
143158
144159
@UserDefinition
145160
@Table(name = "test_user")
@@ -160,6 +175,16 @@ public class CustomPasswordUserEntity {
160175
@Roles
161176
public String role;
162177
}
178+
----
179+
180+
[source,java]
181+
----
182+
import jakarta.xml.bind.DatatypeConverter;
183+
184+
import org.wildfly.security.password.Password;
185+
import org.wildfly.security.password.interfaces.SimpleDigestPassword;
186+
187+
import io.quarkus.security.jpa.PasswordProvider;
163188
164189
public class CustomPasswordProvider implements PasswordProvider {
165190
@Override

0 commit comments

Comments
 (0)