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: _generated-doc/main/infra/quarkus-all-build-items.adoc
+4
Original file line number
Diff line number
Diff line change
@@ -8843,6 +8843,10 @@ _No Javadoc found_
8843
8843
8844
8844
If this interceptor is always accompanied by `io.quarkus.security.spi.runtime.SecurityCheck` . For example, we know that endpoint annotated with `HttpAuthenticationMechanism` is always secured.
TIP: It is possible to read annotations from the test class or method to control what the callback shall be doing.
459
459
460
-
WARNING: While it is possible to use JUnit Jupiter callback interfaces like `BeforeEachCallback`, you might run into classloading issues because Quarkus has
461
-
to run tests in a custom classloader which JUnit is not aware of.
462
-
463
460
[[testing_different_profiles]]
464
461
== Testing Different Profiles
465
462
@@ -705,6 +702,11 @@ match the value of `quarkus.test.profile.tags`.
705
702
* `quarkus.test.profile.tags=test2,test3`: In this case only `MultipleTagsTest` will be run because `MultipleTagsTest` is the only `QuarkusTestProfile` implementation whose `tags` method
706
703
matches the value of `quarkus.test.profile.tags`.
707
704
705
+
== Nested Tests
706
+
707
+
JUnit 5 https://junit.org/junit5/docs/current/user-guide/#writing-tests-nested[@Nested tests] are useful for structuring more complex test scenarios.
708
+
However, note that it is not possible to assign different test profiles or resources to nested tests within the same parent class.
709
+
708
710
== Mock Support
709
711
710
712
Quarkus supports the use of mock objects using two different approaches. You can either use CDI alternatives to
Copy file name to clipboardExpand all lines: _versions/main/guides/security-oidc-bearer-token-authentication.adoc
+107
Original file line number
Diff line number
Diff line change
@@ -1604,6 +1604,113 @@ public class OidcStartup {
1604
1604
For more complex setup involving multiple tenants please see the xref:security-openid-connect-multitenancy.adoc#programmatic-startup[Programmatic OIDC start-up for multitenant application]
1605
1605
section of the OpenID Connect Multi-Tenancy guide.
1606
1606
1607
+
== Step Up Authentication
1608
+
1609
+
The `io.quarkus.oidc.AuthenticationContext` annotation can be used to list one or more Authentication Context Class Reference (ACR) values to enforce a required authentication level for the Jakarta REST resource classes and methods.
1610
+
The https://datatracker.ietf.org/doc/rfc9470/[OAuth 2.0 Step Up Authentication Challenge Protocol] introduces a mechanism for resource servers to request stronger authentication methods when the token does not have expected Authentication Context Class Reference (ACR) values.
<1> Bearer access token must have an `acr` claim with the `myACR` ACR value.
1642
+
<2> Bearer access token must have an `acr` claim with the `myACR` ACR value and be in use for no longer than 120 minutes since the authentication time.
1643
+
1644
+
[source,properties]
1645
+
----
1646
+
quarkus.http.auth.proactive=false <1>
1647
+
----
1648
+
<1> Disable proactive authentication so that the `@AuthenticationContext` annotation can be matched with the endpoint before Quarkus authenticates incoming requests.
1649
+
1650
+
If the bearer access token claim `acr` does not contain `myACR`, Quarkus returns an authentication requirements challenge indicating required `acr_values`:
error_description="A different authentication level is required",
1656
+
acr_values="myACR"
1657
+
----
1658
+
1659
+
When a client such as Single-page application (SPA) receives a challenge with the `insufficient_user_authentication` error code, it must parse `acr_values`, request a new user login which must meet the `acr_values` constraints, and use a new access token to access Quarkus.
1660
+
1661
+
[NOTE]
1662
+
====
1663
+
The `io.quarkus.oidc.AuthenticationContext` annotation can also be used to enforce required authentication level for a WebSockets Next server endpoint.
1664
+
The annotation must be placed on the endpoint class, because the `SecurityIdentity` is created before the HTTP connection is upgraded to a WebSocket connection.
1665
+
For more information about the HTTP upgrade security, see the xref:websockets-next-reference.adoc#secure-http-upgrade[Secure HTTP upgrade] section of the Quarkus "WebSockets Next reference" guide.
1666
+
====
1667
+
1668
+
It is also possible to enforce the required authentication level for an OIDC tenant:
1669
+
1670
+
[source,properties]
1671
+
----
1672
+
quarkus.oidc.hr.token.required-claims.acr=myACR
1673
+
----
1674
+
1675
+
Or, if you need more flexibility, write a <<jose4j-validator>>:
The link:https://smallrye.io/docs/smallrye-fault-tolerance/6.9.0/reference/programmatic-api.html[programmatic API] is present and integrated with the declarative, annotation-based API.
611
+
The link:https://smallrye.io/docs/smallrye-fault-tolerance/6.9.1/reference/programmatic-api.html[programmatic API] is present and integrated with the declarative, annotation-based API.
612
612
You can use the `Guard`, `TypedGuard` and `@ApplyGuard` APIs out of the box.
613
613
614
614
Support for Kotlin is present (assuming you use the Quarkus extension for Kotlin), so you can guard your `suspend` functions with fault tolerance annotations.
0 commit comments