问题描述
我正在尝试在JBoss7中配置单一登录.
I am trying to configure Single-Sign-On in JBoss7.
standalone.xml中的安全域:
security-domain in standalone.xml:
<security-domain name="my_auth">
<authentication>
<login-module code="Database" flag="required">
<module-option name="dsJndiName" value="java:/comp/env/myDS"/>
<module-option name="principalsQuery"
value="select password from usertable where login_id=?"/>
<module-option name="rolesQuery"
value="select user_role from usertable where login_id=?"/>
<module-option name="hashAlgorithm" value="MD5"/>
<module-option name="hashEncoding" value="hex"/>
</login-module>
</authentication>
</security-domain>
standalone.xml中的虚拟服务器
virtual-server in standalone.xml
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<sso/>
</virtual-server>
我的webapp1和webapp2的jboss-web.xml
my webapp1 and webapp2's jboss-web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<jboss-web>
<security-domain>my_auth</security-domain>
</jboss-web>
配置后工作正常.但这有一个小问题:
It works fine after configure.But it has a little problem:
启动服务器并首次登录到webapp1或webapp2时,未登录另一个webapp.我从第一个Web应用程序注销,然后再次登录,一切正常.
When start the server and first time login to webapp1 or webapp2, another webapp is not logined.I logout from the first webapp, and login again, it works fine.
我尝试将属性reauthenticate ="false"添加到,仍然存在相同的问题.
I tried to add attribute reauthenticate="false" to , still have the same problem.
我对这个问题一无所知,有人可以提出建议吗?
I have no idea about this problem, could anyone have suggestions?
推荐答案
我认为您还必须将SSO Valve添加到jboss-web.xml中.
I think you have to add the SSO Valve to your jboss-web.xml also.
以下内容对我有用(JBoss 7.1.1)
The following worked for me (JBoss 7.1.1)
standalone.xml
standalone.xml
<security-domain name="my_auth">
<authentication>
<login-module code="Database" flag="required">
<module-option name="dsJndiName" value="java:/comp/env/myDS"/>
<module-option name="principalsQuery"
value="select password from usertable where login_id=?"/>
<module-option name="rolesQuery"
value="select user_role from usertable where login_id=?"/>
<module-option name="hashAlgorithm" value="MD5"/>
<module-option name="hashEncoding" value="hex"/>
</login-module>
</authentication>
</security-domain>
...
<virtual-server name="default-host" enable-welcome-root="false">
...
<sso reauthenticate="false"/>
</virtual-server>
jboss-web.xml:
jboss-web.xml:
<jboss-web>
<security-domain flushOnSessionInvalidation="true">java:/jaas/my_auth</security-domain>
<valve>
<class-name>org.apache.catalina.authenticator.SingleSignOn</class-name>
</valve>
</jboss-web>
这篇关于JBoss7 Web SSO(非集群)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!