ServerSecurityInterceptor.java

00001 
00026 package org.objectweb.jonas.security.interceptors.jrmp;
00027 
00028 import java.io.IOException;
00029 
00030 import org.objectweb.security.context.SecurityCurrent;
00031 import org.objectweb.security.context.SecurityContext;
00032 
00033 //carol JRMP Interceptor API Import
00034 import org.objectweb.carol.rmi.jrmp.interceptor.JServerRequestInterceptor;
00035 import org.objectweb.carol.rmi.jrmp.interceptor.JServerRequestInfo;
00036 
00045 public class ServerSecurityInterceptor implements JServerRequestInterceptor {
00046 
00050     public static int SEC_CTX_ID = 1;
00051 
00055     private String interceptorName = "ServerSecurityInterceptor";
00056 
00060     public ServerSecurityInterceptor() {
00061     }
00062 
00068     public void receive_request(JServerRequestInfo jri) throws IOException {
00069         // Gets SecurityCurrent object (always existing in JOnAS Server)
00070         SecurityCurrent current = SecurityCurrent.getCurrent();
00071         if (current != null) {
00072             SecurityServiceContext sctx = (SecurityServiceContext) jri.get_request_service_context(SEC_CTX_ID);
00073             if (sctx != null) {
00074                 // put into the the Current object (true for client side context
00075                 current.setSecurityContext(sctx.getSecurityContext());
00076             }
00077         }
00078     }
00079 
00085     public void send_reply(JServerRequestInfo jri) throws IOException {
00086         SecurityCurrent current = SecurityCurrent.getCurrent();
00087         if (current != null) {
00088             current.setSecurityContext(new SecurityContext());
00089         }
00090     }
00091 
00096     public String name() {
00097         return interceptorName;
00098     }
00099 
00100     public void send_exception(JServerRequestInfo jri) throws IOException {
00101     }
00102 
00103     public void send_other(JServerRequestInfo jri) throws IOException {
00104     }
00105 }

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