我们已经在我们的应用程序中实现了“单点登录”,在JASIG作为身份验证服务器的帮助下。
现在,我们需要一个设置,在CAS中,每个用户只能创建一个会话/票证。
如果用户试图从其他系统/浏览器登录,CAS将使用户的当前票证无效,并从上一次会话/浏览器中注销他/她。
发布于 2015-11-04 11:21:56
最后,我找到了解决问题的办法,我自己。希望它能帮助别人。
Jasig Cas本身使用内存中的映射来跟踪分配给用户的票证。我现正采用类似的方法,以达到以下要求:
为了实现这一功能,在项目中增加了一些额外的功能。有关的更改如下:
下面是必须在项目中完成的配置更改:- 1.src/main/resources/ configuration . project
#Toggle the feature if Single Session.
is.single.sesion.per.user=true
#MySQL query to check the authentication.
user.authentication.sql=select password from user where email=? and is_active=1 /src/main/webapp/WEB-INF/spring-configuration/ticketRegistry.xml
<!--Comment the default ticket regitry. -->
<!-- <bean id="ticketRegistry" class="org.jasig.cas.ticket.registry.DefaultTicketRegistry" /> -->
<!--Add the custom ticket regitry. -->
<bean id="ticketRegistry" class="com.naval.cas.SingleSesionTicketRegistry"
p:isSingleSesionPerUser="${is.single.sesion.per.user}"
p:logoutManager-ref="logoutManager"/>/src/main/webapp/WEB-INF/deployerConfigContext.xml
<!--Add the Following code block -->
<bean id="passwordEncoder"
class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder"
c:encodingAlgorithm="MD5"
p:characterEncoding="UTF-8" />
<bean id="primaryAuthenticationHandler"
class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler"
p:dataSource-ref="dataSource"
p:passwordEncoder-ref="passwordEncoder"
p:sql="${user.authentication.sql}" />可以在下面的github回购中找到单个会话票证注册表类。
https://stackoverflow.com/questions/31942043
复制相似问题