1
2
3
4
5
6
7
8
9
10
11 package org.mule.extras.acegi;
12
13 import org.mule.umo.security.UMOAuthentication;
14 import org.mule.umo.security.UMOSecurityContext;
15
16 import org.acegisecurity.context.SecurityContext;
17 import org.acegisecurity.context.SecurityContextHolder;
18
19
20
21
22
23
24 public class AcegiSecurityContext implements UMOSecurityContext
25 {
26 private SecurityContext delegate;
27 private AcegiAuthenticationAdapter authentication;
28
29 public AcegiSecurityContext(SecurityContext delegate)
30 {
31 this.delegate = delegate;
32 SecurityContextHolder.setContext(this.delegate);
33 }
34
35 public void setAuthentication(UMOAuthentication authentication)
36 {
37 this.authentication = ((AcegiAuthenticationAdapter)authentication);
38 delegate.setAuthentication(this.authentication.getDelegate());
39 SecurityContextHolder.setContext(delegate);
40 }
41
42 public UMOAuthentication getAuthentication()
43 {
44 return this.authentication;
45 }
46 }