@Override protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final EJBComponentDescription description) throws DeploymentUnitProcessingException { if (description.getDescriptorData() == null) { return; } final SecurityRoleRefsMetaData roleRefs = description.getDescriptorData().getSecurityRoleRefs(); if (roleRefs != null) { for(SecurityRoleRefMetaData ref : roleRefs) { description.addDeclaredRoles(ref.getRoleName()); } } } }
@Override protected void processBeanMetaData(final EnterpriseBeanMetaData beanMetaData, final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final SecurityRoleRefsMetaData securityRoleRefs = beanMetaData.getSecurityRoleRefs(); if (securityRoleRefs == null) { return; } final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); final EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) moduleDescription.getComponentByName(beanMetaData.getEjbName()); for (final SecurityRoleRefMetaData securityRoleRef : securityRoleRefs) { final String fromRole = securityRoleRef.getRoleName(); String toRole = securityRoleRef.getRoleLink(); if (fromRole == null || fromRole.trim().isEmpty()) { throw EjbLogger.ROOT_LOGGER.roleNamesIsNull(ejbComponentDescription.getEJBName()); } // if role-link hasn't been specified, then it links to the same role name as the one specified // in the role-name if (toRole == null) { toRole = fromRole; } ejbComponentDescription.linkSecurityRoles(fromRole, toRole); } } }
@Override protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final EJBComponentDescription description) throws DeploymentUnitProcessingException { if (description.getDescriptorData() == null) { return; } final SecurityRoleRefsMetaData roleRefs = description.getDescriptorData().getSecurityRoleRefs(); if (roleRefs != null) { for(SecurityRoleRefMetaData ref : roleRefs) { description.addDeclaredRoles(ref.getRoleName()); } } } }
@Override protected void processBeanMetaData(final EnterpriseBeanMetaData beanMetaData, final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final SecurityRoleRefsMetaData securityRoleRefs = beanMetaData.getSecurityRoleRefs(); if (securityRoleRefs == null) { return; } final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final EEModuleDescription moduleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); final EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) moduleDescription.getComponentByName(beanMetaData.getEjbName()); for (final SecurityRoleRefMetaData securityRoleRef : securityRoleRefs) { final String fromRole = securityRoleRef.getRoleName(); String toRole = securityRoleRef.getRoleLink(); if (fromRole == null || fromRole.trim().isEmpty()) { throw MESSAGES.roleNamesIsNull(ejbComponentDescription.getEJBName()); } // if role-link hasn't been specified, then it links to the same role name as the one specified // in the role-name if (toRole == null) { toRole = fromRole; } ejbComponentDescription.linkSecurityRoles(fromRole, toRole); } } }