[java-opensaml] branch main updated: Use NonNull Set and List creation methods
Rod Widdowson
rdw at steadingsoftware.com
Tue Jan 24 14:21:45 UTC 2023
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=c0d4c52667bdfc6a200984557475e3d5d233784e
The following commit(s) were added to refs/heads/main by this push:
new c0d4c5266 Use NonNull Set and List creation methods
c0d4c5266 is described below
commit c0d4c52667bdfc6a200984557475e3d5d233784e
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Jan 24 14:09:37 2023 +0000
Use NonNull Set and List creation methods
---
.../impl/FilesystemLoadSaveManagerTest.java | 39 +++++++++++-----------
.../encoding/impl/HTTPRedirectDeflateEncoder.java | 3 +-
.../impl/AbstractDynamicMetadataResolverTest.java | 5 +--
.../index/impl/MetadataIndexManagerTest.java | 7 ++--
.../impl/AddProxyRestrictionToAssertionsTest.java | 24 ++++++-------
.../crypto/ec/tests/NamedCurveRegistryTest.java | 6 ++--
.../soap/wsaddressing/WSAddressingConstants.java | 3 +-
.../xmlsec/agreement/KeyAgreementSupport.java | 4 ++-
.../xmlsec/signature/support/SignatureSupport.java | 3 +-
.../KeyAgreementProcessorRegistryTest.java | 8 +++--
.../DefaultSecurityConfigurationBootstrap.java | 5 +--
.../GlobalKeyAgreementProcessorRegistryTest.java | 6 ++--
.../support/tests/DHWithLegacyKDFTest.java | 3 +-
.../AbstractSecurityParametersResolverTest.java | 7 ++--
14 files changed, 68 insertions(+), 55 deletions(-)
diff --git a/opensaml-core-impl/src/test/java/org/opensaml/core/xml/persist/impl/FilesystemLoadSaveManagerTest.java b/opensaml-core-impl/src/test/java/org/opensaml/core/xml/persist/impl/FilesystemLoadSaveManagerTest.java
index 20d311e71..e6664e1e6 100644
--- a/opensaml-core-impl/src/test/java/org/opensaml/core/xml/persist/impl/FilesystemLoadSaveManagerTest.java
+++ b/opensaml-core-impl/src/test/java/org/opensaml/core/xml/persist/impl/FilesystemLoadSaveManagerTest.java
@@ -40,8 +40,6 @@ import org.opensaml.core.xml.XMLRuntimeException;
import org.opensaml.core.xml.io.MarshallingException;
import org.opensaml.core.xml.mock.SimpleXMLObject;
import org.opensaml.core.xml.persist.FilesystemLoadSaveManager;
-import org.opensaml.core.xml.persist.impl.PassthroughSourceStrategy;
-import org.opensaml.core.xml.persist.impl.SegmentingIntermediateDirectoryStrategy;
import org.opensaml.core.xml.util.XMLObjectSource;
import org.opensaml.core.xml.util.XMLObjectSupport;
import org.slf4j.Logger;
@@ -54,6 +52,7 @@ import org.testng.annotations.Test;
import com.google.common.util.concurrent.Uninterruptibles;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.collection.Pair;
import net.shibboleth.shared.logic.ConstraintViolationException;
@@ -111,11 +110,11 @@ public class FilesystemLoadSaveManagerTest extends XMLObjectBaseTestCase {
manager.save("bar", (SimpleXMLObject) buildXMLObject(SimpleXMLObject.ELEMENT_NAME, buildWithObjectSourceByteArray));
manager.save("baz", (SimpleXMLObject) buildXMLObject(SimpleXMLObject.ELEMENT_NAME, buildWithObjectSourceByteArray));
- testState(Set.of("foo", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo", "bar", "baz"));
// Duplicate with overwrite
manager.save("bar", (SimpleXMLObject) buildXMLObject(SimpleXMLObject.ELEMENT_NAME, buildWithObjectSourceByteArray), true);
- testState(Set.of("foo", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo", "bar", "baz"));
// Duplicate without overwrite
try {
@@ -124,17 +123,17 @@ public class FilesystemLoadSaveManagerTest extends XMLObjectBaseTestCase {
} catch (IOException e) {
// expected, do nothing
}
- testState(Set.of("foo", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo", "bar", "baz"));
// Test again. Since checkModifyTime=false, we should get back data even though unmodified
- testState(Set.of("foo", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo", "bar", "baz"));
Assert.assertTrue(manager.updateKey("foo", "foo2"));
- testState(Set.of("foo2", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo2", "bar", "baz"));
// Doesn't exist anymore
Assert.assertFalse(manager.updateKey("foo", "foo2"));
- testState(Set.of("foo2", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo2", "bar", "baz"));
// Can't update to an existing name
try {
@@ -143,14 +142,14 @@ public class FilesystemLoadSaveManagerTest extends XMLObjectBaseTestCase {
} catch (IOException e) {
// expected, do nothing
}
- testState(Set.of("foo2", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo2", "bar", "baz"));
// Doesn't exist anymore
Assert.assertFalse(manager.remove("foo"));
- testState(Set.of("foo2", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo2", "bar", "baz"));
Assert.assertTrue(manager.remove("foo2"));
- testState(Set.of("bar", "baz"));
+ testState(CollectionSupport.setOf("bar", "baz"));
Assert.assertTrue(manager.remove("bar"));
Assert.assertTrue(manager.remove("baz"));
@@ -174,13 +173,13 @@ public class FilesystemLoadSaveManagerTest extends XMLObjectBaseTestCase {
Assert.assertFalse(new File(parentPath(baseDir, "ba"), "baz").exists());
manager.save("bar", (SimpleXMLObject) buildXMLObject(SimpleXMLObject.ELEMENT_NAME, buildWithObjectSourceByteArray));
manager.save("baz", (SimpleXMLObject) buildXMLObject(SimpleXMLObject.ELEMENT_NAME, buildWithObjectSourceByteArray));
- testState(Set.of("foo", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo", "bar", "baz"));
Assert.assertTrue(new File(parentPath(baseDir, "ba"), "bar").exists());
Assert.assertTrue(new File(parentPath(baseDir, "ba"), "baz").exists());
// Duplicate with overwrite
manager.save("bar", (SimpleXMLObject) buildXMLObject(SimpleXMLObject.ELEMENT_NAME, buildWithObjectSourceByteArray), true);
- testState(Set.of("foo", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo", "bar", "baz"));
// Duplicate without overwrite
try {
@@ -189,19 +188,19 @@ public class FilesystemLoadSaveManagerTest extends XMLObjectBaseTestCase {
} catch (IOException e) {
// expected, do nothing
}
- testState(Set.of("foo", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo", "bar", "baz"));
// Test again. Since checkModifyTime=false, we should get back data even though unmodified
- testState(Set.of("foo", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo", "bar", "baz"));
Assert.assertFalse(new File(parentPath(baseDir, "fo"), "foo2").exists());
Assert.assertTrue(manager.updateKey("foo", "foo2"));
- testState(Set.of("foo2", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo2", "bar", "baz"));
Assert.assertTrue(new File(parentPath(baseDir, "fo"), "foo2").exists());
// Doesn't exist anymore
Assert.assertFalse(manager.updateKey("foo", "foo2"));
- testState(Set.of("foo2", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo2", "bar", "baz"));
// Can't update to an existing name
try {
@@ -210,16 +209,16 @@ public class FilesystemLoadSaveManagerTest extends XMLObjectBaseTestCase {
} catch (IOException e) {
// expected, do nothing
}
- testState(Set.of("foo2", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo2", "bar", "baz"));
// Doesn't exist anymore
Assert.assertFalse(manager.remove("foo"));
- testState(Set.of("foo2", "bar", "baz"));
+ testState(CollectionSupport.setOf("foo2", "bar", "baz"));
Assert.assertFalse(new File(parentPath(baseDir, "fo"), "foo").exists());
Assert.assertTrue(new File(parentPath(baseDir, "fo"), "foo2").exists());
Assert.assertTrue(manager.remove("foo2"));
- testState(Set.of("bar", "baz"));
+ testState(CollectionSupport.setOf("bar", "baz"));
Assert.assertFalse(new File(parentPath(baseDir, "fo"), "foo2").exists());
Assert.assertTrue(new File(parentPath(baseDir, "ba"), "bar").exists());
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/encoding/impl/HTTPRedirectDeflateEncoder.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/encoding/impl/HTTPRedirectDeflateEncoder.java
index b18142543..fb3673b41 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/encoding/impl/HTTPRedirectDeflateEncoder.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/encoding/impl/HTTPRedirectDeflateEncoder.java
@@ -54,6 +54,7 @@ import jakarta.servlet.http.HttpServletResponse;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.codec.Base64Support;
import net.shibboleth.shared.codec.EncodingException;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.collection.Pair;
import net.shibboleth.shared.net.URLBuilder;
import net.shibboleth.shared.primitive.StringSupport;
@@ -69,7 +70,7 @@ public class HTTPRedirectDeflateEncoder extends BaseSAML2MessageEncoder {
/** Params which are disallowed from appearing in the input endpoint URL. */
@Nonnull @NonnullElements private static final Set<String> DISALLOWED_ENDPOINT_QUERY_PARAMS =
- Set.of("SAMLEncoding", "SAMLRequest", "SAMLResponse", "RelayState", "SigAlg", "Signature");
+ CollectionSupport.setOf("SAMLEncoding", "SAMLRequest", "SAMLResponse", "RelayState", "SigAlg", "Signature");
/** Class logger. */
private final Logger log = LoggerFactory.getLogger(HTTPRedirectDeflateEncoder.class);
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolverTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolverTest.java
index 116e7ebff..acf29aa58 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolverTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolverTest.java
@@ -76,6 +76,7 @@ import org.testng.annotations.Test;
import com.google.common.collect.Iterables;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.resolver.CriteriaSet;
import net.shibboleth.shared.resolver.ResolverException;
@@ -641,12 +642,12 @@ public class AbstractDynamicMetadataResolverTest extends XMLObjectBaseTestCase {
indexedData = backingStore.getSecondaryIndexManager().lookupIndexedItems(new CriteriaSet(new EntityRoleCriterion(SPSSODescriptor.DEFAULT_ELEMENT_NAME)));
Assert.assertTrue(indexedData.isPresent());
- Assert.assertEquals(indexedData.get(), Set.of(id1, id2));
+ Assert.assertEquals(indexedData.get(), CollectionSupport.setOf(id1, id2));
results.clear();
Iterables.addAll(results, resolver.resolve(new CriteriaSet(new EntityRoleCriterion(SPSSODescriptor.DEFAULT_ELEMENT_NAME))));
Assert.assertEquals(results.size(), 2);
- Assert.assertEquals(results, Set.of(ed1, ed2));
+ Assert.assertEquals(results, CollectionSupport.setOf(ed1, ed2));
}
@Test
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/index/impl/MetadataIndexManagerTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/index/impl/MetadataIndexManagerTest.java
index f14925435..fd039f9f1 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/index/impl/MetadataIndexManagerTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/index/impl/MetadataIndexManagerTest.java
@@ -34,6 +34,7 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.resolver.CriteriaSet;
/**
@@ -273,7 +274,7 @@ public class MetadataIndexManagerTest extends XMLObjectBaseTestCase {
new SimpleStringCriteriaFunction());
MetadataIndexManager<EntityDescriptor> manager =
- new MetadataIndexManager<>(Set.of(roleIndex, functionIndex), extractionFunction);
+ new MetadataIndexManager<>(CollectionSupport.setOf(roleIndex, functionIndex), extractionFunction);
manager.indexEntityDescriptor(a);
manager.indexEntityDescriptor(b);
@@ -298,7 +299,7 @@ public class MetadataIndexManagerTest extends XMLObjectBaseTestCase {
new SimpleStringCriteriaFunction());
MetadataIndexManager<EntityDescriptor> manager =
- new MetadataIndexManager<>(Set.of(roleIndex, functionIndex), extractionFunction);
+ new MetadataIndexManager<>(CollectionSupport.setOf(roleIndex, functionIndex), extractionFunction);
manager.indexEntityDescriptor(a);
manager.indexEntityDescriptor(b);
@@ -321,7 +322,7 @@ public class MetadataIndexManagerTest extends XMLObjectBaseTestCase {
new SimpleStringCriteriaFunction());
MetadataIndexManager<EntityDescriptor> manager =
- new MetadataIndexManager<>(Set.of(roleIndex, functionIndex), extractionFunction);
+ new MetadataIndexManager<>(CollectionSupport.setOf(roleIndex, functionIndex), extractionFunction);
manager.indexEntityDescriptor(a);
manager.indexEntityDescriptor(b);
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/impl/AddProxyRestrictionToAssertionsTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/impl/AddProxyRestrictionToAssertionsTest.java
index 5390dd65f..c4145e275 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/impl/AddProxyRestrictionToAssertionsTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/impl/AddProxyRestrictionToAssertionsTest.java
@@ -17,11 +17,6 @@
package org.opensaml.saml.saml2.profile.impl;
-import net.shibboleth.shared.collection.Pair;
-import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.logic.FunctionSupport;
-
-import java.util.Set;
import java.util.stream.Collectors;
import org.opensaml.core.testing.OpenSAMLInitBaseTestCase;
@@ -41,6 +36,11 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.shared.collection.Pair;
+import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.logic.FunctionSupport;
+
/** {@link AddProxyRestrictionToAssertions} unit test. */
public class AddProxyRestrictionToAssertionsTest extends OpenSAMLInitBaseTestCase {
@@ -51,7 +51,7 @@ public class AddProxyRestrictionToAssertionsTest extends OpenSAMLInitBaseTestCas
@BeforeMethod public void setUp() {
action = new AddProxyRestrictionToAssertions();
- action.setProxyRestrictionLookupStrategy(FunctionSupport.constant(new Pair<>(1,Set.of(AUDIENCE1, AUDIENCE2))));
+ action.setProxyRestrictionLookupStrategy(FunctionSupport.constant(new Pair<>(1,CollectionSupport.setOf(AUDIENCE1, AUDIENCE2))));
}
/**
@@ -95,7 +95,7 @@ public class AddProxyRestrictionToAssertionsTest extends OpenSAMLInitBaseTestCas
final ProfileRequestContext prc = new RequestContextBuilder().setOutboundMessage(response).buildProfileRequestContext();
- action.setProxyRestrictionLookupStrategy(FunctionSupport.constant(new Pair<>(0,Set.of(AUDIENCE1, AUDIENCE2))));
+ action.setProxyRestrictionLookupStrategy(FunctionSupport.constant(new Pair<>(0,CollectionSupport.setOf(AUDIENCE1, AUDIENCE2))));
action.initialize();
action.execute(prc);
ActionTestingSupport.assertProceedEvent(prc);
@@ -153,7 +153,7 @@ public class AddProxyRestrictionToAssertionsTest extends OpenSAMLInitBaseTestCas
final ProfileRequestContext prc = new RequestContextBuilder().setOutboundMessage(response).buildProfileRequestContext();
- action.setProxyRestrictionLookupStrategy(FunctionSupport.constant(new Pair<>(null, Set.of(AUDIENCE1, AUDIENCE2))));
+ action.setProxyRestrictionLookupStrategy(FunctionSupport.constant(new Pair<>(null, CollectionSupport.setOf(AUDIENCE1, AUDIENCE2))));
action.initialize();
action.execute(prc);
ActionTestingSupport.assertProceedEvent(prc);
@@ -166,7 +166,7 @@ public class AddProxyRestrictionToAssertionsTest extends OpenSAMLInitBaseTestCas
final ProxyRestriction proxy = assertion.getConditions().getProxyRestriction();
Assert.assertNull(proxy.getProxyCount());
Assert.assertEquals(proxy.getAudiences().stream().map(Audience::getURI).collect(Collectors.toUnmodifiableSet()),
- Set.of(AUDIENCE1, AUDIENCE2));
+ CollectionSupport.setOf(AUDIENCE1, AUDIENCE2));
}
/**
@@ -195,7 +195,7 @@ public class AddProxyRestrictionToAssertionsTest extends OpenSAMLInitBaseTestCas
final ProxyRestriction proxy = assertion.getConditions().getProxyRestriction();
Assert.assertEquals(proxy.getProxyCount(), Integer.valueOf(1));
Assert.assertEquals(proxy.getAudiences().stream().map(Audience::getURI).collect(Collectors.toUnmodifiableSet()),
- Set.of(AUDIENCE1, AUDIENCE2));
+ CollectionSupport.setOf(AUDIENCE1, AUDIENCE2));
}
/**
@@ -227,7 +227,7 @@ public class AddProxyRestrictionToAssertionsTest extends OpenSAMLInitBaseTestCas
final ProxyRestriction proxy = assertion.getConditions().getProxyRestriction();
Assert.assertEquals(proxy.getProxyCount(), Integer.valueOf(1));
Assert.assertEquals(proxy.getAudiences().stream().map(Audience::getURI).collect(Collectors.toUnmodifiableSet()),
- Set.of(AUDIENCE1, AUDIENCE2));
+ CollectionSupport.setOf(AUDIENCE1, AUDIENCE2));
}
/** Test that the condition is properly added if there are multiple assertions in the response.
@@ -255,7 +255,7 @@ public class AddProxyRestrictionToAssertionsTest extends OpenSAMLInitBaseTestCas
final ProxyRestriction proxy = assertion.getConditions().getProxyRestriction();
Assert.assertEquals(proxy.getProxyCount(), Integer.valueOf(1));
Assert.assertEquals(proxy.getAudiences().stream().map(Audience::getURI).collect(Collectors.toUnmodifiableSet()),
- Set.of(AUDIENCE1, AUDIENCE2));
+ CollectionSupport.setOf(AUDIENCE1, AUDIENCE2));
}
}
diff --git a/opensaml-security-impl/src/test/java/org/opensaml/security/crypto/ec/tests/NamedCurveRegistryTest.java b/opensaml-security-impl/src/test/java/org/opensaml/security/crypto/ec/tests/NamedCurveRegistryTest.java
index 05f838f1c..b89e959e2 100644
--- a/opensaml-security-impl/src/test/java/org/opensaml/security/crypto/ec/tests/NamedCurveRegistryTest.java
+++ b/opensaml-security-impl/src/test/java/org/opensaml/security/crypto/ec/tests/NamedCurveRegistryTest.java
@@ -35,6 +35,8 @@ import org.opensaml.security.crypto.ec.curves.Secp521r1;
import org.testng.Assert;
import org.testng.annotations.Test;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
*
*/
@@ -93,7 +95,7 @@ public class NamedCurveRegistryTest extends BaseNamedCurveTest {
Assert.assertEquals(registry.getRegisteredCurves().size(), 3);
Assert.assertEquals(registry.getRegisteredCurves().stream().map(NamedCurve::getName).collect(Collectors.toSet()),
- Set.of("secp256r1", "secp384r1", "secp521r1"));
+ CollectionSupport.setOf("secp256r1", "secp384r1", "secp521r1"));
Assert.assertTrue(registry.getRegisteredCurves().contains(secp256r1));
Assert.assertTrue(registry.getRegisteredCurves().contains(secp384r1));
Assert.assertTrue(registry.getRegisteredCurves().contains(secp521r1));
@@ -114,7 +116,7 @@ public class NamedCurveRegistryTest extends BaseNamedCurveTest {
Assert.assertEquals(registry.getRegisteredCurves().size(), 2);
Assert.assertEquals(registry.getRegisteredCurves().stream().map(NamedCurve::getName).collect(Collectors.toSet()),
- Set.of("secp256r1", "secp384r1"));
+ CollectionSupport.setOf("secp256r1", "secp384r1"));
Assert.assertTrue(registry.getRegisteredCurves().contains(secp256r1));
Assert.assertTrue(registry.getRegisteredCurves().contains(secp384r1));
Assert.assertFalse(registry.getRegisteredCurves().contains(secp521r1));
diff --git a/opensaml-soap-api/src/main/java/org/opensaml/soap/wsaddressing/WSAddressingConstants.java b/opensaml-soap-api/src/main/java/org/opensaml/soap/wsaddressing/WSAddressingConstants.java
index b31d3db8c..697dcccc3 100644
--- a/opensaml-soap-api/src/main/java/org/opensaml/soap/wsaddressing/WSAddressingConstants.java
+++ b/opensaml-soap-api/src/main/java/org/opensaml/soap/wsaddressing/WSAddressingConstants.java
@@ -24,6 +24,7 @@ import javax.xml.namespace.QName;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.collection.CollectionSupport;
/**
* WS-Addressing 1.0 constants.
@@ -86,7 +87,7 @@ public final class WSAddressingConstants {
new QName(WSA_NS, "EndpointUnavailable", WSA_PREFIX);
/** Set of all WS-Addressing SOAP fault codes. */
- @Nonnull @NonnullElements public static final Set<QName> WS_ADDRESSING_FAULTS = Set.of(
+ @Nonnull @NonnullElements public static final Set<QName> WS_ADDRESSING_FAULTS = CollectionSupport.setOf(
SOAP_FAULT_INVALID_ADDRESSING_HEADER,
SOAP_FAULT_INVALID_ADDRESS,
SOAP_FAULT_INVALID_EPR,
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/agreement/KeyAgreementSupport.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/agreement/KeyAgreementSupport.java
index 588823570..9a9577d80 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/agreement/KeyAgreementSupport.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/agreement/KeyAgreementSupport.java
@@ -31,13 +31,15 @@ import org.opensaml.xmlsec.encryption.EncryptedType;
import org.opensaml.xmlsec.encryption.EncryptionMethod;
import org.opensaml.xmlsec.encryption.KeySize;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
* Support for key agreement operations.
*/
public final class KeyAgreementSupport {
/** JCA key algorithms that support key agreement. */
- public static final Set<String> KEY_ALGORITHMS = Set.of(JCAConstants.KEY_ALGO_EC, JCAConstants.KEY_ALGO_DH);
+ public static final Set<String> KEY_ALGORITHMS = CollectionSupport.setOf(JCAConstants.KEY_ALGO_EC, JCAConstants.KEY_ALGO_DH);
/** Constructor. */
private KeyAgreementSupport() {}
diff --git a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureSupport.java b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureSupport.java
index 9a09a6383..602048b79 100644
--- a/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureSupport.java
+++ b/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/signature/support/SignatureSupport.java
@@ -38,6 +38,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.StringSupport;
@@ -50,7 +51,7 @@ public final class SignatureSupport {
@Nonnull private static final Logger LOG = LoggerFactory.getLogger(SignatureSupport.class);
/** Set of known canonicalization algorithm URIs. */
- @Nonnull @NonnullElements private static final Set<String> C14N_ALGORITHMS = Set.of(
+ @Nonnull @NonnullElements private static final Set<String> C14N_ALGORITHMS = CollectionSupport.setOf(
SignatureConstants.ALGO_ID_C14N11_OMIT_COMMENTS,
SignatureConstants.ALGO_ID_C14N11_WITH_COMMENTS,
SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS,
diff --git a/opensaml-xmlsec-api/src/test/java/org/opensaml/xmlsec/agreement/KeyAgreementProcessorRegistryTest.java b/opensaml-xmlsec-api/src/test/java/org/opensaml/xmlsec/agreement/KeyAgreementProcessorRegistryTest.java
index f71b6b67d..4b8c0c4e8 100644
--- a/opensaml-xmlsec-api/src/test/java/org/opensaml/xmlsec/agreement/KeyAgreementProcessorRegistryTest.java
+++ b/opensaml-xmlsec-api/src/test/java/org/opensaml/xmlsec/agreement/KeyAgreementProcessorRegistryTest.java
@@ -23,6 +23,8 @@ import org.opensaml.security.credential.Credential;
import org.testng.Assert;
import org.testng.annotations.Test;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
*
*/
@@ -40,7 +42,7 @@ public class KeyAgreementProcessorRegistryTest {
registry.register(foo1);
Assert.assertEquals(registry.getRegisteredAlgorithms().size(), 1);
- Assert.assertEquals(registry.getRegisteredAlgorithms(), Set.of("urn:test:KeyAgreementProcessor:Foo"));
+ Assert.assertEquals(registry.getRegisteredAlgorithms(), CollectionSupport.singleton("urn:test:KeyAgreementProcessor:Foo"));
Assert.assertSame(registry.getProcessor("urn:test:KeyAgreementProcessor:Foo"), foo1);
registry.register(foo2);
@@ -50,13 +52,13 @@ public class KeyAgreementProcessorRegistryTest {
registry.register(bar);
Assert.assertEquals(registry.getRegisteredAlgorithms().size(), 2);
- Assert.assertEquals(registry.getRegisteredAlgorithms(), Set.of("urn:test:KeyAgreementProcessor:Foo", "urn:test:KeyAgreementProcessor:Bar"));
+ Assert.assertEquals(registry.getRegisteredAlgorithms(), CollectionSupport.setOf("urn:test:KeyAgreementProcessor:Foo", "urn:test:KeyAgreementProcessor:Bar"));
Assert.assertSame(registry.getProcessor("urn:test:KeyAgreementProcessor:Foo"), foo2);
Assert.assertSame(registry.getProcessor("urn:test:KeyAgreementProcessor:Bar"), bar);
registry.deregister("urn:test:KeyAgreementProcessor:Foo");
Assert.assertEquals(registry.getRegisteredAlgorithms().size(), 1);
- Assert.assertEquals(registry.getRegisteredAlgorithms(), Set.of("urn:test:KeyAgreementProcessor:Bar"));
+ Assert.assertEquals(registry.getRegisteredAlgorithms(), CollectionSupport.singleton("urn:test:KeyAgreementProcessor:Bar"));
Assert.assertNull(registry.getProcessor("urn:test:KeyAgreementProcessor:Foo"));
Assert.assertSame(registry.getProcessor("urn:test:KeyAgreementProcessor:Bar"), bar);
diff --git a/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/config/impl/DefaultSecurityConfigurationBootstrap.java b/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/config/impl/DefaultSecurityConfigurationBootstrap.java
index c08350f19..1ad687929 100644
--- a/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/config/impl/DefaultSecurityConfigurationBootstrap.java
+++ b/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/config/impl/DefaultSecurityConfigurationBootstrap.java
@@ -62,6 +62,7 @@ import org.opensaml.xmlsec.signature.support.SignatureConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
/**
@@ -159,7 +160,7 @@ public class DefaultSecurityConfigurationBootstrap {
ecConcatKDF.setPartyUInfo("00");
ecConcatKDF.setPartyVInfo("00");
ecConcatKDF.initialize();
- ecConfig.setParameters(Set.of(ecConcatKDF));
+ ecConfig.setParameters(CollectionSupport.singleton(ecConcatKDF));
} else if (PBKDF2.equals(ecKDF)) {
final PBKDF2 ecPBKDF2 = new PBKDF2();
ecPBKDF2.initialize();
@@ -179,7 +180,7 @@ public class DefaultSecurityConfigurationBootstrap {
final KANonce nonce = new KANonce();
// This will use an auto-generated nonce value each time
nonce.initialize();
- dhConfig.setParameters(Set.of(digestMethod, nonce));
+ dhConfig.setParameters(CollectionSupport.setOf(digestMethod, nonce));
kaConfigs.put(JCAConstants.KEY_ALGO_DH, dhConfig);
} catch (final ComponentInitializationException e) {
diff --git a/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/config/impl/GlobalKeyAgreementProcessorRegistryTest.java b/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/config/impl/GlobalKeyAgreementProcessorRegistryTest.java
index aba9cbf3a..6b63136f3 100644
--- a/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/config/impl/GlobalKeyAgreementProcessorRegistryTest.java
+++ b/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/config/impl/GlobalKeyAgreementProcessorRegistryTest.java
@@ -17,8 +17,6 @@
package org.opensaml.xmlsec.config.impl;
-import java.util.Set;
-
import org.opensaml.core.testing.OpenSAMLInitBaseTestCase;
import org.opensaml.xmlsec.agreement.KeyAgreementProcessorRegistry;
import org.opensaml.xmlsec.agreement.KeyAgreementSupport;
@@ -29,6 +27,8 @@ import org.opensaml.xmlsec.encryption.support.EncryptionConstants;
import org.testng.Assert;
import org.testng.annotations.Test;
+import net.shibboleth.shared.collection.CollectionSupport;
+
/**
*
*/
@@ -41,7 +41,7 @@ public class GlobalKeyAgreementProcessorRegistryTest extends OpenSAMLInitBaseTes
Assert.assertNotNull(registry);
Assert.assertEquals(registry.getRegisteredAlgorithms().size(), 3);
- Assert.assertEquals(registry.getRegisteredAlgorithms(), Set.of(EncryptionConstants.ALGO_ID_KEYAGREEMENT_ECDH_ES,
+ Assert.assertEquals(registry.getRegisteredAlgorithms(), CollectionSupport.setOf(EncryptionConstants.ALGO_ID_KEYAGREEMENT_ECDH_ES,
EncryptionConstants.ALGO_ID_KEYAGREEMENT_DH, EncryptionConstants.ALGO_ID_KEYAGREEMENT_DH_EXPLICIT_KDF));
Assert.assertNotNull(registry.getProcessor(EncryptionConstants.ALGO_ID_KEYAGREEMENT_ECDH_ES));
diff --git a/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/DHWithLegacyKDFTest.java b/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/DHWithLegacyKDFTest.java
index 53e920b3a..c6dd74bf6 100644
--- a/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/DHWithLegacyKDFTest.java
+++ b/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/encryption/support/tests/DHWithLegacyKDFTest.java
@@ -70,6 +70,7 @@ import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.w3c.dom.Element;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.resolver.CriteriaSet;
import net.shibboleth.shared.xml.SerializeSupport;
@@ -129,7 +130,7 @@ public class DHWithLegacyKDFTest extends XMLObjectBaseTestCase {
dm.initialize();
KANonce nonce = new KANonce();
nonce.initialize();
- kaConfig.setParameters(Set.of(dm, nonce));
+ kaConfig.setParameters(CollectionSupport.setOf(dm, nonce));
encConfig2.setKeyAgreementConfigurations(Map.of("DH", kaConfig));
decryptConfig = new BasicDecryptionConfiguration();
diff --git a/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/impl/AbstractSecurityParametersResolverTest.java b/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/impl/AbstractSecurityParametersResolverTest.java
index 28fdd71b4..95e723be2 100644
--- a/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/impl/AbstractSecurityParametersResolverTest.java
+++ b/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/impl/AbstractSecurityParametersResolverTest.java
@@ -32,6 +32,7 @@ import java.util.function.Predicate;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.ConstraintViolationException;
import net.shibboleth.shared.resolver.CriteriaSet;
import net.shibboleth.shared.resolver.ResolverException;
@@ -74,9 +75,9 @@ public class AbstractSecurityParametersResolverTest extends XMLObjectBaseTestCas
criteriaSet = new CriteriaSet(criterion);
- set1 = Set.of("A", "B", "C", "D");
- set2 = Set.of("X", "Y", "Z");
- set3 = Set.of("foo", "bar", "baz");
+ set1 = CollectionSupport.setOf("A", "B", "C", "D");
+ set2 = CollectionSupport.setOf("X", "Y", "Z");
+ set3 = CollectionSupport.setOf("foo", "bar", "baz");
}
@Test
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list