AuthenticationService auth = (AuthenticationService) ctx.getBean("AuthenticationService");
auth.validate(user.getTicket());
// save last username into portlet preferences, get from
// LoginBean state
LoginBean loginBean = (LoginBean) request.getPortletSession().getAttribute(AuthenticationHelper.LOGIN_BEAN);
if (loginBean != null) {
// TODO: Need to login to the Portal to get a user
// here to store prefs against
// so not really a suitable solution as they get
// thrown away at present!
// Also would need to store prefs PER user - so auto
// login for each...?
String oldValue = request.getPreferences().getValue(PREF_ALF_USERNAME, null);
if (oldValue == null || oldValue.equals(loginBean.getUsernameInternal()) == false) {
if (request.getPreferences().isReadOnly(PREF_ALF_USERNAME) == false) {
request.getPreferences().setValue(PREF_ALF_USERNAME, loginBean.getUsernameInternal());
request.getPreferences().store();
}
}
}