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

josso1.8在tomcat6下安装配置

锺博耘
2023-12-01

 

参考地址
http://www.josso.org/confluence/display/JOSSO1/Quick+Start

1.下载josso-1.8.0 解压(解压的路径最好不要存在中文)

2.cmd-〉进入到josso-1.8.0/bin

3.安装

gateway install --target E:/tomcat6 --platform tc60

agent install --target E:/tomcat6 --platform tc60

samples install --target E:/tomcat6 --platform tc60


配置

mysql数据库配置语句:

CREATE DATABASE `josso`
    CHARACTER SET 'gbk'
    COLLATE 'gbk_chinese_ci';

#
# Structure for the `josso_role` table :
#

CREATE TABLE `josso_role` (
  `NAME` varchar(16) NOT NULL,
  `DESCRIPTION` varchar(64) default NULL,
  PRIMARY KEY  (`NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk;

#
# Structure for the `josso_user` table :
#

CREATE TABLE `josso_user` (
  `LOGIN` varchar(16) NOT NULL,
  `PASSWORD` varchar(20) NOT NULL,
  `NAME` varchar(64) default NULL,
  `DESCRIPTION` varchar(64) default NULL,
  PRIMARY KEY  (`LOGIN`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk;

#
# Structure for the `josso_user_property` table :
#

CREATE TABLE `josso_user_property` (
  `LOGIN` varchar(16) NOT NULL,
  `NAME` varchar(255) NOT NULL,
  `VALUE` varchar(255) NOT NULL,
  PRIMARY KEY  (`LOGIN`,`NAME`),
  KEY `LOGIN` (`LOGIN`),
  CONSTRAINT `josso_user_property_fk` FOREIGN KEY (`LOGIN`) REFERENCES `josso_user` (`LOGIN`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=gbk;

#
# Structure for the `josso_user_role` table :
#

CREATE TABLE `josso_user_role` (
  `LOGIN` varchar(16) NOT NULL,
  `NAME` varchar(255) NOT NULL,
  PRIMARY KEY  (`LOGIN`,`NAME`),
  KEY `NAME` (`NAME`),
  KEY `LOGIN` (`LOGIN`),
  CONSTRAINT `josso_user_role_fk1` FOREIGN KEY (`LOGIN`) REFERENCES `josso_user` (`LOGIN`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `josso_user_role_fk` FOREIGN KEY (`NAME`) REFERENCES `josso_role` (`NAME`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=gbk;

#
# Data for the `josso_role` table  (LIMIT 0,500)
#

INSERT INTO `josso_role` (`NAME`, `DESCRIPTION`) VALUES
  ('role1','The Role1'),
  ('role2','The Role2'),
  ('role3','The Role3');

COMMIT;

#
# Data for the `josso_user` table  (LIMIT 0,500)
#

INSERT INTO `josso_user` (`LOGIN`, `PASSWORD`, `NAME`, `DESCRIPTION`) VALUES
  ('user1','user1pwd',NULL,'The User1'),
  ('user2','user2pwd',NULL,'The User2');

COMMIT;

#
# Data for the `josso_user_property` table  (LIMIT 0,500)
#

INSERT INTO `josso_user_property` (`LOGIN`, `NAME`, `VALUE`) VALUES
  ('user1','user.lastName','User1 Last Name'),
  ('user1','user.name','User1 Name'),
  ('user1','user.registrationDate','User1 Registration Date'),
  ('user2','user.lastName','User2 Last Name'),
  ('user2','user.name','User2 Name'),
  ('user2','user.registrationDate','User2 Registration Date');

COMMIT;

#
# Data for the `josso_user_role` table  (LIMIT 0,500)
#

INSERT INTO `josso_user_role` (`LOGIN`, `NAME`) VALUES
  ('user1','role1'),
  ('user1','role2'),
  ('user2','role3');

COMMIT;

配置
josso-agent-config.xml
...
            <agent:agent-configuration>

                <agent:partner-apps>
                    <agent:partner-app id="MySimplePartnerApp" context="/simple-partnerapp"/>
                    <agent:partner-app id="MyPartnerApp1" context="/partnerapp" />
                </agent:partner-apps>


josso-agent-config.xml


<s:beans xmlns:s="http://www.springframework.org/schema/beans"
         xmlns:tc60="urn:org:josso:agent:tomcat60"
         xmlns:agent="urn:org:josso:agent:core"
         xmlns:protocol="urn:org:josso:protocol:client"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
         urn:org:josso:agent:tomcat60 http://www.josso.org/schema/josso-tomcat60-agent.xsd
         urn:org:josso:agent:core http://www.josso.org/schema/josso-agent.xsd
         urn:org:josso:protocol:client http://www.josso.org/schema/josso-protocol-client.xsd">

    <tc60:agent name="josso-tomcat60-agent" sessionAccessMinInterval="1000" >

        <!-- Gateway LOGIN and LOGOUT URLs -->
       <gatewayLoginUrl>http://xxx:8080/josso/signon/login.do</gatewayLoginUrl>
 <gatewayLogoutUrl>http://xxx:8080/josso/signon/logout.do</gatewayLogoutUrl>

        <!-- Gateway service locator -->
        <gatewayServiceLocator>
            <!-- Other properties for ws-service-locator :
            username, password, servicesWebContext, transportSecurity
            -->
          <protocol:ws-service-locator endpoint="xxx:8080" />
        </gatewayServiceLocator>

xxx表示 安装了gateway的服务器地址。


        ....
</s:beans>


josso-gateway-stores.xml

增加
<db-istore:jdbc-store id="josso-identity-store"
                    
       driverName="com.mysql.jdbc.Driver"
   connectionURL="jdbc:mysql://localhost:3306/josso"
   connectionName="root"
   connectionPassword="wsc"
                      userQueryString="SELECT LOGIN AS NAME FROM JOSSO_USER WHERE LOGIN = ?"
                      rolesQueryString="SELECT NAME AS ROLE FROM JOSSO_USER_ROLE WHERE LOGIN = ?"
                      credentialsQueryString="SELECT LOGIN AS USERNAME, PASSWORD FROM JOSSO_USER WHERE LOGIN = ?"
                      userPropertiesQueryString="SELECT NAME, VALUE FROM JOSSO_USER_PROPERTY WHERE LOGIN = ?"
                      resetCredentialDml="UPDATE JOSSO_USER SET PASSWORD = ? WHERE LOGIN = ?"
                      relayCredentialQueryString="SELECT LOGIN FROM JOSSO_USER WHERE #?# = ?" />


进入web时作以下认证即可:

参照 partnerapp/index.jsp


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/warison2008/archive/2009/11/27/4887652.aspx

 类似资料: