boolean success = userManager.authenticate(username, password);
if (success)
{
Set principals = new PrincipalsSet();
Subject subject = new Subject(true, principals, new HashSet(), new HashSet());
UserPrincipal userPrincipal = new UserSubjectPrincipalImpl(username, subject);
principals.add(userPrincipal);
sRequest = wrapperRequest((HttpServletRequest)request, userPrincipal);
request.getSession().removeAttribute(LoginConstants.ERRORCODE);
HttpSession session = request.getSession(true);
session.setAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT, subject);