SASContextBody contextBody = new SASContextBody(); contextBody.establish_msg(message);
private static Any createMsgCtxAccepted(long contextId) { Any any = ORB.init().create_any(); synchronized (msgBodyCtxAccepted) { msgBodyCtxAccepted.complete_msg().client_context_id = contextId; SASContextBodyHelper.insert(any, msgBodyCtxAccepted); } return any; }
if (contextBody.discriminator() == MTMessageInContext.value) { long contextId = contextBody.in_context_msg().client_context_id; threadLocal.sasReply = createMsgCtxError(contextId, 4 /* major status: no context */); throw IIOPLogger.ROOT_LOGGER.missingSASContext(); } else if (contextBody.discriminator() == MTEstablishContext.value) { EstablishContext message = contextBody.establish_msg(); threadLocal.contextId = message.client_context_id; threadLocal.sasContextReceived = true;
encapsulatedErrorToken); msgBodyCtxError = new SASContextBody(); msgBodyCtxError.error_msg(ctxError);
public static org.omg.CSI.SASContextBody read (org.omg.CORBA.portable.InputStream istream) org.omg.CSI.SASContextBody value = new org.omg.CSI.SASContextBody (); short _dis0 = (short)0; _dis0 = istream.read_short (); org.omg.CSI.EstablishContext _establish_msg = null; _establish_msg = org.omg.CSI.EstablishContextHelper.read (istream); value.establish_msg (_establish_msg); break; case org.omg.CSI.MTCompleteEstablishContext.value: org.omg.CSI.CompleteEstablishContext _complete_msg = null; _complete_msg = org.omg.CSI.CompleteEstablishContextHelper.read (istream); value.complete_msg (_complete_msg); break; case org.omg.CSI.MTContextError.value: org.omg.CSI.ContextError _error_msg = null; _error_msg = org.omg.CSI.ContextErrorHelper.read (istream); value.error_msg (_error_msg); break; case org.omg.CSI.MTMessageInContext.value: org.omg.CSI.MessageInContext _in_context_msg = null; _in_context_msg = org.omg.CSI.MessageInContextHelper.read (istream); value.in_context_msg (_in_context_msg); break; default: value._default( _dis0 ) ; break;
public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CSI.SASContextBody value) { ostream.write_short (value.discriminator ()); switch (value.discriminator ()) { case org.omg.CSI.MTEstablishContext.value: org.omg.CSI.EstablishContextHelper.write (ostream, value.establish_msg ()); break; case org.omg.CSI.MTCompleteEstablishContext.value: org.omg.CSI.CompleteEstablishContextHelper.write (ostream, value.complete_msg ()); break; case org.omg.CSI.MTContextError.value: org.omg.CSI.ContextErrorHelper.write (ostream, value.error_msg ()); break; case org.omg.CSI.MTMessageInContext.value: org.omg.CSI.MessageInContextHelper.write (ostream, value.in_context_msg ()); break; } }
@Override public void receive_reply(ClientRequestInfo ri) { try { ServiceContext sc = ri.get_reply_service_context(SAS_CONTEXT_ID); 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(). IIOPLogger.ROOT_LOGGER.tracef("receive_reply: got SAS reply, type %d", contextBody.discriminator()); if (contextBody.discriminator() == MTContextError.value) { // should not happen. throw IIOPLogger.ROOT_LOGGER.unexpectedContextErrorInSASReply(0, CompletionStatus.COMPLETED_YES); } } catch (BAD_PARAM e) { // no service context with sasContextId: do nothing } catch (FormatMismatch | TypeMismatch e) { throw IIOPLogger.ROOT_LOGGER.errorParsingSASReply(e, 0, CompletionStatus.COMPLETED_YES); } }
if (contextBody.discriminator() == MTCompleteEstablishContext.value) CompleteEstablishContext reply = contextBody.complete_msg(); if (contextBody.discriminator() == MTContextError.value) ContextError reply = contextBody.error_msg();
void returnCompleteEstablishContext(ServerRequestInfo ri) { // Create CompleteEstablishContext SASContextBody sasBody = new SASContextBody(); CompleteEstablishContext completeMsg = new CompleteEstablishContext(); completeMsg.client_context_id = 0; completeMsg.context_stateful = false; completeMsg.final_context_token = EMPTY_BARR; sasBody.complete_msg(completeMsg); log.fine("Adding SASContextBody, discriminator = " + sasBody.discriminator()); ri.add_reply_service_context(encodeSASContextBody(sasBody), true); }
void returnContextError(ServerRequestInfo ri, int major, int minor) { // Create CompleteEstablishContext SASContextBody sasBody = new SASContextBody(); ContextError errorMsg = new ContextError(); errorMsg.client_context_id = 0; errorMsg.major_status = major; errorMsg.minor_status = minor; errorMsg.error_token = EMPTY_BARR; sasBody.error_msg(errorMsg); log.fine("Adding SASContextBody, discriminator = " + sasBody.discriminator()); ri.add_reply_service_context(encodeSASContextBody(sasBody), true); }
protected Any makeMessageInContext(org.omg.CORBA.ORB orb, long client_context_id, 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; }
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 { ri.add_reply_service_context(new ServiceContext(SASInitializer.SecurityAttributeService, codec.encode_value( any ) ), true); } catch (Exception e) { logger.error("Error setting reply service context:" + e); throw new org.omg.CORBA.NO_PERMISSION("SAS Error setting reply service context: " + e, MinorCodes.SAS_TSS_FAILURE, CompletionStatus.COMPLETED_MAYBE); } } return any; }
+ sasBody.discriminator()); switch (sasBody.discriminator()) { case MTCompleteEstablishContext.value: case MTContextError.value: + sasBody.discriminator()); throw new org.omg.CORBA.NO_PERMISSION("unexpected SAS message"); acceptContext(ri, sasBody.establish_msg(), support_gssup_authorization, require_gssup_authorization,
private Any createMsgCtxError(long contextId, int majorStatus) { Any any = ORB.init().create_any(); synchronized (msgBodyCtxError) { msgBodyCtxError.error_msg().client_context_id = contextId; msgBodyCtxError.error_msg().major_status = majorStatus; SASContextBodyHelper.insert(any, msgBodyCtxError); } return any; }
public void _default (short discriminator) { verifyDefault( discriminator ) ; __discriminator = discriminator ; __uninitialized = false; }
public static org.omg.CSI.SASContextBody read (org.omg.CORBA.portable.InputStream istream) org.omg.CSI.SASContextBody value = new org.omg.CSI.SASContextBody (); short _dis0 = (short)0; _dis0 = istream.read_short (); org.omg.CSI.EstablishContext _establish_msg = null; _establish_msg = org.omg.CSI.EstablishContextHelper.read (istream); value.establish_msg (_establish_msg); break; case org.omg.CSI.MTCompleteEstablishContext.value: org.omg.CSI.CompleteEstablishContext _complete_msg = null; _complete_msg = org.omg.CSI.CompleteEstablishContextHelper.read (istream); value.complete_msg (_complete_msg); break; case org.omg.CSI.MTContextError.value: org.omg.CSI.ContextError _error_msg = null; _error_msg = org.omg.CSI.ContextErrorHelper.read (istream); value.error_msg (_error_msg); break; case org.omg.CSI.MTMessageInContext.value: org.omg.CSI.MessageInContext _in_context_msg = null; _in_context_msg = org.omg.CSI.MessageInContextHelper.read (istream); value.in_context_msg (_in_context_msg); break; default: value._default( _dis0 ) ; break;
public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CSI.SASContextBody value) { ostream.write_short (value.discriminator ()); switch (value.discriminator ()) { case org.omg.CSI.MTEstablishContext.value: org.omg.CSI.EstablishContextHelper.write (ostream, value.establish_msg ()); break; case org.omg.CSI.MTCompleteEstablishContext.value: org.omg.CSI.CompleteEstablishContextHelper.write (ostream, value.complete_msg ()); break; case org.omg.CSI.MTContextError.value: org.omg.CSI.ContextErrorHelper.write (ostream, value.error_msg ()); break; case org.omg.CSI.MTMessageInContext.value: org.omg.CSI.MessageInContextHelper.write (ostream, value.in_context_msg ()); break; } }
@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(). IIOPLogger.ROOT_LOGGER.tracef("receive_reply: got SAS reply, type %d", contextBody.discriminator()); if (contextBody.discriminator() == MTContextError.value) { // should not happen. throw IIOPLogger.ROOT_LOGGER.unexpectedContextErrorInSASReply(0, CompletionStatus.COMPLETED_YES); } } catch (BAD_PARAM e) { // no service context with sasContextId: do nothing } catch (FormatMismatch e) { throw IIOPLogger.ROOT_LOGGER.errorParsingSASReply(e, 0, CompletionStatus.COMPLETED_YES); } catch (TypeMismatch e) { throw IIOPLogger.ROOT_LOGGER.errorParsingSASReply(e, 0, CompletionStatus.COMPLETED_YES); } }
if (contextBody.discriminator() == MTCompleteEstablishContext.value) CompleteEstablishContext reply = contextBody.complete_msg(); logger.debug("receive_exception MTCompleteEstablishContext: " + reply.client_context_id); if (contextBody.discriminator() == MTContextError.value) ContextError reply = contextBody.error_msg(); logger.debug("receive_exception MTContextError: " + reply.client_context_id);
protected Any makeContextError(ServerRequestInfo ri, long client_context_id, int major_status, int minor_status, byte[] error_token) { 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 { ri.add_reply_service_context(new ServiceContext(SASInitializer.SecurityAttributeService, codec.encode_value( any ) ), true); } catch (Exception e) { logger.error("Error setting reply service context:" + e); throw new org.omg.CORBA.NO_PERMISSION("SAS Error setting reply service context: " + e, MinorCodes.SAS_TSS_FAILURE, CompletionStatus.COMPLETED_MAYBE); } } return any; }