03-16-2010 05:00 PM
authComponent.setCurrentUser(crowdUser);
UserTransaction tx = transactionService.getUserTransaction();
NodeRef homeSpaceRef = null;
User user;
try {
tx.begin();
user = new User(userName, authService.getCurrentTicket(), personService.getPerson(crowdUser));
homeSpaceRef = (NodeRef) nodeService.getProperty(personService.getPerson(crowdUser), ContentModel.PROP_HOMEFOLDER);
if(homeSpaceRef == null) {
logger.warn("Home Folder is null for user '" + crowdUser + "', using company_home.");
homeSpaceRef = (NodeRef) nodeService.getRootNode(Repository.getStoreRef());
}
user.setHomeSpaceId(homeSpaceRef.getId());
tx.commit();
} catch (Throwable ex) {
logger.error(ex);
try {
tx.rollback();
} catch (Exception ex2) {
logger.error("Failed to rollback transaction", ex2);
}
if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
} else {
throw new RuntimeException("Failed to set authenticated user", ex);
}
}
httpSess.setAttribute(AuthenticationHelper.AUTHENTICATION_USER, user);
httpSess.setAttribute(LoginBean.LOGIN_EXTERNAL_AUTH, Boolean.TRUE);
if(req.getRequestURI().endsWith(getLoginPage()) == true) {
res.sendRedirect(req.getContextPath() + "/faces/jsp/browse/browse.jsp");
return;
}
else {
fc.doFilter(req, res);
return;
}
UserFactory userFactory = FrameworkHelper.getUserFactory();
boolean authenticated = userFactory.authenticate(req, userName, "mypassword123!");
if (authenticated) {
AuthenticationUtil.login(req, res, userName);
}
03-18-2010 03:32 PM
05-25-2010 04:50 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.