Search in sources :

Example 51 with EjbDescriptor

use of com.sun.enterprise.deployment.EjbDescriptor in project Payara by payara.

the class ConcurrencyManagementHandler method processAnnotation.

protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
    ConcurrencyManagement cmAn = (ConcurrencyManagement) ainfo.getAnnotation();
    ConcurrencyManagementType cmType = cmAn.value();
    for (EjbContext ejbContext : ejbContexts) {
        EjbDescriptor ejbDesc = ejbContext.getDescriptor();
        if (ejbDesc instanceof EjbSessionDescriptor) {
            EjbSessionDescriptor.ConcurrencyManagementType descCMType;
            switch(cmType) {
                case CONTAINER:
                    descCMType = EjbSessionDescriptor.ConcurrencyManagementType.Container;
                    break;
                case BEAN:
                    descCMType = EjbSessionDescriptor.ConcurrencyManagementType.Bean;
                    break;
                default:
                    throw new AnnotationProcessorException("Unsupported concurrency management " + "type = " + cmType);
            }
            EjbSessionDescriptor sDesc = (EjbSessionDescriptor) ejbDesc;
            // Set value on descriptor unless it has been set by .xml
            sDesc.setConcurrencyManagementTypeIfNotSet(descCMType);
        }
    }
    return getDefaultProcessedResult();
}
Also used : ConcurrencyManagement(javax.ejb.ConcurrencyManagement) ConcurrencyManagementType(javax.ejb.ConcurrencyManagementType) EjbContext(com.sun.enterprise.deployment.annotation.context.EjbContext) AnnotationProcessorException(org.glassfish.apf.AnnotationProcessorException) EjbSessionDescriptor(org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 52 with EjbDescriptor

use of com.sun.enterprise.deployment.EjbDescriptor in project Payara by payara.

the class ActiveJmsResourceAdapter method getJMSDestination.

/*
     * Get JMS destination resource from ejb module
     */
private JMSDestinationDefinitionDescriptor getJMSDestination(String logicalDestination, EjbBundleDescriptor ejbBundleDescriptor) {
    JMSDestinationDefinitionDescriptor destination = getJMSDestination(logicalDestination, ejbBundleDescriptor.getResourceDescriptors(JavaEEResourceType.JMSDD));
    if (isValidDestination(destination)) {
        return destination;
    }
    Set<EjbDescriptor> ejbDescriptors = (Set<EjbDescriptor>) ejbBundleDescriptor.getEjbs();
    for (EjbDescriptor ejbDescriptor : ejbDescriptors) {
        destination = getJMSDestination(logicalDestination, ejbDescriptor.getResourceDescriptors(JavaEEResourceType.JMSDD));
        if (isValidDestination(destination)) {
            return destination;
        }
    }
    return null;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) JMSDestinationDefinitionDescriptor(com.sun.enterprise.deployment.JMSDestinationDefinitionDescriptor) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 53 with EjbDescriptor

use of com.sun.enterprise.deployment.EjbDescriptor in project Payara by payara.

the class SecIORInterceptor method addCSIv2Components.

private void addCSIv2Components(IORInfo iorInfo) {
    EjbDescriptor desc = null;
    try {
        if (_logger.isLoggable(FINE)) {
            _logger.log(FINE, ".addCSIv2Components->: " + " " + iorInfo);
        }
        if (orbFactory != null && orbFactory.isClusterActive()) {
            return;
        }
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, ".addCSIv2Components ");
        }
        int sslMutualAuthPort = getServerPort("SSL_MUTUALAUTH");
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, ".addCSIv2Components: sslMutualAuthPort: " + sslMutualAuthPort);
        }
        CSIV2TaggedComponentInfo ctc = new CSIV2TaggedComponentInfo(orb, sslMutualAuthPort);
        desc = ctc.getEjbDescriptor(iorInfo);
        // Create CSIv2 tagged component
        int sslport = getServerPort("SSL");
        if (_logger.isLoggable(FINE)) {
            _logger.log(FINE, ".addCSIv2Components: sslport: " + sslport);
        }
        TaggedComponent csiv2Comp = null;
        if (desc != null) {
            csiv2Comp = ctc.createSecurityTaggedComponent(sslport, desc);
        } else {
            // this is not an EJB object, must be a non-EJB CORBA object
            csiv2Comp = ctc.createSecurityTaggedComponent(sslport);
        }
        iorInfo.add_ior_component(csiv2Comp);
    } finally {
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, ".addCSIv2Components<-: " + " " + iorInfo + " " + desc);
        }
    }
}
Also used : TaggedComponent(org.omg.IOP.TaggedComponent) EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor)

