亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? onlineusermanager.java

?? 解觖java技術中后臺無法上傳數給的情況
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
/*
 * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/auth/OnlineUserManager.java,v 1.44 2006/04/14 17:05:26 minhnn Exp $
 * $Author: minhnn $
 * $Revision: 1.44 $
 * $Date: 2006/04/14 17:05:26 $
 *
 * ====================================================================
 *
 * Copyright (C) 2002-2006 by MyVietnam.net
 *
 * All copyright notices regarding mvnForum MUST remain 
 * intact in the scripts and in the outputted HTML.
 * The "powered by" text/logo with a link back to
 * http://www.mvnForum.com and http://www.MyVietnam.net in 
 * the footer of the pages MUST remain visible when the pages
 * are viewed on the internet or intranet.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Support can be obtained from support forums at:
 * http://www.mvnForum.com/mvnforum/index
 *
 * Correspondence and Marketing Questions can be sent to:
 * info at MyVietnam net
 *
 * @author: Minh Nguyen  
 * @author: Mai  Nguyen  
 */
package com.mvnforum.auth;

import java.sql.Timestamp;
import java.util.*;

import javax.servlet.http.*;

import com.mvnforum.*;
import com.mvnforum.db.DAOFactory;
import net.myvietnam.mvncore.exception.*;
import net.myvietnam.mvncore.security.Encoder;
import net.myvietnam.mvncore.security.FloodControl;
import net.myvietnam.mvncore.util.*;
import net.myvietnam.mvncore.web.GenericRequest;
import net.myvietnam.mvncore.web.GenericResponse;
import net.myvietnam.mvncore.web.impl.GenericRequestServletImpl;
import net.myvietnam.mvncore.web.impl.GenericResponseServletImpl;

public class OnlineUserManager {
    private static final int REMOVE_INTERVAL = 2000; //update every 2 second

    private static final String MVNFORUM_SESSION_USERNAME = "mvnforum.membername";
    private static final String MVNFORUM_SESSION_PASSWORD = "mvnforum.encodedpassword";

    private static final String MVNFORUM_COOKIE_USERNAME = "mvnforum.membername";
    private static final String MVNFORUM_COOKIE_PASSWORD = "mvnforum.encodedpassword";

    private static final String MVNFORUM_COOKIE_PATH     = "/";

    public static final String PASSWORD_OF_METHOD_REALM         = "Realm"; //must not be changed in all cases
    public static final String PASSWORD_OF_METHOD_CUSTOMIZATION = "Remote";//must not be changed in all cases

    //static variable
    private static OnlineUserManager instance = new OnlineUserManager();

    //instance variable
    private Map userMap = new TreeMap();
    private long timeOfLastRemoveAction = 0;
    private transient Vector onlineUserListeners;

    private Authenticator authenticator = null;

    private OnlineUserManager() {
    }

    public static OnlineUserManager getInstance() {
        return instance;
    }

    public Authenticator getAuthenticator() {
        return authenticator;
    }

    public void setAuthenticator(Authenticator authenticator) {
        this.authenticator = authenticator;
    }

