}
}
if (componentConfiguration.getRunAs() != null) {
String principal = null;
String globalRunAsPrincipal = null;
EjbJarMetaData jbossMetaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
if (jbossMetaData != null) {
List<EJBBoundSecurityMetaData> securityMetaDatas = jbossMetaData.getAssemblyDescriptor().getAny(EJBBoundSecurityMetaData.class);
if (securityMetaDatas != null) {
for (EJBBoundSecurityMetaData securityMetaData : securityMetaDatas) {
if (securityMetaData.getEjbName().equals(componentConfiguration.getComponentName())) {
principal = securityMetaData.getRunAsPrincipal();
break;
}
// check global run-as principal
if (securityMetaData.getEjbName().equals("*")) {
globalRunAsPrincipal = securityMetaData.getRunAsPrincipal();
continue;
}
}
}
// get extra roles from role-mapping
List<SecurityRoleMetaData> list = jbossMetaData.getAssemblyDescriptor().getAny(SecurityRoleMetaData.class);
SecurityRolesMetaData securityRoles = new SecurityRolesMetaData();
if (list != null) {
for (SecurityRoleMetaData securityRoleMetaData : list) {
securityRoles.add(securityRoleMetaData);
}