1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.module.acegi; |
12 | |
|
13 | |
import org.mule.api.security.Authentication; |
14 | |
import org.mule.api.security.SecurityContext; |
15 | |
import org.mule.api.security.SecurityContextFactory; |
16 | |
|
17 | |
import org.acegisecurity.context.SecurityContextHolder; |
18 | |
import org.acegisecurity.context.SecurityContextImpl; |
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | 116 | public class AcegiSecurityContextFactory implements SecurityContextFactory |
25 | |
{ |
26 | |
public SecurityContext create(Authentication authentication) |
27 | |
{ |
28 | 22 | org.acegisecurity.context.SecurityContext context = new SecurityContextImpl(); |
29 | 22 | context.setAuthentication(((AcegiAuthenticationAdapter)authentication).getDelegate()); |
30 | |
|
31 | 22 | if (authentication.getProperties() != null) |
32 | |
{ |
33 | 4 | if ((authentication.getProperties().containsKey("securityMode"))) |
34 | |
{ |
35 | 4 | SecurityContextHolder.setStrategyName((String)authentication.getProperties().get( |
36 | |
"securityMode")); |
37 | |
} |
38 | |
} |
39 | 22 | SecurityContextHolder.setContext(context); |
40 | 22 | return new AcegiSecurityContext(context); |
41 | |
} |
42 | |
} |