Package org.beangle.security.monitor.auth.ui

Examples of org.beangle.security.monitor.auth.ui.UserDetails


public class AuthorityListener extends AbstractAuthenticationListener {
  protected AuthorityManager authorityManager;

  public void afterAuthenticate(Authentication auth) {
    UserDetails details = (UserDetails) auth.getDetails();
    authorityManager.registerAuthorities(details.getUserid());
  }
View Full Code Here


   * @return either -1 meaning unlimited, or a positive integer to limit
   *         (never zero)
   */
  protected int getMaximumSessionsForThisUser(Authentication auth) {
    loadProfilesWhenNecessary();
    UserDetails details = (UserDetails) auth.getDetails();
    OnlineProfile profile = (OnlineProfile) profileMap.get(details.getCategory());
    if (null == profile) {
      logger.error("cannot find profile for {}", details.getCategory().getId());
      throw new RuntimeException("cannot find profile:" + details.getCategory().getName());
    }
    return profile.getCategoryProfile().getUserMaxSessions();
  }
View Full Code Here

      HttpSession session = request.getSession();
      int min = authenticationManager.getSessionController().getInactiveInterval(
          ((UserDetails) auth.getDetails()).getCategory());
      session.setMaxInactiveInterval(min * 60);
      ((ServletRequestAware) auth).setRequest(null);
      UserDetails details = (UserDetails) auth.getDetails();
      if (null == details) {
        return;
      }
      session.setAttribute(Authentication.USERID, details.getUserid());
      session.setAttribute(Authentication.LOGINNAME, auth.getPrincipal());
      session.setAttribute(Authentication.FULLNAME, details.getFullname());
      session.setAttribute(Authentication.USER_CATEGORYID, details.getCategory().getId());
      logger.debug(
          "added session attributes USERID,LOGINNAME,USERNAME,USER_CATEGORYID for {}",
          auth.getPrincipal());
    }
  }
View Full Code Here

    }
    if (!user.isEnabled()) {
      throw new AuthenticationException(Authentication.ERROR_UNACTIVE);
    }
    if (null == auth.getDetails()) {
      auth.setDetails(new UserDetails());
    }
    UserDetails details = (UserDetails) auth.getDetails();
    details.setUserid(user.getId());
    details.setFullname(user.getFullname());
    details.setCategory(entityDao.get(UserCategory.class, user.getDefaultCategory().getId()));
    return user;
  }
View Full Code Here

    }
    if (!user.isEnabled()) {
      throw new AuthenticationException(Authentication.ERROR_UNACTIVE);
    }
    if (null == auth.getDetails()) {
      auth.setDetails(new UserDetails());
    }
    UserDetails details = (UserDetails) auth.getDetails();
    details.setUserid(user.getId());
    details.setFullname(user.getFullname());
    details.setCategory(user.getDefaultCategory());
    return user;
  }
View Full Code Here

      Date lastRequest) {
    OnlineActivityBean activity = new OnlineActivityBean();
    activity.setSessionid(sessionid);
    activity.setPrincipal(principal);
    activity.setLastAccessAt(lastRequest);
    UserDetails details = (UserDetails) userDetails;
    activity.setUserid(details.getUserid());
    activity.setFullname(details.getFullname());
    activity.setCategory(details.getCategory());
    if (details instanceof WebUserDetails) {
      activity.setHost(((WebUserDetails) details).getHost());
    }
    activity.setLoginAt(new Date());
    return activity;
View Full Code Here

TOP

Related Classes of org.beangle.security.monitor.auth.ui.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.