Recently, there is a need in the project, the previous restful interface in the form of HTTPS access, from the Internet to check the data, after a close test to achieve the demand.
After the information on the Internet is collated as follows, please read.
1, according to the previous article tomcat6.0 configure HTTPS one-way (server) encryption method to configure the server HTTPS access.
2, two ways to configure the rest interface HTTPS mode:
First: Increase in Web.xml
<security-constraint>
<web-resource-collection>
<web-resource-name>securedapp</web-resource-name>
<url-pattern>/rest/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
The second type:
1) Increase in Web.xml
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/rest/*</url-pattern>
</filter-mapping>
2) Increase Spring-security.xml
<beans:beans xmlns:beans= "Http://www.springframework.org/schema/beans"
Xmlns= "Http://www.springframework.org/schema/security"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
Xsi:schemalocation= "Http://www.springframework.org/schema/beans
Http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
Http://www.springframework.org/schema/security
Http://www.springframework.org/schema/security/spring-security-3.1.xsd ">
<intercept-url pattern= "/rest/**" requires-channel= "https"/>
<port-mappings>
<port-mapping http= "9090" https= "9443"/>
</port-mappings>
<authentication-manager>
</authentication-manager>
</beans:beans>