添加https支持
This commit is contained in:
BIN
keystore.p12
Normal file
BIN
keystore.p12
Normal file
Binary file not shown.
@@ -1,14 +1,35 @@
|
|||||||
package com.macro.mall.portal;
|
package com.macro.mall.portal;
|
||||||
|
|
||||||
|
import org.apache.catalina.connector.Connector;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
|
||||||
|
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@MapperScan({"com.macro.mall.mapper","com.macro.mall.portal.dao"})
|
@MapperScan({"com.macro.mall.mapper","com.macro.mall.portal.dao"})
|
||||||
public class MallPortalApplication {
|
public class MallPortalApplication {
|
||||||
|
@Value("${http.port}")
|
||||||
|
private Integer port;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(MallPortalApplication.class, args);
|
SpringApplication.run(MallPortalApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public EmbeddedServletContainerFactory servletContainer() {
|
||||||
|
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
|
||||||
|
tomcat.addAdditionalTomcatConnectors(createStandardConnector()); // 添加http
|
||||||
|
return tomcat;
|
||||||
|
}
|
||||||
|
|
||||||
|
//配置http
|
||||||
|
private Connector createStandardConnector() {
|
||||||
|
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
|
||||||
|
connector.setPort(port);
|
||||||
|
return connector;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,10 +62,12 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
.logoutSuccessHandler(new GoLogoutSuccessHandler())
|
.logoutSuccessHandler(new GoLogoutSuccessHandler())
|
||||||
.invalidateHttpSession(true)
|
.invalidateHttpSession(true)
|
||||||
.deleteCookies("JSESSIONID")
|
.deleteCookies("JSESSIONID")
|
||||||
// .and()
|
.and()
|
||||||
// .requiresChannel()
|
.requiresChannel()
|
||||||
// .antMatchers("/sso/*").requiresSecure()
|
.antMatchers("/sso/*")
|
||||||
// .anyRequest().requiresInsecure()
|
.requiresSecure()
|
||||||
|
.anyRequest()
|
||||||
|
.requiresInsecure()
|
||||||
// .and()
|
// .and()
|
||||||
// .rememberMe()
|
// .rememberMe()
|
||||||
// .tokenValiditySeconds(1800)
|
// .tokenValiditySeconds(1800)
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
#===server start===
|
#===server start===
|
||||||
server.port=8085
|
http.port=8085
|
||||||
|
server.port=8443
|
||||||
|
server.ssl.key-store=keystore.p12
|
||||||
|
server.ssl.key-alias=tomcat
|
||||||
|
server.ssl.key-store-password=123456
|
||||||
|
server.ssl.key-store-type=PKCS12
|
||||||
#===server end===
|
#===server end===
|
||||||
|
|
||||||
#===logging start===
|
#===logging start===
|
||||||
|
|||||||
Reference in New Issue
Block a user