当前位置: 首页 > news >正文

政务信息网站建设工作方案洛阳免费网站建设

政务信息网站建设工作方案,洛阳免费网站建设,wifi推广小程序搭建,手机怎么建网站如果您看过我的上一个博客#xff0c;您会知道我列出了Spring Security可以做的十件事 。 但是#xff0c;在认真开始使用Spring Security之前#xff0c;您真正要做的第一件事就是确保您的Web应用使用正确的传输协议#xff0c;在这种情况下为HTTPS –毕竟#xff0c;没有… 如果您看过我的上一个博客您会知道我列出了Spring Security可以做的十件事 。 但是在认真开始使用Spring Security之前您真正要做的第一件事就是确保您的Web应用使用正确的传输协议在这种情况下为HTTPS –毕竟没有一个安全的网站是没有意义的如果您要在互联网上以纯文本格式广播用户密码。 要设置SSL需要执行三个基本步骤…… 创建密钥库 您需要的第一件事是包含有效证书的私有密钥库生成其中一个证书的最简单方法是使用位于$JAVA_HOME/bin目录中的Java的keytool实用程序。 keytool -genkey -alias MyKeyAlias -keyalg RSA -keystore /Users/Roger/tmp/roger.keystore 在以上示例中 -alias是密钥的唯一标识符。 -keyalg是用于生成密钥的算法。 您在网络上找到的大多数示例通常都引用“ RSA”但是您也可以使用“ DSA”或“ DES” -keystore是一个可选参数用于指定密钥存储文件的位置。 如果缺少此参数则默认位置是$ HOME目录。 RSA代表Ron Rivest也是RC4算法的创建者Adi Shamir和Leonard Adleman DSA代表数字签名算法 DES代表数据加密标准 有关keytool及其参数的更多信息 keytool 参阅Jon Svede的Informit文章。 当您运行此程序时系统会提示您一些问题 Roger$ keytool -genkey -alias MyKeyAlias -keyalg RSA -keystore /Users/Roger/tmp/roger.keystore Enter keystore password: Re-enter new password: What is your first and last name?[Unknown]: localhost What is the name of your organizational unit?[Unknown]: MyDepartmentName What is the name of your organization?[Unknown]: MyCompanyName What is the name of your City or Locality?[Unknown]: Stafford What is the name of your State or Province?[Unknown]: NA What is the two-letter country code for this unit?[Unknown]: UK Is CNlocalhost, OUMyDepartmentName, OMyCompanyName, LStafford, STUK, CUK correct?[no]: YEnter key password for (RETURN if same as keystore password): 大多数字段是不言自明的。 但是对于名字和名字我通常使用机器名称–在这种情况下 localhost 更新Tomcat配置 保护您的应用程序的第二步是确保您的tomcat具有SSL连接器。 为此您需要找到tomcat的server.xml配置文件该文件通常位于conf目录中。 一旦掌握了这一点并且如果您使用的是tomcat那么就不用注释了 Connector port8443 protocolHTTP/1.1 SSLEnabledtruemaxThreads150 schemehttps securetrueclientAuthfalse sslProtocolTLS / …并使它看起来像这样 Connector SSLEnabledtrue keystoreFile/Users/Roger/tmp/roger.keystore keystorePasspassword port8443 schemehttps securetrue sslProtocolTLS/ 请注意密码“ password”是纯文本格式不是很安全。 有很多解决方法但这超出了本博客的范围。 如果您使用的是Spring的tcServer那么您会发现它已经具有配置如下的SSL连接器 Connector SSLEnabledtrue acceptCount100 connectionTimeout20000 executortomcatThreadPool keyAliastcserver keystoreFile${catalina.base}/conf/tcserver.keystore keystorePasschangeme maxKeepAliveRequests15 port${bio-ssl.https.port} protocolorg.apache.coyote.http11.Http11Protocol redirectPort${bio-ssl.https.port} schemehttps securetrue/ …在这种情况下只需编辑各个字段包括keyAliaskeystoreFile和keystorePass。 配置您的应用 如果现在启动tomcat并运行您的Web应用程序您现在会发现可以使用HTTPS访问它。 例如键入https://localhost:8443/my-app可以但是http://localhost:8080/my-app也可以。这意味着您还需要对应用程序进行一些jiggery-pokery以确保其成功仅响应HTTPS可以采用两种方法。 如果您不使用Spring Security则可以在最后一个web-app标签之前将以下内容添加到web.xml security-constraintweb-resource-collectionweb-resource-namemy-secure-app/web-resource-nameurl-pattern/*/url-pattern/web-resource-collectionuser-data-constrainttransport-guaranteeCONFIDENTIAL/transport-guarantee/user-data-constraint /security-constraint 如果您使用的是Spring Security那么还有更多步骤可以解决问题。 常规Spring Security设置的一部分是将以下内容添加到您的web.xml文件中。 首先您需要将一个Spring Security应用程序上下文文件添加到contextConfigLocation context-param context-paramparam-namecontextConfigLocation/param-nameparam-value/WEB-INF/spring/root-context.xml/WEB-INF/spring/appServlet/application-security.xml /param-value/context-param 其次您需要添加Spring Security filter和filter-mapping filterfilter-namespringSecurityFilterChain/filter-namefilter-classorg.springframework.web.filter.DelegatingFilterProxy/filter-class/filterfilter-mappingfilter-namespringSecurityFilterChain/filter-nameurl-pattern/*/url-pattern/filter-mapping 最后您需要创建或编辑application-security.xml 如以下非常简单的示例所示 ?xml version1.0 encodingUTF-8? beans:beans xmlnshttp://www.springframework.org/schema/securityxmlns:beanshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/securityhttp://www.springframework.org/schema/security/spring-security-3.1.xsdhttp auto-configtrue intercept-url pattern/** requires-channelhttps / /httpauthentication-manager/authentication-manager/beans:beans 在上面的示例中已经设置了intercept-url元素来拦截所有URL并强制它们使用https通道。 上面的配置详细信息可能给人的印象是使用简单的web.xml配置更改会更快但是如果您已经在使用Spring Security那么只需在现有配置中添加一个requires-channel属性即可。 可以在git hub上找到一个名为tomcat-ssl的示例应用程序用于演示上述内容网址为https://github.com/roghughe/captaindebug 参考 Captain Debug的Blog博客上的JCG合作伙伴 Roger Hughes 通过SSL和Spring Security保护Tomcat应用程序 。 翻译自: https://www.javacodegeeks.com/2012/12/securing-your-tomcat-app-with-ssl-and-spring-security.html
http://www.zqtcl.cn/news/610286/

