You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _data/versioned/main/index/quarkus.yaml
+1-1
Original file line number
Diff line number
Diff line change
@@ -1903,7 +1903,7 @@ types:
1903
1903
url: /guides/quarkus-reactive-architecture
1904
1904
- title: Quarkus Security with Jakarta Persistence
1905
1905
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.
Copy file name to clipboardExpand all lines: _versions/main/guides/performance-measure.adoc
+22
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ This guide covers:
14
14
* how we measure memory usage
15
15
* how we measure startup time
16
16
* which additional flags will Quarkus apply to native-image by default
17
+
* Coordinated omission Problem in Tools
17
18
18
19
All of our tests are run on the same hardware for a given batch.
19
20
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.
237
238
If you're to investigate some differences in detail make sure to check what Quarkus is invoking exactly: when the build
238
239
plugin is producing a native image, the full command lines are logged.
239
240
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.
Copy file name to clipboardExpand all lines: _versions/main/guides/security-architecture.adoc
+9-9
Original file line number
Diff line number
Diff line change
@@ -15,14 +15,14 @@ The primary mechanism for securing HTTP applications in Quarkus is the `HttpAuth
15
15
16
16
== Overview of the Quarkus Security architecture
17
17
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`.
19
19
20
20
The sequential security validation process results in one of three outcomes:
21
21
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.
26
26
27
27
The following diagram steps through the detailed process flow of the Quarkus Security architecture:
Quarkus Security uses `HttpAuthenticationMechanism` to extract the authentication credentials from the HTTP request and delegates them to `IdentityProvider` to convert the credentials to `SecurityIdentity`.
36
36
For example, the credentials can come from the `Authorization` header, client HTTPS certificates, or cookies.
37
37
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.
39
39
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.
41
41
42
42
=== `IdentityProvider`
43
43
`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
49
49
For more information, see the Quarkus xref:security-identity-providers.adoc[Identity providers] guide.
50
50
51
51
=== `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.
53
53
54
54
Registered instances of `SecurityIdentityAugmentor` are invoked during the final stage of the security authentication process.
55
55
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
58
58
== Supported authentication mechanisms
59
59
60
60
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.
62
62
63
63
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.
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.
14
15
15
16
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.
16
17
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.
18
19
19
20
20
21
== Jakarta Persistence entity specification
@@ -111,19 +112,24 @@ public class User extends PanacheEntity {
111
112
public class Role extends PanacheEntity {
112
113
113
114
@ManyToMany(mappedBy = "roles")
114
-
public List<ExternalRolesUserEntity> users;
115
+
public List<User> users;
115
116
116
117
@RolesValue
117
118
public String role;
118
119
}
119
120
----
120
121
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
+
121
127
== Password storage and hashing
122
128
123
129
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.
124
130
125
131
With the default option, passwords are stored and hashed with https://en.wikipedia.org/wiki/Bcrypt[bcrypt] under the
While using MCF, the hashing algorithm, iteration count, and salt are stored as a part of the hashed value.
128
134
As such, we do not need dedicated columns to keep them.
129
135
@@ -132,14 +138,23 @@ As such, we do not need dedicated columns to keep them.
132
138
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.
133
139
====
134
140
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.
136
142
137
143
The following snippet shows how to set a custom password provider that represents a password which was hashed with the SHA256 hashing algorithm.
0 commit comments