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: docs/src/main/asciidoc/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>>:
0 commit comments