Weblogic 10.3:在WLS控制台中使用web.xml和DB角色进行Webapp安全
||
情境
我们正在使用Weblogic Server 10.3.4运行我们的webapp,该webapp启用了安全性限制,以便要求用户在使用该应用程序之前登录。用户和组信息应驻留在应用程序数据库中,认证应由WLS(容器)处理。
我已经按照此博客文章中的说明设置了数据库架构,在WLS控制台中设置了一个新的Security Realm \“ app.realm \”,并在其中定义了一个“ 0”。
重新启动WLS之后,我可以在WLS Web控制台的\“ app.realm \”中从数据库中查看我的用户和组定义。我要验证的用户是“ 1”组的成员(我在WLS控制台的用户详细信息页面上看到该组的成员身份)。
当我部署应用程序(使用标准设置,在WLS Web控制台中不进行任何调整)并调用受保护的URL时,我将按预期的方式重定向到“ 2”格式。但是,无论我如何尝试,输入(正确的)密码始终会导致身份验证失败,使我无法进入
login_error.html
页面。出于调试目的,我在ѭ0中启用了纯文本密码,因此,我可以肯定使用了正确的凭据。
我已经看到了这两个线程,但似乎都没有帮助解决我的问题。
更新1
感谢emzy \的评论,我现在看到WLS正在对照默认领域\“ myrealm \”检查凭据,并尝试针对嵌入式LDAP解析登录用户名:
...
####<20.04.2011 09:29 Uhr MESZ> <Debug> <SecurityAtn> <hostname> <AdminServer> <[ACTIVE] ExecuteThread: \'6\' for queue: \'weblogic.kernel.Default (self-tuning)\'> <<WLS Kernel>> <> <> <1303284573150> <BEA-000000> <getDNForUser search(\"ou=people,ou=myrealm,dc=nvs_dev\", \"(&(uid=app.user)(objectclass=person))\", base DN & below)>
####<20.04.2011 09:29 Uhr MESZ> <Debug> <SecurityAtn> <hostname> <AdminServer> <[ACTIVE] ExecuteThread: \'6\' for queue: \'weblogic.kernel.Default (self-tuning)\'> <<WLS Kernel>> <> <> <1303284573150> <BEA-000000> <DN for user app.user: null>
####<20.04.2011 09:29 Uhr MESZ> <Debug> <SecurityAtn> <hostname> <AdminServer> <[ACTIVE] ExecuteThread: \'6\' for queue: \'weblogic.kernel.Default (self-tuning)\'> <<WLS Kernel>> <> <> <1303284573150> <BEA-000000> <returnConnection conn:LDAPConnection { ldapVersion:2 bindDN:\"\"}>
####<20.04.2011 09:29 Uhr MESZ> <Debug> <SecurityAtn> <hostname> <AdminServer> <[ACTIVE] ExecuteThread: \'6\' for queue: \'weblogic.kernel.Default (self-tuning)\'> <<WLS Kernel>> <> <> <1303284573151> <BEA-000000> <javax.security.auth.login.FailedLoginException: [Security:090302]Authentication Failed: User app.user denied
at weblogic.security.providers.authentication.LDAPAtnLoginModuleImpl.login(LDAPAtnLoginModuleImpl.java:229)
at com.bea.common.security.internal.service.LoginModuleWrapper$1.run(LoginModuleWrapper.java:110)
at java.security.AccessController.doPrivileged(Native Method)
...
更新2
我现在执行了以下步骤,并使身份验证起作用:
在WLS控制台中将“ 0”添加到默认领域\“ myrealm \”
在相应的提供程序设置中将Weblogic的ѭ7和新的ѭ0都设置为ѭ9(他们称之为“ JAAS控制标志”)
重启WLS
但是,仍然存在一个问题:
问题
除了<domain>/server/AdminServer/logs
文件夹中的标准日志文件之外,WLS是否还有其他日志记录,我可以看到会发生什么情况?
我做错了什么/我缺少基于表单的身份验证以与我的应用程序一起工作的难题中的哪一部分?
当我在ѭ11中明确给出“ app.realm”时,为什么WLS使用“ myrealm”进行身份验证?
这是我的配置详细信息:
web.xml
...
<security-constraint>
<web-resource-collection>
<web-resource-name>Webapp Platform</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>USER</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>app-realm</realm-name>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/login_error.html</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description>Standard user</description>
<role-name>USER</role-name>
</security-role>
...
weblogic.xml
<wls:weblogic-web-app xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:wls=\"http://www.bea.com/ns/weblogic/weblogic-web-app\"
xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app.xsd\">
...
<security-role-assignment>
<role-name>USER</role-name>
<principal-name>WEBAPP_USER</principal-name>
</security-role-assignment>
</wls:weblogic-web-app>
login.html
<html>
<head>
<title>Login</title>
</head>
<body>
<form method=\"POST\" action=\"j_security_check\">
<table>
<tr><td>Username:</td><td><input type=\"text\" name=\"j_username\"></td></tr>
<tr><td>Password:</td><td><input type=\"password\" name=\"j_password\"></td></tr>
<tr><td colspan=2 align=right><input type=submit value=\"Submit\"></td></tr>
</table>
</form>
</body>
</html>
没有找到相关结果
已邀请:
2 个回复
联课
誓猎贰