少年阿宾

那些青春的岁月

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks

1.tomcat下所有应用都强制https访问

在tomcat\conf\web.xml中的</welcome-file-list>后面加上以下配置:


  <login-config>
      <!-- Authorization setting for SSL -->
      <auth-method>CLIENT-CERT</auth-method>
      <realm-name>Client Cert Users-only Area</realm-name>
  </login-config>
  <security-constraint>
      <!-- Authorization setting for SSL -->
      <web-resource-collection >
          <web-resource-name >SSL</web-resource-name>
          <url-pattern>/*</url-pattern>
      </web-resource-collection>
      <user-data-constraint>
          <transport-guarantee>CONFIDENTIAL</transport-guarantee>
      </user-data-constraint>
  </security-constraint>





2.单个应用强制https访问

WEB-INF/web.xml的</welcome-file-list>后面加上以下配置:

  <login-config>
      <!-- Authorization setting for SSL -->
      <auth-method>CLIENT-CERT</auth-method>
      <realm-name>Client Cert Users-only Area</realm-name>
  </login-config>
  <security-constraint>
      <!-- Authorization setting for SSL -->
      <web-resource-collection >
          <web-resource-name >SSL</web-resource-name>
          <url-pattern>/*</url-pattern>
      </web-resource-collection>
      <user-data-constraint>
          <transport-guarantee>CONFIDENTIAL</transport-guarantee>
      </user-data-constraint>
  </security-constraint>




posted on 2013-01-06 21:28 abin 阅读(1332) 评论(0)  编辑  收藏 所属分类: HTTPS

只有注册用户登录后才能发表评论。


网站导航: