00001 00026 package org.objectweb.jonas.security.interceptors.jeremie; 00027 00028 import org.objectweb.security.propagation.SecurityReceiver; 00029 import org.objectweb.security.context.SecurityCurrent; 00030 import org.objectweb.security.context.SecurityContext; 00031 00036 public class JonasSecurityReceiver implements SecurityReceiver { 00037 00041 public JonasSecurityReceiver() { 00042 } 00043 00044 public void received_request(int request_id, SecurityContext ctx) { 00045 // Gets SecurityCurrent object (always existing in JOnAS Server) 00046 SecurityCurrent current = SecurityCurrent.getCurrent(); 00047 if (current == null) { 00048 return; 00049 } 00050 // Associates the current thread with this security context 00051 current.setSecurityContext(ctx); 00052 } 00053 00054 public SecurityContext sending_reply(int request_id) { 00055 // Gets Current object (always existing in JOnAS Server) 00056 SecurityCurrent current = SecurityCurrent.getCurrent(); 00057 if (current == null) { 00058 return null; 00059 } 00060 // Get the Security Context 00061 SecurityContext ctx = current.getSecurityContext(); 00062 // associates the current thread with a new default SecurityContext 00063 current.setSecurityContext(new SecurityContext()); 00064 //System.out.println ("JOnAS send a reply : "+ 00065 // ctx.getCallerPrincipal().getName()) ; 00066 return ctx; 00067 } 00068 }