    /**
     * MemberUtil method to be called from Processor.
     * It assumes that to input parameters are
     * MemberName      for username
     * MemberMatkhau   for password
     */
    public void processLogin(HttpServletRequest request, HttpServletResponse response)
        throws AuthenticationException, AssertionException, DatabaseException, BadInputException, FloodException {

        String memberName      = ParamUtil.getParameter(request, "MemberName", true);
        StringUtil.checkGoodName(memberName);// check for better security
        String memberPassword  = "";
        String memberPasswordMD5  = ParamUtil.getParameter(request, "md5pw", false);
        if (memberPasswordMD5.length() == 0 || (memberPasswordMD5.endsWith("==") == false)) {
            // md5 is not valid, try to use unencoded password method
            memberPassword  = ParamUtil.getParameterPassword(request, "MemberMatkhau", 3, 0);

            if (memberPassword.length() == 0) {
                throw new AssertionException("Cannot allow memberPassword's length is 0. Serious Assertion Failed.");
            }
        }

        processLogin(request, response, memberName, memberPassword, memberPasswordMD5);
        /*
        String currentIP = request.getRemoteAddr();
        try {
            // Control the login action, we dont want user to try too many login attempt
            FloodControl.ensureNotReachMaximum(MVNForumGlobal.FLOOD_ID_LOGIN, currentIP);

            OnlineUser user = null;
            if (memberPassword.length() > 0) {
                // that is we cannot find the md5 password
                user = login(request, response, memberName, memberPassword, false);
            } else {
                // have the md5, go ahead
                user = login(request, response, memberName, memberPasswordMD5, true);
            }
            ((OnlineUserImpl)user).setAuthenticationType(OnlineUser.AUTHENTICATION_TYPE_HTML_FORM);
        } catch (AuthenticationException ex) {
            // only increase login count if unsucessful
            FloodControl.increaseCount(MVNForumGlobal.FLOOD_ID_LOGIN, currentIP);

            if (ex.getReason() == NotLoginException.WRONG_PASSWORD) {
                request.setAttribute("MemberName", memberName);// so user dont have to retype USER NAME
            }
            throw ex;
        } catch (FloodException fe) {
            Locale locale = I18nUtil.getLocaleInRequest(request);
            Integer maxWrongLogins = new Integer(FloodControl.getActionsPerHour(MVNForumGlobal.FLOOD_ID_LOGIN));
            //throw new FloodException("You have reached the maximum number of wrong login actions for this page. Please try this page later. This is to prevent forum from being flooded.");
            String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.FloodException.login_too_many_times", new Object[]{ maxWrongLogins });
            throw new FloodException(localizedMessage);
        }*/
    }

    /**
     * Login method, if memberPassword length == 0, then login with memberPasswordMD5
     */
    public void processLogin(HttpServletRequest request, HttpServletResponse response,
                             String memberName, String memberPassword, String memberPasswordMD5)
        throws AuthenticationException, AssertionException, DatabaseException, BadInputException, FloodException {

        StringUtil.checkGoodName(memberName);// check for better security

        String currentIP = request.getRemoteAddr();
        try {
            // Control the login action, we dont want user to try too many login attempt
            FloodControl.ensureNotReachMaximum(MVNForumGlobal.FLOOD_ID_LOGIN, currentIP);

            OnlineUser user = null;
            if (memberPassword.length() > 0) {
                // that is we cannot find the md5 password
                user = login(request, response, memberName, memberPassword, false);
            } else {
                // have the md5, go ahead
                user = login(request, response, memberName, memberPasswordMD5, true);
            }
            ((OnlineUserImpl)user).setAuthenticationType(OnlineUser.AUTHENTICATION_TYPE_HTML_FORM);
        } catch (AuthenticationException ex) {
            // only increase login count if unsucessful
            FloodControl.increaseCount(MVNForumGlobal.FLOOD_ID_LOGIN, currentIP);

            if (ex.getReason() == NotLoginException.WRONG_PASSWORD) {
                request.setAttribute("MemberName", memberName);// so user dont have to retype USER NAME
            }
            throw ex;
        } catch (FloodException fe) {
            Locale locale = I18nUtil.getLocaleInRequest(request);
            Integer maxWrongLogins = new Integer(FloodControl.getActionsPerHour(MVNForumGlobal.FLOOD_ID_LOGIN));
            //throw new FloodException("You have reached the maximum number of wrong login actions for this page. Please try this page later. This is to prevent forum from being flooded.");
            String localizedMessage = MVNForumResourceBundle.getString(locale, "mvncore.exception.FloodException.login_too_many_times", new Object[]{ maxWrongLogins });
            throw new FloodException(localizedMessage);
        }
    }

