From 69d4485ff196a67ca318afed5e8cd65c2f057dcd Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 5 Jan 2022 13:44:09 +0100 Subject: [PATCH 1/2] mockup update --- .../lms/impl/mockup/MockupLmsAPITemplate.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/mockup/MockupLmsAPITemplate.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/mockup/MockupLmsAPITemplate.java index 35e67a9f..fd039f43 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/mockup/MockupLmsAPITemplate.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/mockup/MockupLmsAPITemplate.java @@ -66,22 +66,22 @@ public class MockupLmsAPITemplate implements LmsAPITemplate { "2020-01-01T09:00:00Z", null, "http://lms.mockup.com/api/")); this.mockups.add(new QuizData( "quiz2", institutionId, lmsSetupId, lmsType, "Demo Quiz 2 (MOCKUP)", "

Demo Quiz Mockup

", - "2020-01-01T09:00:00Z", "2022-01-01T09:00:00Z", "http://lms.mockup.com/api/")); + "2020-01-01T09:00:00Z", "2025-01-01T09:00:00Z", "http://lms.mockup.com/api/")); this.mockups.add(new QuizData( "quiz3", institutionId, lmsSetupId, lmsType, "Demo Quiz 3 (MOCKUP)", "

Demo Quiz Mockup

", "2018-07-30T09:00:00Z", "2018-08-01T00:00:00Z", "http://lms.mockup.com/api/")); this.mockups.add(new QuizData( "quiz4", institutionId, lmsSetupId, lmsType, "Demo Quiz 4 (MOCKUP)", "

Demo Quiz Mockup

", - "2018-01-01T00:00:00Z", "2019-01-01T00:00:00Z", "http://lms.mockup.com/api/")); + "2018-01-01T00:00:00Z", "2025-01-01T00:00:00Z", "http://lms.mockup.com/api/")); this.mockups.add(new QuizData( "quiz5", institutionId, lmsSetupId, lmsType, "Demo Quiz 5 (MOCKUP)", "

Demo Quiz Mockup

", - "2018-01-01T09:00:00Z", "2022-01-01T09:00:00Z", "http://lms.mockup.com/api/")); + "2018-01-01T09:00:00Z", "2025-01-01T09:00:00Z", "http://lms.mockup.com/api/")); this.mockups.add(new QuizData( "quiz6", institutionId, lmsSetupId, lmsType, "Demo Quiz 6 (MOCKUP)", "

Demo Quiz Mockup

", - "2019-01-01T09:00:00Z", "2022-01-01T09:00:00Z", "http://lms.mockup.com/api/")); + "2019-01-01T09:00:00Z", "2025-01-01T09:00:00Z", "http://lms.mockup.com/api/")); this.mockups.add(new QuizData( "quiz7", institutionId, lmsSetupId, lmsType, "Demo Quiz 7 (MOCKUP)", "

Demo Quiz Mockup

", - "2018-01-01T09:00:00Z", "2022-01-01T09:00:00Z", "http://lms.mockup.com/api/")); + "2018-01-01T09:00:00Z", "2025-01-01T09:00:00Z", "http://lms.mockup.com/api/")); this.mockups.add(new QuizData( "quiz10", institutionId, lmsSetupId, lmsType, "Demo Quiz 10 (MOCKUP)", From c0c58763bf1a999b3fdb9c87d11fe03aa8d615df Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 5 Jan 2022 15:29:49 +0100 Subject: [PATCH 2/2] fixed OAuth2 JDBCTokenStore cache --- .../weblayer/oauth/CachableJdbcTokenStore.java | 10 +++++----- src/main/resources/config/ehcache.xml | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/oauth/CachableJdbcTokenStore.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/oauth/CachableJdbcTokenStore.java index 8933b1bd..8dd35ed5 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/oauth/CachableJdbcTokenStore.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/oauth/CachableJdbcTokenStore.java @@ -50,10 +50,6 @@ public class CachableJdbcTokenStore implements TokenStore { } @Override - @Cacheable( - cacheNames = CACHE_NAME, - key = "#token", - unless = "#result == null") public OAuth2Authentication readAuthentication(final OAuth2AccessToken token) { if (log.isDebugEnabled()) { log.debug("Read authentication from persistent and cache if available"); @@ -68,6 +64,10 @@ public class CachableJdbcTokenStore implements TokenStore { } @Override + @Cacheable( + cacheNames = CACHE_NAME, + key = "#tokenValue", + unless = "#result == null") public OAuth2AccessToken readAccessToken(final String tokenValue) { return this.jdbcTokenStore.readAccessToken(tokenValue); } @@ -75,7 +75,7 @@ public class CachableJdbcTokenStore implements TokenStore { @Override @CacheEvict( cacheNames = CACHE_NAME, - key = "#token") + key = "#token.getValue()") public void removeAccessToken(final OAuth2AccessToken token) { if (log.isDebugEnabled()) { log.debug("Evict token from cache and remove it also from persistent store"); diff --git a/src/main/resources/config/ehcache.xml b/src/main/resources/config/ehcache.xml index ecc1b6f6..db9b470a 100644 --- a/src/main/resources/config/ehcache.xml +++ b/src/main/resources/config/ehcache.xml @@ -61,10 +61,10 @@ - org.springframework.security.oauth2.common.OAuth2AccessToken - org.springframework.security.oauth2.provider.OAuth2Authentication + java.lang.String + org.springframework.security.oauth2.common.OAuth2AccessToken - 24 + 1 100