<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 37,  comments - 53,  trackbacks - 0
    關(guān)于JForum論壇的基本情況就不在此介紹了,官方網(wǎng)址:www.jforum.net.jforum論壇系統(tǒng)的安裝也很簡單,按照官方文檔,或者google一下,基本都可以搞定,在此就不在介紹了。大概描述一下我使用jforum的情況:
    1.應用服務(wù)器:weblogic8.1
    2.數(shù)據(jù)庫:oracle10g
    3.已有一個電子商務(wù)網(wǎng)站,需要和jforum進行簡單的集成,提供sso(單點登錄的功能)。
    4.說明:已有的電子商務(wù)網(wǎng)站域名:http://www.123.com jforum域名:www.123.com/forum,電子商務(wù)網(wǎng)站和jfroum在統(tǒng)一臺服務(wù)器和同一應用服務(wù)器下,如果分開可能會存在session或cookie訪問的問題。
    5.JForum版本:2.1.8
    下面簡要的介紹一下使用cookie進行jforum和電子商務(wù)網(wǎng)站的sso集成的過程:
    (1)實現(xiàn)net.jforum.sso接口
    public class CookieUserSSO implements SSO {
        static final Logger  logger       = Logger.getLogger(CookieUserSSO.class.getName());

        public String authenticateUser(RequestContext request) {
            // login cookie set by my web LOGIN application
            Cookie cookieNameUser = ControllerUtils.getCookie(SystemGlobals
                    .getValue(ConfigKeys.COOKIE_NAME_USER));
            String username = null;

            if (cookieNameUser != null) {
                username = cookieNameUser.getValue();
            }
            logger.info("cookie username="+username);
            System.out.println("cookie username="+username);
            return username; // return username for jforum
            // jforum will use this name to regist database or set in HttpSession
        }

        public boolean isSessionValid(UserSession userSession,
                RequestContext request) {
            Cookie cookieNameUser = ControllerUtils.getCookie(SystemGlobals
                    .getValue(ConfigKeys.COOKIE_NAME_USER)); // user cookie
            String remoteUser = null;

            if (cookieNameUser != null) {
                remoteUser = cookieNameUser.getValue(); // jforum username
            }

            if (remoteUser == null
                    && userSession.getUserId() != SystemGlobals
                            .getIntValue(ConfigKeys.ANONYMOUS_USER_ID)) {
                // user has since logged out
                return false;
            } else if (remoteUser != null
                    && userSession.getUserId() == SystemGlobals
                            .getIntValue(ConfigKeys.ANONYMOUS_USER_ID)) {
                // anonymous user has logged in
                return false;
            } else if (remoteUser != null
                    && !remoteUser.equals(userSession.getUsername())) {
                // not the same user (cookie and session)
                return false;
            }       
            return true; // myapp user and forum user the same. valid user.
        }

    }
    (2)修改SystemGlobals.properties中的配置:
        修改
    SystemGlobals.properties文件中的一下屬性的內(nèi)容:
        authentication.type = sso
        sso.implementation = net.jforum.sso.CookieUserSSO
        sso.redirect = http://www.123.com/login.jsp //可根據(jù)實際的登錄頁面地址進行修改

        cookie.name.user = 123UserInfo //電子商務(wù)網(wǎng)站中保存的cookie名稱,可根據(jù)實際情況修改

    (3)修改web應用中的登錄和注銷部分的邏輯:
        登錄部分加入以下代碼:
       
    ...
        Cookie cookie = new Cookie("springTourUserInfo", sname);
         cookie.setMaxAge(-1);
         cookie.setPath("/");//cookie只在同一應用服務(wù)器有效
         response.addCookie(cookie);

       ...
        注銷部分加入以下代碼:
        ......
          Cookie cookie = new Cookie("springTourUserInfo", "");
          cookie.setMaxAge(0); // delete the cookie.
          cookie.setPath("/");
          response.addCookie(cookie);

        ......
    (4)在電子商務(wù)網(wǎng)站增加論壇的鏈接:
        <a href="/forum">論壇</a>

    基本配置完整,測試通過,如有問題,歡迎交流!

    感謝網(wǎng)友提供的資料:
    http://www.lifevv.com/java/doc/20080305224358885.html?page=0
    http://www.99inf.net/SoftwareDev/Java/54230.htm(作者:王保政)


       

    posted on 2008-06-26 16:54 雪地孤鴻 閱讀(4035) 評論(3)  編輯  收藏 所屬分類: java

    FeedBack:
    # re: JForum 的 SSO集成的問題解決
    2008-09-24 11:43 | wn
    請問我按照上面說的配置以后,在得到cookie的時候得不到,
    Cookie cookieNameUser = ControllerUtils.getCookie(SystemGlobals
    .getValue(ConfigKeys.COOKIE_NAME_USER));
    cookieNameUser始終是null,
    cookie.setPath("/");不起作用,
    所以登錄的時候一直是游客的身份,如何解決呢,謝謝!  回復  更多評論
      
    # re: JForum 的 SSO集成的問題解決
    2008-11-22 17:17 | 雪地孤鴻
    上面這樣的解決方式是有個前提條件的,就是你的forum必須和你的主web應用是在同一域名下,例如:主web應用為:www.ggyy.com,你的forum的訪問路徑應該為www.ggyy.com/forum這樣的,cookie才能正確的被訪問到,這個也是由于瀏覽的安全因素導致,如果跨域訪問cookie,一般情況下是不會被允許的。  回復  更多評論
      
    # re: JForum 的 SSO集成的問題解決
    2010-11-09 13:36 | sail
    解決難題了。。3Q。。  回復  更多評論
      
    <2008年6月>
    25262728293031
    1234567
    891011121314
    15161718192021
    22232425262728
    293012345

    常用鏈接

    留言簿(17)

    隨筆分類

    隨筆檔案

    文章檔案

    blog

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 啦啦啦手机完整免费高清观看| 四虎免费大片aⅴ入口| 亚洲精品国产福利在线观看| 日日麻批免费40分钟日本的| 亚洲日韩一区二区三区| 亚洲国产一级在线观看| 99久久人妻精品免费二区| 亚洲欧美日韩综合久久久久| 在线亚洲97se亚洲综合在线| h视频在线观看免费完整版| 精品成人一区二区三区免费视频| 亚洲电影一区二区| 国产最新凸凹视频免费| 久久国产精品免费视频| 日韩色视频一区二区三区亚洲| 亚洲AV成人无码久久精品老人| 成年大片免费视频| a级毛片免费全部播放| 亚洲欧美日韩综合久久久久| 亚洲成色在线综合网站| 日本不卡视频免费| 99精品免费观看| 亚洲五月午夜免费在线视频| 日本免费一区二区三区四区五六区| 日韩亚洲不卡在线视频中文字幕在线观看| 亚洲视频在线免费| 成人免费一区二区无码视频| 国产成人无码区免费网站| 亚洲AV成人无码网站| 亚洲理论在线观看| 国产成人A人亚洲精品无码| 国产一区二区三区无码免费| 亚洲精品在线免费看| 特级做A爰片毛片免费看无码| 无码天堂亚洲国产AV| 亚洲国产中文在线视频| 久久精品国产亚洲av四虎| 亚洲人成人网站在线观看| 午夜神器成在线人成在线人免费| 1000部拍拍拍18勿入免费视频下载| eeuss草民免费|