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
Allows to create additional security checks for standard security annotations defined on a class level. We strongly recommended to secure CDI beans with `AdditionalSecuredMethodsBuildItem` if additional security is required. If you decide to use this build item, you must use class security check storage and apply checks manually. Thus, it's only suitable for very special cases.
7895
+
Allows to create additional security checks for standard security annotations defined on a class level and security interceptors for security annotations (such as selecting tenant or authentication mechanism). We strongly recommended to secure CDI beans with `AdditionalSecuredMethodsBuildItem` if additional security is required. If you decide to use this build item, you must use class security check storage and apply checks manually. Thus, it's only suitable for very special cases and intended for internal use in Quarkus core extensions.
Security check storage containing additional security checks created for secured classes matching one of the `ClassSecurityCheckAnnotationBuildItem` filters during the static init.
7906
+
Security check storage containing additional security checks created for secured classes matching one of the `ClassSecurityAnnotationBuildItem` filters during the static init.
Registers security check against `io.quarkus.security.spi.ClassSecurityCheckStorageBuildItem` for security annotation instances passed in this build item. This class is exposed for limited Quarkus core-specific use cases and can be changed or be removed if necessary. If other extensions require this build item, please open Quarkus issue so that we document and test the use case.
Bears collected intercepted classes annotated with registered security annotation if and only if class-level security is applied due to the matching `io.quarkus.security.spi.ClassSecurityAnnotationBuildItem` annotation. Security interceptor needs to be created and applied for each intercepted class.
8760
+
@see EagerSecurityInterceptorBindingBuildItem for more information on security filters
Ensure that the value of the `auth-mechanism` property matches the authentication scheme supported by `HttpAuthenticationMechanism`, for example, `basic`, `bearer`, or `form`.
688
688
689
+
[[use-annotations-for-path-based-auth]]
689
690
==== Use annotations to enable path-based authentication for Jakarta REST endpoints
690
691
691
692
It is possible to use annotations to select an authentication mechanism specific to each Jakarta REST endpoint.
<1> Tell Quarkus to run the HTTP permission check after the tenant has been selected with the `@Tenant` annotation.
665
665
====
666
666
667
+
[NOTE]
668
+
====
669
+
The `io.quarkus.oidc.Tenant` annotation can be used to select tenant for a WebSockets Next server endpoint.
670
+
The annotation must be placed on the endpoint class, because the `SecurityIdentity` is created before the HTTP connection is upgraded to a WebSocket connection.
671
+
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.
Security annotations used during authentication must be placed on an endpoint class as well, for the `SecurityIdentity` is created before the websocket connection is opened.
850
+
851
+
.Select Bearer token authentication mechanism
852
+
[source, java]
853
+
----
854
+
package io.quarkus.websockets.next.test.security;
855
+
856
+
import io.quarkus.oidc.BearerTokenAuthentication;
857
+
import io.quarkus.websockets.next.OnTextMessage;
858
+
import io.quarkus.websockets.next.WebSocket;
859
+
860
+
@BearerTokenAuthentication <1>
861
+
@WebSocket(path = "/end")
862
+
public class Endpoint {
863
+
864
+
@OnTextMessage
865
+
String echo(String message) {
866
+
return message;
867
+
}
868
+
869
+
}
870
+
----
871
+
<1> Require that an opening WebSocket handshake request is authenticated using the bearer token authentication.
872
+
See the xref:security-authentication-mechanisms.adoc#use-annotations-for-path-based-auth[Authentication mechanisms in Quarkus] guide for more information about selecting authentication mechanisms with annotations.
873
+
874
+
[source,properties]
875
+
----
876
+
quarkus.http.auth.proactive=false <1>
877
+
----
878
+
<1> Start authenticating an opening WebSocket handshake request only when the `io.quarkus.oidc.BearerTokenAuthentication` annotation is detected.
879
+
849
880
[[secure-callback-methods]]
850
881
==== Secure WebSocket endpoint callback methods
851
882
@@ -937,7 +968,7 @@ public class PermissionChecker {
937
968
938
969
@PermissionChecker("product:premium")
939
970
public boolean canGetPremiumProduct(SecurityIdentity securityIdentity) { <1>
0 commit comments