Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Apache能否基于Tomcat webapp限制访问;s Spring SecurityContext?_Java_Apache_Web Applications_Tomcat_Spring Security - Fatal编程技术网

Java Apache能否基于Tomcat webapp限制访问;s Spring SecurityContext?

Java Apache能否基于Tomcat webapp限制访问;s Spring SecurityContext?,java,apache,web-applications,tomcat,spring-security,Java,Apache,Web Applications,Tomcat,Spring Security,我们有一个tomcat webapp,它提供使用Spring安全性保护的Web服务。客户端调用一个特定的authenticationService方法,我们编写该方法对它们进行身份验证,并创建一个authToken,然后使用该authToken向Spring Security注册它们,如下所示: SecurityContextHolder.getContext().setAuthentication( authToken ) 那很好。但是,我们还要求经过身份验证的用户能够访问由Apache(h

我们有一个tomcat webapp,它提供使用Spring安全性保护的Web服务。客户端调用一个特定的authenticationService方法,我们编写该方法对它们进行身份验证,并创建一个authToken,然后使用该authToken向Spring Security注册它们,如下所示:

SecurityContextHolder.getContext().setAuthentication( authToken )
那很好。但是,我们还要求经过身份验证的用户能够访问由Apache(httpd)在同一台服务器上提供的静态内容。有没有办法强制要求用户在下载静态内容之前(通过Java/Spring)进行身份验证?似乎Apache和Tomcat必须以某种方式共享SecurityContext

或者,Tomcat似乎可以自己提供静态内容,因为它已经可以访问SecurityContext。如果这是最好的解决方案,任何人都可以提供一个指针,指示我们如何让tomcat做到这一点(在检查用户是否已通过身份验证后提供静态内容)


谢谢。

是的,Tomcat必须提供静态内容

这可能会有帮助。设置之后,使用标准截取url配置保护这些映射