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 | 0 | { |
31 | 0 | this.delegate = delegate; |
32 | 0 | SecurityContextHolder.setContext(this.delegate); |
33 | 0 | } |
34 | |
|
35 | |
public void setAuthentication(UMOAuthentication authentication) |
36 | |
{ |
37 | 0 | this.authentication = ((AcegiAuthenticationAdapter)authentication); |
38 | 0 | delegate.setAuthentication(this.authentication.getDelegate()); |
39 | 0 | SecurityContextHolder.setContext(delegate); |
40 | 0 | } |
41 | |
|
42 | |
public UMOAuthentication getAuthentication() |
43 | |
{ |
44 | 0 | return this.authentication; |
45 | |
} |
46 | |
} |