Package org.omg.CSI

Examples of org.omg.CSI.SASContextBody


    protected Any makeCompleteEstablishContext(ServerRequestInfo ri, long client_context_id, SASPolicyValues sasValues) {
        CompleteEstablishContext msg = new CompleteEstablishContext();
        msg.client_context_id = client_context_id;
        msg.context_stateful = sasValues.stateful;
        msg.final_context_token = new byte[0];
        SASContextBody contextBody = new SASContextBody();
        contextBody.complete_msg(msg);
        Any any = orb.create_any();
        SASContextBodyHelper.insert( any, contextBody );
        if (ri != null)
        {
            try
View Full Code Here


        ContextError msg = new ContextError();
        msg.client_context_id = client_context_id;
        msg.error_token = error_token;
        msg.major_status = major_status;
        msg.minor_status = minor_status;
        SASContextBody contextBody = new SASContextBody();
        contextBody.error_msg(msg);
        Any any = orb.create_any();
        SASContextBodyHelper.insert( any, contextBody );
        if (ri != null)
        {
            try
View Full Code Here

        {
            return;
        }

        // get SAS message
        SASContextBody contextBody = null;
        ServiceContext ctx = null;
        try
        {
            ctx = ri.get_reply_service_context(SecurityAttributeService);
        }
        catch (BAD_PARAM e)
        {
            if (logger.isDebugEnabled())
                logger.debug("No SAS security context found: "+ri.operation());
        }
        catch (Exception e)
        {
            if (logger.isWarnEnabled())
                logger.warn("No SAS security context found: "+e);
        }
        if (ctx == null || ctx.context_data.length <= 1) return;

        try
        {
            Any msg = codec.decode_value( ctx.context_data, SASContextBodyHelper.type() );
            contextBody = SASContextBodyHelper.extract(msg);
        }
        catch (Exception e)
        {
            logger.error("Could not parse SAS reply", e);

            throw new org.omg.CORBA.NO_PERMISSION("SAS Could not parse SAS reply: " + e,
                                                  MinorCodes.SAS_CSS_FAILURE,
                                                  CompletionStatus.COMPLETED_MAYBE);
        }
        ClientConnection connection = ri.getConnection();

        // process CompleteEstablishContext message
        if (contextBody.discriminator() == MTCompleteEstablishContext.value)
        {
            CompleteEstablishContext reply = contextBody.complete_msg();

            // if not stateful, remove from connection
            if (reply.client_context_id > 0 && !reply.context_stateful)
                connection.purgeSASContext(reply.client_context_id);
        }

        // process ContextError message
        if (contextBody.discriminator() == MTContextError.value)
        {
            ContextError reply = contextBody.error_msg();

            // if stateful, remove from connection
            if (reply.client_context_id > 0)
                connection.purgeSASContext(reply.client_context_id);
        }
View Full Code Here

        if (ri.isLocalInterceptor())
        {
            return;
        }
        // get SAS message
        SASContextBody contextBody = null;
        ServiceContext ctx = null;
        try
        {
            ctx = ri.get_reply_service_context(SecurityAttributeService);
        }
        catch (BAD_PARAM e)
        {
            if (logger.isDebugEnabled())
                logger.debug("No SAS security context found (exception): "+ri.operation());
        }
        catch (Exception e)
        {
            if (logger.isWarnEnabled())
                logger.warn("No SAS security context found (exception): "+e);
        }
        if (ctx == null || ctx.context_data.length <= 1) return;

        try
        {
            Any msg = codec.decode_value( ctx.context_data, SASContextBodyHelper.type() );
            contextBody = SASContextBodyHelper.extract(msg);
        }
        catch (Exception e)
        {
            logger.error ("Could not parse SAS reply", e);

            throw new org.omg.CORBA.NO_PERMISSION("SAS Could not parse SAS reply: " + e,
                                                  MinorCodes.SAS_CSS_FAILURE,
                                                  CompletionStatus.COMPLETED_MAYBE);
        }
        ClientConnection connection = ri.getConnection();

        // process CompleteEstablishContext message
        if (contextBody.discriminator() == MTCompleteEstablishContext.value)
        {
            CompleteEstablishContext reply = contextBody.complete_msg();
            logger.debug("receive_exception MTCompleteEstablishContext: " + reply.client_context_id);

            // if not stateful, remove from connection
            if (reply.client_context_id > 0 && !reply.context_stateful)
                connection.purgeSASContext(reply.client_context_id);
        }

        // process ContextError message
        if (contextBody.discriminator() == MTContextError.value)
        {
            ContextError reply = contextBody.error_msg();
            logger.debug("receive_exception MTContextError: " + reply.client_context_id);

            // if stateful, remove from connection
            if (reply.client_context_id > 0)
                connection.purgeSASContext(reply.client_context_id);
View Full Code Here

        EstablishContext msg = new EstablishContext();
        msg.client_context_id = client_context_id;
        msg.client_authentication_token = client_authentication_token;
        msg.identity_token = identity_token;
        msg.authorization_token = authorization_token;
        SASContextBody contextBody = new SASContextBody();
        contextBody.establish_msg(msg);
        Any any = orb.create_any();
        SASContextBodyHelper.insert( any, contextBody );
        return any;
    }
View Full Code Here

                                       boolean discard_context)
    {
        MessageInContext msg = new MessageInContext();
        msg.client_context_id = client_context_id;
        msg.discard_context = discard_context;
        SASContextBody contextBody = new SASContextBody();
        contextBody.in_context_msg(msg);
        Any any = orb.create_any();
        SASContextBodyHelper.insert( any, contextBody );
        return any;
    }
View Full Code Here

                // at least one non-null token was created, create EstablishContext message with it.
                EstablishContext message = new EstablishContext(0, // stateless ctx id
                        noAuthorizationToken, identityToken, encodedAuthenticationToken);

                // create SAS context with the EstablishContext message.
                SASContextBody contextBody = new SASContextBody();
                contextBody.establish_msg(message);

                // stuff the SAS context into the outgoing request.
                Any any = ORB.init().create_any();
                SASContextBodyHelper.insert(any, contextBody);
                ServiceContext sc = new ServiceContext(sasContextId, codec.encode_value(any));
View Full Code Here

    @Override
    public void receive_reply(ClientRequestInfo ri) {
        try {
            ServiceContext sc = ri.get_reply_service_context(sasContextId);
            Any msg = codec.decode_value(sc.context_data, SASContextBodyHelper.type());
            SASContextBody contextBody = SASContextBodyHelper.extract(msg);

            // At this point contextBody should contain a CompleteEstablishContext message, which does not require any
            // treatment. ContextError messages should arrive via receive_exception().

            if (traceEnabled) {
                log.trace("receive_reply: got SAS reply, type " + contextBody.discriminator());
            }

            if (contextBody.discriminator() == MTContextError.value) {
                // should not happen.
                log.warn("Unexpected ContextError in SAS reply");
                throw new NO_PERMISSION("Unexpected ContextError in SAS reply", MinorCodes.SAS_CSS_FAILURE,
                        CompletionStatus.COMPLETED_YES);
            }
View Full Code Here

    @Override
    public void receive_exception(ClientRequestInfo ri) {
        try {
            ServiceContext sc = ri.get_reply_service_context(sasContextId);
            Any msg = codec.decode_value(sc.context_data, SASContextBodyHelper.type());
            SASContextBody contextBody = SASContextBodyHelper.extract(msg);

            // At this point contextBody may contain a either a CompleteEstablishContext message or a ContextError message.
            // Neither message requires any treatment. We decoded the contextbody just to check that it contains a
            // well-formed message.
            if (traceEnabled) {
                log.trace("receive_exceptpion: got SAS reply, type " + contextBody.discriminator());
            }
        } catch (BAD_PARAM e) {
            // no service context with sasContextId: do nothing.
        } catch (FormatMismatch e) {
            throw new MARSHAL("Could not parse SAS reply: " + e, MinorCodes.SAS_CSS_FAILURE,
View Full Code Here

                    // create EstablishContext message with the encoded token.
                    EstablishContext message = new EstablishContext(0, // stateless ctx id
                            noAuthorizationToken, absentIdentityToken, encodedAuthenticationToken);

                    // create SAS context with the EstablishContext message.
                    SASContextBody contextBody = new SASContextBody();
                    contextBody.establish_msg(message);

                    // stuff the SAS context into the outgoing request.
                    Any any = ORB.init().create_any();
                    SASContextBodyHelper.insert(any, contextBody);
                    ServiceContext sc = new ServiceContext(sasContextId, codec.encode_value(any));
View Full Code Here

TOP

Related Classes of org.omg.CSI.SASContextBody

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.