2009-12-08 47 views
2

我有兴趣确保Web应用中的几个页面只能通过https访问,但我不想验证用户身份。如何在没有Java webapp授权的情况下确保仅限SSL的访问?

我可以使用安全约束来声明性地执行此操作吗?或者我需要以编程方式做些事情?

赞赏任何帮助,感谢乡亲

(Tomcat 5.5中,Servlet规范2.3 - 这是一个传统的事情...)

+0

+1愿意看到的答案 – 2009-12-08 21:13:23

回答

4

使用security-constraint并设置transport-guaranteeCONFIDENTIAL

<security-constraint> 
    <web-resource-collection> 
     <web-resource-name>SSL Redirect</web-resource-name> 
     <url-pattern>*</url-pattern> 
    </web-resource-collection> 
    <user-data-constraint> 
     <transport-guarantee>CONFIDENTIAL 
     </transport-guarantee> 
    </user-data-constraint> 
</security-constraint> 

Servlet 2.3 Spec

1

你有机会来放置一个Apache代理在它的前面?只有SSL的连接将通过该连接,并且会阻止从外部网络直接访问您的Tomcat实例。

相关问题