Search in sources :

Example 1 with EjbJaccConfigurator

use of org.jboss.as.ejb3.security.EjbJaccConfigurator in project wildfly by wildfly.

the class MethodPermissionsMergingProcessor method handleDeploymentDescriptor.

@Override
protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final EJBComponentDescription componentDescription) throws DeploymentUnitProcessingException {
    //Add the configurator that calculates JACC permissions
    //TODO: should this be elsewhere?
    componentDescription.getConfigurators().add(new EjbJaccConfigurator());
    //DO NOT USE componentConfiguration.getDescriptorData()
    //It will return null if there is no <enterprise-beans/> declaration even if there is an assembly descriptor entry
    EjbJarMetaData ejbJarMetadata = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA);
    if (ejbJarMetadata != null) {
        final AssemblyDescriptorMetaData assemblyDescriptor = ejbJarMetadata.getAssemblyDescriptor();
        if (assemblyDescriptor != null) {
            //handle wildcard exclude-list
            final ExcludeListMetaData wildCardExcludeList = assemblyDescriptor.getExcludeListByEjbName("*");
            if (wildCardExcludeList != null && wildCardExcludeList.getMethods() != null) {
                handleExcludeMethods(componentDescription, wildCardExcludeList);
            }
            //handle ejb-specific exclude-list
            final ExcludeListMetaData excludeList = assemblyDescriptor.getExcludeListByEjbName(componentDescription.getEJBName());
            if (excludeList != null && excludeList.getMethods() != null) {
                handleExcludeMethods(componentDescription, excludeList);
            }
            //handle wildcard method permissions
            final MethodPermissionsMetaData wildCardMethodPermissions = assemblyDescriptor.getMethodPermissionsByEjbName("*");
            if (wildCardMethodPermissions != null) {
                handleMethodPermissions(componentDescription, wildCardMethodPermissions);
            }
            //handle ejb-specific method permissions
            final MethodPermissionsMetaData methodPermissions = assemblyDescriptor.getMethodPermissionsByEjbName(componentDescription.getEJBName());
            if (methodPermissions != null) {
                handleMethodPermissions(componentDescription, methodPermissions);
            }
        }
    }
}
Also used : MethodPermissionsMetaData(org.jboss.metadata.ejb.spec.MethodPermissionsMetaData) EjbJaccConfigurator(org.jboss.as.ejb3.security.EjbJaccConfigurator) EjbJarMetaData(org.jboss.metadata.ejb.spec.EjbJarMetaData) AssemblyDescriptorMetaData(org.jboss.metadata.ejb.spec.AssemblyDescriptorMetaData) ExcludeListMetaData(org.jboss.metadata.ejb.spec.ExcludeListMetaData)

Aggregations

EjbJaccConfigurator (org.jboss.as.ejb3.security.EjbJaccConfigurator)1 AssemblyDescriptorMetaData (org.jboss.metadata.ejb.spec.AssemblyDescriptorMetaData)1 EjbJarMetaData (org.jboss.metadata.ejb.spec.EjbJarMetaData)1 ExcludeListMetaData (org.jboss.metadata.ejb.spec.ExcludeListMetaData)1 MethodPermissionsMetaData (org.jboss.metadata.ejb.spec.MethodPermissionsMetaData)1