@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); } } }
if (ref.getRoleLink().equals(role)) roleName = ref.getName(); break;
if (getSecurityRoleRefs().containsKey(securityRoleRef.getKey())) SecurityRoleRefMetaData check = getSecurityRoleRefs().get(securityRoleRef.getKey()); if (!resolveConflicts && check.getRoleLink() != null && !check.getRoleLink().equals(securityRoleRef.getRoleLink())) || !webMetaData.getSecurityRoleRefs().containsKey(securityRoleRef.getKey())) throw new IllegalStateException("Unresolved conflict on role ref: " + securityRoleRef.getKey());
@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()); } } } }
/** * Get the link * * @return the link */ public String getLink() { return getDelegate().getRoleLink(); }
/** * Get the roleNames. * * @return the roleNames. */ public String getRoleName() { return getName(); }
public SecurityRoleRefMetaData merge(SecurityRoleRefMetaData original) { SecurityRoleRefMetaData merged = new SecurityRoleRefMetaData(); merged.merge(this, original); return merged; } public void merge(SecurityRoleRefMetaData override, SecurityRoleRefMetaData original)
/** * Get the description * * @return the description */ public String getDescription() { DescriptionsImpl descriptions = (DescriptionsImpl) getDelegate().getDescriptions(); if (descriptions == null || descriptions.isEmpty()) return null; return descriptions.iterator().next().getDescription(); } /*
for(SecurityRoleRefMetaData roleRef : roleRefs) String roleName = roleRef.getRoleLink(); WebRoleRefPermission wrrp = new WebRoleRefPermission(servletName, roleRef.getName()); pc.addToRole(roleName, wrrp); pc.addToRole(roleRef.getName(), wrrp);
} else if (webFragmentMetaData.getSecurityRoleRefs() != null) { for (SecurityRoleRefMetaData securityRoleRef : webFragmentMetaData.getSecurityRoleRefs()) { if (dest.getSecurityRoleRefs().containsKey(securityRoleRef.getKey())) { SecurityRoleRefMetaData check = dest.getSecurityRoleRefs().get(securityRoleRef.getKey()); if (!resolveConflicts && check.getRoleLink() != null && !check.getRoleLink().equals(securityRoleRef.getRoleLink())) { if (webMetaData == null || webMetaData.getSecurityRoleRefs() == null || !webMetaData.getSecurityRoleRefs().containsKey(securityRoleRef.getKey())) { throw new IllegalStateException("Unresolved conflict on role ref: " + securityRoleRef.getKey());
/** * Get the name * * @return the name */ public String getName() { return getDelegate().getRoleName(); }
/** * Get the link * * @return the link */ public String getLink() { return getDelegate().getRoleLink(); }
/** * Get the roleNames. * * @return the roleNames. */ public String getRoleName() { return getName(); }
public SecurityRoleRefMetaData merge(SecurityRoleRefMetaData original) { SecurityRoleRefMetaData merged = new SecurityRoleRefMetaData(); merged.merge(this, original); return merged; } public void merge(SecurityRoleRefMetaData override, SecurityRoleRefMetaData original)
/** * Get the description * * @return the description */ public String getDescription() { DescriptionsImpl descriptions = (DescriptionsImpl) getDelegate().getDescriptions(); if (descriptions == null || descriptions.isEmpty()) return null; return descriptions.iterator().next().getDescription(); } /*
String roleRef = roleRefMetaData.getRoleLink(); String roleName = roleRefMetaData.getRoleName(); WebRoleRefPermission wrrp = new WebRoleRefPermission(servletName, roleName); pc.addToRole(roleRef, wrrp);
/** * Get the name * * @return the name */ public String getName() { return getDelegate().getRoleName(); }
s.addSecurityRoleRef(ref.getRoleName(), ref.getRoleLink());
@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); } } }