    /**
     * NOTE: This method MUST be the only way to authenticate a user
     * NOTE: the parameter response can be equals null
     */
    protected OnlineUser login(HttpServletRequest request, HttpServletResponse response,
                               String memberName, String memberPassword, boolean passwordEncoded)
        throws AuthenticationException, DatabaseException, AssertionException {

        try {
            StringUtil.checkGoodName(memberName);
        } catch (Exception ex) {
            throw new AuthenticationException(ex.getMessage(), NotLoginException.WRONG_NAME);
        }
        String encodedPassword;
        OnlineUser user;

        if (passwordEncoded) {
            encodedPassword = memberPassword;
            user = ManagerFactory.getOnlineUserFactory().getAuthenticatedUser(request, response, memberName, encodedPassword, true);
        } else {
            encodedPassword = ManagerFactory.getOnlineUserFactory().getEncodedPassword(memberName, memberPassword);
            //user = ManagerFactory.getOnlineUserFactory().getAuthenticatedUser(request, response, memberName, memberPassword, false);
            user = ManagerFactory.getOnlineUserFactory().getAuthenticatedUser(request, response, memberName, encodedPassword, true);
        }

        HttpSession session = request.getSession();
        String sessionID = session.getId();
        setOnlineUser(sessionID, user);

        // now save the login info in the session only if we support
        // encoded passwords
        if (null != encodedPassword) {
            session.setAttribute(MVNFORUM_SESSION_USERNAME, memberName);
            session.setAttribute(MVNFORUM_SESSION_PASSWORD, encodedPassword);
        }

        boolean fromLoginPage = ParamUtil.getParameterBoolean(request, "FromLoginPage");
        if ( fromLoginPage && (response != null) ) {
            manageAutoLogin(memberName, encodedPassword, request, response);
        }

        // Now call the postLogin method, in the default implementation, the default folder
        // is checked and created if not existed
        ManagerFactory.getOnlineUserFactory().postLogin(request, response, user);

        return user;
    }

