protected Object processAuthenication() throws SherpaRuntimeException {
String userid = request.getParameter("userid");
String password = request.getParameter("password");
try {
Authentication authentication = new Authentication(applicationContext);
SessionToken token = authentication.authenticate(userid, password, request, response);
boolean hasAdminRole = applicationContext.getManagedBean(SessionTokenService.class)
.hasRole(token.getUserid(), token.getToken(), (String) applicationContext.getAttribute(ApplicationContext.SETTINGS_ADMIN_USER));
// load the sherpa admin user
if(hasAdminRole) {
String[] roles = token.getRoles();
token.setRoles(Util.append(roles, "SHERPA_ADMIN"));
}
return token;
} catch (NoSuchManagedBeanExcpetion e) {
throw new SherpaRuntimeException(e);
}