Example 54 with EjbDescriptor

use of com.sun.enterprise.deployment.EjbDescriptor in project Payara by payara.

the class SecurityMechanismSelector method evaluateClientConformance.

/**
 * Evaluates a client's conformance to the security policies configured on the target. Returns true
 * if conformant to the security policies otherwise return false.
 *
 * Conformance checking is done as follows: First, the object_id is mapped to the set of
 * EjbIORConfigurationDescriptor. Each EjbIORConfigurationDescriptor corresponds to a single
 * CompoundSecMechanism of the CSIv2 spec. A client is considered to be conformant if a
 * CompoundSecMechanism consistent with the client's actions is found i.e. transport_mech,
 * as_context_mech and sas_context_mech must all be consistent.
 */
private boolean evaluateClientConformance(SecurityContext ctx, byte[] objectId, boolean sslUsed, X509Certificate[] certchain) {
    // If objectId is null then nothing to evaluate. This is a sanity check - the objectId should never be null.
    if (objectId == null) {
        return true;
    }
    if (protocolMgr == null) {
        protocolMgr = orbHelper.getProtocolManager();
    }
    // is on a callback object in the client VM.
    if (protocolMgr == null) {
        return true;
    }
    EjbDescriptor ejbDesc = protocolMgr.getEjbDescriptor(objectId);
    Set<EjbIORConfigurationDescriptor> iorDescSet = null;
    if (ejbDesc != null) {
        iorDescSet = ejbDesc.getIORConfigurationDescriptors();
    } else {
        // Probably a non-EJB CORBA object.
        // Create a temporary EjbIORConfigurationDescriptor.
        iorDescSet = getCorbaIORDescSet();
    }
    if (_logger.isLoggable(FINE)) {
        _logger.log(FINE, "SecurityMechanismSelector.evaluate_client_conformance: iorDescSet: " + iorDescSet);
    }
    /*
         * if there are no IORConfigurationDescriptors configured, then no security policy is configured. So
         * consider the client to be conformant.
         */
    if (iorDescSet.isEmpty()) {
        return true;
    }
    // Go through each EjbIORConfigurationDescriptor trying to find
    // a find a CompoundSecMechanism that matches client's actions.
    boolean checkSkipped = false;
    for (Iterator itr = iorDescSet.iterator(); itr.hasNext(); ) {
        EjbIORConfigurationDescriptor iorDesc = (EjbIORConfigurationDescriptor) itr.next();
        if (skip_client_conformance(iorDesc)) {
            _logger.log(Level.FINE, "SecurityMechanismSelector.evaluate_client_conformance: skip_client_conformance");
            checkSkipped = true;
            continue;
        }
        if (!GlassFishORBManager.disableSSLCheck()) {
            if (!evaluate_client_conformance_ssl(iorDesc, sslUsed, certchain)) {
                _logger.log(FINE, "SecurityMechanismSelector.evaluate_client_conformance: evaluate_client_conformance_ssl");
                checkSkipped = false;
                continue;
            }
        }
        String realmName = "default";
        if (ejbDesc != null && ejbDesc.getApplication() != null) {
            realmName = ejbDesc.getApplication().getRealm();
        }
        if (realmName == null) {
            realmName = iorDesc.getRealmName();
        }
        if (realmName == null) {
            realmName = "default";
        }
        if (!evaluate_client_conformance_ascontext(ctx, iorDesc, realmName)) {
            _logger.log(FINE, "SecurityMechanismSelector.evaluate_client_conformance: evaluate_client_conformance_ascontext");
            checkSkipped = false;
            continue;
        }
        if (!evaluate_client_conformance_sascontext(ctx, iorDesc)) {
            _logger.log(FINE, "SecurityMechanismSelector.evaluate_client_conformance: evaluate_client_conformance_sascontext");
            checkSkipped = false;
            continue;
        }
        // security policy matched.
        return true;
    }
    if (checkSkipped) {
        return true;
    }
    // No matching security policy found
    return false;
}
Also used : EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor) EjbIORConfigurationDescriptor(com.sun.enterprise.deployment.EjbIORConfigurationDescriptor)