    protected OnlineUser login(GenericRequest request, GenericResponse response,
                               String memberName, String memberPassword, boolean passwordEncoded)
        throws AuthenticationException, DatabaseException, AssertionException {

        try {
            StringUtil.checkGoodName(memberName);
        } catch (Exception ex) {
            throw new AuthenticationException(ex.getMessage(), NotLoginException.WRONG_NAME);
        }

        String encodedPassword;
        OnlineUser user;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品剧情在线亚洲| 972aa.com艺术欧美| 亚洲精品高清在线| 中文字幕乱码久久午夜不卡| 欧美影院一区二区| 9191精品国产综合久久久久久 | 欧美一区二区福利在线| 欧美色图免费看| 6080国产精品一区二区| 欧美最猛黑人xxxxx猛交| 欧洲精品一区二区| 日本视频一区二区三区| 亚洲免费观看在线视频| 色哟哟国产精品| 成人av免费在线播放| 久久疯狂做爰流白浆xx| 国产精品99久| 亚洲欧美日韩国产手机在线| 亚洲精品成人在线| 国产精品无码永久免费888| 99国内精品久久| 欧美在线观看视频一区二区| 欧美一区午夜视频在线观看| 国产亚洲视频系列| 久久精品一区蜜桃臀影院| 精品国产乱码久久久久久浪潮| 国产成人午夜高潮毛片| 色综合久久六月婷婷中文字幕| 日韩欧美视频在线| 亚洲18色成人| 国产欧美一区二区三区在线老狼| 一本久久a久久精品亚洲| 欧美日韩一区二区三区免费看| 亚洲午夜久久久久| 亚洲第一二三四区| 久久久亚洲高清| 亚洲国产精品传媒在线观看| 亚洲自拍都市欧美小说| 国产美女主播视频一区| 蜜臀av在线播放一区二区三区| 日本中文在线一区| 豆国产96在线|亚洲| 91精品国产乱| 91婷婷韩国欧美一区二区| 91天堂素人约啪| 日韩欧美国产午夜精品| 国产精品国产三级国产aⅴ无密码| 亚洲丝袜美腿综合| 亚洲午夜免费电影| 精品夜夜嗨av一区二区三区| 欧美一三区三区四区免费在线看| 精品国产免费人成在线观看| 中文字幕一区二区在线观看| 亚洲国产精品一区二区www| 美日韩黄色大片| 亚洲国产综合人成综合网站| 一区二区三区丝袜| 麻豆成人91精品二区三区| 亚洲女性喷水在线观看一区| 美日韩一区二区| 色婷婷久久一区二区三区麻豆| 麻豆精品久久久| 亚洲午夜在线电影| 国精产品一区一区三区mba桃花| 中文字幕av一区二区三区免费看 | 亚洲成人综合网站| 国产精品 日产精品 欧美精品| 欧美另类久久久品| 日本成人在线电影网| 欧美另类z0zxhd电影| 日韩午夜在线观看| 欧美国产成人精品| 午夜国产不卡在线观看视频| 成人精品免费看| 日韩精品一区在线| 亚洲国产精品自拍| 欧美电影免费观看高清完整版 | 色哟哟一区二区在线观看| 日日摸夜夜添夜夜添国产精品| 色婷婷一区二区| 欧美国产日韩亚洲一区| 国产一区二区三区四区五区入口| 久久午夜电影网| 国产99久久久国产精品潘金网站| 国产日韩精品一区二区三区| 成人h动漫精品| 亚洲精品自拍动漫在线| 欧美性生交片4| 欧美aaa在线| 久久久99久久精品欧美| 国产suv精品一区二区883| 国产精品久久久久精k8| 在线视频观看一区| 日韩电影一区二区三区四区| 久久99热狠狠色一区二区| 欧美大片国产精品| 成人免费视频app| 亚洲综合免费观看高清在线观看| 9191国产精品| 风间由美一区二区三区在线观看| 亚洲欧美日韩中文字幕一区二区三区| 亚洲一区二区在线免费看| 欧美一级在线视频| 国产成人小视频| 亚洲妇女屁股眼交7| 久久综合色一综合色88| 91精彩视频在线观看| 日本午夜精品一区二区三区电影 | 欧美一区二区三区公司| 国产一区二区免费看| 亚洲色图.com| 在线看不卡av| 免费一级片91| 樱桃国产成人精品视频| 极品尤物av久久免费看| 一区二区在线观看视频| 久久综合资源网| 91.麻豆视频| 97国产一区二区| 国产剧情一区在线| 天堂蜜桃91精品| 亚洲视频免费在线| 国产亚洲精品aa| 91精品国产色综合久久不卡电影| 91色porny蝌蚪| 国产又粗又猛又爽又黄91精品| 亚洲成人av一区二区三区| 久久久久久久电影| 51午夜精品国产| 亚洲日本中文字幕区| 一区二区三区av电影| 欧美猛男gaygay网站| 日本高清不卡一区| 精久久久久久久久久久| 日本v片在线高清不卡在线观看| 欧美无乱码久久久免费午夜一区| 日韩和欧美一区二区| 国产精品正在播放| 香蕉加勒比综合久久| 亚洲乱码国产乱码精品精小说 | 久久这里只有精品6| 亚洲综合丝袜美腿| 亚洲欧洲日韩一区二区三区| 久久久亚洲午夜电影| 日韩欧美亚洲一区二区| 97久久人人超碰| 欧美精品在线一区二区三区| 久久亚洲一区二区三区明星换脸| 91在线小视频| 久久99精品久久久久久动态图| 91精品蜜臀在线一区尤物| 99精品久久免费看蜜臀剧情介绍| 亚洲第一久久影院| 成人h版在线观看| 综合在线观看色| 一片黄亚洲嫩模| 洋洋成人永久网站入口| 91免费精品国自产拍在线不卡| 91麻豆福利精品推荐| 色综合色狠狠天天综合色| 精品一区二区三区免费观看 | 色综合网色综合| 亚洲一区在线免费观看| 69av一区二区三区| 91精品黄色片免费大全| 欧美丰满一区二区免费视频| 亚洲欧美区自拍先锋| 国产精品久久久99| 91麻豆精品国产自产在线| 欧美一区二区免费视频| 97精品超碰一区二区三区| 67194成人在线观看| 日韩一级精品视频在线观看| 精品少妇一区二区三区日产乱码| 欧美猛男男办公室激情| 国产女人18毛片水真多成人如厕| 欧美久久久久免费| 午夜天堂影视香蕉久久| 欧美激情一区不卡| 欧美精品久久天天躁| 欧美v日韩v国产v| 在线观看一区二区视频| 国产成人a级片| 亚洲成人在线网站| 91精品国产综合久久蜜臀| 欧美另类一区二区三区| 久久精品这里都是精品| 亚洲私人影院在线观看| 亚洲福利视频一区二区| 日韩美女视频一区| 国产精品99久久久久久有的能看 | 国产91在线看| 蜜臂av日日欢夜夜爽一区| 国产日韩精品一区二区三区| 久久精品视频一区二区三区| 激情六月婷婷综合| 欧美视频在线播放| 日韩精品一区二区三区蜜臀 | 亚洲综合一区二区| 国产精品剧情在线亚洲|