1 22 package org.jboss.iiop.csiv2; 23 24 32 33 import org.omg.CORBA.LocalObject ; 34 import org.omg.IOP.Codec ; 35 import org.omg.IOP.ENCODING_CDR_ENCAPS ; 36 import org.omg.IOP.Encoding ; 37 import org.omg.PortableInterceptor.ORBInitInfo ; 38 import org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName ; 39 import org.omg.PortableInterceptor.ORBInitializer ; 40 41 import org.jboss.ejb.plugins.SecurityInterceptor; 42 import org.jboss.system.Registry; 43 44 51 public class SASInitializer 52 extends LocalObject 53 implements ORBInitializer 54 { 55 56 public SASInitializer() 57 { 58 } 60 61 63 public void pre_init(ORBInitInfo info) 64 { 65 try 66 { 67 SASCurrent sasCurrent = new SASCurrentImpl(); 69 info.register_initial_reference("SASCurrent", sasCurrent); 70 } 71 catch(InvalidName e) 72 { 73 throw new RuntimeException ("Could not register initial " + 74 "reference for SASCurrent: " + e); 75 } 76 } 77 78 public void post_init(ORBInitInfo info) 79 { 80 try 81 { 82 Encoding encoding = new Encoding (ENCODING_CDR_ENCAPS.value, 84 (byte) 1, 85 (byte) 0 ); 86 Codec codec = info.codec_factory().create_codec(encoding); 87 88 SASClientIdentityInterceptor clientInterceptor = 90 new SASClientIdentityInterceptor(codec); 91 info.add_client_request_interceptor(clientInterceptor); 92 93 SASTargetInterceptor serverInterceptor = 95 new SASTargetInterceptor(codec); 96 info.add_server_request_interceptor(serverInterceptor); 97 98 org.omg.CORBA.Object obj = 100 info.resolve_initial_references("SASCurrent"); 101 final SASCurrentImpl sasCurrentImpl = (SASCurrentImpl) obj; 102 sasCurrentImpl.init(serverInterceptor); 103 104 Registry.bind(SecurityInterceptor.AuthenticationObserver.KEY, 107 new SecurityInterceptor.AuthenticationObserver() { 108 public void authenticationFailed() 109 { 110 sasCurrentImpl.reject_incoming_context(); 111 } 112 }); 113 } 114 catch(Exception e) 115 { 116 throw new RuntimeException ("Unexpected " + e); 117 } 118 } 119 120 } 121 | Popular Tags |