private void createSecurityRoles(final Deployment dep, final JBossWebMetaData jbossWebMD) {
        final String authMethod = getAuthMethod(dep);
        final boolean hasAuthMethod = authMethod != null;

        if (hasAuthMethod) {
            final SecurityRolesMetaData securityRolesMD = ejb3SecurityAccessor.getSecurityRoles(dep);
            final boolean hasSecurityRolesMD = securityRolesMD != null && !securityRolesMD.isEmpty();

            if (hasSecurityRolesMD) {
                 WSLogger.ROOT_LOGGER.trace("Setting security roles");
                jbossWebMD.setSecurityRoles(securityRolesMD);
            }
        }

        //merge security roles from the ear
        //TODO: is there somewhere better to put this?
        final DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
        DeploymentUnit parent = unit.getParent();
        if (parent != null) {
            final EarMetaData earMetaData = parent.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
            if (earMetaData != null) {
                if (jbossWebMD.getSecurityRoles() == null) {
                    jbossWebMD.setSecurityRoles(new SecurityRolesMetaData());
                }

                SecurityRolesMetaData earSecurityRolesMetaData = earMetaData.getSecurityRoles();
                if (earSecurityRolesMetaData != null) {
                    SecurityRolesMetaDataMerger.merge(jbossWebMD.getSecurityRoles(), jbossWebMD.getSecurityRoles(), earSecurityRolesMetaData);
                }
            }
        }
    }
private void createSecurityRoles(final Deployment dep, final JBossWebMetaData jbossWebMD) {
        final String authMethod = getAuthMethod(dep);
        final boolean hasAuthMethod = authMethod != null;

        if (hasAuthMethod) {
            final SecurityRolesMetaData securityRolesMD = ejb3SecurityAccessor.getSecurityRoles(dep);
            final boolean hasSecurityRolesMD = securityRolesMD != null && !securityRolesMD.isEmpty();

            if (hasSecurityRolesMD) {
                 WSLogger.ROOT_LOGGER.trace("Setting security roles");
                jbossWebMD.setSecurityRoles(securityRolesMD);
            }
        }

        
        
        final DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
        DeploymentUnit parent = unit.getParent();
        if (parent != null) {
            final EarMetaData earMetaData = parent.getAttachment(org.jboss.as.ee.structure.Attachments.EAR_METADATA);
            if (earMetaData != null) {
                if (jbossWebMD.getSecurityRoles() == null) {
                    jbossWebMD.setSecurityRoles(new SecurityRolesMetaData());
                }

                SecurityRolesMetaData earSecurityRolesMetaData = earMetaData.getSecurityRoles();
                if (earSecurityRolesMetaData != null) {
                    SecurityRolesMetaDataMerger.merge(jbossWebMD.getSecurityRoles(), jbossWebMD.getSecurityRoles(), earSecurityRolesMetaData);
                }
            }
        }
    }
private void createSecurityRoles ( final Deployment dep , final JBossWebMetaData jbossWebMD ) { final String authMethod = getAuthMethod ( dep ) ; final boolean hasAuthMethod = authMethod != null ; if ( hasAuthMethod ) { final SecurityRolesMetaData securityRolesMD = ejb3SecurityAccessor . getSecurityRoles ( dep ) ; final boolean hasSecurityRolesMD = securityRolesMD != null && ! securityRolesMD . isEmpty ( ) ; if ( hasSecurityRolesMD ) { WSLogger . ROOT_LOGGER . trace ( "Setting security roles" ) ; jbossWebMD . setSecurityRoles ( securityRolesMD ) ; } } //merge security roles from the ear //TODO: is there somewhere better to put this? final DeploymentUnit unit = dep . getAttachment ( DeploymentUnit . class ) ; DeploymentUnit parent = unit . getParent ( ) ; if ( parent != null ) { final EarMetaData earMetaData = parent . getAttachment ( org . jboss . as . ee . structure . Attachments . EAR_METADATA ) ; if ( earMetaData != null ) { if ( jbossWebMD . getSecurityRoles ( ) == null ) { jbossWebMD . setSecurityRoles ( new SecurityRolesMetaData ( ) ) ; } SecurityRolesMetaData earSecurityRolesMetaData = earMetaData . getSecurityRoles ( ) ; if ( earSecurityRolesMetaData != null ) { SecurityRolesMetaDataMerger . merge ( jbossWebMD . getSecurityRoles ( ) , jbossWebMD . getSecurityRoles ( ) , earSecurityRolesMetaData ) ; } } } }
Creates security roles part of web.xml descriptor.
<p/>
<pre>
&lt;security-role&gt;
&lt;role-name&gt;role1&lt;/role-name&gt;
...
&lt;role-name&gt;roleN&lt;/role-name&gt;
&lt;/security-role&gt;
</pre>

@param dep        webservice deployment
@param jbossWebMD jboss web meta data
Creates security roles part of web . xml descriptor . <p / > <pre > &lt ; security - role&gt ; &lt ; role - name&gt ; role1&lt ; / role - name&gt ; ... &lt ; role - name&gt ; roleN&lt ; / role - name&gt ; &lt ; / security - role&gt ; < / pre >