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