1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.tck.security; |
12 | |
|
13 | |
|
14 | |
import org.mule.api.MuleEventContext; |
15 | |
import org.mule.api.lifecycle.Callable; |
16 | |
import org.mule.api.security.Authentication; |
17 | |
import org.mule.api.security.SecurityContext; |
18 | |
|
19 | |
import org.apache.commons.logging.Log; |
20 | |
import org.apache.commons.logging.LogFactory; |
21 | |
|
22 | 0 | public class TestSecurityComponent implements Callable |
23 | |
{ |
24 | 0 | protected static final Log logger = LogFactory.getLog(TestSecurityComponent.class); |
25 | |
|
26 | |
public Object onCall(MuleEventContext eventContext) throws Exception |
27 | |
{ |
28 | 0 | SecurityContext securityContext = eventContext.getSession().getSecurityContext(); |
29 | 0 | Authentication authentication = securityContext.getAuthentication(); |
30 | |
|
31 | 0 | int numberLogins = (Integer) authentication.getProperties().get(TestSingleUserSecurityProvider.PROPERTY_NUMBER_LOGINS); |
32 | 0 | String favoriteColor = (String) authentication.getProperties().get(TestSingleUserSecurityProvider.PROPERTY_FAVORITE_COLOR); |
33 | |
|
34 | 0 | String msg = "user = " + authentication.getPrincipal() + ", logins = " + numberLogins + ", color = " + favoriteColor; |
35 | 0 | logger.debug(msg); |
36 | 0 | return msg; |
37 | |
} |
38 | |
} |
39 | |
|
40 | |
|