diff --git a/tamguo-bms/src/main/java/com/tamguo/config/web/WebConfig.java b/tamguo-bms/src/main/java/com/tamguo/config/web/WebConfig.java index 27b0699..2b2faad 100644 --- a/tamguo-bms/src/main/java/com/tamguo/config/web/WebConfig.java +++ b/tamguo-bms/src/main/java/com/tamguo/config/web/WebConfig.java @@ -2,7 +2,10 @@ package com.tamguo.config.web; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.session.web.http.CookieSerializer; +import org.springframework.session.web.http.DefaultCookieSerializer; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -14,6 +17,8 @@ public class WebConfig implements WebMvcConfigurer { @Value("${file.storage.path}") private String fileStoragePath; + @Value("${cookie.domian.name}") + private String cookieDomianName; @Autowired private MemberInterceptor memberInterceptor; @@ -26,4 +31,13 @@ public class WebConfig implements WebMvcConfigurer { public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(memberInterceptor).addPathPatterns("/member/**"); } + + @Bean + public CookieSerializer defaultCookieSerializer(){ + DefaultCookieSerializer defaultCookieSerializer = new DefaultCookieSerializer(); + defaultCookieSerializer.setCookieName("sessionId"); + defaultCookieSerializer.setDomainName(cookieDomianName); + defaultCookieSerializer.setCookiePath("/"); + return defaultCookieSerializer; + } } diff --git a/tamguo-bms/src/main/resources/application.properties b/tamguo-bms/src/main/resources/application.properties index 30bc224..ea1c838 100644 --- a/tamguo-bms/src/main/resources/application.properties +++ b/tamguo-bms/src/main/resources/application.properties @@ -1,6 +1,7 @@ -domain.name=http://localhost:8083/ -admin.domain.name=http://localhost:8083/ -tamguo.admin.name=http://localhost:8081/login +domain.name=https://book.tamguo.com/ +admin.domain.name=https://book.tamguo.com/ +tamguo.admin.name=https://www.tamguo.com/login +cookie.domian.name=tamguo.com server.port=8083 jasypt.encryptor.password=tamguo @@ -13,14 +14,14 @@ spring.datasource.maxPoolPreparedStatementPerConnectionSize=20 spring.datasource.maxWait=60000 spring.datasource.minEvictableIdleTimeMillis=300000 spring.datasource.minIdle=5 -spring.datasource.password=123456 +spring.datasource.password=tanguo520pig spring.datasource.poolPreparedStatements=true spring.datasource.testOnBorrow=false spring.datasource.testOnReturn=false spring.datasource.testWhileIdle=true spring.datasource.timeBetweenEvictionRunsMillis=60000 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource -spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tamguo_20181110?useUnicode=true&characterEncoding=UTF-8&useSSL=false +spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tamguo?useUnicode=true&characterEncoding=UTF-8&useSSL=false spring.datasource.username=root spring.datasource.validationQuery=SELECT 1 FROM DUAL diff --git a/tamguo-mms/src/main/java/com/tamguo/config/web/WebConfig.java b/tamguo-mms/src/main/java/com/tamguo/config/web/WebConfig.java index 5a5d3fc..5235434 100644 --- a/tamguo-mms/src/main/java/com/tamguo/config/web/WebConfig.java +++ b/tamguo-mms/src/main/java/com/tamguo/config/web/WebConfig.java @@ -2,7 +2,10 @@ package com.tamguo.config.web; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.session.web.http.CookieSerializer; +import org.springframework.session.web.http.DefaultCookieSerializer; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -15,16 +18,30 @@ public class WebConfig implements WebMvcConfigurer { @Value("${file.storage.path}") private String fileStoragePath; + @Value("${cookie.domian.name}") + private String cookieDomianName; + @Autowired private MemberInterceptor memberInterceptor; + @Override public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(memberInterceptor).addPathPatterns("/**").excludePathPatterns("/login.html","/register.html","/password/**","/captcha.jpg" , "/submitLogin.html" , "/miniLogin.html","/static/**","/sendFindPasswordSms","/subRegister"); + registry.addInterceptor(memberInterceptor).addPathPatterns("/**").excludePathPatterns("/login.html","/register.html","/password/**","/captcha.jpg" , "/submitLogin.html" , "/miniLogin.html","/static/**","/sendFindPasswordSms","/subRegister","/checkMobile.html","/checkUsername.html"); } @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/files/**").addResourceLocations("file:"+fileStoragePath); } + + @Bean + public CookieSerializer defaultCookieSerializer(){ + DefaultCookieSerializer defaultCookieSerializer = new DefaultCookieSerializer(); + defaultCookieSerializer.setCookieName("sessionId"); + defaultCookieSerializer.setDomainName(cookieDomianName); + defaultCookieSerializer.setCookiePath("/"); + return defaultCookieSerializer; + } + } diff --git a/tamguo-mms/src/main/resources/application.properties b/tamguo-mms/src/main/resources/application.properties index e370d4a..6b4fa54 100644 --- a/tamguo-mms/src/main/resources/application.properties +++ b/tamguo-mms/src/main/resources/application.properties @@ -1,6 +1,7 @@ -domain.name=http://localhost:8084/ -book.domain.name=http://localhost:8083/ -tamguo.domain.name=http://localhost:8081/ +domain.name=https://member.tamguo.com/ +book.domain.name=https://book.tamguo.com/ +tamguo.domain.name=https://www.tamguo.com/ +cookie.domian.name=tamguo.com server.port=8084 jasypt.encryptor.password=tamguo @@ -13,14 +14,14 @@ spring.datasource.maxPoolPreparedStatementPerConnectionSize=20 spring.datasource.maxWait=60000 spring.datasource.minEvictableIdleTimeMillis=300000 spring.datasource.minIdle=5 -spring.datasource.password=123456 +spring.datasource.password=tanguo520pig spring.datasource.poolPreparedStatements=true spring.datasource.testOnBorrow=false spring.datasource.testOnReturn=false spring.datasource.testWhileIdle=true spring.datasource.timeBetweenEvictionRunsMillis=60000 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource -spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tamguo_20181110?useUnicode=true&characterEncoding=UTF-8&useSSL=false +spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tamguo?useUnicode=true&characterEncoding=UTF-8&useSSL=false spring.datasource.username=root spring.datasource.validationQuery=SELECT 1 FROM DUAL diff --git a/tamguo-tms/src/main/java/com/tamguo/config/web/WebConfig.java b/tamguo-tms/src/main/java/com/tamguo/config/web/WebConfig.java index 1cb893f..2b7185c 100644 --- a/tamguo-tms/src/main/java/com/tamguo/config/web/WebConfig.java +++ b/tamguo-tms/src/main/java/com/tamguo/config/web/WebConfig.java @@ -2,7 +2,10 @@ package com.tamguo.config.web; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.session.web.http.CookieSerializer; +import org.springframework.session.web.http.DefaultCookieSerializer; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -16,6 +19,8 @@ public class WebConfig implements WebMvcConfigurer { @Value("${file.storage.path}") private String fileStoragePath; + @Value("${cookie.domian.name}") + private String cookieDomianName; @Autowired private MemberInterceptor memberInterceptor; @Autowired @@ -31,4 +36,14 @@ public class WebConfig implements WebMvcConfigurer { public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/files/**").addResourceLocations("file:"+fileStoragePath); } + + @Bean + public CookieSerializer defaultCookieSerializer(){ + DefaultCookieSerializer defaultCookieSerializer = new DefaultCookieSerializer(); + defaultCookieSerializer.setCookieName("sessionId"); + defaultCookieSerializer.setDomainName(cookieDomianName); + defaultCookieSerializer.setCookiePath("/"); + return defaultCookieSerializer; + } + } diff --git a/tamguo-tms/src/main/resources/application.properties b/tamguo-tms/src/main/resources/application.properties index ceebcaa..b061798 100644 --- a/tamguo-tms/src/main/resources/application.properties +++ b/tamguo-tms/src/main/resources/application.properties @@ -1,6 +1,7 @@ -domain.name=http://localhost:8081/ -admin.domain.name=http://localhost:8081/ -member.domain.name=http://localhost:8084/ +domain.name=https://www.tamguo.com/ +admin.domain.name=https://www.tamguo.com/ +member.domain.name=https://member.tamguo.com/ +cookie.domian.name=tamguo.com server.port=8081 jasypt.encryptor.password=tamguo @@ -13,14 +14,14 @@ spring.datasource.maxPoolPreparedStatementPerConnectionSize=20 spring.datasource.maxWait=60000 spring.datasource.minEvictableIdleTimeMillis=300000 spring.datasource.minIdle=5 -spring.datasource.password=123456 +spring.datasource.password=tanguo520pig spring.datasource.poolPreparedStatements=true spring.datasource.testOnBorrow=false spring.datasource.testOnReturn=false spring.datasource.testWhileIdle=true spring.datasource.timeBetweenEvictionRunsMillis=60000 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource -spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tamguo_20181110?useUnicode=true&characterEncoding=UTF-8&useSSL=false +spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tamguo?useUnicode=true&characterEncoding=UTF-8&useSSL=false spring.datasource.username=root spring.datasource.validationQuery=SELECT 1 FROM DUAL