1 10 11 package org.mule.extras.acegi; 12 13 import org.acegisecurity.context.SecurityContext; 14 import org.acegisecurity.context.SecurityContextHolder; 15 import org.acegisecurity.context.SecurityContextImpl; 16 import org.mule.umo.security.UMOAuthentication; 17 import org.mule.umo.security.UMOSecurityContext; 18 import org.mule.umo.security.UMOSecurityContextFactory; 19 20 24 public class AcegiSecurityContextFactory implements UMOSecurityContextFactory 25 { 26 public UMOSecurityContext create(UMOAuthentication authentication) 27 { 28 SecurityContext context = new SecurityContextImpl(); 29 context.setAuthentication(((AcegiAuthenticationAdapter)authentication).getDelegate()); 30 31 if (authentication.getProperties() != null) 32 { 33 if ((authentication.getProperties().containsKey("securityMode"))) 34 { 35 SecurityContextHolder.setStrategyName((String )authentication.getProperties().get( 36 "securityMode")); 37 } 38 } 39 SecurityContextHolder.setContext(context); 40 return new AcegiSecurityContext(context); 41 } 42 } 43 | Popular Tags |