コード例 #1
0
 /* (non-Javadoc)
  * @see net.webpasswordsafe.client.LoginService#getLogin()
  */
 @Override
 @Transactional(propagation = Propagation.REQUIRED, readOnly = true)
 public User getLogin() {
   String username = ServerSessionUtil.getUsername();
   User user = userDAO.findActiveUserByUsername(username);
   if (null != user) {
     user.setRoles(ServerSessionUtil.getRoles());
   }
   LOG.debug("logged in user="******"null" : user.getUsername()));
   return user;
 }
コード例 #2
0
 /* (non-Javadoc)
  * @see net.webpasswordsafe.client.LoginService#logout()
  */
 @Override
 public boolean logout() {
   auditLogger.log(
       new Date(),
       ServerSessionUtil.getUsername(),
       ServerSessionUtil.getIP(),
       "logout",
       "",
       true,
       "");
   ServerSessionUtil.setUsername(null);
   ServerSessionUtil.setRoles(null);
   ServerSessionUtil.invalidateSession();
   return true;
 }
コード例 #3
0
 /* (non-Javadoc)
  * @see net.webpasswordsafe.client.LoginService#login(java.lang.String, java.lang.String)
  */
 @Override
 @Transactional(propagation = Propagation.REQUIRED)
 public boolean login(String username, String password) {
   boolean isValidLogin = false;
   Date now = new Date();
   String message = "";
   username = trimUsername(username);
   if (authenticator.authenticate(username, password)) {
     User user = userDAO.findActiveUserByUsername(username);
     if (null != user) {
       isValidLogin = true;
       user.setLastLogin(now);
       userDAO.makePersistent(user);
       ServerSessionUtil.setUsername(username);
       ServerSessionUtil.setRoles(roleRetriever.retrieveRoles(user));
     } else {
       message = "user not found";
     }
   } else {
     message = "authentication failed";
   }
   auditLogger.log(now, username, ServerSessionUtil.getIP(), "login", "", isValidLogin, message);
   return isValidLogin;
 }
コード例 #4
0
 @Override
 public boolean ping() {
   ServerSessionUtil.initCsrfSession();
   return true;
 }