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