Example 55 with EjbDescriptor

use of com.sun.enterprise.deployment.EjbDescriptor in project Payara by payara.

the class IIOPSSLUtilImpl method createSSLTaggedComponent.

@Override
public TaggedComponent createSSLTaggedComponent(IORInfo iorInfo, Object sInfos) {
    List<com.sun.corba.ee.spi.folb.SocketInfo> socketInfos = (List<com.sun.corba.ee.spi.folb.SocketInfo>) sInfos;
    orbHelper = Lookups.getGlassFishORBHelper();
    TaggedComponent result = null;
    org.omg.CORBA.ORB orb = orbHelper.getORB();
    int sslMutualAuthPort = -1;
    try {
        if (iorInfo instanceof com.sun.corba.ee.spi.legacy.interceptor.IORInfoExt) {
            sslMutualAuthPort = ((com.sun.corba.ee.spi.legacy.interceptor.IORInfoExt) iorInfo).getServerPort("SSL_MUTUALAUTH");
        }
    } catch (com.sun.corba.ee.spi.legacy.interceptor.UnknownType ute) {
        _logger.log(Level.FINE, ".isnert: UnknownType exception", ute);
    }
    if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE, ".insert: sslMutualAuthPort: " + sslMutualAuthPort);
    }
    CSIV2TaggedComponentInfo ctc = new CSIV2TaggedComponentInfo(orb, sslMutualAuthPort);
    EjbDescriptor desc = ctc.getEjbDescriptor(iorInfo);
    if (desc != null) {
        result = ctc.createSecurityTaggedComponent(socketInfos, desc);
    }
    return result;
}
Also used : EjbDescriptor(com.sun.enterprise.deployment.EjbDescriptor) TaggedComponent(org.omg.IOP.TaggedComponent) List(java.util.List)

Aggregations

EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)55 EjbBundleDescriptor (com.sun.enterprise.deployment.EjbBundleDescriptor)17 BundleDescriptor (com.sun.enterprise.deployment.BundleDescriptor)14 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)13 JndiNameEnvironment (com.sun.enterprise.deployment.JndiNameEnvironment)9 Application (com.sun.enterprise.deployment.Application)8 WebServiceEndpoint (com.sun.enterprise.deployment.WebServiceEndpoint)7 NamingException (javax.naming.NamingException)5 ComponentInvocation (org.glassfish.api.invocation.ComponentInvocation)5 ComponentEnvManager (com.sun.enterprise.container.common.spi.util.ComponentEnvManager)4 ManagedBeanDescriptor (com.sun.enterprise.deployment.ManagedBeanDescriptor)4 WebComponentDescriptor (com.sun.enterprise.deployment.WebComponentDescriptor)4 EjbContext (com.sun.enterprise.deployment.annotation.context.EjbContext)4 Method (java.lang.reflect.Method)4 ArrayList (java.util.ArrayList)4 Descriptor (org.glassfish.deployment.common.Descriptor)4 BeanDeploymentArchive (org.jboss.weld.bootstrap.spi.BeanDeploymentArchive)4 ApplicationClientDescriptor (com.sun.enterprise.deployment.ApplicationClientDescriptor)3 MethodDescriptor (com.sun.enterprise.deployment.MethodDescriptor)3 RunAsIdentityDescriptor (com.sun.enterprise.deployment.RunAsIdentityDescriptor)3