Search in sources :

Example 1 with RunAsPrincipal

use of org.jboss.ejb3.annotation.RunAsPrincipal in project wildfly by wildfly.

the class RunAsMergingProcessor method handleAnnotations.

@Override
protected void handleAnnotations(final DeploymentUnit deploymentUnit, final EEApplicationClasses applicationClasses, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final EJBComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {
    final EEModuleClassDescription clazz = applicationClasses.getClassByName(componentClass.getName());
    // we only care about annotations on the bean class itself
    if (clazz == null) {
        return;
    }
    final ClassAnnotationInformation<RunAs, String> runAs = clazz.getAnnotationInformation(RunAs.class);
    final ClassAnnotationInformation<RunAsPrincipal, String> runAsPrincipal = clazz.getAnnotationInformation(RunAsPrincipal.class);
    if (runAs == null) {
        if (runAsPrincipal != null) {
            EjbLogger.DEPLOYMENT_LOGGER.missingRunAsAnnotation(componentClass.getName());
        }
        return;
    }
    if (!runAs.getClassLevelAnnotations().isEmpty()) {
        componentConfiguration.setRunAs(runAs.getClassLevelAnnotations().get(0));
    }
    String principal = DEFAULT_RUN_AS_PRINCIPAL;
    if (runAsPrincipal != null && !runAsPrincipal.getClassLevelAnnotations().isEmpty()) {
        principal = runAsPrincipal.getClassLevelAnnotations().get(0);
    }
    componentConfiguration.setRunAsPrincipal(principal);
}
Also used : RunAsPrincipal(org.jboss.ejb3.annotation.RunAsPrincipal) RunAs(javax.annotation.security.RunAs) EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription)

Aggregations

RunAs (javax.annotation.security.RunAs)1 EEModuleClassDescription (org.jboss.as.ee.component.EEModuleClassDescription)1 RunAsPrincipal (org.jboss.ejb3.annotation.RunAsPrincipal)1