Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
7b947183
Commit
7b947183
authored
Apr 19, 2019
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Improve DefaultCookieSerializer auto-configuration"
Closes gh-16513
parent
5e025411
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
16 deletions
+7
-16
SessionAutoConfiguration.java
.../boot/autoconfigure/session/SessionAutoConfiguration.java
+6
-15
SessionAutoConfigurationTests.java
.../autoconfigure/session/SessionAutoConfigurationTests.java
+1
-1
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java
View file @
7b947183
/*
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -90,18 +90,10 @@ public class SessionAutoConfiguration {
...
@@ -90,18 +90,10 @@ public class SessionAutoConfiguration {
SessionRepositoryFilterConfiguration
.
class
})
SessionRepositoryFilterConfiguration
.
class
})
static
class
ServletSessionConfiguration
{
static
class
ServletSessionConfiguration
{
private
final
SpringSessionRememberMeServices
springSessionRememberMeServices
;
ServletSessionConfiguration
(
ObjectProvider
<
SpringSessionRememberMeServices
>
springSessionRememberMeServices
)
{
this
.
springSessionRememberMeServices
=
springSessionRememberMeServices
.
getIfAvailable
();
}
@Bean
@Bean
@Conditional
(
DefaultCookieSerializerCondition
.
class
)
@Conditional
(
DefaultCookieSerializerCondition
.
class
)
public
DefaultCookieSerializer
cookieSerializer
(
public
DefaultCookieSerializer
cookieSerializer
(
ServerProperties
serverProperties
,
ServerProperties
serverProperti
es
)
{
ObjectProvider
<
SpringSessionRememberMeServices
>
springSessionRememberMeServic
es
)
{
Cookie
cookie
=
serverProperties
.
getServlet
().
getSession
().
getCookie
();
Cookie
cookie
=
serverProperties
.
getServlet
().
getSession
().
getCookie
();
DefaultCookieSerializer
cookieSerializer
=
new
DefaultCookieSerializer
();
DefaultCookieSerializer
cookieSerializer
=
new
DefaultCookieSerializer
();
PropertyMapper
map
=
PropertyMapper
.
get
().
alwaysApplyingWhenNonNull
();
PropertyMapper
map
=
PropertyMapper
.
get
().
alwaysApplyingWhenNonNull
();
...
@@ -112,10 +104,9 @@ public class SessionAutoConfiguration {
...
@@ -112,10 +104,9 @@ public class SessionAutoConfiguration {
map
.
from
(
cookie:
:
getSecure
).
to
(
cookieSerializer:
:
setUseSecureCookie
);
map
.
from
(
cookie:
:
getSecure
).
to
(
cookieSerializer:
:
setUseSecureCookie
);
map
.
from
(
cookie:
:
getMaxAge
).
to
((
maxAge
)
->
cookieSerializer
map
.
from
(
cookie:
:
getMaxAge
).
to
((
maxAge
)
->
cookieSerializer
.
setCookieMaxAge
((
int
)
maxAge
.
getSeconds
()));
.
setCookieMaxAge
((
int
)
maxAge
.
getSeconds
()));
if
(
this
.
springSessionRememberMeServices
!=
null
)
{
springSessionRememberMeServices
.
ifAvailable
((
cookieSerializer
.
setRememberMeRequestAttribute
(
rememberMeServices
)
->
cookieSerializer
.
setRememberMeRequestAttribute
(
SpringSessionRememberMeServices
.
REMEMBER_ME_LOGIN_ATTR
);
SpringSessionRememberMeServices
.
REMEMBER_ME_LOGIN_ATTR
));
}
return
cookieSerializer
;
return
cookieSerializer
;
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationTests.java
View file @
7b947183
/*
/*
* Copyright 2012-201
8
the original author or authors.
* Copyright 2012-201
9
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
...
Write
Preview
Markdown
is supported
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