iiop-openjdk/src/main/java/org/wildfly/iiop/openjdk/csiv2/CSIv2Util.java
public static AS_ContextSec createAuthenticationServiceContext(IORSecurityConfigMetaData metadata) {

        AS_ContextSec context;

        // the content of the context.
        int support = 0;
        int require = 0;
        byte[] clientAuthMech = {};
        byte[] targetName = {};

        IORASContextMetaData asMeta = metadata.getAsContext();

        // if no AS context metatada exists, or authentication method "none" is specified, we can produce an empty AS context.
        if (asMeta == null || asMeta.getAuthMethod().equals(IORASContextMetaData.AUTH_METHOD_NONE)) {
            context = new AS_ContextSec((short) support, (short) require, clientAuthMech, targetName);
        } else {
            // we do support.
            support = EstablishTrustInClient.value;

            // required depends on the metadata.
            if (asMeta.isRequired()) {
                require = EstablishTrustInClient.value;
            }

            // we only support GSSUP authentication method.
            clientAuthMech = createGSSUPMechOID();

            // finally, encode the "realm" name as a CSI.GSS_NT_ExportedName.
            // clientAuthMech should contain the DER encoded GSSUPMechOID at this point.
            String realm = asMeta.getRealm();
            targetName = createGSSExportedName(clientAuthMech, realm.getBytes(StandardCharsets.UTF_8));

            context = new AS_ContextSec((short) support, (short) require, clientAuthMech, targetName);
        }

        return context;
    }
public static AS_ContextSec createAuthenticationServiceContext(IORSecurityConfigMetaData metadata) {

        AS_ContextSec context;

        // the content of the context.
        int support = 0;
        int require = 0;
        byte[] clientAuthMech = {};
        byte[] targetName = {};

        IORASContextMetaData asMeta = metadata.getAsContext();

        // if no AS context metatada exists, or authentication method "none" is specified, we can produce an empty AS context.
        if (asMeta == null || asMeta.getAuthMethod().equals(IORASContextMetaData.AUTH_METHOD_NONE)) {
            context = new AS_ContextSec((short) support, (short) require, clientAuthMech, targetName);
        } else {
            // we do support.
            support = EstablishTrustInClient.value;

            // required depends on the metadata.
            if (asMeta.isRequired()) {
                require = EstablishTrustInClient.value;
            }

            // we only support GSSUP authentication method.
            clientAuthMech = createGSSUPMechOID();

            // finally, encode the "realm" name as a CSI.GSS_NT_ExportedName.
            // clientAuthMech should contain the DER encoded GSSUPMechOID at this point.
            String realm = asMeta.getRealm();
            targetName = createGSSExportedName(clientAuthMech, realm.getBytes(StandardCharsets.UTF_8));

            context = new AS_ContextSec((short) support, (short) require, clientAuthMech, targetName);
        }

        return context;
    }
public static AS_ContextSec createAuthenticationServiceContext ( IORSecurityConfigMetaData metadata ) { AS_ContextSec context ; // the content of the context. int support = 0 ; int require = 0 ; byte [ ] clientAuthMech = { } ; byte [ ] targetName = { } ; IORASContextMetaData asMeta = metadata . getAsContext ( ) ; // if no AS context metatada exists, or authentication method "none" is specified, we can produce an empty AS context. if ( asMeta == null || asMeta . getAuthMethod ( ) . equals ( IORASContextMetaData . AUTH_METHOD_NONE ) ) { context = new AS_ContextSec ( ( short ) support , ( short ) require , clientAuthMech , targetName ) ; } else { // we do support. support = EstablishTrustInClient . value ; // required depends on the metadata. if ( asMeta . isRequired ( ) ) { require = EstablishTrustInClient . value ; } // we only support GSSUP authentication method. clientAuthMech = createGSSUPMechOID ( ) ; // finally, encode the "realm" name as a CSI.GSS_NT_ExportedName. // clientAuthMech should contain the DER encoded GSSUPMechOID at this point. String realm = asMeta . getRealm ( ) ; targetName = createGSSExportedName ( clientAuthMech , realm . getBytes ( StandardCharsets . UTF_8 ) ) ; context = new AS_ContextSec ( ( short ) support , ( short ) require , clientAuthMech , targetName ) ; } return context ; }
<p>
Create the client Authentication Service (AS) context included in a {@code CompoundSecMech} definition.
</p>

@param metadata the metadata object that contains the CSIv2 security configuration info.
@return the constructed {@code AS_ContextSec} instance.
<p > Create the client Authentication Service ( AS ) context included in a { @code CompoundSecMech } definition . < / p >