一、用到网站
http://code.google.com/p/discuz-ucenter-api-for-java/
http://www.comsenz.com/index.php
可能用到的网址:
http://www.javaeye.com/topic/750323
http://www.javaeye.com/topic/750323#1651562
http://www.javaeye.com/topic/895086
二、 下载ucenter 记事狗 supesite discuz 等等
三、安装ucenter ,安装xampp(略,配置好apache与mysql)
四、安装记事狗,在ucenter上配置记事狗,配置记事狗如图
更改记事狗中setting setting.php中 'site_url' => 'http://10.4.1.202/jishigou'为你服务器的ip
在ucenter中配置你的记事狗 开启同步登陆
其他应用也相同 如果在别的机器打开看不到图片,检查配置文件的php中,localhost一项 改为服务器的地址试一试
五、与java应用整合,看ucenter api 4 java的 google project
贴上登录的jsp如下
<% /** * ================================================ * Discuz! Ucenter API for JAVA * ================================================ * JSP 调用示例 * * 更多信息:http://code.google.com/p/discuz-ucenter-api-for-java/ * 作者:梁平 ([email protected]) * 创建时间:2009-2-20 */ %> <%@page import="java.util.LinkedList"%> <%@page import="com.fivestars.interfaces.bbs.util.XMLHelper"%> <%@page import="com.fivestars.interfaces.bbs.client.Client"%> <% Client uc = new Client(); String result = uc.uc_user_login("crterry", "cr0109"); LinkedList<String> rs = XMLHelper.uc_unserialize(result); if(rs.size()>0){ int $uid = Integer.parseInt(rs.get(0)); String $username = rs.get(1); String $password = rs.get(2); String $email = rs.get(3); if($uid > 0) { response.addHeader("P3P"," CP=/"CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR/""); out.println("success login"); out.println($username); out.println($password); out.println($email); String $ucsynlogin = uc.uc_user_synlogin($uid); out.println(" success login ussynlogin: "+$ucsynlogin+""); //本地登陆代码 //TODO ... .... Cookie auth = new Cookie("auth", uc.uc_authcode($password+"/t"+$uid, "ENCODE")); auth.setMaxAge(31536000); auth.setDomain("localhost"); response.addCookie(auth); Cookie user = new Cookie("uchome_loginuser", $username); response.addCookie(user); } else if($uid == -1) { out.println("用户不存在,或者被删除 unkonwn user"); } else if($uid == -2) { out.println("密码错 wrong password"); } else { out.println("未定义 unkonwn error"); } }else{ out.println("Login failed"); System.out.println(result); } %>