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.context.SecurityContextHolder; |
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
public class SpringSecurityContext implements SecurityContext |
24 | |
{ |
25 | |
private org.springframework.security.context.SecurityContext delegate; |
26 | |
private SpringAuthenticationAdapter authentication; |
27 | |
|
28 | |
public SpringSecurityContext(org.springframework.security.context.SecurityContext delegate) |
29 | 0 | { |
30 | 0 | this.delegate = delegate; |
31 | 0 | SecurityContextHolder.setContext(this.delegate); |
32 | 0 | } |
33 | |
|
34 | |
public void setAuthentication(Authentication authentication) |
35 | |
{ |
36 | 0 | this.authentication = ((SpringAuthenticationAdapter)authentication); |
37 | 0 | delegate.setAuthentication(this.authentication.getDelegate()); |
38 | 0 | SecurityContextHolder.setContext(delegate); |
39 | 0 | } |
40 | |
|
41 | |
public Authentication getAuthentication() |
42 | |
{ |
43 | 0 | return this.authentication; |
44 | |
} |
45 | |
} |