示例#1
0
 private static void checkExpiredSession(HttpSession session) throws ActionException {
   EditorUserAuthentication authentication = getEditorUserAuthentication(session);
   if (authentication == null || !authentication.isAuthenticated()) {
     throw new ActionException(
         Constants.SESSION_EXPIRED_FLAG
             + URLS.ROOT()
             + (URLS.LOCALHOST() ? URLS.LOGIN_LOCAL_PAGE : URLS.LOGIN_PAGE));
   }
 }
示例#2
0
 /**
  * Gets the user id.
  *
  * @param closeCon the close con
  * @return the user id
  * @throws DatabaseException the database exception
  * @throws SQLException
  */
 @Deprecated
 protected Long getUserId(boolean closeCon) throws DatabaseException, SQLException {
   SecurityContext secContext =
       (SecurityContext) httpSessionProvider.get().getAttribute("SPRING_SECURITY_CONTEXT");
   EditorUserAuthentication authentication = null;
   if (secContext != null)
     authentication = (EditorUserAuthentication) secContext.getAuthentication();
   if (authentication != null) {
     return getUsersId(
         (String) authentication.getPrincipal(), authentication.getIdentityType(), closeCon);
   } else {
     throw new DatabaseException(
         Constants.SESSION_EXPIRED_FLAG
             + URLS.ROOT()
             + (URLS.LOCALHOST() ? URLS.LOGIN_LOCAL_PAGE : URLS.LOGIN_PAGE));
   }
 }