Search in sources :

Example 1 with ServiceConfiguration

use of org.omg.CSIIOP.ServiceConfiguration in project wildfly by wildfly.

the class CSIv2Util method createSecureAttributeServiceContext.

/**
     * <p>
     * Create the Secure Attribute Service (SAS) context included in a {@code CompoundSecMech} definition.
     * </p>
     *
     * @param metadata the metadata object that contains the CSIv2 security configuration info.
     * @return the constructed {@code SAS_ContextSec} instance.
     */
public static SAS_ContextSec createSecureAttributeServiceContext(IORSecurityConfigMetaData metadata) {
    SAS_ContextSec context;
    // context contains target_supports, target_requires, privilige_authorities, supported_naming_mechanisms, supported_identity_types.
    int support = 0;
    int require = 0;
    ServiceConfiguration[] privilAuth = new ServiceConfiguration[0];
    byte[][] supNamMechs = {};
    // 0 means ITTAbsent
    int supIdenTypes = 0;
    // the the SasContext metadata.
    IORSASContextMetaData sasMeta = metadata.getSasContext();
    // if no SAS context metadata, or caller propagation is not supported, we return with a more or less empty sas context.
    if (sasMeta == null || sasMeta.getCallerPropagation().equals(IORSASContextMetaData.CALLER_PROPAGATION_NONE)) {
        context = new SAS_ContextSec((short) support, (short) require, privilAuth, supNamMechs, supIdenTypes);
    } else {
        support = IdentityAssertion.value;
        // supporting GSSUP (username/password) naming mechanism.
        byte[] upMech = createGSSUPMechOID();
        supNamMechs = new byte[1][upMech.length];
        System.arraycopy(upMech, 0, supNamMechs[0], 0, upMech.length);
        // since we support IdentityAssertion we need to specify supported identity types. CTS says we need them all
        supIdenTypes = ITTAnonymous.value | ITTPrincipalName.value | ITTX509CertChain.value | ITTDistinguishedName.value;
        context = new SAS_ContextSec((short) support, (short) require, privilAuth, supNamMechs, supIdenTypes);
    }
    return context;
}
Also used : ServiceConfiguration(org.omg.CSIIOP.ServiceConfiguration) IORSASContextMetaData(org.jboss.metadata.ejb.jboss.IORSASContextMetaData) SAS_ContextSec(org.omg.CSIIOP.SAS_ContextSec)

Aggregations

IORSASContextMetaData (org.jboss.metadata.ejb.jboss.IORSASContextMetaData)1 SAS_ContextSec (org.omg.CSIIOP.SAS_ContextSec)1 ServiceConfiguration (org.omg.CSIIOP.ServiceConfiguration)1