2015-12-03 73 views
0

如果我使用的术语不正确,我会提前道歉,我对Jetty不熟悉。Jetty:配置SSL连接器以仅为特定资源提供服务

我已将SSL连接器连接到我的Jetty服务器。现在,我的公共资源可通过httphttps访问。我想限制从https服务的资源,最好通过检查一些URI模式。我怎么做到这一点?

回答

1

使用标准的servlet <security-constraint>配置在WEB-INF/web.xml

例子:

<security-constraint> 
    <web-resource-collection> 
     <web-resource-name>Force SSL on /private/ url-patterns</web-resource-name> 
     <url-pattern>/private/*</url-pattern> 
    </web-resource-collection> 
    <user-data-constraint> 
     <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint> 
</security-constraint>