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