Package io.quarkus.test.security
Annotation Interface TestSecurity
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionAdds attributes to aSecurityIdentity
configured by this annotation.Class<? extends io.quarkus.security.identity.SecurityIdentityAugmentor>[]
SpecifySecurityIdentityAugmentor
CDI beans that should augmentSecurityIdentity
created with this annotation.Selects authentication mechanism used in a path-based authentication.boolean
If this is false then all security constraints are disabled.String[]
Used in combination withuser()
to specify permissions possessed by theSecurityIdentity
.String[]
Used in combination withuser()
to specify the users roles.If this is non-zero then the test will be run with a SecurityIdentity with the specified username.
-
Element Details
-
authorizationEnabled
boolean authorizationEnabledIf this is false then all security constraints are disabled.- Default:
true
-
user
String userIf this is non-zero then the test will be run with a SecurityIdentity with the specified username.- Default:
""
-
roles
String[] rolesUsed in combination withuser()
to specify the users roles.- Default:
{}
-
permissions
String[] permissionsUsed in combination withuser()
to specify permissions possessed by theSecurityIdentity
. Accepted format corresponds to thePermissionsAllowed.value()
annotation attribute. That is, permission is separated from actions withPermissionsAllowed.PERMISSION_TO_ACTION_SEPARATOR
. For example, valuesee:detail
gives permission tosee
actiondetail
. All permissions are added asStringPermission
.PermissionChecker
methods always authorize matchedPermissionsAllowed.value()
permissions. This annotation attribute cannot grant access to permissions granted by the checker methods.- Default:
{}
-
augmentors
Class<? extends io.quarkus.security.identity.SecurityIdentityAugmentor>[] augmentorsSpecifySecurityIdentityAugmentor
CDI beans that should augmentSecurityIdentity
created with this annotation. By default, no identity augmentors are applied. Use this option if you need to test customPermissionsAllowed.permission()
added with the identity augmentors.- Default:
{}
-
attributes
SecurityAttribute[] attributesAdds attributes to aSecurityIdentity
configured by this annotation. The attributes can be retrieved by theSecurityIdentity.getAttributes()
method.- Default:
{}
-
authMechanism
String authMechanismSelects authentication mechanism used in a path-based authentication. If an HTTP Security Policy is used to enable path-based authentication, then aSecurityIdentity
will only be provided by this annotation if this attribute matches the 'quarkus.http.auth.permission."permissions".auth-mechanism' configuration property. Situation is similar when annotations are used to enable path-based authentication for Jakarta REST endpoints. For example, set this attribute to 'basic' if an HTTP request to Jakarta REST endpoint annotated with theBasicAuthentication
should be successfully authenticated.- Default:
""
-