gpt4 book ai didi

java - Weblogic 10.3 : Webapp security using web. WLS 控制台内的 xml 和 DB 角色

转载 作者:行者123 更新时间:2023-12-03 18:19:55 24 4
gpt4 key购买 nike

场景

我们正在使用 Weblogic Server 10.3.4 来运行我们的 Web 应用程序,该应用程序启用了安全限制,以便要求用户在他/她可以使用该应用程序之前登录。用户和组信息应驻留在应用程序数据库中,身份验证应由 WLS(容器)处理。

我已经将数据库架构设置为 described in this blog article ,在 WLS 控制台中设置一个新的安全领域“app.realm”并定义一个 SQLAuthenticator在里面。

重新启动 WLS 后,我可以在 WLS Web 控制台的“app.realm”中的数据库中看到我的用户和组定义。我要验证的用户是 WEBAPP_USER 的成员组(我在 WLS 控制台的用户详细信息页面上看到了组成员身份)。

当我部署应用程序(使用标准设置,在 WLS Web 控制台中没有调整)并调用 protected URL 时,我被重定向到 login.html形式如预期。但是,无论我尝试什么,输入(正确的)密码总是会导致身份验证失败,并将我发送到 login_error.html页。出于调试目的,我在 SQLAuthenticator 中启用了纯文本密码。 ,所以我很确定使用了正确的凭据。

我已经看到了 these two线程,但似乎都无法解决我的问题。

更新 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

我现在执行了这些步骤并让身份验证工作:

  • 添加 SQLAuthenticator到 WLS 控制台中的默认领域“myrealm”
  • 同时设置 Weblogic 的 DefaultAuthenticator和新的 SQLAuthenticator作为SUFFICIENT在各自的提供者设置中(他们如何称呼“JAAS 控制标志”)
  • 重启 WLS

不过还有一个问题:

问题

  • 除了 <domain>/server/AdminServer/logs 中的标准日志文件外,WLS 是否有一些额外的日志记录?我可以看到发生了什么的文件夹?
  • 我做错了什么/我错过了难题中的哪一部分来让我的基于表单的身份验证与我的应用程序一起工作?
  • 当我在 web.xml 中明确提供“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>

登录.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>

最佳答案

对于 auth 领域来说这是一个棘手的概念。关于你最后一个 Unresolved 问题:- 当我在我的 web.xml 中明确提供“app.realm”时,为什么 WLS 使用“myrealm”进行身份验证?

您可以在 WebLogic 中配置多个安全领域,但只有一个可以处于 Activity 状态(在本例中为默认的 myrealm)。不幸的是,这是令人讨厌的限制之一不活动的根本不使用。在 web.xml 中引用非 Activity 领域无效。

看这里http://docs.oracle.com/cd/E24329_01/web.1211/e24422/overview.htm#i1093279

关于java - Weblogic 10.3 : Webapp security using web. WLS 控制台内的 xml 和 DB 角色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5716204/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com