*/
public void userEvent(UserEvent event)
{
if ((event != null) && (event.isLoggedIn()))
{
User user = event.getUser();
ModelRequest req = null;
try
{
req = ModelTools.createModelRequest();
AuthenticationManager authMgr = (AuthenticationManager) req.getService(AuthenticationManager.ROLE,
"default");
authMgr.setUsername(user.getName());
authMgr.setPassword(event.getPlainPassword());
authMgr.setDomain("default");
UserEnvironment userEnvironment = new DefaultUserEnvironment();
Context context = new DefaultContext();
((DefaultContext) context).put(UserEnvironment.CONTEXT_KEY, userEnvironment);
authMgr.login(userEnvironment);
keelIritgoAuthMap.put(new Long(user.getUniqueId()), context);
}
catch (Exception x)
{
x.printStackTrace();
}
finally
{
ModelTools.releaseModelRequest(req);
}
}
if ((event != null) && (event.isLoggedOut()))
{
User user = event.getUser();
ModelRequest req = null;
try
{
req = ModelTools.createModelRequest();
AuthenticationManager authMgr = (AuthenticationManager) req.getService(AuthenticationManager.ROLE, "*");
authMgr.setUsername(user.getName());
authMgr.setPassword("");
authMgr.setDomain("default");
Context c = (Context) keelIritgoAuthMap.get(new Long(user.getUniqueId()));
UserEnvironment userEnv = (UserEnvironment) c.get(UserEnvironment.CONTEXT_KEY);
authMgr.logout(userEnv);
keelIritgoAuthMap.remove(user.getUniqueId());
}
catch (Exception x)
{
}
finally