Package org.omg.CSI

Examples of org.omg.CSI.SASContextBody


            if (serviceContext == null) return;

            if (log.isDebugEnabled()) log.debug("Found service context");

            Any any = Util.getCodec().decode_value(serviceContext.context_data, SASContextBodyHelper.type());
            SASContextBody contextBody = SASContextBodyHelper.extract(any);

            short msgType = contextBody.discriminator();
            switch (msgType) {
                case MTEstablishContext.value:
                    if (log.isDebugEnabled()) log.debug("   EstablishContext");

                    contextId = contextBody.establish_msg().client_context_id;

                    identity = tssPolicy.check(SSLSessionManager.getSSLSession(ri.request_id()), contextBody.establish_msg());

                    if (identity != null) {
                        ContextManager.registerSubject(identity);
                    } else {
                        identity = defaultSubject;
                    }

                    SASReplyManager.setSASReply(ri.request_id(), generateContextEstablished(identity, contextId, false));

                    break;

                case MTCompleteEstablishContext.value:
                    log.error("The CSIv2 TSS is not supposed to receive a CompleteEstablishContext message.");
                    throw new INTERNAL("The CSIv2 TSS is not supposed to receive a CompleteEstablishContext message.");

                case MTContextError.value:
                    log.error("The CSIv2 TSS is not supposed to receive a CompleteEstablishContext message.");
                    throw new INTERNAL("The CSIv2 TSS is not supposed to receive a ContextError message.");

                case MTMessageInContext.value:
                    log.error("The CSIv2 TSS is not supposed to receive a CompleteEstablishContext message.");

                    contextId = contextBody.in_context_msg().client_context_id;
                    throw new SASNoContextException();
            }
        } catch (BAD_PARAM e) {
            if (log.isDebugEnabled()) log.debug("No security service context found");
            identity = defaultSubject;
View Full Code Here


    public String name() {
        return "org.apache.geronimo.corba.security.ServerSecurityInterceptor";
    }

    protected SASContextBody generateContextError(SASException e, long contextId) {
        SASContextBody reply = new SASContextBody();

        reply.error_msg(new ContextError(contextId, e.getMajor(), e.getMinor(), e.getErrorToken()));

        return reply;
    }
View Full Code Here

        return reply;
    }

    protected SASContextBody generateContextEstablished(Subject identity, long contextId, boolean stateful) {
        SASContextBody reply = new SASContextBody();

        byte[] finalContextToken = null;
        Set credentials = identity.getPrivateCredentials(FinalContextToken.class);
        if (!credentials.isEmpty()) {
            try {
                FinalContextToken token = (FinalContextToken) credentials.iterator().next();
                finalContextToken = token.getToken();
                token.destroy();
            } catch (DestroyFailedException e) {
                // do nothing
            }
        }
        if (finalContextToken == null) finalContextToken = new byte[0];
        reply.complete_msg(new CompleteEstablishContext(contextId, stateful, finalContextToken));

        return reply;
    }
View Full Code Here

        return reply;
    }

    protected void insertServiceContext(ServerRequestInfo ri) {
        try {
            SASContextBody sasContextBody = SASReplyManager.clearSASReply(ri.request_id());
            if (sasContextBody != null) {
                Any any = ORB.init().create_any();
                SASContextBodyHelper.insert(any, sasContextBody);
                ri.add_reply_service_context(new ServiceContext(SecurityAttributeService.value, Util.getCodec().encode_value(any)), true);
            }
View Full Code Here

                new ContextError(0, /* context id                     */
                        1,          /* major status: invalid evidence */
                        1,          /* minor status (always 1)        */
                        encapsulatedErrorToken);

        msgBodyCtxError = new SASContextBody();
        msgBodyCtxError.error_msg(ctxError);

        // initialize msgCtx0Rejected (major status: invalid evidence).
        msgCtx0Rejected = createMsgCtxError(0, 1);

View Full Code Here

        threadLocal.sasReplyIsAccept = false;

        try {
            ServiceContext sc = ri.get_request_service_context(sasContextId);
            Any any = codec.decode_value(sc.context_data, SASContextBodyHelper.type());
            SASContextBody contextBody = SASContextBodyHelper.extract(any);

            if (contextBody != null) {
                if (contextBody.discriminator() == MTMessageInContext.value) {
                    // should not happen, as stateful context requests are always negotiated down to stateless in this implementation.
                    long contextId = contextBody.in_context_msg().client_context_id;
                    threadLocal.sasReply = createMsgCtxError(contextId, 4 /* major status: no context */);
                    throw JacORBMessages.MESSAGES.missingSASContext();
                } else if (contextBody.discriminator() == MTEstablishContext.value) {
                    EstablishContext message = contextBody.establish_msg();
                    threadLocal.contextId = message.client_context_id;
                    threadLocal.sasContextReceived = true;

                    if (message.client_authentication_token != null && message.client_authentication_token.length > 0) {
                        JacORBLogger.ROOT_LOGGER.authTokenReceived();
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().

            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

    @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.
            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);
        } catch (TypeMismatch e) {
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.