Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
mall
Commits
69ec434f
Commit
69ec434f
authored
Aug 06, 2018
by
zhh
Browse files
添加https支持
parent
575eb0a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
keystore.p12
0 → 100644
View file @
69ec434f
File added
mall-portal/src/main/java/com/macro/mall/portal/MallPortalApplication.java
View file @
69ec434f
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
;
}
}
}
mall-portal/src/main/java/com/macro/mall/portal/config/SecurityConfig.java
View file @
69ec434f
...
@@ -62,10 +62,12 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -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)
...
...
mall-portal/src/main/resources/application.properties
View file @
69ec434f
#===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===
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment