You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2020/05/25 12:03:38 UTC
[cxf] 01/03: More ehcache refactoring
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit fdcccee816a8639a4b253d12d44beb4cb285789b
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Mon May 25 10:36:19 2020 +0100
More ehcache refactoring
---
.../apache/cxf/ws/security/SecurityConstants.java | 4 +-
.../cxf/ws/security/trust/STSLoginModule.java | 6 +-
.../cxf/xkms/cache/EHCacheXKMSClientCache.java | 116 ++++++++++++++-------
.../src/main/resources/cxf-xkms-client-ehcache.xml | 20 ----
.../systest/jaxrs/security/SecurityTestUtil.java | 16 ---
.../grants/AuthorizationGrantNegativeTest.java | 7 --
.../oauth2/grants/AuthorizationGrantTest.java | 7 --
.../oauth2/grants/DynamicRegistrationTest.java | 7 --
.../oauth2/grants/IntrospectionServiceTest.java | 7 --
.../security/oauth2/grants/JAXRSOAuth2Test.java | 7 --
.../security/oauth2/grants/PublicClientTest.java | 7 --
.../oauth2/grants/RevocationServiceTest.java | 7 --
.../systest/jaxrs/security/oidc/OIDCFlowTest.java | 7 --
.../jaxrs/security/oidc/OIDCKeysServiceTest.java | 7 --
.../jaxrs/security/oidc/OIDCNegativeTest.java | 7 --
.../systest/jaxrs/security/oidc/UserInfoTest.java | 7 --
.../cxf/systest/ws/cache/per-proxy-cache.xml | 12 ---
17 files changed, 83 insertions(+), 168 deletions(-)
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
index b9146fc..4fc0b15 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/SecurityConstants.java
@@ -218,8 +218,8 @@ public final class SecurityConstants extends org.apache.cxf.rt.security.Security
public static final String SAML_ONE_TIME_USE_CACHE_INSTANCE = "ws-security.saml.cache.instance";
/**
- * Set this property to point to a configuration file for the underlying caching implementation.
- * The default configuration file that is used is cxf-ehcache.xml in this module.
+ * Set this property to point to a configuration file for the underlying caching implementation for the
+ * TokenStore. The default configuration file that is used is cxf-ehcache.xml in this module.
*/
public static final String CACHE_CONFIG_FILE =
"ws-security.cache.config.file";
diff --git a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSLoginModule.java b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSLoginModule.java
index 4f926b1..793f426 100644
--- a/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSLoginModule.java
+++ b/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSLoginModule.java
@@ -165,11 +165,16 @@ public class STSLoginModule implements LoginModule {
private String tokenType = "http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0";
private String namespace;
private Map<String, Object> stsClientProperties = new HashMap<>();
+ private final TokenStore tokenStore;
/** the authentication status*/
private boolean succeeded;
private boolean commitSucceeded;
+ public STSLoginModule() throws MalformedURLException, TokenStoreException {
+ tokenStore = configureTokenStore();
+ }
+
@Override
public void initialize(Subject subj, CallbackHandler cbHandler, Map<String, ?> sharedState,
Map<String, ?> options) {
@@ -263,7 +268,6 @@ public class STSLoginModule implements LoginModule {
message.put(SecurityConstants.STS_CLIENT, stsClient);
data.setMsgContext(message);
} else {
- TokenStore tokenStore = configureTokenStore();
validator.setStsClient(stsClient);
validator.setTokenStore(tokenStore);
}
diff --git a/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/cache/EHCacheXKMSClientCache.java b/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/cache/EHCacheXKMSClientCache.java
index 52c2a99..f02ed95 100644
--- a/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/cache/EHCacheXKMSClientCache.java
+++ b/services/xkms/xkms-client/src/main/java/org/apache/cxf/xkms/cache/EHCacheXKMSClientCache.java
@@ -20,86 +20,105 @@
package org.apache.cxf.xkms.cache;
import java.io.File;
-import java.net.URL;
+import java.nio.file.Path;
+import java.time.Duration;
+import java.time.temporal.ChronoUnit;
import java.util.UUID;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.buslifecycle.BusLifeCycleListener;
import org.apache.cxf.buslifecycle.BusLifeCycleManager;
-import org.apache.cxf.common.classloader.ClassLoaderUtils;
-import org.apache.wss4j.common.util.Loader;
import org.ehcache.Cache;
import org.ehcache.CacheManager;
+import org.ehcache.CachePersistenceException;
+import org.ehcache.PersistentCacheManager;
import org.ehcache.Status;
import org.ehcache.config.builders.CacheConfigurationBuilder;
import org.ehcache.config.builders.CacheManagerBuilder;
-import org.ehcache.xml.XmlConfiguration;
+import org.ehcache.config.builders.ExpiryPolicyBuilder;
+import org.ehcache.config.builders.ResourcePoolsBuilder;
+import org.ehcache.config.units.EntryUnit;
+import org.ehcache.config.units.MemoryUnit;
+import org.ehcache.expiry.ExpiryPolicy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* An in-memory EHCache implementation of the XKMSClientCache interface.
*/
public class EHCacheXKMSClientCache implements XKMSClientCache, BusLifeCycleListener {
- public static final String TEMPLATE_KEY = "cxf.xkms.client.cache";
- private static final String DEFAULT_CONFIG_URL = "cxf-xkms-client-ehcache.xml";
+ private static final Logger LOG = LoggerFactory.getLogger(EHCacheXKMSClientCache.class);
private final Cache<String, XKMSCacheToken> cache;
private final CacheManager cacheManager;
private final Bus bus;
private final String cacheKey;
+ private final Path diskstorePath;
+ private final boolean persistent;
public EHCacheXKMSClientCache() throws XKMSClientCacheException {
- this(DEFAULT_CONFIG_URL, null);
+ this(null);
}
public EHCacheXKMSClientCache(Bus cxfBus) throws XKMSClientCacheException {
- this(DEFAULT_CONFIG_URL, cxfBus);
+ this(cxfBus, null, 10L, 5000L, false);
}
- public EHCacheXKMSClientCache(String configFileURL) throws XKMSClientCacheException {
- this(configFileURL, null);
- }
+ public EHCacheXKMSClientCache(Bus cxfBus, Path diskstorePath, long diskSize,
+ long heapEntries, boolean persistent) throws XKMSClientCacheException {
+ // Do some sanity checking on the arguments
+ if (persistent && diskstorePath == null) {
+ throw new NullPointerException();
+ }
+ if (diskstorePath != null && (diskSize < 5 || diskSize > 10000)) {
+ throw new IllegalArgumentException("The diskSize parameter must be between 5 and 10000 (megabytes)");
+ }
+ if (heapEntries < 100) {
+ throw new IllegalArgumentException("The heapEntries parameter must be greater than 100 (entries)");
+ }
- public EHCacheXKMSClientCache(String configFile, Bus cxfBus) throws XKMSClientCacheException {
if (cxfBus == null) {
cxfBus = BusFactory.getThreadDefaultBus(true);
}
- this.bus = cxfBus;
- if (bus != null) {
- bus.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(this);
- }
-
- URL configFileURL = null;
- try {
- configFileURL =
- ClassLoaderUtils.getResource(configFile, EHCacheXKMSClientCache.class);
- } catch (Exception ex) {
- // ignore
- }
- if (configFileURL == null) {
- configFileURL = Loader.getResource(this.getClass().getClassLoader(), configFile);
+ if (cxfBus != null) {
+ cxfBus.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(this);
}
- XmlConfiguration xmlConfig = new XmlConfiguration(configFileURL);
+ this.bus = cxfBus;
+ this.diskstorePath = diskstorePath;
+ this.persistent = persistent;
- try {
- CacheConfigurationBuilder<String, XKMSCacheToken> configurationBuilder =
- xmlConfig.newCacheConfigurationBuilderFromTemplate(TEMPLATE_KEY,
- String.class, XKMSCacheToken.class);
+ cacheKey = UUID.randomUUID().toString();
- cacheKey = UUID.randomUUID().toString();
+ ResourcePoolsBuilder resourcePoolsBuilder = ResourcePoolsBuilder.newResourcePoolsBuilder()
+ .heap(heapEntries, EntryUnit.ENTRIES);
+ if (diskstorePath != null) {
+ resourcePoolsBuilder = resourcePoolsBuilder.disk(diskSize, MemoryUnit.MB, persistent);
+ }
- cacheManager = CacheManagerBuilder.newCacheManagerBuilder().withCache(cacheKey,
- configurationBuilder)
- .with(CacheManagerBuilder.persistence(new File(System.getProperty("java.io.tmpdir"), cacheKey)))
+ ExpiryPolicy<Object, Object> expiryPolicy =
+ ExpiryPolicyBuilder.timeToLiveExpiration(Duration.of(3600, ChronoUnit.SECONDS));
+ CacheConfigurationBuilder<String, XKMSCacheToken> configurationBuilder =
+ CacheConfigurationBuilder.newCacheConfigurationBuilder(
+ String.class, XKMSCacheToken.class, resourcePoolsBuilder)
+ .withExpiry(expiryPolicy);
+
+ if (diskstorePath != null) {
+ cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
+ .with(CacheManagerBuilder.persistence(diskstorePath.toFile()))
+ .withCache(cacheKey, configurationBuilder)
+ .build();
+ } else {
+ cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
+ .withCache(cacheKey, configurationBuilder)
.build();
-
- cacheManager.init();
- cache = cacheManager.getCache(cacheKey, String.class, XKMSCacheToken.class);
- } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
- throw new XKMSClientCacheException(e);
}
+
+ cacheManager.init();
+ cache = cacheManager.getCache(cacheKey, String.class, XKMSCacheToken.class);
+
}
/**
@@ -122,6 +141,23 @@ public class EHCacheXKMSClientCache implements XKMSClientCache, BusLifeCycleList
cacheManager.removeCache(cacheKey);
cacheManager.close();
+ if (!persistent && cacheManager instanceof PersistentCacheManager) {
+ try {
+ ((PersistentCacheManager) cacheManager).destroy();
+ } catch (CachePersistenceException e) {
+ LOG.debug("Error in shutting down persistent cache", e);
+ }
+
+ // As we're not using a persistent disk store, just delete it - it should be empty after calling
+ // destroy above
+ if (diskstorePath != null) {
+ File file = diskstorePath.toFile();
+ if (file.exists() && file.canWrite()) {
+ file.delete();
+ }
+ }
+ }
+
if (bus != null) {
bus.getExtension(BusLifeCycleManager.class).unregisterLifeCycleListener(this);
}
diff --git a/services/xkms/xkms-client/src/main/resources/cxf-xkms-client-ehcache.xml b/services/xkms/xkms-client/src/main/resources/cxf-xkms-client-ehcache.xml
deleted file mode 100644
index 2206eac..0000000
--- a/services/xkms/xkms-client/src/main/resources/cxf-xkms-client-ehcache.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<config
- xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
- xmlns='http://www.ehcache.org/v3'
- xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.8.xsd">
-
- <cache-template name="cxf.xkms.client.cache">
- <key-type>java.lang.String</key-type>
- <value-type>org.apache.cxf.xkms.cache.XKMSCacheToken</value-type>
- <expiry>
- <ttl unit="seconds">3600</ttl>
- </expiry>
- <resources>
- <heap unit="entries">5000</heap>
- <disk unit="MB" persistent="false">10</disk>
- </resources>
- </cache-template>
-
-</config>
-
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/SecurityTestUtil.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/SecurityTestUtil.java
index 5ca3d32..15db2a5 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/SecurityTestUtil.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/SecurityTestUtil.java
@@ -18,8 +18,6 @@
*/
package org.apache.cxf.systest.jaxrs.security;
-import java.io.File;
-
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
@@ -58,18 +56,4 @@ public final class SecurityTestUtil {
return UNRESTRICTED_POLICIES_INSTALLED;
}
- public static void cleanup() {
- String tmpDir = System.getProperty("java.io.tmpdir");
- if (tmpDir != null) {
- File[] tmpFiles = new File(tmpDir).listFiles();
- if (tmpFiles != null) {
- for (File tmpFile : tmpFiles) {
- // Cleanup eh-caches
- if (tmpFile.exists() && tmpFile.getName().matches("cxf.*.data")) {
- tmpFile.delete();
- }
- }
- }
- }
- }
}
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantNegativeTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantNegativeTest.java
index 10eee52..841975f 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantNegativeTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantNegativeTest.java
@@ -42,7 +42,6 @@ import org.apache.cxf.rs.security.jose.jws.JwsUtils;
import org.apache.cxf.rs.security.jose.jwt.JwtClaims;
import org.apache.cxf.rs.security.oauth2.common.ClientAccessToken;
import org.apache.cxf.rs.security.oauth2.common.OAuthAuthorizationData;
-import org.apache.cxf.systest.jaxrs.security.SecurityTestUtil;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.SamlCallbackHandler;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -53,7 +52,6 @@ import org.apache.wss4j.common.saml.SAMLUtil;
import org.apache.wss4j.common.saml.SamlAssertionWrapper;
import org.apache.wss4j.common.saml.builder.SAML2Constants;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameters;
@@ -103,11 +101,6 @@ public class AuthorizationGrantNegativeTest extends AbstractBusClientServerTestB
launchServer(BookServerOAuth2GrantsNegativeJCacheJWTNonPersist.class, true));
}
- @AfterClass
- public static void cleanup() throws Exception {
- SecurityTestUtil.cleanup();
- }
-
@Parameters(name = "{0}")
public static Collection<String> data() {
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantTest.java
index 4a6b009..6f0a843 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/AuthorizationGrantTest.java
@@ -38,7 +38,6 @@ import org.apache.cxf.rs.security.jose.jwt.JwtClaims;
import org.apache.cxf.rs.security.oauth2.common.ClientAccessToken;
import org.apache.cxf.rs.security.oauth2.common.OAuthAuthorizationData;
import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
-import org.apache.cxf.systest.jaxrs.security.SecurityTestUtil;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils;
import org.apache.cxf.systest.jaxrs.security.oidc.SpringBusTestServer;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -46,7 +45,6 @@ import org.apache.cxf.testutil.common.TestUtil;
import org.apache.cxf.transport.http.HTTPConduitConfigurer;
import org.apache.xml.security.utils.ClassLoaderUtils;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameters;
@@ -102,11 +100,6 @@ public class AuthorizationGrantTest extends AbstractBusClientServerTestBase {
assertTrue("server did not launch correctly", launchServer(JWT_NON_PERSIST_JCACHE_SERVER));
}
- @AfterClass
- public static void cleanup() throws Exception {
- SecurityTestUtil.cleanup();
- }
-
@Parameters(name = "{0}")
public static String[] data() {
return new String[] {
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/DynamicRegistrationTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/DynamicRegistrationTest.java
index 006d08c..e0728b3 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/DynamicRegistrationTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/DynamicRegistrationTest.java
@@ -28,14 +28,12 @@ import org.apache.cxf.rs.security.oauth2.common.ClientAccessToken;
import org.apache.cxf.rs.security.oauth2.services.ClientRegistration;
import org.apache.cxf.rs.security.oauth2.services.ClientRegistrationResponse;
import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
-import org.apache.cxf.systest.jaxrs.security.SecurityTestUtil;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.testutil.common.TestUtil;
import org.apache.cxf.transport.http.HTTPConduitConfigurer;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameters;
@@ -79,11 +77,6 @@ public class DynamicRegistrationTest extends AbstractBusClientServerTestBase {
launchServer(BookServerOAuth2DynamicRegistrationJPA.class));
}
- @AfterClass
- public static void cleanup() throws Exception {
- SecurityTestUtil.cleanup();
- }
-
@Parameters(name = "{0}")
public static String[] data() {
return new String[] {JCACHE_PORT, JWT_JCACHE_PORT, JPA_PORT};
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/IntrospectionServiceTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/IntrospectionServiceTest.java
index cb24660..669048d 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/IntrospectionServiceTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/IntrospectionServiceTest.java
@@ -31,13 +31,11 @@ import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.rs.security.oauth2.common.ClientAccessToken;
import org.apache.cxf.rs.security.oauth2.common.TokenIntrospection;
-import org.apache.cxf.systest.jaxrs.security.SecurityTestUtil;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.testutil.common.TestUtil;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameters;
@@ -87,11 +85,6 @@ public class IntrospectionServiceTest extends AbstractBusClientServerTestBase {
launchServer(BookServerOAuth2IntrospectionJCacheJWTNonPersist.class, true));
}
- @AfterClass
- public static void cleanup() throws Exception {
- SecurityTestUtil.cleanup();
- }
-
@Parameters(name = "{0}")
public static Collection<String> data() {
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/JAXRSOAuth2Test.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/JAXRSOAuth2Test.java
index 634700f..a228875 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/JAXRSOAuth2Test.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/JAXRSOAuth2Test.java
@@ -54,7 +54,6 @@ import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
import org.apache.cxf.rs.security.saml.SAMLUtils;
import org.apache.cxf.rs.security.saml.SAMLUtils.SelfSignInfo;
import org.apache.cxf.rt.security.SecurityConstants;
-import org.apache.cxf.systest.jaxrs.security.SecurityTestUtil;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.SamlCallbackHandler;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -67,7 +66,6 @@ import org.apache.wss4j.common.saml.SamlAssertionWrapper;
import org.apache.wss4j.common.saml.builder.SAML2Constants;
import org.apache.wss4j.common.util.DOM2Writer;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -119,11 +117,6 @@ public class JAXRSOAuth2Test extends AbstractBusClientServerTestBase {
launchServer(BookServerOAuth2JCacheJWTNonPersist.class, true));
}
- @AfterClass
- public static void cleanup() throws Exception {
- SecurityTestUtil.cleanup();
- }
-
@Parameters(name = "{0}")
public static Collection<String> data() {
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/PublicClientTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/PublicClientTest.java
index 7608fd6..4fa89db 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/PublicClientTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/PublicClientTest.java
@@ -31,14 +31,12 @@ import org.apache.cxf.rs.security.oauth2.grants.code.PlainCodeVerifier;
import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
import org.apache.cxf.rt.security.crypto.CryptoUtils;
-import org.apache.cxf.systest.jaxrs.security.SecurityTestUtil;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils.AuthorizationCodeParameters;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
import org.apache.cxf.testutil.common.TestUtil;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import static org.junit.Assert.assertFalse;
@@ -64,11 +62,6 @@ public class PublicClientTest extends AbstractClientServerTestBase {
launchServer(BookServerOAuth2GrantsJCache.class, true));
}
- @AfterClass
- public static void cleanup() throws Exception {
- SecurityTestUtil.cleanup();
- }
-
@org.junit.Test
public void testAuthorizationCodeGrant() throws Exception {
URL busFile = PublicClientTest.class.getResource("publicclient.xml");
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/RevocationServiceTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/RevocationServiceTest.java
index 7847f7a..3d80c14 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/RevocationServiceTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oauth2/grants/RevocationServiceTest.java
@@ -31,13 +31,11 @@ import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.rs.security.oauth2.common.ClientAccessToken;
import org.apache.cxf.rs.security.oauth2.common.TokenIntrospection;
-import org.apache.cxf.systest.jaxrs.security.SecurityTestUtil;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.testutil.common.TestUtil;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameters;
@@ -80,11 +78,6 @@ public class RevocationServiceTest extends AbstractBusClientServerTestBase {
launchServer(BookServerOAuth2RevocationJPA.class, true));
}
- @AfterClass
- public static void cleanup() throws Exception {
- SecurityTestUtil.cleanup();
- }
-
@Parameters(name = "{0}")
public static Collection<String> data() {
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
index 58fef56..6f96839 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCFlowTest.java
@@ -57,14 +57,12 @@ import org.apache.cxf.rs.security.oidc.idp.OidcProviderMetadata;
import org.apache.cxf.rs.security.oidc.rp.IdTokenReader;
import org.apache.cxf.rs.security.oidc.utils.OidcUtils;
import org.apache.cxf.rt.security.crypto.CryptoUtils;
-import org.apache.cxf.systest.jaxrs.security.SecurityTestUtil;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils.AuthorizationCodeParameters;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.transport.http.HTTPConduitConfigurer;
import org.apache.xml.security.utils.ClassLoaderUtils;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameters;
@@ -109,11 +107,6 @@ public class OIDCFlowTest extends AbstractBusClientServerTestBase {
assertTrue("Server failed to launch", launchServer(JWT_NON_PERSIST_JCACHE_SERVER));
}
- @AfterClass
- public static void cleanup() throws Exception {
- SecurityTestUtil.cleanup();
- }
-
@Parameters(name = "{0}")
public static String[] data() {
return new String[]{
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCKeysServiceTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCKeysServiceTest.java
index 3144c4a..7021f6e 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCKeysServiceTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCKeysServiceTest.java
@@ -26,11 +26,9 @@ import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.rs.security.jose.jwk.JsonWebKey;
import org.apache.cxf.rs.security.jose.jwk.JsonWebKeys;
import org.apache.cxf.rs.security.jose.jwk.KeyType;
-import org.apache.cxf.systest.jaxrs.security.SecurityTestUtil;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import static org.junit.Assert.assertEquals;
@@ -51,11 +49,6 @@ public class OIDCKeysServiceTest extends AbstractBusClientServerTestBase {
assertTrue("Server failed to launch", launchServer(JCACHE_SERVER));
}
- @AfterClass
- public static void cleanup() throws Exception {
- SecurityTestUtil.cleanup();
- }
-
@org.junit.Test
public void testGetRSAPublicKey() throws Exception {
URL busFile = OIDCFlowTest.class.getResource("client.xml");
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
index a19b5f2..52f3b46 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/OIDCNegativeTest.java
@@ -36,12 +36,10 @@ import org.apache.cxf.rs.security.oauth2.common.ClientAccessToken;
import org.apache.cxf.rs.security.oauth2.common.OAuthAuthorizationData;
import org.apache.cxf.rs.security.oidc.common.IdToken;
import org.apache.cxf.rs.security.oidc.common.UserInfo;
-import org.apache.cxf.systest.jaxrs.security.SecurityTestUtil;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils.AuthorizationCodeParameters;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
-import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@@ -84,11 +82,6 @@ public class OIDCNegativeTest extends AbstractBusClientServerTestBase {
assertTrue("Server failed to launch", launchServer(JWT_NON_PERSIST_JCACHE_SERVER));
}
- @AfterClass
- public static void cleanup() throws Exception {
- SecurityTestUtil.cleanup();
- }
-
@Parameters(name = "{0}")
public static String[] data() {
return new String[]{
diff --git a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/UserInfoTest.java b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/UserInfoTest.java
index bc540fe..1159fe9 100644
--- a/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/UserInfoTest.java
+++ b/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/oidc/UserInfoTest.java
@@ -40,11 +40,9 @@ import org.apache.cxf.rs.security.jose.jwt.JwtToken;
import org.apache.cxf.rs.security.oauth2.common.ClientAccessToken;
import org.apache.cxf.rs.security.oidc.common.IdToken;
import org.apache.cxf.rs.security.oidc.common.UserInfo;
-import org.apache.cxf.systest.jaxrs.security.SecurityTestUtil;
import org.apache.cxf.systest.jaxrs.security.oauth2.common.OAuth2TestUtils;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameters;
@@ -84,11 +82,6 @@ public class UserInfoTest extends AbstractBusClientServerTestBase {
assertTrue("Server failed to launch", launchServer(JWT_NON_PERSIST_JCACHE_SERVER));
}
- @AfterClass
- public static void cleanup() throws Exception {
- SecurityTestUtil.cleanup();
- }
-
@Parameters(name = "{0}")
public static String[] data() {
return new String[]{
diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/cache/per-proxy-cache.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/cache/per-proxy-cache.xml
index dcbf079..7ee9923 100644
--- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/cache/per-proxy-cache.xml
+++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/cache/per-proxy-cache.xml
@@ -4,18 +4,6 @@
xmlns='http://www.ehcache.org/v3'
xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core.xsd">
- <cache-template name="wss4jCache">
- <key-type>java.lang.String</key-type>
- <value-type>org.apache.wss4j.common.cache.EHCacheIdentityValue</value-type>
- <expiry>
- <class>org.apache.wss4j.common.cache.EHCacheExpiry</class>
- </expiry>
- <resources>
- <heap unit="entries">5000</heap>
- <disk unit="MB" persistent="false">10</disk>
- </resources>
- </cache-template>
-
<!--
Security Tokens are not writable to Disk so use a memory only
cache with a bit larger maxEntriesLocalHeap. However, this