相关文章:

  • 企业网站改版升级成都便宜网站建设公司
  • 广州公共资源建设工程交易中心网站新塘做网站
  • 数码港 太原网站开发公司iis 建立子网站
  • 做一个自己的网站需要什么商标设计网站猪八戒
  • 傻瓜式网站建设软件保险预约
  • 网站 备案规定自己做简单网站
  • 网站上怎么做支付接口南乐网站建设
  • 咸阳网站建设公司电话做个公司网站大概多少钱
  • 网站如何做关键词排名点子网创意网
  • 浙江建设培训考试网站河源东莞网站建设
  • 网站移动端做pc端的301跳转哪些网站是增值网
  • wordpress新闻站浙江耀华建设集团网站
  • 网站开发代理企业网站推广技巧和方法
  • 俄语网站开发用模板做的网站多少钱
  • 丽水网站建设公司广州网络公司
  • 做基金的网站哪个好针对大学生推广引流
  • 国外对旅游网站的建设互联网推广和互联网营销
  • 海南省建设厅网站首页有什么做设计的兼职网站
  • 网站导航功能苏州市高新区建设局网站
  • jsp网站 值班多语种网站开发
  • 公司网站英文做电商
  • 合肥企业网站建设公司哪家好卖产品怎么做网站
  • 网站建设公司86215中国中小企业网站
  • 做网站 如何 挣钱游戏网站开发协议
  • 网站建设发展wordpress比较慢
  • 收费网站推广动漫制作就业方向
  • 湖北优化网站建设设计公司需要什么资质
  • 个人网站怎么制作wordpress创意小工具
  • 网站管理维护怎么做在线oa
  • vue做企业网站wordpress 不发送邮件