private EJBMethodSecurityAttribute mergeExistingRoles(EJBMethodSecurityAttribute ejbMethodSecurityMetaData, final EJBMethodSecurityAttribute existingRoles) { if (existingRoles != null && !existingRoles.getRolesAllowed().isEmpty()) { final Set<String> roles = new HashSet<String>(existingRoles.getRolesAllowed()); roles.addAll(ejbMethodSecurityMetaData.getRolesAllowed()); ejbMethodSecurityMetaData = EJBMethodSecurityAttribute.rolesAllowed(roles); } return ejbMethodSecurityMetaData; } }
@Override protected void handleAnnotations(final DeploymentUnit deploymentUnit, final EEApplicationClasses applicationClasses, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final EJBComponentDescription description) throws DeploymentUnitProcessingException { final RuntimeAnnotationInformation<Boolean> permitData = MethodAnnotationAggregator.runtimeAnnotationInformation(componentClass, applicationClasses, deploymentReflectionIndex, PermitAll.class); for (Map.Entry<String, List<Boolean>> entry : permitData.getClassAnnotations().entrySet()) { description.getAnnotationMethodPermissions().setAttribute(null, entry.getKey(), EJBMethodSecurityAttribute.permitAll()); } for (Map.Entry<Method, List<Boolean>> entry : permitData.getMethodAnnotations().entrySet()) { final Method method = entry.getKey(); description.getAnnotationMethodPermissions().setAttribute(null, EJBMethodSecurityAttribute.permitAll(), method.getDeclaringClass().getName(), method.getName(), MethodInfoHelper.getCanonicalParameterTypes(method)); } final RuntimeAnnotationInformation<String[]> data = MethodAnnotationAggregator.runtimeAnnotationInformation(componentClass, applicationClasses, deploymentReflectionIndex, RolesAllowed.class); for (Map.Entry<String, List<String[]>> entry : data.getClassAnnotations().entrySet()) { description.getAnnotationMethodPermissions().setAttribute(null, entry.getKey(), EJBMethodSecurityAttribute.rolesAllowed(new HashSet<String>(Arrays.<String>asList(entry.getValue().get(0))))); } for (Map.Entry<Method, List<String[]>> entry : data.getMethodAnnotations().entrySet()) { final Method method = entry.getKey(); description.getAnnotationMethodPermissions().setAttribute(null, EJBMethodSecurityAttribute.rolesAllowed(new HashSet<String>(Arrays.<String>asList(entry.getValue().get(0)))), method.getDeclaringClass().getName(), method.getName(), MethodInfoHelper.getCanonicalParameterTypes(method)); } final RuntimeAnnotationInformation<Boolean> denyData = MethodAnnotationAggregator.runtimeAnnotationInformation(componentClass, applicationClasses, deploymentReflectionIndex, DenyAll.class); for (Map.Entry<String, List<Boolean>> entry : denyData.getClassAnnotations().entrySet()) { description.getAnnotationMethodPermissions().setAttribute(null, entry.getKey(), EJBMethodSecurityAttribute.denyAll()); } for (Map.Entry<Method, List<Boolean>> entry : denyData.getMethodAnnotations().entrySet()) { final Method method = entry.getKey(); description.getAnnotationMethodPermissions().setAttribute(null, EJBMethodSecurityAttribute.denyAll(), method.getDeclaringClass().getName(), method.getName(), MethodInfoHelper.getCanonicalParameterTypes(method)); } }
rolesAllowed.addAll(attr.getRolesAllowed()); ejbMethodSecurityMetaData = EJBMethodSecurityAttribute.rolesAllowed(rolesAllowed);
ejbMethodSecurityMetaData = EJBMethodSecurityAttribute.permitAll(); } else { ejbMethodSecurityMetaData = EJBMethodSecurityAttribute.rolesAllowed(methodPermissionMetaData.getRoles());
private EJBMethodSecurityAttribute mergeExistingRoles(EJBMethodSecurityAttribute ejbMethodSecurityMetaData, final EJBMethodSecurityAttribute existingRoles) { if (existingRoles != null && !existingRoles.getRolesAllowed().isEmpty()) { final Set<String> roles = new HashSet<String>(existingRoles.getRolesAllowed()); roles.addAll(ejbMethodSecurityMetaData.getRolesAllowed()); ejbMethodSecurityMetaData = EJBMethodSecurityAttribute.rolesAllowed(roles); } return ejbMethodSecurityMetaData; } }
@Override protected void handleAnnotations(final DeploymentUnit deploymentUnit, final EEApplicationClasses applicationClasses, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final EJBComponentDescription description) throws DeploymentUnitProcessingException { final RuntimeAnnotationInformation<Boolean> permitData = MethodAnnotationAggregator.runtimeAnnotationInformation(componentClass, applicationClasses, deploymentReflectionIndex, PermitAll.class); for (Map.Entry<String, List<Boolean>> entry : permitData.getClassAnnotations().entrySet()) { description.getAnnotationMethodPermissions().setAttribute(null, entry.getKey(), EJBMethodSecurityAttribute.permitAll()); } for (Map.Entry<Method, List<Boolean>> entry : permitData.getMethodAnnotations().entrySet()) { final Method method = entry.getKey(); final MethodIdentifier identifier = MethodIdentifier.getIdentifierForMethod(method); description.getAnnotationMethodPermissions().setAttribute(null, EJBMethodSecurityAttribute.permitAll(), method.getDeclaringClass().getName(), method.getName(), identifier.getParameterTypes()); } final RuntimeAnnotationInformation<String[]> data = MethodAnnotationAggregator.runtimeAnnotationInformation(componentClass, applicationClasses, deploymentReflectionIndex, RolesAllowed.class); for (Map.Entry<String, List<String[]>> entry : data.getClassAnnotations().entrySet()) { description.getAnnotationMethodPermissions().setAttribute(null, entry.getKey(), EJBMethodSecurityAttribute.rolesAllowed(new HashSet<String>(Arrays.<String>asList(entry.getValue().get(0))))); } for (Map.Entry<Method, List<String[]>> entry : data.getMethodAnnotations().entrySet()) { final Method method = entry.getKey(); final MethodIdentifier identifier = MethodIdentifier.getIdentifierForMethod(method); description.getAnnotationMethodPermissions().setAttribute(null, EJBMethodSecurityAttribute.rolesAllowed(new HashSet<String>(Arrays.<String>asList(entry.getValue().get(0)))), method.getDeclaringClass().getName(), method.getName(), identifier.getParameterTypes()); } final RuntimeAnnotationInformation<Boolean> denyData = MethodAnnotationAggregator.runtimeAnnotationInformation(componentClass, applicationClasses, deploymentReflectionIndex, DenyAll.class); for (Map.Entry<String, List<Boolean>> entry : denyData.getClassAnnotations().entrySet()) { description.getAnnotationMethodPermissions().setAttribute(null, entry.getKey(), EJBMethodSecurityAttribute.denyAll()); } for (Map.Entry<Method, List<Boolean>> entry : denyData.getMethodAnnotations().entrySet()) { final Method method = entry.getKey(); final MethodIdentifier identifier = MethodIdentifier.getIdentifierForMethod(method); description.getAnnotationMethodPermissions().setAttribute(null, EJBMethodSecurityAttribute.denyAll(), method.getDeclaringClass().getName(), method.getName(), identifier.getParameterTypes()); } }
rolesAllowed.addAll(attr.getRolesAllowed()); ejbMethodSecurityMetaData = EJBMethodSecurityAttribute.rolesAllowed(rolesAllowed);
ejbMethodSecurityMetaData = EJBMethodSecurityAttribute.permitAll(); } else { ejbMethodSecurityMetaData = EJBMethodSecurityAttribute.rolesAllowed(methodPermissionMetaData.getRoles());