准备文件:
1.从 下载apache-tomcat-5.5.25_josso-1.6.zip
2.从下载tomcat5.5.25 配置:
配置josso认证服务器
1).将apache-tomcat-5.5.25_josso-1.6.zip解压文件里,webapp目录下的josso.war文件拷贝到%CATALINA_HOME%/webapp目录下,启动tomcat,josso.war自动解压
2).%CATALINA_HOME%/bin下新增josso-config.xml和josso-gateway-config.xml配置文件. josso-config.xml内容如下:
josso-gateway-config.xml内容如下:
SampleDomain
web
org.josso.auth.AuthenticatorImpl
basic-authentication org.josso.auth.scheme.UsernamePasswordAuthScheme
org.josso.gateway.identity.service.store.db.JDBCIdentityStore
SELECT login AS username , password AS password FROM josso_user WHERE login = ?
root mysql jdbc:mysql://localhost:3306/tennisweb com.mysql.jdbc.Driver
org.josso.gateway.identity.service.store.SimpleIdentityStoreKeyAdapter
org.josso.gateway.identity.service.SSOIdentityManagerImpl
org.josso.gateway.identity.service.store.db.JDBCIdentityStore
SELECT login FROM josso_user WHERE login = ?
SELECT josso_role.name FROM josso_role , josso_user_role , josso_user WHERE josso_user.login = ? AND josso_user.login = josso_user_role.login AND josso_role.name = josso_user_role.name
root mysql jdbc:mysql://localhost:3306/tennisweb com.mysql.jdbc.Driver
org.josso.gateway.identity.service.store.SimpleIdentityStoreKeyAdapter
org.josso.gateway.session.service.SSOSessionManagerImpl 30
-1
org.josso.gateway.session.service.store.MemorySessionStore
org.josso.gateway.session.service.SessionIdGeneratorImpl
MD5
org.josso.gateway.audit.service.SSOAuditManagerImpl
org.josso.gateway.audit.service.handler.LoggerAuditTrailHandler LoggerAuditTrailHandler org.josso.gateway.audit.SSO_AUDIT
org.josso.gateway.event.security.JMXSSOEventManagerImpl
josso:type=SSOEventManager
3).将
josso-tomcat55-plugin-1.6.jar; josso-1.6.jar; commons-configuration-1.1.jar; commons-lang-2.0.jar; commons-digester.jar; commons-collections-3.1.jar; commons-beanutils.jar; xmldb-common-20030701.jar; jaxrpc.jar; axis.jar; commons-discovery-0.2.jar; saaj.jar; wsdl4j-1.5.2.jar及数据库驱动包
放到%CATALINA_HOME%/common/lib下
4).配置完毕,启动tomcat,用访问,如果能正常出现登录页面说明部署成功。
5).执行如下sql脚本:
建表:
CREATE TABLE JOSSO_ROLE ( NAME VARCHAR2(16) NOT NULL, DESCRIPTION VARCHAR2(64) NULL );
ALTER TABLE JOSSO_ROLE ADD ( PRIMARY KEY (NAME) ) ;
CREATE TABLE JOSSO_USER ( LOGIN VARCHAR2(16) NOT NULL, PASSWORD VARCHAR2(20) NOT NULL, NAME VARCHAR2(64) NULL, DESCRIPTION VARCHAR2(64) NULL );
ALTER TABLE JOSSO_USER ADD ( PRIMARY KEY (LOGIN) ) ;
CREATE TABLE JOSSO_USER_PROPERTY ( LOGIN VARCHAR2(16) NOT NULL, NAME VARCHAR2(255) NOT NULL, VALUE VARCHAR2(255) NOT NULL );
ALTER TABLE JOSSO_USER_PROPERTY ADD ( PRIMARY KEY (LOGIN, NAME) ) ; CREATE TABLE JOSSO_USER_ROLE ( LOGIN VARCHAR2(16) NOT NULL, NAME VARCHAR2(255) NOT NULL );
ALTER TABLE JOSSO_USER_ROLE ADD ( PRIMARY KEY (LOGIN, NAME) ) ;
ALTER TABLE JOSSO_USER_PROPERTY ADD ( FOREIGN KEY (LOGIN) REFERENCES JOSSO_USER ) ;
ALTER TABLE JOSSO_USER_ROLE ADD ( FOREIGN KEY (NAME) REFERENCES JOSSO_ROLE ) ;
ALTER TABLE JOSSO_USER_ROLE ADD ( FOREIGN KEY (LOGIN) REFERENCES JOSSO_USER ) ; Execute this DDL in your database.
插入测试数据:
INSERT INTO JOSSO_ROLE (NAME,DESCRIPTION) VALUES('role1','The Role1');
INSERT INTO JOSSO_ROLE (NAME,DESCRIPTION) VALUES('role2','The Role2');
INSERT INTO JOSSO_ROLE (NAME,DESCRIPTION) VALUES('role3','The Role3');
INSERT INTO JOSSO_USER (LOGIN,PASSWORD,DESCRIPTION) VALUES('user1', 'user1pwd', 'The User1');
INSERT INTO JOSSO_USER_ROLE (LOGIN,NAME) VALUES('user1', 'role1');
INSERT INTO JOSSO_USER_ROLE (LOGIN,NAME) VALUES('user1', 'role2');
INSERT INTO JOSSO_USER (LOGIN,PASSWORD,DESCRIPTION) VALUES('user2', 'user2pwd', 'The User2');
INSERT INTO JOSSO_USER_ROLE (LOGIN,NAME) VALUES('user2', 'role3');
INSERT INTO JOSSO_USER_PROPERTY(LOGIN,NAME,VALUE) VALUES('user1', 'user.name', 'User1 Name');
INSERT INTO JOSSO_USER_PROPERTY(LOGIN,NAME,VALUE) VALUES('user1', 'user.lastName', 'User1 Last Name');
INSERT INTO JOSSO_USER_PROPERTY(LOGIN,NAME,VALUE) VALUES('user1', 'user.registrationDate', 'User1 Registration Date');
INSERT INTO JOSSO_USER_PROPERTY(LOGIN,NAME,VALUE) VALUES('user2', 'user.name', 'User2 Name');
INSERT INTO JOSSO_USER_PROPERTY(LOGIN,NAME,VALUE) VALUES('user2', 'user.lastName', 'User2 Last Name');
INSERT INTO JOSSO_USER_PROPERTY(LOGIN,NAME,VALUE) VALUES('user2', 'user.registrationDate', 'User2 Registration Date');
6).正确执行如上sql脚本后,用用户名:user1,密码:user1pwd,即可进入成功登录页面.