posts - 66,  comments - 40,  trackbacks - 0
          1)先用hashTable初始化ldap用到的參數。
          Hashtable env = new Hashtable();
          env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
          env.put(Context.PROVIDER_URL,"ldap://192.***.***.***:portNumber(389 is defualt)");
          env.put(Context.SECURITY_PRINCIPAL,userID+"yourDomain(@***.com)");//
          env.put(Context.SECURITY_CREDENTIALS, pass);
          userID 和 pass就是登錄域的賬號。不要用全稱。因為你在上面用到了域名。
          2)開始驗證。通過try..catch來判斷用戶的合法性。
          try{
          LdapContext ctx = new InitialLdapContext(env, null);
          System.out.println("Succeess");
          } catch (Exception e) {
          if (e.getMessage().indexOf("775") > = 0) {
          System.out.println("你的賬號被鎖了。");
          }else {
          System.out.println("Invalid User");
          }
          }
          posted on 2007-08-22 11:58 happytian 閱讀(430) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2007年8月>
          2930311234
          567891011
          12131415161718
          19202122232425
          2627282930311
          2345678

          Welcome here, my friend!

          常用鏈接

          留言簿(12)

          隨筆檔案(66)

          文章分類

          文章檔案(63)

          web

          最新隨筆

          搜索

          •  

          積分與排名

          • 積分 - 89702
          • 排名 - 647

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 纳雍县| 德州市| 贵州省| 江阴市| 历史| 墨竹工卡县| 龙井市| 长阳| 仙桃市| 朝阳县| 巩留县| 泰和县| 聂荣县| 蒲城县| 静海县| 天长市| 永城市| 南阳市| 安阳县| 莱州市| 巴中市| 临沧市| 呼玛县| 镶黄旗| 富蕴县| 高密市| 深州市| 定日县| 鄢陵县| 游戏| 丰顺县| 乌兰察布市| 左云县| 阿坝县| 林甸县| 盐边县| 墨玉县| 清丰县| 冷水江市| 平泉县| 丰镇市|