1 21 package org.jacorb.orb.standardInterceptors; 22 23 import org.apache.avalon.framework.configuration.*; 24 25 import org.omg.PortableInterceptor.*; 26 import org.omg.IOP.*; 27 import org.omg.SSLIOP.*; 28 29 import org.jacorb.orb.*; 30 31 37 38 public class SSLComponentInterceptor 39 extends org.omg.CORBA.LocalObject 40 implements IORInterceptor, Configurable 41 { 42 private ORB orb = null; 43 private TaggedComponent tc = null; 44 private short supported = 0; 45 private short required = 0; 46 47 public SSLComponentInterceptor( ORB orb ) 48 throws ConfigurationException 49 { 50 this.orb = orb; 51 configure( orb.getConfiguration()); 52 } 53 54 public void configure(Configuration configuration) 55 throws ConfigurationException 56 { 57 supported = 58 Short.parseShort( 59 configuration.getAttribute("jacorb.security.ssl.server.supported_options","20"), 60 16); 62 required = 63 Short.parseShort( 64 configuration.getAttribute("jacorb.security.ssl.server.required_options","0"), 65 16); 66 67 } 68 69 public String name() 71 { 72 return "SSLComponentCreator"; 73 } 74 75 public void destroy() 76 { 77 } 78 79 83 84 98 99 public void establish_components(IORInfo info) 100 { 101 try 102 { 103 if( tc == null ) 104 { 105 SSL ssl = 106 new SSL ( supported, 107 required, 108 (short) orb.getBasicAdapter().getSSLPort()); 109 110 ssl.target_supports |= 0x80; 114 115 ssl.target_supports |= 0x20; 118 CDROutputStream sslDataStream = 119 new CDROutputStream( orb ); 120 121 sslDataStream.beginEncapsulatedArray(); 122 123 SSLHelper.write( sslDataStream , ssl ); 124 125 tc = new TaggedComponent( TAG_SSL_SEC_TRANS.value, 126 sslDataStream.getBufferCopy() ); 127 128 sslDataStream.close (); 129 sslDataStream = null; 130 } 131 132 info.add_ior_component_to_profile (tc, TAG_INTERNET_IOP.value); 133 } 134 catch (Exception e) 135 { 136 e.printStackTrace(); 138 } 139 } 140 } | Popular Tags |