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; }
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; }
@Override public int get_incoming_identity_token_type() { return this.serverInterceptor.getIncomingIdentity().discriminator(); }
GSS_NT_ExportedNameHelper.insert(any, encodedName); try { encapsulatedEncodedName = codec.encode_value(any); identityToken = new IdentityToken(); identityToken.principal_name(encapsulatedEncodedName); } else if ((secMech.sas_context_mech.supported_identity_types & ITTAnonymous.value) != 0) { identityToken = new IdentityToken(); identityToken.anonymous(true); EstablishContext message = new EstablishContext(0, // stateless ctx id noAuthorizationToken, identityToken, encodedAuthenticationToken); SASContextBody contextBody = new SASContextBody(); contextBody.establish_msg(message); SASContextBodyHelper.insert(any, contextBody); ServiceContext sc = new ServiceContext(sasContextId, codec.encode_value(any)); ri.add_request_service_context(sc, true /*replace existing context*/);
Any any = codec.decode_value(sc.context_data, SASContextBodyHelper.type()); SASContextBody contextBody = SASContextBodyHelper.extract(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; IIOPLogger.ROOT_LOGGER.trace("Received identity token"); threadLocal.incomingIdentity = message.identity_token; if (message.identity_token.discriminator() == ITTPrincipalName.value) { Any a = codec.decode_value(message.identity_token.principal_name(), GSS_NT_ExportedNameHelper.type()); byte[] encodedName = GSS_NT_ExportedNameHelper.extract(a);
@Override public void receive_exception(ClientRequestInfo ri) throws ForwardRequest { 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 may contain 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. IIOPLogger.ROOT_LOGGER.tracef("receive_exception: got SAS reply, type %d", contextBody.discriminator()); } catch (BAD_PARAM e) { // no service context with sasContextId: do nothing. } catch (FormatMismatch | TypeMismatch e) { throw IIOPLogger.ROOT_LOGGER.errorParsingSASReply(e, 0, CompletionStatus.COMPLETED_MAYBE); } }
EstablishContext message = new EstablishContext(0, // stateless ctx id noAuthorizationToken, absentIdentityToken, encodedAuthenticationToken); SASContextBody contextBody = new SASContextBody(); contextBody.establish_msg(message); SASContextBodyHelper.insert(any, contextBody); ServiceContext sc = new ServiceContext(sasContextId, codec.encode_value(any)); ri.add_request_service_context(sc, true /*replace existing context*/);
new ContextError(0, /* context id */ 1, /* major status: invalid evidence */ 1, /* minor status (always 1) */ encapsulatedErrorToken); msgBodyCtxError = new SASContextBody(); msgBodyCtxError.error_msg(ctxError);
public static org.omg.CSI.EstablishContext read (final org.omg.CORBA.portable.InputStream in) { org.omg.CSI.EstablishContext result = new org.omg.CSI.EstablishContext(); result.client_context_id=in.read_ulonglong(); result.authorization_token = org.omg.CSI.AuthorizationTokenHelper.read(in); result.identity_token=org.omg.CSI.IdentityTokenHelper.read(in); result.client_authentication_token = org.omg.CSI.GSSTokenHelper.read(in); return result; } public static void write (final org.omg.CORBA.portable.OutputStream out, final org.omg.CSI.EstablishContext s)
public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CSI.EstablishContext value) { ostream.write_ulonglong (value.client_context_id); org.omg.CSI.AuthorizationTokenHelper.write (ostream, value.authorization_token); org.omg.CSI.IdentityTokenHelper.write (ostream, value.identity_token); org.omg.CSI.GSSTokenHelper.write (ostream, value.client_authentication_token); }
GSS_NT_ExportedNameHelper.insert(any, encodedName); try { encapsulatedEncodedName = codec.encode_value(any); identityToken = new IdentityToken(); identityToken.principal_name(encapsulatedEncodedName); } else if ((secMech.sas_context_mech.supported_identity_types & ITTAnonymous.value) != 0) { identityToken = new IdentityToken(); identityToken.anonymous(true); EstablishContext message = new EstablishContext(0, // stateless ctx id NO_AUTHORIZATION_TOKEN, identityToken, encodedAuthenticationToken); SASContextBody contextBody = new SASContextBody(); contextBody.establish_msg(message); SASContextBodyHelper.insert(any, contextBody); ServiceContext sc = new ServiceContext(SAS_CONTEXT_ID, codec.encode_value(any)); ri.add_request_service_context(sc, true /*replace existing context*/);
@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); } }
public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.GSSUP.InitialContextToken value) { org.omg.CSI.UTF8StringHelper.write (ostream, value.username); org.omg.CSI.UTF8StringHelper.write (ostream, value.password); org.omg.CSI.GSS_NT_ExportedNameHelper.write (ostream, value.target_name); }
@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); } }
@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); } }
public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.GSSUP.InitialContextToken value) { org.omg.CSI.UTF8StringHelper.write (ostream, value.username); org.omg.CSI.UTF8StringHelper.write (ostream, value.password); org.omg.CSI.GSS_NT_ExportedNameHelper.write (ostream, value.target_name); }
@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 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. IIOPLogger.ROOT_LOGGER.tracef("receive_exception: got SAS reply, type %d", contextBody.discriminator()); } catch (BAD_PARAM e) { // no service context with sasContextId: do nothing. } catch (FormatMismatch e) { throw IIOPLogger.ROOT_LOGGER.errorParsingSASReply(e, 0, CompletionStatus.COMPLETED_MAYBE); } catch (TypeMismatch e) { throw IIOPLogger.ROOT_LOGGER.errorParsingSASReply(e, 0, CompletionStatus.COMPLETED_MAYBE); } }
@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 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. IIOPLogger.ROOT_LOGGER.tracef("receive_exception: got SAS reply, type %d", contextBody.discriminator()); } catch (BAD_PARAM e) { // no service context with sasContextId: do nothing. } catch (FormatMismatch e) { throw IIOPLogger.ROOT_LOGGER.errorParsingSASReply(e, 0, CompletionStatus.COMPLETED_MAYBE); } catch (TypeMismatch e) { throw IIOPLogger.ROOT_LOGGER.errorParsingSASReply(e, 0, CompletionStatus.COMPLETED_MAYBE); } }