@Override public void send_reply(ServerRequestInfo ri) { IIOPLogger.ROOT_LOGGER.tracef("send_reply: %s", ri.operation()); CurrentRequestInfo threadLocal = (CurrentRequestInfo) threadLocalData.get(); if (threadLocal.sasReply != null) { try { ServiceContext sc = new ServiceContext(sasContextId, codec.encode_value(threadLocal.sasReply)); ri.add_reply_service_context(sc, true); } catch (InvalidTypeForEncoding e) { throw IIOPLogger.ROOT_LOGGER.unexpectedException(e); } } }
InitialContextTokenHelper.insert(any, authToken); try { out = codec.encode_value(any); } catch (Exception e) { return new byte[0];
@Override public void send_exception(ServerRequestInfo ri) { IIOPLogger.ROOT_LOGGER.tracef("send_exception: %s", ri.operation()); CurrentRequestInfo threadLocal = (CurrentRequestInfo) threadLocalData.get(); // The check below was added for interoperability with IONA's ASP 6.0, which throws an // ArrayIndexOutOfBoundsException when it receives an IIOP reply carrying both an application exception // and a SAS reply CompleteEstablishContext. The flag serves the purpose of refraining fromsending an SAS // accept (CompleteEstablishContext) reply together with an exception. // // The CSIv2 spec does not explicitly disallow an SAS accept in an IIOP exception reply. boolean interopIONA = Boolean.valueOf(CorbaORBService.getORBProperty(Constants.INTEROP_IONA)); if (threadLocal.sasReply != null && !interopIONA) { try { ServiceContext sc = new ServiceContext(sasContextId, codec.encode_value(threadLocal.sasReply)); ri.add_reply_service_context(sc, true); } catch (InvalidTypeForEncoding e) { throw IIOPLogger.ROOT_LOGGER.unexpectedException(e); } } }
public void establish_components(IORInfo info) { try { // Invocation Policy = EITHER Any any = ORB.init().create_any(); any.insert_short(EITHER); byte[] taggedComponentData = codec.encode_value(any); info.add_ior_component(new TaggedComponent(TAG_INV_POLICY, taggedComponentData)); // OTS Policy = ADAPTS any = ORB.init().create_any(); any.insert_short(ADAPTS); taggedComponentData = codec.encode_value(any); info.add_ior_component(new TaggedComponent(TAG_OTS_POLICY, taggedComponentData)); } catch (InvalidTypeForEncoding e) { throw IIOPLogger.ROOT_LOGGER.errorEncodingContext(e); } } }
ServiceContext sc = new ServiceContext(sasContextId, codec.encode_value(any)); ri.add_request_service_context(sc, true /*replace existing context*/);
/** * <p> * Creates an instance of {@code CSIv2IORInterceptor} with the specified codec. * </p> * * @param codec the {@code Codec} used to encode the IOR security components. */ public CSIv2IORInterceptor(Codec codec) { String sslPortString = CorbaORBService.getORBProperty(Constants.ORB_SSL_PORT); int sslPort = sslPortString == null ? 0 : Integer.parseInt(sslPortString); try { SSL ssl = new SSL((short) MIN_SSL_OPTIONS, (short) 0, /* required options */ (short) sslPort); ORB orb = ORB.init(); Any any = orb.create_any(); SSLHelper.insert(any, ssl); byte[] componentData = codec.encode_value(any); defaultSSLComponent = new TaggedComponent(TAG_SSL_SEC_TRANS.value, componentData); IORSecurityConfigMetaData iorSecurityConfigMetaData = IORSecConfigMetaDataService.getCurrent(); if (iorSecurityConfigMetaData == null) iorSecurityConfigMetaData = new IORSecurityConfigMetaData(); defaultCSIComponent = CSIv2Util.createSecurityTaggedComponent(iorSecurityConfigMetaData, codec, sslPort, orb); } catch (InvalidTypeForEncoding e) { throw IIOPLogger.ROOT_LOGGER.unexpectedException(e); } }
GSS_NT_ExportedNameHelper.insert(any, encodedName); try { encapsulatedEncodedName = codec.encode_value(any); } catch (InvalidTypeForEncoding e) { throw IIOPLogger.ROOT_LOGGER.unexpectedException(e); ServiceContext sc = new ServiceContext(sasContextId, codec.encode_value(any)); ri.add_request_service_context(sc, true /*replace existing context*/);
Any any = orb.create_any(); CompoundSecMechListHelper.insert(any, csmList); byte[] b = codec.encode_value(any); tc = new TaggedComponent(TAG_CSI_SEC_MECH_LIST.value, b); } catch (InvalidTypeForEncoding e) {
encapsulatedErrorToken = codec.encode_value(any); } catch (InvalidTypeForEncoding e) { throw IIOPLogger.ROOT_LOGGER.unexpectedException(e);
Any any = orb.create_any(); SSLHelper.insert(any, ssl); byte[] componentData = codec.encode_value(any); tc = new TaggedComponent(TAG_SSL_SEC_TRANS.value, componentData); } catch (InvalidTypeForEncoding e) {
Any any = orb.create_any(); TLS_SEC_TRANSHelper.insert(any, tst); byte[] b = codec.encode_value(any); tc = new TaggedComponent(TAG_TLS_SEC_TRANS.value, b); } catch (InvalidTypeForEncoding e) {
GSS_NT_ExportedNameHelper.insert(any, encodedName); try { encapsulatedEncodedName = codec.encode_value(any); } catch (InvalidTypeForEncoding e) { throw IIOPLogger.ROOT_LOGGER.unexpectedException(e); ServiceContext sc = new ServiceContext(SAS_CONTEXT_ID, codec.encode_value(any)); ri.add_request_service_context(sc, true /*replace existing context*/);
@Override public byte[] run() throws org.omg.CORBA.UserException { return _codec.encode_value(finalData); } });
/** * CDR encode a SAS Context body and then construct a service context * element. */ private ServiceContext createSvcContext(SASContextBody sasctxtbody, ORB orb) { ServiceContext sc = null; Any a = orb.create_any(); SASContextBodyHelper.insert(a, sasctxtbody); byte[] cdr_encoded_saselm = {}; try { cdr_encoded_saselm = codec.encode_value(a); } catch (Exception e) { _logger.log(Level.SEVERE,"iiop.encode_exception",e); } sc = new ServiceContext(); sc.context_id = SECURITY_ATTRIBUTE_SERVICE_ID; sc.context_data = cdr_encoded_saselm; return sc; }
@Override public void send_reply(ServerRequestInfo ri) { IIOPLogger.ROOT_LOGGER.tracef("send_reply: %s", ri.operation()); CurrentRequestInfo threadLocal = (CurrentRequestInfo) threadLocalData.get(); if (threadLocal.sasReply != null) { try { ServiceContext sc = new ServiceContext(sasContextId, codec.encode_value(threadLocal.sasReply)); ri.add_reply_service_context(sc, true); } catch (InvalidTypeForEncoding e) { throw IIOPLogger.ROOT_LOGGER.unexpectedException(e); } } }
@Override public void send_reply(ServerRequestInfo ri) { IIOPLogger.ROOT_LOGGER.tracef("send_reply: %s", ri.operation()); CurrentRequestInfo threadLocal = (CurrentRequestInfo) threadLocalData.get(); if (threadLocal.sasReply != null) { try { ServiceContext sc = new ServiceContext(sasContextId, codec.encode_value(threadLocal.sasReply)); ri.add_reply_service_context(sc, true); } catch (InvalidTypeForEncoding e) { throw IIOPLogger.ROOT_LOGGER.unexpectedException(e); } } }
@Override public void send_exception(ServerRequestInfo ri) { IIOPLogger.ROOT_LOGGER.tracef("send_exception: %s", ri.operation()); CurrentRequestInfo threadLocal = (CurrentRequestInfo) threadLocalData.get(); // The check below was added for interoperability with IONA's ASP 6.0, which throws an // ArrayIndexOutOfBoundsException when it receives an IIOP reply carrying both an application exception // and a SAS reply CompleteEstablishContext. The flag serves the purpose of refraining fromsending an SAS // accept (CompleteEstablishContext) reply together with an exception. // // The CSIv2 spec does not explicitly disallow an SAS accept in an IIOP exception reply. boolean interopIONA = Boolean.valueOf(CorbaORBService.getORBProperty(Constants.INTEROP_IONA)); if (threadLocal.sasReply != null && !interopIONA) { try { ServiceContext sc = new ServiceContext(sasContextId, codec.encode_value(threadLocal.sasReply)); ri.add_reply_service_context(sc, true); } catch (InvalidTypeForEncoding e) { throw IIOPLogger.ROOT_LOGGER.unexpectedException(e); } } }
public void establish_components(IORInfo info) { try { // Invocation Policy = EITHER Any any = ORB.init().create_any(); any.insert_short(EITHER); byte[] taggedComponentData = codec.encode_value(any); info.add_ior_component(new TaggedComponent(TAG_INV_POLICY, taggedComponentData)); // OTS Policy = ADAPTS any = ORB.init().create_any(); any.insert_short(ADAPTS); taggedComponentData = codec.encode_value(any); info.add_ior_component(new TaggedComponent(TAG_OTS_POLICY, taggedComponentData)); } catch (InvalidTypeForEncoding e) { throw IIOPLogger.ROOT_LOGGER.errorEncodingContext(e); } } }
public void establish_components(IORInfo info) { try { // Invocation Policy = EITHER Any any = ORB.init().create_any(); any.insert_short(EITHER); byte[] taggedComponentData = codec.encode_value(any); info.add_ior_component(new TaggedComponent(TAG_INV_POLICY, taggedComponentData)); // OTS Policy = ADAPTS any = ORB.init().create_any(); any.insert_short(ADAPTS); taggedComponentData = codec.encode_value(any); info.add_ior_component(new TaggedComponent(TAG_OTS_POLICY, taggedComponentData)); } catch (InvalidTypeForEncoding e) { throw IIOPLogger.ROOT_LOGGER.errorEncodingContext(e); } } }
ServiceContext encodeSASContextBody(SASContextBody sasBody) { // // Create encapsulation for SAS context body // Any a = getOrb().create_any(); SASContextBodyHelper.insert(a, sasBody); // wrap the ANY in an encapsulation byte[] data; try { data = codec.encode_value(a); } catch (UserException ex) { MARSHAL me = new MARSHAL("cannot encode local security descriptor", 0, CompletionStatus.COMPLETED_NO); me.initCause(ex); throw me; } return new ServiceContext(SecurityAttributeService.value, data); }