Compare commits
69 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c66ee750f9 | ||
|
|
9062db3f55 | ||
|
|
4bf15cda3b | ||
|
|
7f8c0387a7 | ||
|
|
3bc15c4259 | ||
|
|
c9add24c77 | ||
|
|
aaed973d27 | ||
|
|
55c4fcfd3f | ||
|
|
2a5d6b4d2e | ||
|
|
42aa10bfe8 | ||
|
|
221b48094a | ||
|
|
d43b48bbb0 | ||
|
|
e1dea5e0a8 | ||
|
|
23a32acd56 | ||
|
|
dc8cca5351 | ||
|
|
2369b2cfb3 | ||
|
|
e6ce56ec8b | ||
|
|
36939c1b02 | ||
|
|
0a84f9d544 | ||
|
|
a5ec1ccf1f | ||
|
|
7fc0ae47d5 | ||
|
|
ce2e644e04 | ||
|
|
8800fb9816 | ||
|
|
b8e94948ae | ||
|
|
8d2276341f | ||
|
|
63f1c7bf6f | ||
|
|
e8e4ee2850 | ||
|
|
9a643c8866 | ||
|
|
282f774e07 | ||
|
|
e6ec5765b8 | ||
|
|
ab5c727846 | ||
|
|
44ff959c59 | ||
|
|
ad67a3775b | ||
|
|
75c60b27bd | ||
|
|
81bd6bd261 | ||
|
|
2e8c4292fd | ||
|
|
315b9c9929 | ||
|
|
a70abd90bd | ||
|
|
f13df5aa2f | ||
|
|
6fd68e093f | ||
|
|
653d820290 | ||
|
|
950ac50234 | ||
|
|
bda72c074f | ||
|
|
fb1362aa2c | ||
|
|
d5dac6629d | ||
|
|
04b4b9ba17 | ||
|
|
97308bdbf4 | ||
|
|
4ba62c71dd | ||
|
|
265099c586 | ||
|
|
2f4a0110ab | ||
|
|
7a1cb66dae | ||
|
|
9bad2afa14 | ||
|
|
c79173879f | ||
|
|
2c065c0241 | ||
|
|
a08c721118 | ||
|
|
70e0c6d22d | ||
|
|
61bf2eca49 | ||
|
|
59923121f0 | ||
|
|
b5f8e29585 | ||
|
|
307a1f0dde | ||
|
|
ced2d8421c | ||
|
|
d98ff97e1a | ||
|
|
757175516f | ||
|
|
8ae55b7ee4 | ||
|
|
1eb53ead9d | ||
|
|
72159794f4 | ||
|
|
aaf122f3a6 | ||
|
|
6f823805f2 | ||
|
|
7807aa9f3c |
1
.github/workflows/antora-generate.yml
vendored
1
.github/workflows/antora-generate.yml
vendored
@@ -1,6 +1,7 @@
|
||||
name: Generate Antora Files and Request Build
|
||||
|
||||
on:
|
||||
workflow_dispatch: # Manual trigger
|
||||
push:
|
||||
branches-ignore:
|
||||
- 'gh-pages'
|
||||
|
||||
@@ -2,8 +2,6 @@ name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: '0 10 * * *' # Once per day at 10am UTC
|
||||
workflow_dispatch: # Manual trigger
|
||||
@@ -33,7 +31,7 @@ jobs:
|
||||
- name: Setup gradle user name
|
||||
run: |
|
||||
mkdir -p ~/.gradle
|
||||
echo 'systemProp.user.name=spring-builds' >> ~/.gradle/gradle.properties
|
||||
echo 'systemProp.user.name=spring-builds+github' >> ~/.gradle/gradle.properties
|
||||
- name: Cache Gradle packages
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
@@ -59,7 +57,7 @@ jobs:
|
||||
- name: Setup gradle user name
|
||||
run: |
|
||||
mkdir -p ~/.gradle
|
||||
echo 'systemProp.user.name=spring-builds' >> ~/.gradle/gradle.properties
|
||||
echo 'systemProp.user.name=spring-builds+github' >> ~/.gradle/gradle.properties
|
||||
- name: Deploy artifacts
|
||||
run: |
|
||||
export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
|
||||
@@ -87,7 +85,7 @@ jobs:
|
||||
- name: Setup gradle user name
|
||||
run: |
|
||||
mkdir -p ~/.gradle
|
||||
echo 'systemProp.user.name=spring-builds' >> ~/.gradle/gradle.properties
|
||||
echo 'systemProp.user.name=spring-builds+github' >> ~/.gradle/gradle.properties
|
||||
- name: Deploy Docs
|
||||
run: |
|
||||
export GRADLE_ENTERPRISE_CACHE_USERNAME="$GRADLE_ENTERPRISE_CACHE_USER"
|
||||
|
||||
6
.sdkmanrc
Normal file
6
.sdkmanrc
Normal file
@@ -0,0 +1,6 @@
|
||||
# Use sdkman to run "sdk env" to initialize with correct JDK version
|
||||
# Enable auto-env through the sdkman_auto_env config
|
||||
# See https://sdkman.io/usage#config
|
||||
# A summary is to add the following to ~/.sdkman/etc/config
|
||||
# sdkman_auto_env=true
|
||||
java=8.0.332-zulu
|
||||
@@ -19,9 +19,9 @@ This Spring Session repository consists of the following modules:
|
||||
* Spring Session Data Redis - provides `SessionRepository` and `ReactiveSessionRepository` implementation backed by Redis and configuration support
|
||||
* Spring Session JDBC - provides `SessionRepository` implementation backed by a relational database and configuration support
|
||||
* Spring Session Hazelcast - provides `SessionRepository` implementation backed by Hazelcast and configuration support
|
||||
* Spring Session MongoDB - provides `SessionRepository` implementation backed by MongoDB and configuration support
|
||||
|
||||
Additional Spring Session modules can be found in the https://github.com/spring-projects/spring-session-data-mongodb[spring-session-data-mongodb] repository
|
||||
and https://github.com/spring-projects/spring-session-data-geode[spring-session-data-geode] repository.
|
||||
Additional Spring Session modules can be found in the https://github.com/spring-projects/spring-session-data-geode[spring-session-data-geode] repository.
|
||||
|
||||
== Getting Started
|
||||
|
||||
|
||||
110
RELEASE.adoc
Normal file
110
RELEASE.adoc
Normal file
@@ -0,0 +1,110 @@
|
||||
== 1. Update Dependencies
|
||||
|
||||
Dependencies are declared in `gradle/dependency-management.gradle`.
|
||||
Update Spring Framework, Spring Security and Spring Data at a minimum.
|
||||
|
||||
Run all the checks:
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
$ ./gradlew check
|
||||
----
|
||||
|
||||
Create separate issues for each dependency update, aside from test dependencies which can be combined into a single commit.
|
||||
|
||||
== 2. Check All Issues are Closed
|
||||
|
||||
You can manually check at https://github.com/spring-projects/spring-session/milestones
|
||||
|
||||
== 3. Update Release Version
|
||||
|
||||
Update the version number in `gradle.properties` for the release, for example `2.7.0-M1`, `2.7.0-RC1`, `2.7.3`
|
||||
|
||||
== 4. Update Antora Version
|
||||
|
||||
You will need to update the antora.yml version.
|
||||
|
||||
For milestone / release candidate releases you should follow this format:
|
||||
----
|
||||
version: '2.7.0-RC1'
|
||||
prerelease: 'true'
|
||||
display_version: '2.7.0-RC1'
|
||||
----
|
||||
|
||||
== 5. Build Locally
|
||||
|
||||
Run the build using
|
||||
|
||||
[source,bash]
|
||||
----
|
||||
$ ./gradlew check
|
||||
----
|
||||
|
||||
== 6. Push the Release Commit
|
||||
|
||||
Push the commit and GitHub actions will build and deploy the artifacts.
|
||||
Wait for the artifact to appear in https://repo1.maven.org/maven2/org/springframework/session/spring-session-core/
|
||||
|
||||
== 7. Tag the release
|
||||
|
||||
Tag the release and then push the tag
|
||||
|
||||
....
|
||||
git tag 2.7.0-RC1
|
||||
git push origin 2.7.0-RC1
|
||||
....
|
||||
|
||||
== 8. Update to Next Development Version
|
||||
|
||||
Update `gradle.properties` version to next `+SNAPSHOT+` version, update antora.yml and then push
|
||||
|
||||
== 9. Update version on project pages
|
||||
|
||||
Update the versions on https://spring.io/projects for Spring Session Core, Spring Session Data Redis, Spring Session JDBC, Spring Session Hazelcast, and Spring Session MongoDB.
|
||||
|
||||
== 10. Update Release Notes on GitHub
|
||||
|
||||
Download
|
||||
https://github.com/spring-io/github-changelog-generator/releases/latest[the
|
||||
GitHub release notes generator]
|
||||
|
||||
* Generate the release notes
|
||||
|
||||
....
|
||||
java -jar github-changelog-generator.jar \
|
||||
--changelog.repository=spring-projects/spring-session \
|
||||
$MILESTONE release-notes
|
||||
....
|
||||
|
||||
Note 1: `+$MILESTONE+` is something like `+2.7.1+` or `+2.7.0-M1+`. +
|
||||
Note 2: This will create a file on your filesystem
|
||||
called `+release-notes+`.
|
||||
|
||||
* Copy the release notes to your clipboard (your mileage may vary with
|
||||
the following command)
|
||||
|
||||
....
|
||||
cat release-notes | xclip -selection clipboard
|
||||
....
|
||||
|
||||
* Create the
|
||||
https://github.com/spring-projects/spring-session/releases[release on
|
||||
GitHub], associate it with the tag, and paste the generated notes.
|
||||
|
||||
== 11. Close / Create Milestone
|
||||
|
||||
* In
|
||||
https://github.com/spring-projects/spring-session/milestones[GitHub
|
||||
Milestones], create a new milestone for the next release version.
|
||||
* Move any open issues from the existing milestone you just released to
|
||||
the new milestone.
|
||||
* Close the milestone for the release.
|
||||
|
||||
Note: Spring Session typically releases only one milestone (M1) and one release candidate (RC1).
|
||||
|
||||
== 12. Announce the release
|
||||
|
||||
* Announce via Slack on https://pivotal.slack.com/messages/spring-session[#spring-session], and tag any downstream Spring Session projects (e.g Spring Session for Apache Geode).
|
||||
|
||||
Note: Do not post on #spring-release or create a blog post. Those steps happen after the Spring Session BOM is released.
|
||||
|
||||
@@ -4,7 +4,7 @@ buildscript {
|
||||
snapshotBuild = version.endsWith('SNAPSHOT')
|
||||
milestoneBuild = !(releaseBuild || snapshotBuild)
|
||||
|
||||
springBootVersion = '2.5.6'
|
||||
springBootVersion = '2.7.0-M3'
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -9,7 +9,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
optional 'javax.servlet:javax.servlet-api:3.1.0'
|
||||
optional 'jakarta.servlet:jakarta.servlet-api:4.0.4'
|
||||
testImplementation platform('org.junit:junit-bom:5.8.1')
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-engine'
|
||||
|
||||
@@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
provided 'javax.servlet:javax.servlet-api'
|
||||
provided 'jakarta.servlet:jakarta.servlet-api:4.0.4'
|
||||
testImplementation 'commons-io:commons-io:2.11.0'
|
||||
testImplementation 'org.assertj:assertj-core:3.21.0'
|
||||
testImplementation platform('org.junit:junit-bom:5.8.1')
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
org.gradle.parallel=true
|
||||
version=2.6.0
|
||||
version=2.7.0
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom 'io.projectreactor:reactor-bom:2020.0.13'
|
||||
mavenBom 'com.fasterxml.jackson:jackson-bom:2.13.0'
|
||||
mavenBom 'org.junit:junit-bom:5.8.1'
|
||||
mavenBom 'org.springframework:spring-framework-bom:5.3.13'
|
||||
mavenBom 'org.springframework.data:spring-data-bom:2021.1.0'
|
||||
mavenBom 'org.springframework.security:spring-security-bom:5.6.0'
|
||||
mavenBom 'org.testcontainers:testcontainers-bom:1.16.2'
|
||||
mavenBom 'io.projectreactor:reactor-bom:2020.0.19'
|
||||
mavenBom 'com.fasterxml.jackson:jackson-bom:2.13.2.20220328'
|
||||
mavenBom 'org.junit:junit-bom:5.8.2'
|
||||
mavenBom 'org.springframework:spring-framework-bom:5.3.20'
|
||||
mavenBom 'org.springframework.data:spring-data-bom:2021.2.0'
|
||||
mavenBom 'org.springframework.security:spring-security-bom:5.7.0'
|
||||
mavenBom 'org.testcontainers:testcontainers-bom:1.17.1'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -15,35 +15,35 @@ dependencyManagement {
|
||||
entry 'hazelcast-client'
|
||||
}
|
||||
|
||||
dependency 'org.aspectj:aspectjweaver:1.9.7'
|
||||
dependency 'ch.qos.logback:logback-core:1.2.3'
|
||||
dependency 'org.aspectj:aspectjweaver:1.9.9.1'
|
||||
dependency 'ch.qos.logback:logback-core:1.2.11'
|
||||
dependency 'com.google.code.findbugs:jsr305:3.0.2'
|
||||
dependency 'com.h2database:h2:1.4.200'
|
||||
dependency 'com.ibm.db2:jcc:11.5.6.0'
|
||||
dependency 'com.microsoft.sqlserver:mssql-jdbc:9.4.0.jre8'
|
||||
dependency 'com.oracle.database.jdbc:ojdbc8:21.3.0.0'
|
||||
dependency 'com.ibm.db2:jcc:11.5.7.0'
|
||||
dependency 'com.microsoft.sqlserver:mssql-jdbc:9.4.1.jre8'
|
||||
dependency 'com.oracle.database.jdbc:ojdbc8:21.5.0.0'
|
||||
dependency 'com.zaxxer:HikariCP:3.4.5'
|
||||
dependency 'edu.umd.cs.mtc:multithreadedtc:1.01'
|
||||
dependency 'io.lettuce:lettuce-core:6.1.5.RELEASE'
|
||||
dependency 'javax.annotation:javax.annotation-api:1.3.2'
|
||||
dependency 'javax.servlet:javax.servlet-api:4.0.1'
|
||||
dependency 'mysql:mysql-connector-java:8.0.27'
|
||||
dependency 'io.lettuce:lettuce-core:6.1.8.RELEASE'
|
||||
dependency 'jakarta.annotation:jakarta.annotation-api:1.3.5'
|
||||
dependency 'jakarta.servlet:jakarta.servlet-api:4.0.4'
|
||||
dependency 'mysql:mysql-connector-java:8.0.28'
|
||||
dependency 'org.apache.derby:derby:10.14.2.0'
|
||||
dependency 'org.assertj:assertj-core:3.21.0'
|
||||
dependency 'org.hamcrest:hamcrest:2.1'
|
||||
dependency 'org.assertj:assertj-core:3.22.0'
|
||||
dependency 'org.hamcrest:hamcrest:2.2'
|
||||
dependency 'org.hsqldb:hsqldb:2.5.2'
|
||||
dependency 'org.mariadb.jdbc:mariadb-java-client:2.7.4'
|
||||
dependencySet(group: 'org.mockito', version: '4.0.0') {
|
||||
dependency 'org.mariadb.jdbc:mariadb-java-client:2.7.5'
|
||||
dependencySet(group: 'org.mockito', version: '4.4.0') {
|
||||
entry 'mockito-core'
|
||||
entry 'mockito-junit-jupiter'
|
||||
}
|
||||
|
||||
dependencySet(group: 'org.mongodb', version: '4.4.0') {
|
||||
dependencySet(group: 'org.mongodb', version: '4.5.1') {
|
||||
entry 'mongodb-driver-core'
|
||||
entry 'mongodb-driver-sync'
|
||||
entry 'mongodb-driver-reactivestreams'
|
||||
}
|
||||
dependency 'org.postgresql:postgresql:42.3.1'
|
||||
dependency 'org.postgresql:postgresql:42.3.4'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "com.gradle.enterprise" version "3.5.1"
|
||||
id "com.gradle.enterprise" version "3.9"
|
||||
id "io.spring.ge.conventions" version "0.0.7"
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ dependencies {
|
||||
api "org.springframework:spring-jcl"
|
||||
|
||||
optional "io.projectreactor:reactor-core"
|
||||
optional "javax.annotation:javax.annotation-api"
|
||||
optional "javax.servlet:javax.servlet-api"
|
||||
optional "jakarta.annotation:jakarta.annotation-api"
|
||||
optional "jakarta.servlet:jakarta.servlet-api"
|
||||
optional "org.springframework:spring-context"
|
||||
optional "org.springframework:spring-jdbc"
|
||||
optional "org.springframework:spring-messaging"
|
||||
|
||||
@@ -41,5 +41,5 @@ dependencies {
|
||||
testImplementation "org.mockito:mockito-core"
|
||||
testImplementation "org.mockito:mockito-junit-jupiter"
|
||||
testImplementation "io.projectreactor:reactor-test"
|
||||
testImplementation "javax.servlet:javax.servlet-api"
|
||||
testImplementation "jakarta.servlet:jakarta.servlet-api"
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ public abstract class AbstractMongoRepositoryITest extends AbstractITest {
|
||||
|
||||
protected static class BaseConfig {
|
||||
|
||||
private static final String DOCKER_IMAGE = "mongo:4.0.10";
|
||||
private static final String DOCKER_IMAGE = "mongo:4.4.1";
|
||||
|
||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||
public MongoDBContainer mongoContainer() {
|
||||
|
||||
@@ -175,7 +175,7 @@ public class MongoDbDeleteJacksonSessionVerificationTest {
|
||||
@EnableMongoWebSession
|
||||
static class Config {
|
||||
|
||||
private static final String DOCKER_IMAGE = "mongo:4.0.10";
|
||||
private static final String DOCKER_IMAGE = "mongo:4.4.1";
|
||||
|
||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||
MongoDBContainer mongoContainer() {
|
||||
|
||||
@@ -170,7 +170,7 @@ public class MongoDbLogoutVerificationTest {
|
||||
@EnableMongoWebSession
|
||||
static class Config {
|
||||
|
||||
private static final String DOCKER_IMAGE = "mongo:4.0.10";
|
||||
private static final String DOCKER_IMAGE = "mongo:4.4.1";
|
||||
|
||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||
MongoDBContainer mongoContainer() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -39,10 +39,17 @@ import org.springframework.session.Session;
|
||||
public class MongoSession implements Session {
|
||||
|
||||
/**
|
||||
* Mongo doesn't support {@literal dot} in field names. We replace it with a very
|
||||
* rarely used character
|
||||
* Mongo doesn't support {@literal dot} in field names. We replace it with a unicode
|
||||
* character from the Private Use Area.
|
||||
* <p>
|
||||
* NOTE: This was originally stored in unicode format. Delomboking the code caused it
|
||||
* to get converted to another encoding, which isn't supported on all systems, so we
|
||||
* migrated back to unicode. The same character is being represented ensuring binary
|
||||
* compatibility.
|
||||
*
|
||||
* See https://www.compart.com/en/unicode/U+F607
|
||||
*/
|
||||
private static final char DOT_COVER_CHAR = '';
|
||||
private static final char DOT_COVER_CHAR = '\uF607';
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ dependencies {
|
||||
testImplementation "org.mockito:mockito-core"
|
||||
testImplementation "org.springframework:spring-test"
|
||||
testImplementation "io.projectreactor:reactor-test"
|
||||
testImplementation "javax.servlet:javax.servlet-api"
|
||||
testImplementation "jakarta.servlet:jakarta.servlet-api"
|
||||
testImplementation "org.springframework:spring-web"
|
||||
testImplementation "org.springframework.security:spring-security-core"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
|
||||
*/
|
||||
public abstract class AbstractRedisITests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
protected static class BaseConfig {
|
||||
|
||||
|
||||
@@ -527,6 +527,30 @@ class RedisIndexedSessionRepositoryITests extends AbstractRedisITests {
|
||||
assertThat(findByPrincipalName.keySet()).containsOnly(changeSessionId);
|
||||
}
|
||||
|
||||
@Test // gh-1987
|
||||
void changeSessionIdWhenPrincipalNameChangesFromNullThenIndexShouldNotBeCreated() {
|
||||
String principalName = null;
|
||||
String principalNameChanged = "findByChangedPrincipalName" + UUID.randomUUID();
|
||||
RedisSession toSave = this.repository.createSession();
|
||||
toSave.setAttribute(INDEX_NAME, principalName);
|
||||
|
||||
this.repository.save(toSave);
|
||||
|
||||
RedisSession findById = this.repository.findById(toSave.getId());
|
||||
String changeSessionId = findById.changeSessionId();
|
||||
findById.setAttribute(INDEX_NAME, principalNameChanged);
|
||||
this.repository.save(findById);
|
||||
|
||||
Map<String, RedisSession> findByPrincipalName = this.repository.findByIndexNameAndIndexValue(INDEX_NAME,
|
||||
principalName);
|
||||
assertThat(findByPrincipalName).isEmpty();
|
||||
|
||||
findByPrincipalName = this.repository.findByIndexNameAndIndexValue(INDEX_NAME, principalNameChanged);
|
||||
|
||||
assertThat(findByPrincipalName).hasSize(1);
|
||||
assertThat(findByPrincipalName.keySet()).containsOnly(changeSessionId);
|
||||
}
|
||||
|
||||
@Test
|
||||
void changeSessionIdWhenOnlyChangeId() {
|
||||
String attrName = "changeSessionId";
|
||||
|
||||
@@ -858,11 +858,13 @@ public class RedisIndexedSessionRepository
|
||||
catch (NonTransientDataAccessException ex) {
|
||||
handleErrNoSuchKeyError(ex);
|
||||
}
|
||||
String originalPrincipalRedisKey = getPrincipalKey(this.originalPrincipalName);
|
||||
RedisIndexedSessionRepository.this.sessionRedisOperations.boundSetOps(originalPrincipalRedisKey)
|
||||
.remove(this.originalSessionId);
|
||||
RedisIndexedSessionRepository.this.sessionRedisOperations.boundSetOps(originalPrincipalRedisKey)
|
||||
.add(sessionId);
|
||||
if (this.originalPrincipalName != null) {
|
||||
String originalPrincipalRedisKey = getPrincipalKey(this.originalPrincipalName);
|
||||
RedisIndexedSessionRepository.this.sessionRedisOperations.boundSetOps(originalPrincipalRedisKey)
|
||||
.remove(this.originalSessionId);
|
||||
RedisIndexedSessionRepository.this.sessionRedisOperations.boundSetOps(originalPrincipalRedisKey)
|
||||
.add(sessionId);
|
||||
}
|
||||
}
|
||||
this.originalSessionId = sessionId;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2020 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -42,7 +42,10 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class RedisSessionRepository implements SessionRepository<RedisSessionRepository.RedisSession> {
|
||||
|
||||
private static final String DEFAULT_KEY_NAMESPACE = "spring:session";
|
||||
/**
|
||||
* The default namespace for each key and channel in Redis used by Spring Session.
|
||||
*/
|
||||
public static final String DEFAULT_KEY_NAMESPACE = "spring:session";
|
||||
|
||||
private final RedisOperations<String, Object> sessionRedisOperations;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -23,11 +23,14 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -50,6 +53,15 @@ public class RedisHttpSessionConfigurationClassPathXmlApplicationContextTests {
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -21,12 +21,17 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.session.data.redis.config.ConfigureRedisAction;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -52,7 +57,20 @@ class RedisHttpSessionConfigurationNoOpConfigureRedisActionTests {
|
||||
|
||||
@Bean
|
||||
RedisConnectionFactory redisConnectionFactory() {
|
||||
return mock(RedisConnectionFactory.class);
|
||||
RedisConnectionFactory redisConnectionFactory = mock(RedisConnectionFactory.class);
|
||||
RedisConnection connection = mock(RedisConnection.class);
|
||||
given(redisConnectionFactory.getConnection()).willReturn(connection);
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
|
||||
return redisConnectionFactory;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -26,6 +26,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.session.data.redis.config.annotation.SpringSessionRedisOperations;
|
||||
@@ -34,8 +35,10 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -76,6 +79,15 @@ class RedisHttpSessionConfigurationOverrideDefaultSerializerTests {
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -27,8 +27,8 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.scheduling.SchedulingAwareRunnable;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
@@ -36,6 +36,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -57,7 +58,7 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutor {
|
||||
|
||||
@Test
|
||||
void overrideSessionTaskExecutor() {
|
||||
verify(this.springSessionRedisTaskExecutor, times(1)).execute(any(SchedulingAwareRunnable.class));
|
||||
verify(this.springSessionRedisTaskExecutor, times(1)).execute(any(Runnable.class));
|
||||
}
|
||||
|
||||
@EnableRedisHttpSession
|
||||
@@ -66,7 +67,13 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutor {
|
||||
|
||||
@Bean
|
||||
Executor springSessionRedisTaskExecutor() {
|
||||
return mock(Executor.class);
|
||||
Executor executor = mock(Executor.class);
|
||||
willAnswer((it) -> {
|
||||
Runnable r = it.getArgument(0);
|
||||
new Thread(r).start();
|
||||
return null;
|
||||
}).given(executor).execute(any());
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -76,6 +83,15 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutor {
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -27,8 +27,8 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.scheduling.SchedulingAwareRunnable;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
@@ -36,6 +36,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
@@ -62,7 +63,7 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutors {
|
||||
|
||||
@Test
|
||||
void overrideSessionTaskExecutors() {
|
||||
verify(this.springSessionRedisSubscriptionExecutor, times(1)).execute(any(SchedulingAwareRunnable.class));
|
||||
verify(this.springSessionRedisSubscriptionExecutor, times(1)).execute(any(Runnable.class));
|
||||
verify(this.springSessionRedisTaskExecutor, never()).execute(any(Runnable.class));
|
||||
}
|
||||
|
||||
@@ -72,12 +73,24 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutors {
|
||||
|
||||
@Bean
|
||||
Executor springSessionRedisTaskExecutor() {
|
||||
return mock(Executor.class);
|
||||
Executor executor = mock(Executor.class);
|
||||
willAnswer((it) -> {
|
||||
Runnable r = it.getArgument(0);
|
||||
new Thread(r).start();
|
||||
return null;
|
||||
}).given(executor).execute(any());
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean
|
||||
Executor springSessionRedisSubscriptionExecutor() {
|
||||
return mock(Executor.class);
|
||||
Executor executor = mock(Executor.class);
|
||||
willAnswer((it) -> {
|
||||
Runnable r = it.getArgument(0);
|
||||
new Thread(r).start();
|
||||
return null;
|
||||
}).given(executor).execute(any());
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -87,6 +100,15 @@ class RedisHttpSessionConfigurationOverrideSessionTaskExecutors {
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -32,6 +32,7 @@ import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.data.redis.core.RedisOperations;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.mock.env.MockEnvironment;
|
||||
@@ -47,8 +48,9 @@ import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -264,11 +266,24 @@ class RedisHttpSessionConfigurationTests {
|
||||
}
|
||||
|
||||
private static RedisConnectionFactory mockRedisConnectionFactory() {
|
||||
RedisConnectionFactory connectionFactory = mock(RedisConnectionFactory.class);
|
||||
RedisConnection connection = mock(RedisConnection.class);
|
||||
given(connectionFactory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
return connectionFactory;
|
||||
RedisConnectionFactory connectionFactoryMock = mock(RedisConnectionFactory.class);
|
||||
RedisConnection connectionMock = mock(RedisConnection.class);
|
||||
given(connectionFactoryMock.getConnection()).willReturn(connectionMock);
|
||||
|
||||
Properties keyspaceEventsConfig = new Properties();
|
||||
keyspaceEventsConfig.put("notify-keyspace-events", "KEA");
|
||||
given(connectionMock.getConfig("notify-keyspace-events")).willReturn(keyspaceEventsConfig);
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connectionMock).pSubscribe(any(), any());
|
||||
|
||||
return connectionFactoryMock;
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@@ -445,7 +460,7 @@ class RedisHttpSessionConfigurationTests {
|
||||
|
||||
@Bean
|
||||
RedisMessageListenerContainer redisMessageListenerContainer() {
|
||||
return new RedisMessageListenerContainer();
|
||||
return mock(RedisMessageListenerContainer.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -23,12 +23,15 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@@ -46,6 +49,15 @@ public class RedisHttpSessionConfigurationXmlCustomExpireTests {
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -23,12 +23,15 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@@ -46,6 +49,15 @@ public class RedisHttpSessionConfigurationXmlTests {
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -26,6 +26,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.data.redis.core.RedisOperations;
|
||||
import org.springframework.session.data.redis.RedisIndexedSessionRepository;
|
||||
import org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration;
|
||||
@@ -33,8 +34,10 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -75,6 +78,14 @@ class Gh109Tests {
|
||||
RedisConnection connection = mock(RedisConnection.class);
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@ content:
|
||||
- url: https://github.com/spring-io/spring-generated-docs
|
||||
branches: [spring-projects/spring-session/*]
|
||||
- url: https://github.com/spring-projects/spring-session
|
||||
branches: [main]
|
||||
branches: [main,3.0.x,2.6.x]
|
||||
tags: [ '3.0.*', '2.7.*', '2.6.*','!2.6.0-M*','!2.6.0-RC*','!2.7.0-M1','!3.0.0-M1']
|
||||
start_path: spring-session-docs
|
||||
urls:
|
||||
latest_version_segment_strategy: redirect:to
|
||||
@@ -20,7 +21,7 @@ ui:
|
||||
url: https://github.com/spring-io/antora-ui-spring/releases/download/latest/ui-bundle.zip
|
||||
snapshot: true
|
||||
|
||||
pipeline:
|
||||
antora:
|
||||
extensions:
|
||||
- require: ./antora/extensions/version-fix.js
|
||||
- require: ./antora/extensions/major-minor-segment.js
|
||||
- require: ./antora/extensions/root-component-name.js
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
name: ROOT
|
||||
version: '2.6.0'
|
||||
version: '2.7.0'
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
const { posix: path } = require('path')
|
||||
|
||||
module.exports.register = (pipeline, { config }) => {
|
||||
pipeline.on('contentClassified', ({ contentCatalog }) => {
|
||||
module.exports.register = function({ config }) {
|
||||
this.on('contentClassified', ({ contentCatalog }) => {
|
||||
contentCatalog.getComponents().forEach(component => {
|
||||
const componentName = component.name;
|
||||
const generationToVersion = new Map();
|
||||
@@ -91,6 +91,7 @@ function createSymbolicVersionAlias (component, version, symbolicVersionSegment,
|
||||
|
||||
function computeOut (src, family, version, htmlUrlExtensionStyle) {
|
||||
let { component, module: module_, basename, extname, relative, stem } = src
|
||||
if (component === 'ROOT') component = ''
|
||||
if (module_ === 'ROOT') module_ = ''
|
||||
let indexifyPathSegment = ''
|
||||
let familyPathSegment = ''
|
||||
@@ -120,8 +121,11 @@ function computePub (src, out, family, version, htmlUrlExtensionStyle) {
|
||||
const pub = {}
|
||||
let url
|
||||
if (family === 'nav') {
|
||||
const urlSegments = version ? [src.component, version] : [src.component]
|
||||
if (src.module && src.module !== 'ROOT') urlSegments.push(src.module)
|
||||
const component = src.component || 'ROOT'
|
||||
const urlSegments = component === 'ROOT' ? [] : [component]
|
||||
if (version) urlSegments.push(version)
|
||||
const module_ = src.module || 'ROOT'
|
||||
if (module_ !== 'ROOT') urlSegments.push(module_)
|
||||
// an artificial URL used for resolving page references in navigation model
|
||||
url = '/' + urlSegments.join('/') + '/'
|
||||
pub.moduleRootPath = '.'
|
||||
@@ -197,4 +201,4 @@ function no_data(key, value) {
|
||||
return value ? "__data__" : value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
// https://gitlab.com/antora/antora/-/issues/132#note_712132072
|
||||
'use strict'
|
||||
|
||||
const { posix: path } = require('path')
|
||||
|
||||
module.exports.register = (pipeline, { config }) => {
|
||||
pipeline.on('contentClassified', ({ contentCatalog }) => {
|
||||
const rootComponentName = config.rootComponentName || 'ROOT'
|
||||
const rootComponentNameLength = rootComponentName.length
|
||||
contentCatalog.findBy({ component: rootComponentName }).forEach((file) => {
|
||||
if (file.out) {
|
||||
file.out.dirname = file.out.dirname.substr(rootComponentNameLength)
|
||||
file.out.path = file.out.path.substr(rootComponentNameLength + 1)
|
||||
file.out.rootPath = fixPath(file.out.rootPath)
|
||||
}
|
||||
if (file.pub) {
|
||||
file.pub.url = file.pub.url.substr(rootComponentNameLength + 1)
|
||||
if (file.pub.rootPath) {
|
||||
file.pub.rootPath = fixPath(file.pub.rootPath)
|
||||
}
|
||||
}
|
||||
if (file.rel) {
|
||||
if (file.rel.pub) {
|
||||
file.rel.pub.url = file.rel.pub.url.substr(rootComponentNameLength + 1)
|
||||
file.rel.pub.rootPath = fixPath(file.rel.pub.rootPath);
|
||||
}
|
||||
}
|
||||
})
|
||||
const rootComponent = contentCatalog.getComponent(rootComponentName)
|
||||
rootComponent?.versions?.forEach((version) => {
|
||||
version.url = version.url.substr(rootComponentName.length + 1)
|
||||
})
|
||||
// const siteStartPage = contentCatalog.getById({ component: '', version: '', module: '', family: 'alias', relative: 'index.adoc' })
|
||||
// if (siteStartPage) delete siteStartPage.out
|
||||
})
|
||||
|
||||
function fixPath(path) {
|
||||
return path.split('/').slice(1).join('/') || '.'
|
||||
}
|
||||
}
|
||||
15
spring-session-docs/antora/extensions/version-fix.js
Normal file
15
spring-session-docs/antora/extensions/version-fix.js
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict'
|
||||
|
||||
module.exports.register = function({ config }) {
|
||||
|
||||
this.on('contentAggregated', ({ contentAggregate }) => {
|
||||
contentAggregate.forEach(aggregate => {
|
||||
if (aggregate.version === "2.6.2" &&
|
||||
aggregate.prerelease == "-SNAPSHOT") {
|
||||
aggregate.version = "2.6.2"
|
||||
aggregate.displayVersion = `${aggregate.version}`
|
||||
delete aggregate.prerelease
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -20,7 +20,7 @@ ui:
|
||||
url: https://github.com/spring-io/antora-ui-spring/releases/download/latest/ui-bundle.zip
|
||||
snapshot: true
|
||||
|
||||
pipeline:
|
||||
antora:
|
||||
extensions:
|
||||
- require: ./antora/extensions/version-fix.js
|
||||
- require: ./antora/extensions/major-minor-segment.js
|
||||
- require: ./antora/extensions/root-component-name.js
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -20,7 +20,9 @@ import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.session.Session;
|
||||
import org.springframework.session.web.http.SessionRepositoryFilter;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -28,6 +30,9 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -47,7 +52,20 @@ public class HttpSessionConfigurationNoOpConfigureRedisActionXmlTests {
|
||||
}
|
||||
|
||||
static RedisConnectionFactory connectionFactory() {
|
||||
return mock(RedisConnectionFactory.class);
|
||||
RedisConnectionFactory connectionFactoryMock = mock(RedisConnectionFactory.class);
|
||||
RedisConnection connectionMock = mock(RedisConnection.class);
|
||||
given(connectionFactoryMock.getConnection()).willReturn(connectionMock);
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connectionMock).pSubscribe(any(), any());
|
||||
|
||||
return connectionFactoryMock;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -21,13 +21,18 @@ import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.session.data.redis.config.ConfigureRedisAction;
|
||||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -55,7 +60,20 @@ class RedisHttpSessionConfigurationNoOpConfigureRedisActionTests {
|
||||
|
||||
@Bean
|
||||
RedisConnectionFactory redisConnectionFactory() {
|
||||
return mock(RedisConnectionFactory.class);
|
||||
RedisConnectionFactory connectionFactoryMock = mock(RedisConnectionFactory.class);
|
||||
RedisConnection connectionMock = mock(RedisConnection.class);
|
||||
given(connectionFactoryMock.getConnection()).willReturn(connectionMock);
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connectionMock).pSubscribe(any(), any());
|
||||
|
||||
return connectionFactoryMock;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -26,6 +26,7 @@ import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.data.redis.connection.RedisConnection;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.connection.SubscriptionListener;
|
||||
import org.springframework.security.core.session.SessionDestroyedEvent;
|
||||
import org.springframework.session.MapSession;
|
||||
import org.springframework.session.Session;
|
||||
@@ -33,8 +34,10 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
@@ -67,6 +70,15 @@ public abstract class AbstractHttpSessionListenerTests {
|
||||
|
||||
given(factory.getConnection()).willReturn(connection);
|
||||
given(connection.getConfig(anyString())).willReturn(new Properties());
|
||||
|
||||
willAnswer((it) -> {
|
||||
SubscriptionListener listener = it.getArgument(0);
|
||||
listener.onPatternSubscribed(it.getArgument(1), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:del".getBytes(), 0);
|
||||
listener.onChannelSubscribed("__keyevent@0__:expired".getBytes(), 0);
|
||||
|
||||
return null;
|
||||
}).given(connection).pSubscribe(any(), any());
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ You can now try to use the application. To do so, use your favorite REST client
|
||||
|
||||
Note that you are prompted for basic authentication. Provide the following information for the username and password:
|
||||
|
||||
* *Username* _user-
|
||||
* *Username* _user_
|
||||
* *Password* _password_
|
||||
|
||||
Then run the following command:
|
||||
|
||||
@@ -55,7 +55,10 @@ Spring Session is Open Source software released under the https://www.apache.org
|
||||
| Name | Location
|
||||
|
||||
| Spring Session Infinispan
|
||||
| https://infinispan.org/infinispan-spring-boot/master/spring_boot_starter.html#_enabling_spring_session_support
|
||||
| https://infinispan.org/docs/stable/titles/spring/spring.html
|
||||
|
||||
| Spring Session Caffeine
|
||||
| https://github.com/gotson/spring-session-caffeine
|
||||
|
||||
|===
|
||||
|
||||
|
||||
@@ -22,13 +22,13 @@ dependencies {
|
||||
testImplementation 'org.assertj:assertj-core'
|
||||
testImplementation 'com.hazelcast:hazelcast'
|
||||
testImplementation 'io.lettuce:lettuce-core'
|
||||
testImplementation 'javax.servlet:javax.servlet-api'
|
||||
testImplementation 'jakarta.servlet:jakarta.servlet-api'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api'
|
||||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
|
||||
}
|
||||
|
||||
antora {
|
||||
antoraVersion = "3.0.0-alpha.8"
|
||||
antoraVersion = "3.0.1"
|
||||
arguments = ["--fetch"]
|
||||
}
|
||||
|
||||
|
||||
@@ -21,11 +21,11 @@ artifacts {
|
||||
|
||||
dependencies {
|
||||
api project(':spring-session-core')
|
||||
optional "com.hazelcast:hazelcast:4.2.2"
|
||||
optional "com.hazelcast:hazelcast:4.2.4"
|
||||
api "org.springframework:spring-context"
|
||||
api "javax.annotation:javax.annotation-api"
|
||||
api "jakarta.annotation:jakarta.annotation-api"
|
||||
|
||||
testImplementation "javax.servlet:javax.servlet-api"
|
||||
testImplementation "jakarta.servlet:jakarta.servlet-api"
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.mockito:mockito-core"
|
||||
testImplementation "org.springframework:spring-test"
|
||||
@@ -35,7 +35,7 @@ dependencies {
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
|
||||
|
||||
integrationTestCompile "org.testcontainers:testcontainers"
|
||||
integrationTestCompile "com.hazelcast:hazelcast:4.2"
|
||||
integrationTestCompile "com.hazelcast:hazelcast:4.2.4"
|
||||
integrationTestCompile project(":spring-session-hazelcast")
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -45,7 +45,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
|
||||
@WebAppConfiguration
|
||||
class ClientServerHazelcast4IndexedSessionRepositoryITests extends AbstractHazelcast4IndexedSessionRepositoryITests {
|
||||
|
||||
private static GenericContainer container = new GenericContainer<>("hazelcast/hazelcast:4.2.2")
|
||||
private static GenericContainer container = new GenericContainer<>("hazelcast/hazelcast:4.2.4")
|
||||
.withExposedPorts(5701).withCopyFileToContainer(MountableFile.forClasspathResource("/hazelcast-server.xml"),
|
||||
"/opt/hazelcast/hazelcast.xml");
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@ configurations {
|
||||
dependencies {
|
||||
api project(':spring-session-core')
|
||||
api "com.hazelcast:hazelcast"
|
||||
api "javax.annotation:javax.annotation-api"
|
||||
api "jakarta.annotation:jakarta.annotation-api"
|
||||
api "org.springframework:spring-context"
|
||||
|
||||
hazelcast4(project(path: ":hazelcast4", configuration: 'classesOnlyElements'))
|
||||
compileOnly(project(":hazelcast4"))
|
||||
|
||||
testImplementation "javax.servlet:javax.servlet-api"
|
||||
testImplementation "jakarta.servlet:jakarta.servlet-api"
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.mockito:mockito-core"
|
||||
testImplementation "org.springframework:spring-test"
|
||||
|
||||
@@ -7,7 +7,7 @@ dependencies {
|
||||
api "org.springframework:spring-context"
|
||||
api "org.springframework:spring-jdbc"
|
||||
|
||||
testImplementation "javax.servlet:javax.servlet-api"
|
||||
testImplementation "jakarta.servlet:jakarta.servlet-api"
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.mockito:mockito-core"
|
||||
testImplementation "org.springframework:spring-test"
|
||||
|
||||
@@ -42,11 +42,11 @@ final class DatabaseContainers {
|
||||
}
|
||||
|
||||
static MariaDBContainer<?> mariaDb() {
|
||||
return new MariaDBContainer<>("mariadb:10.6.4");
|
||||
return new MariaDBContainer<>("mariadb:10.7.3");
|
||||
}
|
||||
|
||||
static MySQLContainer<?> mySql() {
|
||||
return new MySQLContainer<>("mysql:8.0.27");
|
||||
return new MySQLContainer<>("mysql:8.0.28");
|
||||
}
|
||||
|
||||
static OracleContainer oracle() {
|
||||
@@ -68,7 +68,7 @@ final class DatabaseContainers {
|
||||
}
|
||||
|
||||
static PostgreSQLContainer<?> postgreSql() {
|
||||
return new PostgreSQLContainer<>("postgres:14.0");
|
||||
return new PostgreSQLContainer<>("postgres:14.2");
|
||||
}
|
||||
|
||||
static MSSQLServerContainer<?> sqlServer() {
|
||||
|
||||
@@ -728,7 +728,8 @@ public class JdbcIndexedSessionRepository
|
||||
T attributeValue = supplier.get();
|
||||
if (attributeValue != null
|
||||
&& JdbcIndexedSessionRepository.this.saveMode.equals(SaveMode.ON_GET_ATTRIBUTE)) {
|
||||
this.delta.put(attributeName, DeltaValue.UPDATED);
|
||||
this.delta.merge(attributeName, DeltaValue.UPDATED, (oldDeltaValue,
|
||||
deltaValue) -> (oldDeltaValue == DeltaValue.ADDED) ? oldDeltaValue : deltaValue);
|
||||
}
|
||||
return attributeValue;
|
||||
}
|
||||
|
||||
@@ -655,6 +655,20 @@ class JdbcIndexedSessionRepositoryTests {
|
||||
verifyNoMoreInteractions(this.jdbcOperations);
|
||||
}
|
||||
|
||||
@Test
|
||||
void saveWithSaveModeOnGetAttributeAndNewAttributeSetAndGet() {
|
||||
this.repository.setSaveMode(SaveMode.ON_GET_ATTRIBUTE);
|
||||
MapSession delegate = new MapSession();
|
||||
delegate.setAttribute("attribute1", (Supplier<String>) () -> "value1");
|
||||
JdbcSession session = this.repository.new JdbcSession(delegate, UUID.randomUUID().toString(), false);
|
||||
session.setAttribute("attribute2", "value2");
|
||||
session.getAttribute("attribute2");
|
||||
this.repository.save(session);
|
||||
verify(this.jdbcOperations, times(1)).update(startsWith("INSERT INTO SPRING_SESSION_ATTRIBUTES ("),
|
||||
isA(PreparedStatementSetter.class));
|
||||
verifyNoMoreInteractions(this.jdbcOperations);
|
||||
}
|
||||
|
||||
@Test
|
||||
void saveWithSaveModeAlways() {
|
||||
this.repository.setSaveMode(SaveMode.ALWAYS);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom 'com.fasterxml.jackson:jackson-bom:2.13.0'
|
||||
mavenBom 'com.fasterxml.jackson:jackson-bom:2.13.2.20220328'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
dependency 'ch.qos.logback:logback-classic:1.2.7'
|
||||
dependency 'com.maxmind.geoip2:geoip2:2.15.0'
|
||||
dependency 'ch.qos.logback:logback-classic:1.2.11'
|
||||
dependency 'com.maxmind.geoip2:geoip2:2.16.1'
|
||||
dependency 'javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.2'
|
||||
dependency 'javax.servlet.jsp:javax.servlet.jsp-api:2.3.3'
|
||||
dependency 'org.apache.taglibs:taglibs-standard-jstlel:1.2.5'
|
||||
dependency 'org.seleniumhq.selenium:htmlunit-driver:2.52.0'
|
||||
dependency 'org.slf4j:jcl-over-slf4j:1.7.32'
|
||||
dependency 'org.slf4j:log4j-over-slf4j:1.7.32'
|
||||
dependency 'org.seleniumhq.selenium:htmlunit-driver:3.60.0'
|
||||
dependency 'org.slf4j:jcl-over-slf4j:1.7.36'
|
||||
dependency 'org.slf4j:log4j-over-slf4j:1.7.36'
|
||||
dependency 'org.webjars:bootstrap:2.3.2'
|
||||
dependency 'org.webjars:html5shiv:3.7.3-1'
|
||||
dependency 'org.webjars:jquery:3.6.0'
|
||||
|
||||
@@ -46,7 +46,7 @@ import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDr
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
|
||||
class FindByUsernameTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@@ -7,7 +7,7 @@ dependencies {
|
||||
implementation "org.springframework.boot:spring-boot-starter-actuator"
|
||||
implementation "org.springframework.boot:spring-boot-starter-thymeleaf"
|
||||
implementation "org.springframework.boot:spring-boot-starter-security"
|
||||
implementation "com.hazelcast:hazelcast:4.2.2"
|
||||
implementation "com.hazelcast:hazelcast:4.2.4"
|
||||
implementation "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect"
|
||||
implementation "org.webjars:bootstrap"
|
||||
implementation "org.webjars:html5shiv"
|
||||
|
||||
@@ -2,3 +2,7 @@ logging:
|
||||
level:
|
||||
org.springframework.data.mongodb: DEBUG
|
||||
org.springframework.session: DEBUG
|
||||
spring:
|
||||
mongodb:
|
||||
embedded:
|
||||
version: 3.4.3
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
spring.thymeleaf.cache=false
|
||||
spring.template.cache=false
|
||||
spring.data.mongodb.port=0
|
||||
spring.mongodb.embedded.version=3.4.3
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<html xmlns:layout="https://github.com/ultraq/thymeleaf-layout-dialect" layout:decorator="layout">
|
||||
<html xmlns:layout="https://github.com/ultraq/thymeleaf-layout-dialect" layout:decorate="layout">
|
||||
<head>
|
||||
<title>Secured Content</title>
|
||||
</head>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:th="https://www.thymeleaf.org"
|
||||
xmlns:layout="https://github.com/ultraq/thymeleaf-layout-dialect">
|
||||
<head>
|
||||
<title layout:title-pattern="$DECORATOR_TITLE - $CONTENT_TITLE">Spring Session Sample</title>
|
||||
<title layout:title-pattern="$LAYOUT_TITLE - $CONTENT_TITLE">Spring Session Sample</title>
|
||||
<link rel="icon" type="image/x-icon" th:href="@{/resources/img/favicon.ico}" href="../static/img/favicon.ico"/>
|
||||
<link th:href="@{/webjars/bootstrap/css/bootstrap.min.css}" href="/webjars/bootstrap/css/bootstrap.min.css" rel="stylesheet"></link>
|
||||
<style type="text/css">
|
||||
|
||||
@@ -50,7 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@AutoConfigureMockMvc
|
||||
class HttpRedisJsonTest {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@SpringBootTest
|
||||
class RedisSerializerTest {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@SpringSessionRedisOperations
|
||||
private RedisTemplate<Object, Object> sessionRedisTemplate;
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDr
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
|
||||
class BootTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@@ -45,7 +45,7 @@ import org.springframework.test.web.servlet.htmlunit.webdriver.MockMvcHtmlUnitDr
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.MOCK)
|
||||
class BootTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
class AttributeTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.9";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@LocalServerPort
|
||||
private int port;
|
||||
|
||||
@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
class AttributeTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@LocalServerPort
|
||||
private int port;
|
||||
|
||||
@@ -52,7 +52,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
class ApplicationTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Value("${local.server.port}")
|
||||
private String port;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -38,7 +38,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
*
|
||||
* @author Rob Winch
|
||||
*/
|
||||
@Entity
|
||||
@Entity(name = "custom_user")
|
||||
public class User implements Serializable {
|
||||
|
||||
@Id
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
insert into user(id,email,password,first_name,last_name) values (0,'rob','password','Rob','Winch');
|
||||
insert into user(id,email,password,first_name,last_name) values (1,'luke','password','Luke','Taylor');
|
||||
insert into user(id,email,password,first_name,last_name) values (2,'eve','password','Luke','Taylor');
|
||||
insert into custom_user(id,email,password,first_name,last_name) values (0,'rob','password','Rob','Winch');
|
||||
insert into custom_user(id,email,password,first_name,last_name) values (1,'luke','password','Luke','Taylor');
|
||||
insert into custom_user(id,email,password,first_name,last_name) values (2,'eve','password','Luke','Taylor');
|
||||
|
||||
update user set password = '$2a$10$FBAKClV1zBIOOC9XMXf3AO8RoGXYVYsfvUdoLxGkd/BnXEn4tqT3u';
|
||||
update custom_user set password = '$2a$10$FBAKClV1zBIOOC9XMXf3AO8RoGXYVYsfvUdoLxGkd/BnXEn4tqT3u';
|
||||
|
||||
@@ -17,7 +17,7 @@ dependencies {
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
implementation "org.testcontainers:testcontainers"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
@@ -29,4 +29,5 @@ dependencies {
|
||||
|
||||
gretty {
|
||||
jvmArgs = ['-Dspring.profiles.active=embedded-redis']
|
||||
logbackConfigFile = "src/main/resources/logback.xml"
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
|
||||
@Profile("embedded-redis")
|
||||
public class EmbeddedRedisConfig {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
|
||||
@@ -19,7 +19,7 @@ dependencies {
|
||||
implementation "org.slf4j:log4j-over-slf4j"
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
providedCompile "javax.servlet.jsp:javax.servlet.jsp-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
@@ -29,3 +29,7 @@ dependencies {
|
||||
integrationTestCompile "org.seleniumhq.selenium:htmlunit-driver"
|
||||
integrationTestCompile "org.seleniumhq.selenium:selenium-support"
|
||||
}
|
||||
|
||||
gretty {
|
||||
logbackConfigFile = "src/main/resources/logback.xml"
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ dependencies {
|
||||
implementation "org.slf4j:log4j-over-slf4j"
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
@@ -25,3 +25,7 @@ dependencies {
|
||||
integrationTestCompile "org.seleniumhq.selenium:htmlunit-driver"
|
||||
integrationTestCompile "org.seleniumhq.selenium:selenium-support"
|
||||
}
|
||||
|
||||
gretty {
|
||||
logbackConfigFile = "src/main/resources/logback.xml"
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ dependencies {
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
implementation "org.testcontainers:testcontainers"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
@@ -29,4 +29,5 @@ dependencies {
|
||||
|
||||
gretty {
|
||||
jvmArgs = ['-Dspring.profiles.active=embedded-redis']
|
||||
logbackConfigFile = "src/main/resources/logback.xml"
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
|
||||
@Profile("embedded-redis")
|
||||
public class EmbeddedRedisConfig {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
|
||||
@@ -18,7 +18,7 @@ dependencies {
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
implementation "org.testcontainers:testcontainers"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
|
||||
testImplementation "org.springframework.security:spring-security-test"
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
@@ -30,4 +30,5 @@ dependencies {
|
||||
gretty {
|
||||
jvmArgs = ['-Dspring.profiles.active=embedded-redis']
|
||||
servletContainer = 'tomcat9'
|
||||
logbackConfigFile = "src/main/resources/logback.xml"
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
@WebAppConfiguration
|
||||
class RestMockMvcTests {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Autowired
|
||||
private SessionRepositoryFilter<? extends Session> sessionRepositoryFilter;
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
|
||||
@Profile("embedded-redis")
|
||||
public class EmbeddedRedisConfig {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
|
||||
@@ -19,7 +19,7 @@ dependencies {
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
implementation "org.testcontainers:testcontainers"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
providedCompile "javax.servlet.jsp:javax.servlet.jsp-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
@@ -33,4 +33,5 @@ dependencies {
|
||||
|
||||
gretty {
|
||||
jvmArgs = ['-Dspring.profiles.active=embedded-redis']
|
||||
logbackConfigFile = "src/main/resources/logback.xml"
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
|
||||
@Profile("embedded-redis")
|
||||
public class EmbeddedRedisConfig {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
|
||||
@@ -15,7 +15,7 @@ dependencies {
|
||||
implementation "org.slf4j:log4j-over-slf4j"
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
@@ -24,3 +24,7 @@ dependencies {
|
||||
integrationTestCompile "org.seleniumhq.selenium:htmlunit-driver"
|
||||
integrationTestCompile "org.seleniumhq.selenium:selenium-support"
|
||||
}
|
||||
|
||||
gretty {
|
||||
logbackConfigFile = "src/main/resources/logback.xml"
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ dependencies {
|
||||
implementation "org.slf4j:log4j-over-slf4j"
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
@@ -25,3 +25,7 @@ dependencies {
|
||||
integrationTestCompile "org.seleniumhq.selenium:htmlunit-driver"
|
||||
integrationTestCompile "org.seleniumhq.selenium:selenium-support"
|
||||
}
|
||||
|
||||
gretty {
|
||||
logbackConfigFile = "src/main/resources/logback.xml"
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ dependencies {
|
||||
implementation "ch.qos.logback:logback-classic"
|
||||
implementation "org.testcontainers:testcontainers"
|
||||
|
||||
providedCompile "javax.servlet:javax.servlet-api"
|
||||
providedCompile "jakarta.servlet:jakarta.servlet-api"
|
||||
|
||||
testImplementation "org.assertj:assertj-core"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api"
|
||||
@@ -29,4 +29,5 @@ dependencies {
|
||||
|
||||
gretty {
|
||||
jvmArgs = ['-Dspring.profiles.active=embedded-redis']
|
||||
logbackConfigFile = "src/main/resources/logback.xml"
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
|
||||
@Profile("embedded-redis")
|
||||
public class EmbeddedRedisConfig {
|
||||
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.10";
|
||||
private static final String DOCKER_IMAGE = "redis:5.0.14";
|
||||
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
|
||||
Reference in New Issue
Block a user