Package io.quarkus.test.security
Annotation Interface TestSecurity
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionAdds attributes to aSecurityIdentityconfigured by this annotation.Class<? extends io.quarkus.security.identity.SecurityIdentityAugmentor>[]SpecifySecurityIdentityAugmentorCDI beans that should augmentSecurityIdentitycreated with this annotation.Selects authentication mechanism used in a path-based authentication.booleanIf 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:detailgives permission toseeactiondetail. All permissions are added asStringPermission.PermissionCheckermethods 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>[] augmentorsSpecifySecurityIdentityAugmentorCDI beans that should augmentSecurityIdentitycreated 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 aSecurityIdentityconfigured 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 aSecurityIdentitywill 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 theBasicAuthenticationshould be successfully authenticated.- Default:
- ""
-