Search in sources :

Example 1 with AS_ContextSec

use of com.sun.corba.ee.org.omg.CSIIOP.AS_ContextSec in project Payara by payara.

the class CSIV2TaggedComponentInfo method createCompoundSecMechs.

/**
 * Create the security mechanisms. Only 1 such mechanism is created although the spec allows
 * multiple mechanisms (in decreasing order of preference). Note that creating more than one
 * CompoundSecMech here will cause getSecurityMechanisms to fail, as it supports only one
 * CompoundSecMech.
 */
private CompoundSecMech[] createCompoundSecMechs(DescriptorMaker maker, EjbDescriptor ejbDescriptor) throws IOException {
    if (logger.isLoggable(FINE)) {
        logger.log(FINE, "IIOP: Creating CompoundSecMech");
    }
    if (ejbDescriptor == null) {
        return null;
    }
    Set<EjbIORConfigurationDescriptor> iorDescriptors = getIORConfigurationDescriptors(ejbDescriptor);
    CompoundSecMech[] mechList = new CompoundSecMech[iorDescriptors.size()];
    Iterator<EjbIORConfigurationDescriptor> itr = iorDescriptors.iterator();
    if (logger.isLoggable(FINE)) {
        logger.log(FINE, "IORDescSet SIZE:" + iorDescriptors.size());
    }
    String realmName = DEFAULT_REALM;
    for (int i = 0; i < iorDescriptors.size(); i++) {
        EjbIORConfigurationDescriptor iorDescriptor = itr.next();
        int targetRequires = getTargetRequires(iorDescriptor);
        org.omg.IOP.TaggedComponent comp = maker.evaluate(iorDescriptor);
        if (ejbDescriptor.getApplication() != null) {
            realmName = ejbDescriptor.getApplication().getRealm();
        }
        if (realmName == null) {
            realmName = iorDescriptor.getRealmName();
        }
        if (realmName == null) {
            realmName = DEFAULT_REALM;
        }
        // Create AS_Context
        AS_ContextSec asContext = createASContextSec(iorDescriptor, realmName);
        // Create SAS_Context
        SAS_ContextSec sasContext = createSASContextSec(iorDescriptor);
        // Update the target requires value
        int targ_req = targetRequires | asContext.target_requires | sasContext.target_requires;
        // Convert Profile.TaggedComponent to org.omg.IOP.TaggedComponent
        mechList[i] = new CompoundSecMech((short) targ_req, comp, asContext, sasContext);
    }
    return mechList;
}
Also used : AS_ContextSec(com.sun.corba.ee.org.omg.CSIIOP.AS_ContextSec) SAS_ContextSec(com.sun.corba.ee.org.omg.CSIIOP.SAS_ContextSec) CompoundSecMech(com.sun.corba.ee.org.omg.CSIIOP.CompoundSecMech) SAS_ContextSec(com.sun.corba.ee.org.omg.CSIIOP.SAS_ContextSec) EjbIORConfigurationDescriptor(com.sun.enterprise.deployment.EjbIORConfigurationDescriptor)

Example 2 with AS_ContextSec

use of com.sun.corba.ee.org.omg.CSIIOP.AS_ContextSec in project Payara by payara.

the class CSIV2TaggedComponentInfo method createSecurityTaggedComponent.

/**
 * This method is called on the server side for all non-EJB POAs.
 */
public org.omg.IOP.TaggedComponent createSecurityTaggedComponent(int sslPort) {
    org.omg.IOP.TaggedComponent securityTaggedComponent = null;
    try {
        Properties props = orbHelper.getCSIv2Props();
        boolean sslRequired = getBooleanValue(props, ORBLocator.ORB_SSL_SERVER_REQUIRED);
        boolean clientAuthRequired = getBooleanValue(props, ORBLocator.ORB_CLIENT_AUTH_REQUIRED);
        CompoundSecMech[] mechList = new CompoundSecMech[1];
        org.omg.IOP.TaggedComponent transportMech = createSSLInfo(sslPort, null, sslRequired);
        // Create AS_Context
        AS_ContextSec asContext = createASContextSec(null, DEFAULT_REALM);
        // Create SAS_Context
        SAS_ContextSec sasContext = createSASContextSec(null);
        short targetRequires = (clientAuthRequired ? EstablishTrustInClient.value : 0);
        // Convert Profile.TaggedComponent to org.omg.IOP.TaggedComponent
        mechList[0] = new CompoundSecMech(targetRequires, transportMech, asContext, sasContext);
        securityTaggedComponent = createCompoundSecMechListComponent(mechList);
    } catch (Exception e) {
        logger.log(SEVERE, "iiop.createcompund_exception", e);
    }
    return securityTaggedComponent;
}
Also used : AS_ContextSec(com.sun.corba.ee.org.omg.CSIIOP.AS_ContextSec) SAS_ContextSec(com.sun.corba.ee.org.omg.CSIIOP.SAS_ContextSec) CompoundSecMech(com.sun.corba.ee.org.omg.CSIIOP.CompoundSecMech) SAS_ContextSec(com.sun.corba.ee.org.omg.CSIIOP.SAS_ContextSec) Properties(java.util.Properties) IOException(java.io.IOException)

Aggregations

AS_ContextSec (com.sun.corba.ee.org.omg.CSIIOP.AS_ContextSec)2 CompoundSecMech (com.sun.corba.ee.org.omg.CSIIOP.CompoundSecMech)2 SAS_ContextSec (com.sun.corba.ee.org.omg.CSIIOP.SAS_ContextSec)2 EjbIORConfigurationDescriptor (com.sun.enterprise.deployment.EjbIORConfigurationDescriptor)1 IOException (java.io.IOException)1 Properties (java.util.Properties)1