Examples of SASContextBody


Examples of org.omg.CSI.SASContextBody

    @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().
            JacORBLogger.ROOT_LOGGER.traceReceiveReply(contextBody.discriminator());

            if (contextBody.discriminator() == MTContextError.value) {
                // should not happen.
                throw JacORBMessages.MESSAGES.unexpectedContextErrorInSASReply(MinorCodes.SAS_CSS_FAILURE,
                        CompletionStatus.COMPLETED_YES);
            }
        } catch (BAD_PARAM e) {
View Full Code Here

Examples of org.omg.CSI.SASContextBody

    @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 context body just to check that it contains
            // a well-formed message.
            JacORBLogger.ROOT_LOGGER.traceReceiveException(contextBody.discriminator());

        } catch (BAD_PARAM e) {
            // no service context with sasContextId: do nothing.
        } catch (FormatMismatch e) {
            throw JacORBMessages.MESSAGES.errorParsingSASReply(e, MinorCodes.SAS_CSS_FAILURE, CompletionStatus.COMPLETED_MAYBE);
View Full Code Here

Examples of org.omg.CSI.SASContextBody

    }

    public void receive_reply(org.omg.PortableInterceptor.ClientRequestInfo ri)
    {
        // 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)
        {
            if (logger.isWarnEnabled())
                logger.warn("Could not parse SAS reply: " + e);e.printStackTrace();
            throw new org.omg.CORBA.NO_PERMISSION("SAS Could not parse SAS reply: " + e,
                                                  MinorCodes.SAS_CSS_FAILURE,
                                                  CompletionStatus.COMPLETED_MAYBE);
        }
        ClientConnection connection = ((ClientRequestInfoImpl) ri).connection;

        // 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

Examples of org.omg.CSI.SASContextBody

    public void receive_exception(org.omg.PortableInterceptor.ClientRequestInfo ri)
        throws org.omg.PortableInterceptor.ForwardRequest
    {
        // 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)
        {
            if (logger.isWarnEnabled())
                logger.warn("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 = ((ClientRequestInfoImpl) ri).connection;

        // 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

Examples of org.omg.CSI.SASContextBody

        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

Examples of org.omg.CSI.SASContextBody

                                       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

Examples of org.omg.CSI.SASContextBody

                                                  MinorCodes.SAS_TSS_FAILURE,
                                                  CompletionStatus.COMPLETED_NO);
        }

        // parse service context
        SASContextBody contextBody = null;
        long client_context_id = 0;
        byte[] contextToken = null;
        try
        {
            ServiceContext ctx =
                ri.get_request_service_context(SASInitializer.SecurityAttributeService);
            Any ctx_any =
                codec.decode_value( ctx.context_data, SASContextBodyHelper.type() );
            contextBody = SASContextBodyHelper.extract(ctx_any);
        }
        catch (BAD_PARAM e)
        {
        }
        catch (Exception e)
        {
            if (logger.isWarnEnabled())
                logger.warn("Could not parse service context: ", e);
            makeContextError(ri, client_context_id, 1, 1, new byte[0]);
            throw new org.omg.CORBA.NO_PERMISSION("Could not parse service context: " +
                                                  e,
                                                  MinorCodes.SAS_TSS_FAILURE,
                                                  CompletionStatus.COMPLETED_NO);
        }
        if (contextBody == null)
            return;

        // process MessageInContext
        if (contextBody.discriminator() == MTMessageInContext.value)
        {
            MessageInContext msg = null;
            try
            {
                msg = contextBody.in_context_msg();
                client_context_id = msg.client_context_id;
                contextToken = getSASContext(connection, msg.client_context_id);
            }
            catch (Exception e)
            {
                if (logger.isErrorEnabled())
                    logger.error("Could not parse service MessageInContext " +
                             ri.operation() + ": " + e);
                makeContextError(ri, client_context_id, 1, 1, new byte[0]);
                throw new org.omg.CORBA.NO_PERMISSION("SAS Error parsing MessageInContext: " +
                                                      e,
                                                      MinorCodes.SAS_TSS_FAILURE,
                                                      CompletionStatus.COMPLETED_NO);
            }
            if (contextToken == null)
            {
                if (logger.isErrorEnabled())
                    logger.error("Invalid context in MessageInContext " +
                                 ri.operation() + ": " + msg.client_context_id);

                makeContextError(ri, client_context_id, 2, 1, new byte[0]);
                throw new org.omg.CORBA.NO_PERMISSION("SAS Invalid context in MessageInContext",
                                                      MinorCodes.SAS_TSS_FAILURE,
                                                      CompletionStatus.COMPLETED_NO);
            }
        }

        // process EstablishContext
        String principalName = null;
        if (contextBody.discriminator() == MTEstablishContext.value)
        {
            EstablishContext msg = null;
            try
            {
                msg = contextBody.establish_msg();
                client_context_id = msg.client_context_id;
                contextToken = msg.client_authentication_token;

                if (!sasContext.validateContext(orb, codec, contextToken)) {
                    logger.info("Could not validate context EstablishContext " + ri.operation());
View Full Code Here

Examples of org.omg.CSI.SASContextBody

                                                  MinorCodes.SAS_TSS_FAILURE,
                                                  CompletionStatus.COMPLETED_NO);
        }

        // parse service context
        SASContextBody contextBody = null;
        long client_context_id = 0;
        byte[] contextToken = null;
        try
        {
            ServiceContext ctx =
                ri.get_request_service_context(SASInitializer.SecurityAttributeService);
            Any ctx_any =
                codec.decode_value( ctx.context_data, SASContextBodyHelper.type() );
            contextBody =
                SASContextBodyHelper.extract(ctx_any);
        }
        catch (BAD_PARAM e)
        {
            if (logger.isDebugEnabled())
                logger.debug("Could not parse service context for operation " +
                         ri.operation());
        }
        catch (Exception e)
        {
            if (logger.isWarnEnabled())
                logger.warn("Could not parse service context for operation " +
                        ri.operation() + ": " + e);
        }

        if (contextBody == null &&
           (sasValues.targetRequires & org.omg.CSIIOP.EstablishTrustInClient.value) != 0 &&
           !ri.operation().equals("_non_existent") &&
           !ri.operation().equals("_is_a"))
        {
            if (logger.isErrorEnabled())
                logger.error("Did not parse service context for operation " +
                         ri.operation());
            throw new org.omg.CORBA.NO_PERMISSION("No SAS service context found",
                                                  MinorCodes.SAS_TSS_FAILURE,
                                                  CompletionStatus.COMPLETED_NO);
        }
        if (contextBody == null)
        {
            if (logger.isDebugEnabled())
                logger.debug("No context found, but not required");
            return;
        }

        // process MessageInContext
        if (contextBody.discriminator() == MTMessageInContext.value)
        {
            MessageInContext msg = null;
            try
            {
                msg = contextBody.in_context_msg();
                client_context_id = msg.client_context_id;
                contextToken = getSASContext(connection, msg.client_context_id);
            }
            catch (Exception e)
            {
                if (logger.isErrorEnabled())
                    logger.error("Could not parse service MessageInContext " +
                                 ri.operation() + ": " + e);
                makeContextError(ri, client_context_id, 1, 1, contextToken);
                throw new org.omg.CORBA.NO_PERMISSION("SAS Error parsing MessageInContext: " + e,
                                                      MinorCodes.SAS_TSS_FAILURE,
                                                      CompletionStatus.COMPLETED_NO);
            }
            if (contextToken == null)
            {
                if (logger.isErrorEnabled())
                    logger.error("Could not find context in MessageInContext " +
                                 ri.operation() + ": " + msg.client_context_id);
                makeContextError(ri, client_context_id, 2, 1, contextToken);
                throw new org.omg.CORBA.NO_PERMISSION("SAS Error invalid context in MessageInContext",
                                                      MinorCodes.SAS_TSS_FAILURE,
                                                      CompletionStatus.COMPLETED_NO);
            }
        }

        // process EstablishContext
        if (contextBody.discriminator() == MTEstablishContext.value)
        {
            EstablishContext msg = null;
            String principalName = null;
            try
            {
                msg = contextBody.establish_msg();
                client_context_id = msg.client_context_id;
                contextToken = msg.client_authentication_token;

                principalName = sasContext.getValidatedPrincipal();
            }
View Full Code Here

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

Examples of org.omg.CSI.SASContextBody

        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
TOP
Copyright © 2018 www.massapi.com. 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.