CorbaServerSecurityInterceptor.java

00001 
00021 package org.objectweb.jonas.security.interceptors.iiop;
00022 
00023 import org.omg.IOP.ServiceContext;
00024 import org.omg.PortableInterceptor.ForwardRequest;
00025 import org.omg.PortableInterceptor.ORBInitInfo;
00026 import org.omg.PortableInterceptor.ServerRequestInfo;
00027 import org.omg.PortableInterceptor.ServerRequestInterceptor;
00028 
00029 import org.objectweb.security.context.SecurityContext;
00030 import org.objectweb.security.context.SecurityCurrent;
00031 
00038 public class CorbaServerSecurityInterceptor extends SecurityInterceptor implements ServerRequestInterceptor {
00039 
00043     private String interceptorName = "CorbaServerSecurityInteceptor";
00044 
00048     private SecurityContext sCtx = null;
00049 
00053     public CorbaServerSecurityInterceptor(ORBInitInfo info) {
00054     }
00055 
00060     public String name() {
00061         return interceptorName;
00062     }
00063 
00069     public void receive_request_service_contexts(ServerRequestInfo jri) throws ForwardRequest {
00070         // Gets SecurityCurrent object (always existing in JOnAS Server)
00071         SecurityCurrent current = SecurityCurrent.getCurrent();
00072         if (current != null) {
00073             try {
00074                 ServiceContext serviceCtx = (ServiceContext) jri.get_request_service_context(SEC_CTX_ID);
00075                 if (serviceCtx != null) {
00076                     sCtx = unmarshallSecurityContext(serviceCtx.context_data);
00077                 }
00078             } catch (org.omg.CORBA.BAD_PARAM e) {
00079                 // No Security context, do nothing
00080             }
00081         }
00082     }
00083 
00089     public void receive_request(ServerRequestInfo jri) throws ForwardRequest {
00090         SecurityCurrent current = SecurityCurrent.getCurrent();
00091         if ((current != null) && (sCtx != null)) {
00092             // put into the the Current object
00093             current.setSecurityContext(sCtx);
00094             sCtx = null;
00095         }
00096     }
00097 
00103     public void send_reply(ServerRequestInfo jri) {
00104     }
00105 
00106     public void send_exception(ServerRequestInfo jri) throws ForwardRequest {
00107     }
00108 
00109     public void send_other(ServerRequestInfo jri) throws ForwardRequest {
00110     }
00111 
00112     public void destroy() {
00113     }
00114 }

Generated on Tue Feb 15 15:05:21 2005 for JOnAS by  doxygen 1.3.9.1