日期:2014-05-18  浏览次数:20844 次

大牛请进
前段时间一直忙着测试,这两天,老大又要我搞起单点登录,实在头疼,但是问题总得解决,鄙人脸皮比较厚,上次已经发过一帖了,但是没有得到实质性的解决。希望能有大牛能够指点迷津。

我的需求是,两个应用,分别是a.csdn.com和csdn.com两个域名,两个应用都有独立ip.也都有各自的服务器,一个是安装版的tomcat服务器和一个免安装版的tomcat服务器。
登录时,两个应用分别有独立的登录页面,所以,a登录了,即打开b网站,b也能登录,退出也是一样的。反之亦是如此。

所以,我觉得cas单点登录不适用于我的需求,而用cookie登录也不安全(最主要的还是自己没有弄明白怎么写)上次还试了试josso..也没有看明白。

我没有太多的开发经验,网上的确有很多资料,但是,自己一个人琢磨,英语又比较差,实在没法理解,也无法去写代码。单点登录,到底有多难?

求解?

谢谢,各位回帖大牛!

------解决方案--------------------
我没有接触很多关于单点登录的项目,不过了解一些。个人愚见,这种情况可以用sso实现的。tomcat要配置ssl协议,sso建议不要用ip,可以用域名代替。
------解决方案--------------------
CAS单独作为一个module。

其他Project在配置文件里设置。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sec="http://www.springframework.org/schema/security" xmlns:p="http://www.springframework.org/schema/p"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

  <!-- Load parameters from context.xml -->
   <bean id="propertyConfigurer" class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer"/>

<sec:http entry-point-ref="casEntryPoint">
<sec:intercept-url pattern="/xxx/xxx/**" filters="none" />
<sec:intercept-url pattern="/xxx/**" filters="none" />
<sec:intercept-url pattern="/xxx/**" access="ROLE_USER" />
<sec:logout invalidate-session="true" logout-url="/logout" logout-success-url="/loggedOut.html"/>
<sec:custom-filter position="CAS_FILTER" ref="casFilter" />
</sec:http>

<sec:authentication-manager alias="authenticationManager">
<sec:authentication-provider ref="casAuthenticationProvider" />
</sec:authentication-manager>
 
<bean id="serviceProperties" class="org.springframework.security.cas.ServiceProperties">
<property name="service" value="${casServiceUrl}/j_spring_cas_security_check" />
<property name="sendRenew" value="false" />
</bean>

<bean id="casFilter" class="org.springframework.security.cas.web.CasAuthenticationFilter">
<property name="authenticationManager" ref="authenticationManager" />
</bean>

<bean id="casEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
<property name="loginUrl" value="${casServerUrl}/login" />
<property name="serviceProperties" ref="serviceProperties" />
</bean>

<bean id="casAuthenticationProvider" class="org.springframework.security.cas.authentication.CasAuthenticationProvider">
<property name="authenticationUserDetailsService"&