JBoss身份验证问题
我是JBoss的新手,我的应用程序运行在JBoss6.2中。 我们通常使用JSF设置登录。它显示了一个带有用户名和密码(由JSF创建)的屏幕,这是应用程序的内部部分,可以正常工作 但我知道JBoss中有基本的身份验证设置。我们可以按照需要通过身份验证的方式对其进行配置。 我在互联网上搜索了一下,找到了一种介绍它的方法,如下所示:JBoss身份验证问题,jboss,jboss6.x,Jboss,Jboss6.x,我是JBoss的新手,我的应用程序运行在JBoss6.2中。 我们通常使用JSF设置登录。它显示了一个带有用户名和密码(由JSF创建)的屏幕,这是应用程序的内部部分,可以正常工作 但我知道JBoss中有基本的身份验证设置。我们可以按照需要通过身份验证的方式对其进行配置。 我在互联网上搜索了一下,找到了一种介绍它的方法,如下所示: D:\workspace_Csmart\jboss-eap-6.2\bin>add-user What type of user do you wish to a
D:\workspace_Csmart\jboss-eap-6.2\bin>add-user
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): b
Enter the details of the new user to add.
Using realm 'ApplicationRealm' as discovered from the existing property files.
Username : prabhu
User 'prabhu' already exits, would you like to update the existing user password and roles
Is this correct yes/no? yes
Password :
Re-enter Password :
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[user]: prabhu
Updated user 'prabhu' to file 'D:\workspace_Csmart\jboss-eap-
6.2\standalone\configuration\application-users.properties'
Updated user 'prabhu' to file 'D:\workspace_Csmart\jboss-eap-6.2\domain\configuration\application-users.properties'
Updated user 'prabhu' with groups prabhu to file 'D:\workspace_Csmart\jboss-eap-6.2\standalone\configuration\application-roles.prope
Updated user 'prabhu' with groups prabhu to file 'D:\workspace_Csmart\jboss-eap-6.2\domain\configuration\application-roles.propertie
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="cHJhYmh1QDEyMw==" />
D:\workspace\u Csmart\jboss-eap-6.2\bin>添加用户
您希望添加什么类型的用户?
a) 管理用户(管理用户.属性)
b) 应用程序用户(应用程序用户.属性)
(a) :b
输入要添加的新用户的详细信息。
使用从现有属性文件中发现的领域“ApplicationRealm”。
用户名:prabhu
用户“prabhu”已退出,是否要更新现有用户密码和角色
这是否正确?是/否?对
密码:
重新输入密码:
您希望此用户属于哪些组?(请输入逗号分隔的列表,或为无保留空白)[用户]:prabhu
已将用户“prabhu”更新为文件“D:\workspace\u Csmart\jboss eap”-
6.2\独立\配置\应用程序用户。属性'
已将用户“prabhu”更新为文件“D:\workspace\u Csmart\jboss-eap-6.2\domain\configuration\application users.properties”
已将用户“prabhu”和组prabhu更新为文件“D:\workspace\u Csmart\jboss-eap-6.2\standalone\configuration\application-roles.prope”
已将用户“prabhu”和组prabhu更新为文件“D:\workspace\u Csmart\jboss-eap-6.2\domain\configuration\application-roles.property”
此新用户是否将用于一个AS进程以连接到另一个AS进程?
e、 g.对于连接到主机的从主机控制器,或者对于服务器到服务器EJB调用的远程连接。
是/否?对
要表示用户,请将以下内容添加到服务器标识定义中
您可以看到,用户和密码已在属性中更新,因此我使用本地安装程序运行了服务器,服务器已启动并运行。但我没有看到任何询问JBoss基本凭证的弹出窗口。它直接进入登录页面:http://10.17.195.15:8080/Proj/home.xhtml
我是否必须使用standalone.xml
执行任何操作<代码>安全性标签
如果有人能指出我在这里遗漏了什么,我将不胜感激?我需要做些什么才能使其适用于JBoss基本身份验证?谢谢 1)首先,您需要将所有的jsf
文件(需要保护)移动到某个文件夹中,例如secured
文件夹
<?xml version="1.0"?>
<!DOCTYPE jboss-web PUBLIC
"-//JBoss//DTD Web Application 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<jboss-web>
<security-domain>java:/jaas/BasicAuthWebAppPolicy</security-domain>
<context-root>/basicSecurityWebApp</context-root>
</jboss-web>
2)创建重定向到受保护起始页的index.jsf
,并将其放置在安全的
文件夹之外
<?xml version="1.0"?>
<!DOCTYPE jboss-web PUBLIC
"-//JBoss//DTD Web Application 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<jboss-web>
<security-domain>java:/jaas/BasicAuthWebAppPolicy</security-domain>
<context-root>/basicSecurityWebApp</context-root>
</jboss-web>
3)创建logout.jsf
,它执行session.invalidate()
并重定向到index.jsf
页面
<html>
<body>
<%
if(session!=null)
{
session.invalidate();%>
<jsp:forward page="index.jsp" />
<%
} else{
%>
Logged Out Successfully....
<% }%>
</body>
</html>
5)在项目web\u-INF
文件夹中创建jboss-web.xml
文件
<?xml version="1.0"?>
<!DOCTYPE jboss-web PUBLIC
"-//JBoss//DTD Web Application 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<jboss-web>
<security-domain>java:/jaas/BasicAuthWebAppPolicy</security-domain>
<context-root>/basicSecurityWebApp</context-root>
</jboss-web>
7)创建另一个名为basicSecurityWebApp users.properties
的文件,并将其放入WEB-INF/classes
文件夹中,定义用户名和密码
TestUserOne=TestPassword
8)现在您应该修改$PROFILE/conf/
文件夹中的login config.xml
。添加与BasicSecurityWebApp
同名的应用程序策略
<application-policy name="BasicAuthWebAppPolicy">
<authentication>
<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
<module-option name="usersProperties">basicSecurityWebApp-users.properties</module-option>
<module-option name="rolesProperties">basicSecurityWebApp-roles.properties</module-option>
</login-module>
</authentication>
是。这在某种程度上帮助我解决了这个问题,我只是做了以下几件事:
在WebContent文件夹下:
步骤1:web.xml中的更改
所有资源
保护所有资源
/*
普拉布
普拉布
基本的
步骤2:jboss-web.xml中的更改
C-SMART
java:/jaas/other
步骤3:为jboss基本身份验证创建用户和密码
D:\workspace\u Csmart\jboss-eap-6.2\bin>添加用户
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): b
Enter the details of the new user to add.
Using realm 'ApplicationRealm' as discovered from the existing property files.
Username : prabhu
User 'prabhu' already exits, would you like to update the existing user password and roles
Is this correct yes/no? yes
Password :
Re-enter Password :
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[prabhu]: prabhu
Updated user 'prabhu' to file 'D:\workspace_Csmart\jboss-eap-6.2\standalone\configuration\application-users.properties'
Updated user 'prabhu' to file 'D:\workspace_Csmart\jboss-eap-6.2\domain\configuration\application-users.properties'
Updated user 'prabhu' with groups prabhu to file 'D:\workspace_Csmart\jboss-eap-6.2\standalone\configuration\application-roles.properties'
Updated user 'prabhu' with groups prabhu to file 'D:\workspace_Csmart\jboss-eap-6.2\domain\configuration\application-roles.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="cHJhYmh1QDEyMw==" />
Press any key to continue . . .
您希望添加什么类型的用户?
a) 管理用户(管理用户.属性)
b) 应用程序用户(应用程序用户.属性)
(a) :b
输入要添加的新用户的详细信息。
使用从现有属性文件中发现的领域“ApplicationRealm”。
用户名:prabhu
用户“prabhu”已退出,是否要更新现有用户密码和角色
这是否正确?是/否?对
密码:
重新输入密码:
您希望此用户属于哪些组?(请输入逗号分隔的列表,或为无保留空白)[prabhu]:prabhu
已将用户“prabhu”更新为文件“D:\workspace\u Csmart\jboss-eap-6.2\standalone\configuration\application users.properties”
已将用户“prabhu”更新为文件“D:\workspace\u Csmart\jboss-eap-6.2\domain\configuration\application users.properties”
已将用户“prabhu”和组prabhu更新为文件“D:\workspace\u Csmart\jboss-eap-6.2\standalone\configuration\application roles.properties”
已将用户“prabhu”和组prabhu更新为文件“D:\workspace\u Csmart\jboss-eap-6.2\domain\configuration\application roles.properties”
此新用户是否将用于一个AS进程以连接到另一个AS进程?
e、 g.对于连接到主机的从主机控制器,或者对于服务器到服务器EJB调用的远程连接。
是/否?对
要表示用户,请将以下内容添加到服务器标识定义中
按任意键继续。
步骤4:验证以下文件中反映的上述用户更改
'D:\workspace\u Csmart\jboss-eap-6.2\standalone\configuration\application users.properties'
'D:\workspace\u Csmart\jboss-eap-6.2\domain\configuration\application users.properties'
'D:\workspace\u Csmart\jboss-eap-6.2\standalone\configuration\application roles.properties'
'D:\workspace\u Csmart\jboss-eap-6.2\domain\configuration\application roles.properties'
而且对我来说效果很好。。谢谢你的帮助
<jboss-web>
<context-root>C-SMART</context-root>
<security-domain>java:/jaas/other</security-domain>
</jboss-web>
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): b
Enter the details of the new user to add.
Using realm 'ApplicationRealm' as discovered from the existing property files.
Username : prabhu
User 'prabhu' already exits, would you like to update the existing user password and roles
Is this correct yes/no? yes
Password :
Re-enter Password :
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[prabhu]: prabhu
Updated user 'prabhu' to file 'D:\workspace_Csmart\jboss-eap-6.2\standalone\configuration\application-users.properties'
Updated user 'prabhu' to file 'D:\workspace_Csmart\jboss-eap-6.2\domain\configuration\application-users.properties'
Updated user 'prabhu' with groups prabhu to file 'D:\workspace_Csmart\jboss-eap-6.2\standalone\configuration\application-roles.properties'
Updated user 'prabhu' with groups prabhu to file 'D:\workspace_Csmart\jboss-eap-6.2\domain\configuration\application-roles.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="cHJhYmh1QDEyMw==" />
Press any key to continue . . .