我最近让JBoss在我的JSF应用程序中使用JAAS身份验证。当我意识到我能够在不同的计算机/浏览器中使用相同的用户登录时,一切似乎都能正常工作。
我想知道是否有任何我缺少的配置让它理解我不能允许每个用户多个会话。
起初,我认为这将非常简单,尽管这不是我后来意识到的。已经在JBoss社区网站和这里阅读了2天。
以下是我在standalone.xml中的配置:
<security-domain name="***Realm" cache-type="default">
<authentication>
<login-module code="Database" flag="required">
<module-option name="dsJndiName" value="java:jboss/datasources/***DS"/>
<module-option name="principalsQuery" value="select password from users where email=?"/>
<module-option name="rolesQuery" value="select role_name, 'Roles' from users where email = ?"/>
<module-option name="hashAlgorithm" value="MD5"/>
<module-option name="hashEncoding" value="base64"/>
</login-module>
</authentication>
</security-domain>
相关的JAAS标记到我的web.xml中:
<!-- Allowed Roles -->
<security-role>
<role-name>SUPERADMIN</role-name>
</security-role>
<security-role>
<role-name>ADMIN</role-name>
</security-role>
<security-role>
<role-name>USER</role-name>
</security-role>
<!-- Protected Areas -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Only SUPER Admins</web-resource-name>
<url-pattern>/protected/superadmin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>SUPERADMIN</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Only Admins and SuperAdmins</web-resource-name>
<url-pattern>/protected/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>ADMIN</role-name>
<role-name>SUPERADMIN</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Users and admins and SuperAdmins</web-resource-name>
<url-pattern>/protected/user/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>SUPERADMIN</role-name>
<role-name>ADMIN</role-name>
<role-name>USER</role-name>
</auth-constraint>
</security-constraint>
<!-- Validation By Form -->
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsf</form-login-page>
<form-error-page>/loginError.jsf</form-error-page>
</form-login-config>
</login-config>
<!-- Filter to get the user name and work with it -->
<filter>
<filter-name>LoginFilter</filter-name>
<filter-class>br.com.icts.rybenapessoal.filters.LoginFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>LoginFilter</filter-name>
<url-pattern>/protected/*</url-pattern>
</filter-mapping>
我感谢任何帮助,指出我正确的方向或帮助我找到有关此问题的更多文档。
的问候。 亚瑟