1 25 26 package org.objectweb.easybeans.security.interceptors; 27 28 import javax.security.auth.Subject ; 29 30 import org.objectweb.easybeans.api.EasyBeansInterceptor; 31 import org.objectweb.easybeans.api.EasyBeansInvocationContext; 32 import org.objectweb.easybeans.security.propagation.context.SecurityCurrent; 33 34 38 public class RunAsAccessInterceptor implements EasyBeansInterceptor { 39 40 47 public Object intercept(final EasyBeansInvocationContext invocationContext) throws Exception { 48 Subject runAsSubject = invocationContext.getFactory().getBeanInfo().getSecurityInfo().getRunAsSubject(); 49 Subject previousSubject = SecurityCurrent.getCurrent().getSecurityContext().enterRunAs(runAsSubject); 50 try { 51 return invocationContext.proceed(); 52 } finally { 53 SecurityCurrent.getCurrent().getSecurityContext().endsRunAs(previousSubject); 54 } 55 } 56 } 57 | Popular Tags |