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