WebLogic中部署的REST Web服务的双重身份验证问题

问题描述 投票:1回答:3

我有一个安静的Web服务,使用HTTP Basic提供程序使用LDAP身份验证进行保护。

将应用程序部署到WebLogic后,它会在调用时提示两次身份验证。

首先是Spring Security然后是WebLogic Server。

对该主题的进一步调查显示,client requests that use HTTP BASIC authentication must pass WebLogic Server authentication, even if access control is not enabled on the target resource.

作为选项(在答案中提供),可以通过config.xml中的以下配置禁用WebLogic的身份验证:

<enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials>

但它会影响在同一域中部署的所有其他应用程序。我只希望这个特定的应用程序。

感谢任何建议。

java java-ee-6 weblogic11g http-basic-authentication
3个回答
3
投票

尝试在config.xml中禁用WebLogic的身份验证:

<enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials>

参见例如

因此,您可以在每个域的基础上打开或关闭此功能。如果您需要定位特定应用,请考虑将该应用置于专用域中。


0
投票

添加以下配置后开始工作。但是需要在weblogic控制台中添加新用户,或者我们可以使用默认用户。

在WEB-INF \ web.xml文件中添加了以下配置

  <security-constraint>
    <display-name>Secure REST Area</display-name>
    <web-resource-collection>
        <web-resource-name>Secure REST</web-resource-name>
        <url-pattern>/api/*</url-pattern>
        <http-method>POST</http-method>
    </web-resource-collection>

    <auth-constraint>
        <role-name>Admin</role-name>
    </auth-constraint>
</security-constraint>

<login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>default</realm-name>
</login-config>

<security-role>
    <role-name>Admin</role-name>
</security-role>

在WEB-INF \ weblogic.xml中创建了weblogic描述符文件,并添加到配置下方。

<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <security-role-assignment>
     <role-name>Admin</role-name>
     <!-- <principal-name>Administrators</principal-name>-->
     <externally-defined/>
 </security-role-assignment>


0
投票

解决方法,在web.xml中添加另一个auth方法:

<login-config>
    <auth-method>CLIENT-CERT</auth-method>
</login-config>

Weblogic的basic-auth提示不会显示,只有你自己。

来源:http://forum.spring.io/forum/spring-projects/security/35977-weblogic-9x-10x-double-prompt-for-login-basic-auth-simple

© www.soinside.com 2019 - 2024. All rights reserved.