当前位置: 首页 > 工具软件 > JOSSO > 使用案例 >

[转]josso+tomcat配置之josso服务器配置(一)

姜鸿畴
2023-12-01

转自【http://blog.sina.com.cn/s/blog_4aebeb1201008dri.html

准备文件:
1.从 http://www.josso.org/下载apache-tomcat-5.5.25_josso-1.6.zip
2.从http://apache.mirror.phpchina.com/tomcat/tomcat-5/v5.5.25/bin/apache-tomcat-5.5.25.zip下载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内容如下:

 

<?xml version="1.0" encoding="ISO-8859-1" ?>  
  
<configuration>  
    <!-- Comment this if no Gateway is configured for this server -->  
    <hierarchicalXml fileName="josso-gateway-config.xml"/>  
</configuration>
 

 

 

j osso-gateway-config.xml内容如下:

 

<?xml version="1.0" encoding="ISO-8859-1" ?>
<domain>
	<name>SampleDomain</name>
	<type>web</type>
	<authenticator>
		<class>org.josso.auth.AuthenticatorImpl</class> 
		<authentication-schemes>
			<authentication-scheme>
				<name>basic-authentication</name> 
				<class>org.josso.auth.scheme.UsernamePasswordAuthScheme</class>
				<credential-store>
					<class>org.josso.gateway.identity.service.store.db.JDBCIdentityStore</class>
					<credentialsQueryString>SELECT login AS username , password AS password FROM josso_user WHERE login = ?</credentialsQueryString>
					<connectionName>sa</connectionName> 
					<connectionPassword>sa</connectionPassword> 
					<connectionURL>jdbc:jtds:sqlserver://127.0.0.1:1433/cas</connectionURL> 
					<driverName>net.sourceforge.jtds.jdbc.Driver</driverName>
				</credential-store>
				<credential-store-key-adapter>
					<class>org.josso.gateway.identity.service.store.SimpleIdentityStoreKeyAdapter</class>
				</credential-store-key-adapter>
			</authentication-scheme>
		</authentication-schemes>
	</authenticator>

	<sso-identity-manager> 
		<class>org.josso.gateway.identity.service.SSOIdentityManagerImpl</class>
		<sso-identity-store>
			<class>org.josso.gateway.identity.service.store.db.JDBCIdentityStore</class>
			<userQueryString>SELECT login FROM josso_user WHERE login = ?</userQueryString>
			<rolesQueryString> 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</rolesQueryString>
			<connectionName>sa</connectionName> 
			<connectionPassword>sa</connectionPassword> 
			<connectionURL>jdbc:jtds:sqlserver://127.0.0.1:1433/cas</connectionURL> 
			<driverName>net.sourceforge.jtds.jdbc.Driver</driverName>
		</sso-identity-store>
		<sso-identity-store-key-adapter>
			<class>org.josso.gateway.identity.service.store.SimpleIdentityStoreKeyAdapter</class>
		</sso-identity-store-key-adapter>
	</sso-identity-manager> 
	<sso-session-manager> 
		<class>org.josso.gateway.session.service.SSOSessionManagerImpl</class> 
		<maxInactiveInterval>30</maxInactiveInterval>
		<maxSessionsPerUser>-1</maxSessionsPerUser>
		<sso-session-store>
			<class>org.josso.gateway.session.service.store.MemorySessionStore</class>
		</sso-session-store>
		<sso-session-id-generator> 
			<class>org.josso.gateway.session.service.SessionIdGeneratorImpl</class>
			<algorithm>MD5</algorithm>
		</sso-session-id-generator>
	</sso-session-manager>
	<sso-audit-manager> 
		<class>org.josso.gateway.audit.service.SSOAuditManagerImpl</class> 
		<handlers>
			<handler>
				<class>org.josso.gateway.audit.service.handler.LoggerAuditTrailHandler</class> 
				<name>LoggerAuditTrailHandler</name> 
				<category>org.josso.gateway.audit.SSO_AUDIT</category>
			</handler>
		</handlers> 
	</sso-audit-manager>
	<sso-event-manager> 
		<class>org.josso.gateway.event.security.JMXSSOEventManagerImpl</class>
		<oname>josso:type=SSOEventManager</oname>
	</sso-event-manager>
</domain>
 

 

 

3).将如下包复制到%CATALINA_HOME%/common/lib下

 

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及数据库驱动包
 

 

 

4).配置完毕,启动tomcat,用http://localhost:8080/josso/signon/login.do访问,如果能正常出现登录页面说明部署成功。


5).执行如下sql脚本:
建表:

 

CREATE TABLE JOSSO_ROLE ( NAME VARCHAR(16) NOT NULL, DESCRIPTION VARCHAR(64) NULL );
CREATE TABLE JOSSO_USER ( LOGIN VARCHAR(16) NOT NULL, PASSWORD VARCHAR(20) NOT NULL, NAME VARCHAR(64) NULL, DESCRIPTION VARCHAR(64) NULL );
CREATE TABLE JOSSO_USER_PROPERTY ( LOGIN VARCHAR(16) NOT NULL, NAME VARCHAR(255) NOT NULL, VALUE VARCHAR(255) NOT NULL );
CREATE TABLE JOSSO_USER_ROLE ( LOGIN VARCHAR(16) NOT NULL, NAME VARCHAR(255) NOT NULL );

 

 插入测试数据:

 

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,即可进入成功登录页面.

 

如果出现java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.CompilationResult

.getProblems()[Lorg/eclipse/jdt/core/compiler/IProblem;异常信息,是由于缺少core.jar(Maven下GroupID为org.eclipse.jdt,Artifact Id为:core

 类似资料: