On Friday 16 September 2005 01:26 pm, Achmad Arif Rachim wrote: > Hi andy, > > Im using your suggestion to use SecurityFacade. i found very interesting > result, yes its working but not 100% well. Every successfull invocations > theres periode where AuthenticationCredentialsNotFoundException thrown. I > found every 16 successful invocation always have one failed down :( > > I think the problem becouse we can only invoke > securityFacade.authenticateUser inside targetMethod. Im using > methodSecurityInterceptor with commons-attributes, so it will intercept any > kind of method before they were being called. the issue will be "how to > intercept QUARTZ targetMethod before invoked" so i can call > securityFacade.authenticateUser. > > Wish Ben can help me on this. >
As I said, I'm not yet familiar with Quartz, but it sounds like it is calling a target method on some object. If I understand your problem correctly, then you are asking Quartz to invoke a target method that happens to be secured (MethodSecurityInterceptor?) by Acegi. So, by the time you get "inside" your target method, Acegi has already tried to authenticate the user. If this is all true, then why not have Quartz call some other object that then calls your target method? For example: ---- public class SomeOtherObject { private ActualObject actualSecuredObject; private SecurityFacade securityFacade; public void targetMethod(... args ....) { securityFacade.authenticateUser(subsystemUserName, subsystemCredentials); try { actualSecuredObject.actualTargetMethod(... pass in args ...); } finally { securityFacade.unauthenticateUser(); } } public void setActualSecuredObject(ActualObject ao) { ... } public ActualObject getActualSecuredObject() { ... } public void setSecurityFacade(SecurityFacade sf) { ... } public SecurityFacade getSecurityFacade() { ... } } ---- You could instantiate this in Spring: ---- <bean id="quartzObject" class="...SomeOtherObject"> <property name="actualSecuredObject" ref="someSecuredObject"/> <property name="securityFacade" ref="securityFacade"/> </bean> --- Now, just pass a reference to "quartzObject" to Quartz instead of "someSecuredObject". This is, of course, a very concrete example, but it could easily be made generic by employing interfaces, JDK Proxy, or even Spring's AOP. - Andy ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ Home: http://acegisecurity.sourceforge.net Acegisecurity-developer mailing list Acegisecurity-developer@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer