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 public class TestSecurityComponent implements Callable
23 {
24 protected static final Log logger = LogFactory.getLog(TestSecurityComponent.class);
25
26 public Object onCall(MuleEventContext eventContext) throws Exception
27 {
28 SecurityContext securityContext = eventContext.getSession().getSecurityContext();
29 Authentication authentication = securityContext.getAuthentication();
30
31 int numberLogins = (Integer) authentication.getProperties().get(TestSingleUserSecurityProvider.PROPERTY_NUMBER_LOGINS);
32 String favoriteColor = (String) authentication.getProperties().get(TestSingleUserSecurityProvider.PROPERTY_FAVORITE_COLOR);
33
34 String msg = "user = " + authentication.getPrincipal() + ", logins = " + numberLogins + ", color = " + favoriteColor;
35 logger.debug(msg);
36 return msg;
37 }
38 }
39
40