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