Tomcat安全访问
|
我有两个Web服务(MyService和MyProtectedService)。我希望两者都在同一端口HTTPS下进行,但仅受保护的端口具有客户端身份验证(clientAuth = true)。
所有安全性都可以正常工作,但是问题在于两种服务(不仅是受保护的一项)的客户端身份验证都是打开的。我想要的是删除其中一个的客户端身份验证,或仅将客户端身份验证应用于另一个。
有人有提示吗?谢谢
在web.xml中:
<security-constraint>
<web-resource-collection>
<web-resource-name>protected element</web-resource-name>
<description/>
<url-pattern>/MyProtectedService</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
更新:
我试图将服务分为两个约束:
<security-constraint>
<web-resource-collection>
<web-resource-name>OpenService</web-resource-name>
<description/>
<url-pattern>/OpenService</url-pattern>
</web-resource-collection>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>protected</web-resource-name>
<description/>
<url-pattern>/MyProtectedService</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
<login-config>
<auth-metod>CLIENT-CERT</auth-metod>
</login-config>
</security-constraint>
并在server.xml中使用ClientAuth = false。
但是然后我可以在没有任何客户端身份验证的情况下访问它:
https:// MACHINE / MyProtectedService / MyProtectedService?wsdl
没有找到相关结果
已邀请:
1 个回复
臀博
在“ 2”中指定的角色名称将触发身份验证。 更新: 恐怕我没有正确阅读您的问题,而忽略了证书认证部分。尽管我过去曾经使用过它,但我从未遇到过所需的混合设置,因此我只能提供一些选项,供您下一步尝试: 当前,您需要在传输级别进行身份验证。那太低级了,还为时过早。您是否尝试将clientAuth设置为false,而是将以下行添加到web.xml中:
另一种方法是对两个服务使用两个不同的端口。为此,您可以在server.xml中定义两个不同的连接器。