SEC-2826: Add remember-me-cookie attribute in xml namespace

This commit is contained in:
Kazuki Shimizu
2015-01-31 23:18:47 +09:00
committed by Rob Winch
parent d2fd852711
commit 67cd8465c3
5 changed files with 51 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -277,6 +277,31 @@ class RememberMeConfigTests extends AbstractHttpConfigTests {
BeanDefinitionParsingException e = thrown()
}
// SEC-2826
def 'Custom remember-me-cookie is supported'() {
httpAutoConfig () {
'remember-me'('remember-me-cookie': 'ourCookie')
}
createAppContext(AUTH_PROVIDER_XML)
expect:
rememberMeServices().cookieName == 'ourCookie'
}
// SEC-2826
def 'remember-me-cookie cannot be used together with services-ref'() {
when:
httpAutoConfig () {
'remember-me'('remember-me-cookie': 'ourCookie', 'services-ref': 'ourService')
}
createAppContext(AUTH_PROVIDER_XML)
then:
BeanDefinitionParsingException e = thrown()
expect:
e.message == 'Configuration problem: services-ref can\'t be used in combination with attributes token-repository-ref,data-source-ref, user-service-ref, token-validity-seconds, use-secure-cookie, remember-me-parameter or remember-me-cookie\nOffending resource: null'
}
def rememberMeServices() {
getFilter(RememberMeAuthenticationFilter.class).getRememberMeServices()
}