mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-02 00:32:15 +00:00
SEC-1827: If use-secure-cookie is set to false explicitly set useSecureCookie to false on AbstractRememberMeServices
This commit is contained in:
parent
53483df1f5
commit
999adbc6ee
@ -98,8 +98,9 @@ class RememberMeBeanDefinitionParser implements BeanDefinitionParser {
|
|||||||
|
|
||||||
services.getPropertyValues().addPropertyValue("userDetailsService", uds);
|
services.getPropertyValues().addPropertyValue("userDetailsService", uds);
|
||||||
|
|
||||||
if ("true".equals(element.getAttribute(ATT_SECURE_COOKIE))) {
|
String useSecureCookie = element.getAttribute(ATT_SECURE_COOKIE);
|
||||||
services.getPropertyValues().addPropertyValue("useSecureCookie", true);
|
if (StringUtils.hasText(useSecureCookie)) {
|
||||||
|
services.getPropertyValues().addPropertyValue("useSecureCookie", Boolean.valueOf(useSecureCookie));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tokenValiditySet) {
|
if (tokenValiditySet) {
|
||||||
|
@ -31,7 +31,7 @@ class RememberMeConfigTests extends AbstractHttpConfigTests {
|
|||||||
|
|
||||||
expect:
|
expect:
|
||||||
rememberMeServices() instanceof PersistentTokenBasedRememberMeServices
|
rememberMeServices() instanceof PersistentTokenBasedRememberMeServices
|
||||||
!FieldUtils.getFieldValue(rememberMeServices(), "useSecureCookie")
|
FieldUtils.getFieldValue(rememberMeServices(), "useSecureCookie") == null
|
||||||
}
|
}
|
||||||
|
|
||||||
def rememberMeServiceWorksWithDataSourceRef() {
|
def rememberMeServiceWorksWithDataSourceRef() {
|
||||||
@ -112,6 +112,17 @@ class RememberMeConfigTests extends AbstractHttpConfigTests {
|
|||||||
FieldUtils.getFieldValue(rememberMeServices(), "useSecureCookie")
|
FieldUtils.getFieldValue(rememberMeServices(), "useSecureCookie")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SEC-1827
|
||||||
|
def rememberMeSecureCookieAttributeFalse() {
|
||||||
|
httpAutoConfig () {
|
||||||
|
'remember-me'('key': 'ourkey', 'use-secure-cookie':'false')
|
||||||
|
}
|
||||||
|
|
||||||
|
createAppContext(AUTH_PROVIDER_XML)
|
||||||
|
expect: 'useSecureCookie is false'
|
||||||
|
FieldUtils.getFieldValue(rememberMeServices(), "useSecureCookie") == Boolean.FALSE
|
||||||
|
}
|
||||||
|
|
||||||
def 'Negative token-validity is rejected with persistent implementation'() {
|
def 'Negative token-validity is rejected with persistent implementation'() {
|
||||||
when:
|
when:
|
||||||
httpAutoConfig () {
|
httpAutoConfig () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user