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

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

?? dbauthorizationfactory.java

?? 這是學習Java必須讀懂兩套源代碼
?? JAVA
字號:
/**
 * Copyright (C) 2001 Yasna.com. All rights reserved.
 *
 * ===================================================================
 * The Apache Software License, Version 1.1
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        Yasna.com (http://www.yasna.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Yazd" and "Yasna.com" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact yazd@yasna.com.
 *
 * 5. Products derived from this software may not be called "Yazd",
 *    nor may "Yazd" appear in their name, without prior written
 *    permission of Yasna.com.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL YASNA.COM OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of Yasna.com. For more information
 * on Yasna.com, please see <http://www.yasna.com>.
 */

/**
 * Copyright (C) 2000 CoolServlets.com. All rights reserved.
 *
 * ===================================================================
 * The Apache Software License, Version 1.1
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        CoolServlets.com (http://www.coolservlets.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Jive" and "CoolServlets.com" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact webmaster@coolservlets.com.
 *
 * 5. Products derived from this software may not be called "Jive",
 *    nor may "Jive" appear in their name, without prior written
 *    permission of CoolServlets.com.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL COOLSERVLETS.COM OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CoolServlets.com. For more information
 * on CoolServlets.com, please see <http://www.coolservlets.com>.
 */

package com.Yasna.forum.database;

import com.Yasna.forum.Authorization;
import com.Yasna.forum.AuthorizationFactory;
import com.Yasna.forum.UnauthorizedException;
import com.Yasna.util.StringUtils;

import java.sql.*;

/**
 * A subclass of AuthorizationFactory for the default Jive implementation. It makes an
 * SQL query to the Jive user table to see if the supplied username and password
 * match a user record. If they do, the appropaite Authorization token is
 * returned. If no matching User record is found an UnauthorizedException is
 * thrown.<p>
 *
 * Because each call to createAuthorization(String, String) makes a database
 * connection, Authorization tokens should be cached whenever possible. When
 * using a servlet or JSP skins, a good method is to cache the token in the
 * session. The SkinUtils.getUserAuthorization() methods automatically handles
 * this logic.<p>
 *
 * If you wish to integrate Jive with your own user system, you'll need to
 * either modify the class or provide your own implementation of the
 * AuthorizationFactory interface.
 */
public class DbAuthorizationFactory extends AuthorizationFactory {

    /** DATABASE QUERIES **/
    private static final String AUTHORIZE =
        "SELECT userID FROM yazdUser WHERE username=? AND passwordHash=?";

    /**
     * The same token can be used for all anonymous users, so cache it.
     */
    private static final Authorization anonymousAuth = new DbAuthorization(-1);

