Package org.omg.CSI

Examples of org.omg.CSI.SASContextBody


/*     */
/* 247 */       if ((identityToken != absentIdentityToken) || (encodedAuthenticationToken != noAuthenticationToken))
/*     */       {
/* 252 */         EstablishContext message = new EstablishContext(0L, noAuthorizationToken, identityToken, encodedAuthenticationToken);
/*     */
/* 259 */         SASContextBody contextBody = new SASContextBody();
/* 260 */         contextBody.establish_msg(message);
/*     */
/* 263 */         Any any = ORB.init().create_any();
/* 264 */         SASContextBodyHelper.insert(any, contextBody);
/* 265 */         ServiceContext sc = new ServiceContext(15, this.codec.encode_value(any));
/*     */
View Full Code Here


/*     */     try
/*     */     {
/* 290 */       ServiceContext sc = ri.get_reply_service_context(15);
/* 291 */       Any msg = this.codec.decode_value(sc.context_data, SASContextBodyHelper.type());
/*     */
/* 293 */       SASContextBody contextBody = SASContextBodyHelper.extract(msg);
/*     */
/* 300 */       if (traceEnabled) {
/* 301 */         log.trace("receive_reply: got SAS reply, type " + contextBody.discriminator());
/*     */       }
/*     */
/* 304 */       if (contextBody.discriminator() == 4)
/*     */       {
/* 307 */         log.warn("Unexpected ContextError in SAS reply");
/* 308 */         throw new NO_PERMISSION("Unexpected ContextError in SAS reply", 1245904897, CompletionStatus.COMPLETED_YES);
/*     */       }
/*     */
View Full Code Here

/*     */     try
/*     */     {
/* 335 */       ServiceContext sc = ri.get_reply_service_context(15);
/* 336 */       Any msg = this.codec.decode_value(sc.context_data, SASContextBodyHelper.type());
/*     */
/* 338 */       SASContextBody contextBody = SASContextBodyHelper.extract(msg);
/*     */
/* 345 */       if (traceEnabled) {
/* 346 */         log.trace("receive_exceptpion: got SAS reply, type " + contextBody.discriminator());
/*     */       }
/*     */
/*     */     }
/*     */     catch (BAD_PARAM e)
/*     */     {
View Full Code Here

        msg.authorization_token = sas_mech.encodeAuthorizationElement();
        msg.identity_token = sas_mech.encodeIdentityToken();

        ServiceContext context = new ServiceContext();

        SASContextBody sas = new SASContextBody();
        sas.establish_msg(msg);
        Any sas_any = Util.getORB().create_any();
        SASContextBodyHelper.insert(sas_any, sas);
        context.context_data = Util.getCodec().encode_value(sas_any);

        context.context_id = SecurityAttributeService.value;
View Full Code Here

            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);
                    }

                    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 ContextError 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 MessageInContext 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");
        } catch (INV_POLICY e) {
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

        }
        if (finalContextToken == null) {
            finalContextToken = new byte[0];
        }

        SASContextBody reply = new SASContextBody();
        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

                                                  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

                                                  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

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.