[英]Tomcat authentication and specific web app authentication
I config my tomcat with the following configuration in the web.xml. 我在web.xml中使用以下配置配置了tomcat。 So now I secure all webapps in the folder webapps. 因此,现在我将所有webapp都保护在文件夹webapps中。 The user has to authenticate himself, before he can visit the web apps. 用户必须先进行身份验证,然后才能访问Web应用程序。
<security-constraint>
<web-resource-collection>
<web-resource-name>
My Application
</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>demo123</role-name>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Secure Apps</realm-name>
</login-config>
After the user logged in, he can visit the requested web app. 用户登录后,他可以访问所请求的Web应用程序。 My problem: In the web apps the user have to logged in (with Basic authentication), because behind there is a specific server with all server logic. 我的问题:在Web应用程序中,用户必须登录(使用基本身份验证),因为在后面是具有所有服务器逻辑的特定服务器。 I use REST Webservices to communicate to that server. 我使用REST Web服务与该服务器进行通信。 But I can't call the webservices because it shows me a 401 Unauthorized. 但是我无法调用Web服务,因为它向我显示了401未经授权。 If I delete the above configuration in the web.xml, I can call these webservices without problems. 如果删除web.xml中的上述配置,则可以毫无问题地调用这些web服务。 Is there a way to secure all webapps in the tomcat another way? 有没有一种方法可以以另一种方式保护Tomcat中的所有Web应用程序? I need it because the webapps needs the basic authentication. 我需要它,因为webapps需要基本身份验证。
For the applications I use spring framework. 对于应用程序,我使用spring框架。
我通过更改url模式解决了它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.