Package com.agiletec.aps.system.services.user

Examples of com.agiletec.aps.system.services.user.UserDetails


    @Override
    public UserDetails getUser(String username, String password) throws ApsSystemException {
        if (!isActive()) {
      return super.getUser(username, password);
    }
        UserDetails user = null;
        try {
            user = this.getLdapUserDAO().loadUser(username, password);
        } catch (Throwable t) {
            ApsSystemUtils.logThrowable(t, this, "getUser");
            //throw new ApsSystemException("Error loading LDAP user" + username, t);
View Full Code Here


    @Override
    public UserDetails getUser(String username) throws ApsSystemException {
        if (!isActive()) {
      return super.getUser(username);
    }
        UserDetails user = null;
        try {
            user = this.getLdapUserDAO().loadUser(username);
        } catch (Throwable t) {
            ApsSystemUtils.logThrowable(t, this, "getUser");
            //throw new ApsSystemException("Error loading LDAP user" + username, t);
View Full Code Here

    HttpSession session = this.pageContext.getSession();
    IWebMailManager webmailManager = (IWebMailManager) ApsWebApplicationUtils.getBean(JpwebmailSystemConstants.WEBMAIL_MANAGER, pageContext);
    Store store = null;
    WebMailIntroInfo info = new WebMailIntroInfo();
    try {
      UserDetails currentUser = (UserDetails) session.getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
      if (currentUser.getUsername().equals(SystemConstants.GUEST_USER_NAME)) return super.doStartTag();
      if (currentUser.getUsername().equals(SystemConstants.ADMIN_USER_NAME) && !this.isCheckAdmin()) return super.doStartTag();
      store = webmailManager.initInboxConnection(currentUser.getUsername(), currentUser.getPassword());
    } catch (Throwable t) {
      webmailManager.closeConnection(store);
      this.pageContext.setAttribute(this.getVar(), info);
      ApsSystemUtils.logThrowable(t, this, "doStartTag");
      return super.doStartTag();
View Full Code Here

   
    CalendarTagHelper calendarTagHelper =
      (CalendarTagHelper) ApsWebApplicationUtils.getBean("jpcalendarCalendarTagHelper", pageContext);
   
    ServletRequest request = this.pageContext.getRequest();
    UserDetails currentUser = (UserDetails) this.pageContext.getSession().getAttribute(
        SystemConstants.SESSIONPARAM_CURRENT_USER);
    try {
     
      Calendar cal = (Calendar)
        this.pageContext.getSession().getAttribute(CalendarConstants.LAST_REQUIRED_CALENDAR_SESSION_PARAM);
View Full Code Here

    return result;
  }
 
  private Store getStore(IWebMailManager webmailManager) {
    HttpSession session = ServletActionContext.getRequest().getSession();
    UserDetails currentUser = (UserDetails) session.getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    Store store = null;
    try {
      store = webmailManager.initInboxConnection(currentUser.getUsername(), currentUser.getPassword());
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "getStore");
      return null;
    }
    return store;
View Full Code Here

    }
    return SUCCESS;
  }
 
  protected void addCookieVoting(int surveyId) {
    UserDetails currentUser = this.getCurrentUser();
    String cookieName = CheckVotingUtil.getCookieName(currentUser.getUsername(), surveyId);
    String cookieValue = CheckVotingUtil.getCookieValue(currentUser.getUsername(), surveyId);
    Cookie cookie = new Cookie(cookieName, cookieValue);
    cookie.setMaxAge(365*24*60*60);//one year
    this.getResponse().addCookie(cookie);
  }
View Full Code Here

* @author E.Santoboni
*/
public abstract class AbstractSurveyWondenInterceptor extends AbstractInterceptor {
 
  protected String checkSurveyGroup(SurveyRecord survey, HttpServletRequest request) {
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    IAuthorizationManager authManager = (IAuthorizationManager) ApsWebApplicationUtils.getBean(SystemConstants.AUTHORIZATION_SERVICE, ServletActionContext.getRequest());
    if (!survey.getGroupName().equals(Group.FREE_GROUP_NAME)
        && !authManager.isAuthOnGroup(currentUser, Group.ADMINS_GROUP_NAME)
        && !authManager.isAuthOnGroup(currentUser, survey.getGroupName())) {
      return "userNotAllowedToSurvey";
View Full Code Here

    if (!started) return "surveyNotBegunYet";
    boolean expired = (null != survey.getEndDate() && today.getTime() > survey.getEndDate().getTime());
    //SE FINITO ESCI
    if (expired) return "expiredSurvey";
   
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    if (survey.isCheckUsername() && (null == currentUser || currentUser.getUsername().equals(SystemConstants.GUEST_USER_NAME))) {
      return "userNotAllowedToSurvey";
    }
   
    String checkGroup = this.checkSurveyGroup(survey, request);
    if (null != checkGroup) return checkGroup;
View Full Code Here

  }

  private static boolean isVotedByCookie(SurveyRecord surveyInfo, HttpServletRequest request) {
    Cookie[] cookies = request.getCookies();
    if (null == cookies) return false;
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    String expectedCookieName = getCookieName(currentUser.getUsername(), surveyInfo.getId());
    String expectedCookieValue = getCookieValue(currentUser.getUsername(), surveyInfo.getId());
    for (int i=0; i<cookies.length; i++) {
      Cookie cookie = cookies[i];
      if (cookie.getName().equals(expectedCookieName) && cookie.getValue().equals(expectedCookieValue)) {
        return true;
      }
View Full Code Here

  }

  private static boolean isVotedByIpAddressAndUser(SurveyRecord surveyInfo, HttpServletRequest request) throws ApsSystemException {
    String remoteAddress = request.getRemoteAddr();
    IVoterManager voterManager = (IVoterManager) ApsWebApplicationUtils.getBean(SurveySystemConstants.SURVEY_VOTER_MANAGER, request);
    UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
    Voter voter = voterManager.getVoter(currentUser.getUsername(), remoteAddress, surveyInfo.getId());
    return (voter != null);
  }
View Full Code Here

TOP

Related Classes of com.agiletec.aps.system.services.user.UserDetails

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.