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
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
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
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 }