    /**
     * Creates Authorization tokens for users. This method is implemented by
     * concrete subclasses of AuthorizationFactory.
     *
     * @param username the username to create an Authorization with.
     * @param password the password to create an Authorization with.
     * @return an Authorization token if the username and password are correct.
     * @throws UnauthorizedException if the username and password do not match
     *      any existing user.
     */
    public Authorization createAuthorization(String username, String password)
            throws UnauthorizedException
    {
        if (username == null || password == null) {
            throw new UnauthorizedException();
        }
        //Jive stores all passwords in hashed form. So, hash the plain text
        //password for comparison.
        password = StringUtils.hash(password);
        int userID = 0;
        Connection con = null;
        PreparedStatement pstmt = null;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(AUTHORIZE);
            pstmt.setString(1, username);
            pstmt.setString(2, password);

            ResultSet rs = pstmt.executeQuery();
            //If the query had no results, the username and password
            //did not match a user record. Therefore, throw an exception.
            if (!rs.next()) {
                throw new UnauthorizedException();
            }
            userID = rs.getInt(1);
        }
        catch( SQLException sqle ) {
            System.err.println("Exception in DbAuthorizationFactory:" + sqle);
            sqle.printStackTrace();
            throw new UnauthorizedException();
        }
        finally {
            try {  pstmt.close(); }
            catch (Exception e) { e.printStackTrace(); }
            try {  con.close();   }
            catch (Exception e) { e.printStackTrace(); }
        }
        //Got this far, so the user must be authorized.
        return new DbAuthorization(userID);
    }

    /**
     * Creates anonymous Authorization tokens.
     *
     * @return an anonymous Authorization token.
     */
    public Authorization createAnonymousAuthorization() {
        return anonymousAuth;
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91原创在线视频| 99久久精品免费看| 亚洲国产成人av| 亚洲色欲色欲www在线观看| 国产精品人妖ts系列视频| 久久精品欧美一区二区三区不卡| 日韩三级高清在线| 日韩欧美国产wwwww| 欧美成人免费网站| 久久久www免费人成精品| 精品少妇一区二区三区在线视频| 日韩视频免费观看高清在线视频| 欧美一区2区视频在线观看| 91精品欧美综合在线观看最新 | 2020国产精品| 久久免费看少妇高潮| 久久久久9999亚洲精品| 国产午夜精品一区二区三区嫩草| 国产欧美1区2区3区| 国产精品色哟哟网站| 成人免费在线播放视频| 亚洲制服丝袜一区| 免费在线观看一区| 国产美女娇喘av呻吟久久| 成人午夜电影网站| 色狠狠色狠狠综合| 日韩一区二区免费在线电影| 精品国产一区二区在线观看| 国产精品色一区二区三区| 亚洲精品国产无天堂网2021| 亚洲成av人片在线观看无码| 久久99久久久久| 国产白丝网站精品污在线入口| 99国产麻豆精品| 51精品秘密在线观看| 亚洲精品一区二区三区99| 国产精品女上位| 亚洲成精国产精品女| 激情文学综合网| 99精品黄色片免费大全| 欧美精品免费视频| 久久这里只有精品首页| 亚洲色大成网站www久久九九| 午夜私人影院久久久久| 色激情天天射综合网| 日韩精品在线一区| 亚洲电影在线免费观看| 久久国产乱子精品免费女| 国产精品一级在线| 91黄视频在线观看| 7777精品伊人久久久大香线蕉 | 9191久久久久久久久久久| 久久久国产精品午夜一区ai换脸 | 老司机免费视频一区二区三区| 国产成人精品综合在线观看| 欧美性生交片4| 国产午夜精品福利| 性久久久久久久久| 成人中文字幕合集| 日韩色在线观看| 亚洲综合一区二区三区| 国产东北露脸精品视频| 欧美日韩的一区二区| 国产精品免费看片| 久久精品99国产精品日本| 91美女片黄在线观看91美女| 精品日韩一区二区三区| 亚洲成年人影院| 色综合天天综合在线视频| 精品国产伦一区二区三区观看体验| 一区二区三区精品| 国产成人精品三级| 日韩欧美不卡在线观看视频| 亚洲蜜臀av乱码久久精品蜜桃| 国产最新精品精品你懂的| 欧美日韩免费不卡视频一区二区三区| 欧美经典三级视频一区二区三区| 麻豆久久久久久久| 欧美系列亚洲系列| 日韩美女视频一区二区 | 欧美理论电影在线| 亚洲天堂免费在线观看视频| 国产iv一区二区三区| 欧美电视剧免费全集观看| 亚洲成人激情综合网| 91浏览器打开| 亚洲日本一区二区| 国产不卡在线一区| 精品国产亚洲一区二区三区在线观看| 亚洲国产成人91porn| 91麻豆高清视频| 亚洲欧美日韩综合aⅴ视频| 国产a精品视频| 国产视频一区在线观看| 激情综合色播激情啊| 日韩三区在线观看| 五月天视频一区| 2023国产精品自拍| 99精品欧美一区二区三区小说| 六月丁香婷婷久久| 精品国产乱码久久久久久图片 | 91麻豆免费看| 亚洲综合视频在线| 777a∨成人精品桃花网| 国产一区二区在线观看视频| 成人免费一区二区三区在线观看| 日韩精品高清不卡| 欧美午夜寂寞影院| 亚洲大片精品永久免费| 在线视频综合导航| 亚洲午夜精品网| 欧美浪妇xxxx高跟鞋交| 日韩精品免费视频人成| 欧美一级一级性生活免费录像| 视频一区视频二区中文字幕| 91精品在线免费| 国产永久精品大片wwwapp| 久久女同互慰一区二区三区| 国产激情视频一区二区三区欧美| 国产欧美日韩另类一区| av爱爱亚洲一区| 亚洲一二三四区不卡| 欧美高清视频不卡网| 麻豆精品久久精品色综合| 久久欧美中文字幕| voyeur盗摄精品| 亚洲午夜久久久久久久久电影院| 欧美喷潮久久久xxxxx| 捆绑调教美女网站视频一区| 国产夜色精品一区二区av| 99国产精品国产精品久久| 一区二区三区高清在线| 日韩一区二区三区在线观看| 国产成人免费视频一区| 亚洲丝袜自拍清纯另类| 欧美日韩一区二区三区四区五区| 免费av成人在线| 国产视频一区在线观看 | 国产一区二区三区黄视频| 国产欧美日韩精品a在线观看| 国产成人亚洲综合a∨婷婷图片| 国产精品久久久久久福利一牛影视 | 夜色激情一区二区| 欧美精品免费视频| 国产二区国产一区在线观看 | 高清日韩电视剧大全免费| 国产精品女上位| 91麻豆精品国产| 日韩av电影免费观看高清完整版在线观看| 精品国产制服丝袜高跟| 97精品久久久午夜一区二区三区 | 久久久91精品国产一区二区精品| 91浏览器在线视频| 色综合久久天天| 国产激情一区二区三区| 国产精品一区专区| 国产激情视频一区二区三区欧美| 日本成人在线网站| 免费精品99久久国产综合精品| 亚洲午夜免费视频| 夜夜嗨av一区二区三区| 国产乱码精品1区2区3区| 国产精品伦理在线| 欧美久久高跟鞋激| 韩国v欧美v日本v亚洲v| 亚洲特级片在线| www国产成人免费观看视频 深夜成人网| 成人动漫在线一区| 蜜臀va亚洲va欧美va天堂 | 亚洲一卡二卡三卡四卡| 亚洲精品一区二区三区精华液| 欧美综合一区二区| 国产在线播放一区| 婷婷综合五月天| 亚洲欧洲www| 精品久久久久久久久久久院品网 | 国产亚洲一二三区| 欧美日韩激情一区二区三区| 黄色日韩三级电影| 日韩不卡一区二区三区| 欧美高清在线一区二区| 日韩精品一区二区三区在线| 国产mv日韩mv欧美| 美女视频网站黄色亚洲| 亚洲午夜精品网| 国产精品免费丝袜| 久久久久亚洲蜜桃| 色综合天天综合网国产成人综合天 | 国产高清精品网站| 老司机免费视频一区二区| 亚洲一区二区av在线| 亚洲男人电影天堂| 亚洲国产精品ⅴa在线观看| 亚洲精品一区二区三区香蕉| 欧美一区二区三区在线观看 | 在线免费亚洲电影| 成人av资源在线观看| 国产成人免费av在线| 极品少妇xxxx精品少妇| 日韩免费福利电影在线观看|