new*_*web 8 security https spring
我是基于Spring的Web开发的新手.
我们的网站是基于Spring的,目前基于http(非常不安全).由于该网站尚未生效,我们还通过正常的JSON请求向服务器发送登录/密码,主要关注JSP,UI设计,SQL查询等.
现在,我们希望转向关注安全性,并转而采用https作为第一步.
我读过没有.网页和一些春季书籍似乎没有提供关于如何使用Spring提供https安全性的明确答案.有人可以帮助我实现上述目标吗?
如果我的问题不明确,请告诉我.我会尽快添加更多细节.
我们的web.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
"
id="WebApp_ID" version="2.5">
<display-name>Spring3MVC</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<!--> Mapping for serving static web-content <-->
<!--> The resources folder must be in parallel to WEB-INF <-->
<!--> The mvc:resources gives "not bound" exception unless bound to a namespace as above for xmlns:mvc <-->
<mvc:resources mapping="/resources/**" location="/resources/" />
<mvc:resources mapping="/scripts/**" location="/scripts/" />
</web-app>
Run Code Online (Sandbox Code Playgroud)
现在只有一个控制器,spring-servlet.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan
base-package="console.controllerpkg" />
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud)
非常感谢提前!
PS如果你可以在春天推荐我一个很好的基于网站/书籍的例子,我将不胜感激.我见过的大多数网站/书籍都非常重视理论,但很少有例子.这让我有点困惑.
non*_*ont 12
正如Dave所说,您需要配置容器以提供SSL,然后将spring应用程序部署到该容器中.了解如何为SSL配置Tomcat.
或者,更灵活地,您可以使用Apache将容器放在前面,并在那里启用SSL.
归档时间: |
|
查看次数: |
13365 次 |
最近记录: |