Lit*_*ird 4 java ssl tomcat web-applications maven
我是IT行业的新手.测试场景就像我需要测试我的应用程序的登录页面是否受SSL保护?
通常,有时我们会访问某些网站,其中显示了SSL安全性的弹出窗口.所以我需要在我的应用程序中测试相同的场景.
我有一个小网页应用程序,我有login.html页面.基本上,我可以使用Maven启动我的Web应用程序,使用的服务器是Tomcat.我正在使用的命令是mvn tomcat7:run和URL一起使用http://localhost:8080/login.html.它完美地运作.
但我想我的网址,从改变http到https,当我访问我的网址,即https://localhost:8080/login.html,那么它应该弹出与SSL安全警报,我应该接受它.
如果我的问题仍然不明确,请随时发表评论.
在网上搜索后,我做了一些解决方法,但它没有成功.我尝试过的:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Login App</h1>
<div id="emptyDiv"></div>
<div id="description"></div>
<!--container start-->
<div id="container">
<div id="container_body" style="background-color:#BBD700;float:center;">
<!--Form start-->
<div id="form_name">
<div class="firstnameorlastname">
<form >
<div id="errorBox"></div>
First Name : <input id="firstName" type="text" name="Name" value="" >
Last name : <input id="lastName" type="text" name="LastName" value="" >
</div>
<div id="email_form">
Email Id: <input style="position:right" type="text" name="Email" value="" >
</div>
<input id="sub_form" type="submit" value="Submit">
</form>
</div>
<!--form ends-->
</div>
</div>
<!--container ends-->
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
<pre><code><!DOCTYPE web-app PUBLIC <span style="color: red;">"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"</span> <span style="color: red;">"http://java.sun.com/dtd/web-app_2_3.dtd"</span>>
<web-app>
<!-- <security-constraint>
<web-resource-collection>
<web-resource-name>MyEducationApp</web-resource-name>
<url-pattern>/login.html</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Non-SecureResource</web-resource-name>
<url-pattern>/login.html</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint> -->
<display-name>Login WebApp</display-name>
</web-app>
</span></code></pre>
Run Code Online (Sandbox Code Playgroud)
<!-- Maven Tomcat Plugin -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>https://localhost:8080/manager/text</url>
<server>localhost</server>
<path>/</path>
<username>admin</username>
<password>aRfalah</password>
</configuration>
<executions>
<execution>
<id>tomcat7-run</id>
<goals>
<goal>run-war-only</goal>
</goals>
<phase>pre-integration-test</phase>
<configuration>
<fork>true</fork>
</configuration>
</execution>
<execution>
<id>tomcat7-shutdown</id>
<goals>
<goal>shutdown</goal>
</goals>
<phase>post-integration-test</phase>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
您的网站的SSL/TLS加密在您的Web应用程序中无能为力.它是通过您的Web服务器配置完成的.
请参阅Apache Tomcat 7,SSL配置HOW-TO.
附加信息(从我对OQ的评论重复,因为评论不那么突出):
您无需从其中一个证书颁发机构(CA)购买证书即可获得证书.
- 免费提供2年免费扩展验证SSL证书 - 最多99个域名
- 无限制的无限期2年组织验证SSL证书 - 多域和通配符
- 无限期免费提供2年期组织客户证书
https://站点相关联.如果访问者在浏览器中弹出的对话框中接受您的证书,则会将其存储在浏览器的证书存储区中,并且在达到证书的到期日期之前,对话框不会再次出现.| 归档时间: |
|
| 查看次数: |
425 次 |
| 最近记录: |