|
|
|
@ -34,6 +34,7 @@ import org.springframework.context.annotation.Configuration;
|
|
|
|
|
import org.springframework.session.MapSessionRepository;
|
|
|
|
|
import org.springframework.session.SessionRepository;
|
|
|
|
|
import org.springframework.session.config.annotation.web.http.EnableSpringHttpSession;
|
|
|
|
|
import org.springframework.session.security.web.authentication.SpringSessionRememberMeServices;
|
|
|
|
|
import org.springframework.session.web.http.CookieHttpSessionIdResolver;
|
|
|
|
|
import org.springframework.session.web.http.DefaultCookieSerializer;
|
|
|
|
|
import org.springframework.session.web.http.HeaderHttpSessionIdResolver;
|
|
|
|
@ -245,6 +246,18 @@ public class SessionAutoConfigurationTests extends AbstractSessionAutoConfigurat
|
|
|
|
|
context.getBeansOfType(DefaultCookieSerializer.class)).isEmpty());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void autoConfiguredCookieSerializerIsConfiguredWithRememberMeRequestAttribute() {
|
|
|
|
|
this.contextRunner.withBean(SpringSessionRememberMeServicesConfiguration.class)
|
|
|
|
|
.run((context) -> {
|
|
|
|
|
DefaultCookieSerializer cookieSerializer = context
|
|
|
|
|
.getBean(DefaultCookieSerializer.class);
|
|
|
|
|
assertThat(cookieSerializer).hasFieldOrPropertyWithValue(
|
|
|
|
|
"rememberMeRequestAttribute",
|
|
|
|
|
SpringSessionRememberMeServices.REMEMBER_ME_LOGIN_ATTR);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
|
@EnableSpringHttpSession
|
|
|
|
|
static class SessionRepositoryConfiguration {
|
|
|
|
@ -309,4 +322,16 @@ public class SessionAutoConfigurationTests extends AbstractSessionAutoConfigurat
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
|
@EnableSpringHttpSession
|
|
|
|
|
static class SpringSessionRememberMeServicesConfiguration
|
|
|
|
|
extends SessionRepositoryConfiguration {
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
public SpringSessionRememberMeServices rememberMeServices() {
|
|
|
|
|
return new SpringSessionRememberMeServices();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|