[java-opensaml] branch main updated: IDP-1806 - Trailing Blank in property yields inconsistent error
Scott Cantor
cantor.2 at osu.edu
Tue Jun 13 17:02:11 UTC 2023
This is an automated email from the git hooks/post-receive script.
scantor 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=3f7c8a317a8c96f9275abc8e77e9dbe8b028ad6c
The following commit(s) were added to refs/heads/main by this push:
new 3f7c8a317 IDP-1806 - Trailing Blank in property yields inconsistent error
3f7c8a317 is described below
commit 3f7c8a317a8c96f9275abc8e77e9dbe8b028ad6c
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jun 13 13:02:08 2023 -0400
IDP-1806 - Trailing Blank in property yields inconsistent error
https://shibboleth.atlassian.net/browse/IDP-1806
Convert credential factory beans over to our Resource class.
---
.../BasicResourceCredentialFactoryBean.java | 2 +-
.../credential/BasicX509CredentialFactoryBean.java | 2 +-
.../spring/tls/TLSSocketFactoryFactoryBean.java | 3 +-
...AbstractBasicPKIXValidationInfoFactoryBean.java | 3 +-
.../PKIXResourceValidationInfoFactoryBean.java | 5 ++-
.../spring/trust/StaticExplicitKeyFactoryBean.java | 2 +-
.../spring/trust/StaticPKIXFactoryBean.java | 2 +-
.../BasicX509CredentialFactoryBeanTest.java | 45 +++++++++++-----------
.../org/opensaml/spring/credential/bean.xml | 9 +++++
.../trust/static-pkix-factory-custom-success.xml | 9 +++++
.../spring/trust/static-pkix-factory-defaults.xml | 9 +++++
11 files changed, 60 insertions(+), 31 deletions(-)
diff --git a/opensaml-spring/src/main/java/org/opensaml/spring/credential/BasicResourceCredentialFactoryBean.java b/opensaml-spring/src/main/java/org/opensaml/spring/credential/BasicResourceCredentialFactoryBean.java
index 0543a6a6b..14efa2dab 100644
--- a/opensaml-spring/src/main/java/org/opensaml/spring/credential/BasicResourceCredentialFactoryBean.java
+++ b/opensaml-spring/src/main/java/org/opensaml/spring/credential/BasicResourceCredentialFactoryBean.java
@@ -32,11 +32,11 @@ import org.opensaml.security.crypto.KeySupport;
import org.slf4j.Logger;
import org.springframework.beans.factory.BeanCreationException;
-import org.springframework.core.io.Resource;
import com.google.common.io.ByteStreams;
import net.shibboleth.shared.primitive.LoggerFactory;
+import net.shibboleth.shared.resource.Resource;
/**
* Spring bean factory for producing a {@link org.opensaml.security.credential.BasicCredential} from {@link Resource}s.
diff --git a/opensaml-spring/src/main/java/org/opensaml/spring/credential/BasicX509CredentialFactoryBean.java b/opensaml-spring/src/main/java/org/opensaml/spring/credential/BasicX509CredentialFactoryBean.java
index 289bf34d6..91d4a6776 100644
--- a/opensaml-spring/src/main/java/org/opensaml/spring/credential/BasicX509CredentialFactoryBean.java
+++ b/opensaml-spring/src/main/java/org/opensaml/spring/credential/BasicX509CredentialFactoryBean.java
@@ -35,13 +35,13 @@ import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.collection.LazyList;
import net.shibboleth.shared.primitive.LoggerFactory;
+import net.shibboleth.shared.resource.Resource;
import org.opensaml.security.crypto.KeySupport;
import org.opensaml.security.x509.X509Support;
import org.slf4j.Logger;
import org.springframework.beans.FatalBeanException;
-import org.springframework.core.io.Resource;
/**
* Spring bean factory for producing a {@link org.opensaml.security.x509.BasicX509Credential} from {@link Resource}s.
diff --git a/opensaml-spring/src/main/java/org/opensaml/spring/tls/TLSSocketFactoryFactoryBean.java b/opensaml-spring/src/main/java/org/opensaml/spring/tls/TLSSocketFactoryFactoryBean.java
index e780f6234..652107ec7 100644
--- a/opensaml-spring/src/main/java/org/opensaml/spring/tls/TLSSocketFactoryFactoryBean.java
+++ b/opensaml-spring/src/main/java/org/opensaml/spring/tls/TLSSocketFactoryFactoryBean.java
@@ -75,7 +75,8 @@ public class TLSSocketFactoryFactoryBean extends AbstractFactoryBean<LayeredConn
/** {@inheritDoc} */
- @Override public Class<LayeredConnectionSocketFactory> getObjectType() {
+ @Override
+ @Nonnull public Class<LayeredConnectionSocketFactory> getObjectType() {
return LayeredConnectionSocketFactory.class;
}
diff --git a/opensaml-spring/src/main/java/org/opensaml/spring/trust/AbstractBasicPKIXValidationInfoFactoryBean.java b/opensaml-spring/src/main/java/org/opensaml/spring/trust/AbstractBasicPKIXValidationInfoFactoryBean.java
index af078968d..d3eede443 100644
--- a/opensaml-spring/src/main/java/org/opensaml/spring/trust/AbstractBasicPKIXValidationInfoFactoryBean.java
+++ b/opensaml-spring/src/main/java/org/opensaml/spring/trust/AbstractBasicPKIXValidationInfoFactoryBean.java
@@ -77,7 +77,8 @@ public abstract class AbstractBasicPKIXValidationInfoFactoryBean extends
}
/** {@inheritDoc} */
- @Override public Class<?> getObjectType() {
+ @Override
+ @Nonnull public Class<?> getObjectType() {
return BasicPKIXValidationInformation.class;
}
diff --git a/opensaml-spring/src/main/java/org/opensaml/spring/trust/PKIXResourceValidationInfoFactoryBean.java b/opensaml-spring/src/main/java/org/opensaml/spring/trust/PKIXResourceValidationInfoFactoryBean.java
index 7b30f6383..030302f76 100644
--- a/opensaml-spring/src/main/java/org/opensaml/spring/trust/PKIXResourceValidationInfoFactoryBean.java
+++ b/opensaml-spring/src/main/java/org/opensaml/spring/trust/PKIXResourceValidationInfoFactoryBean.java
@@ -33,9 +33,9 @@ import org.opensaml.security.x509.X509Support;
import org.slf4j.Logger;
import org.springframework.beans.FatalBeanException;
-import org.springframework.core.io.Resource;
import net.shibboleth.shared.primitive.LoggerFactory;
+import net.shibboleth.shared.resource.Resource;
/**
* File system specific bean for PKIXValidationInfo.
@@ -116,4 +116,5 @@ public class PKIXResourceValidationInfoFactoryBean extends AbstractBasicPKIXVali
}
return crls;
}
-}
+
+}
\ No newline at end of file
diff --git a/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticExplicitKeyFactoryBean.java b/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticExplicitKeyFactoryBean.java
index c6c4e941e..1891bde7e 100644
--- a/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticExplicitKeyFactoryBean.java
+++ b/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticExplicitKeyFactoryBean.java
@@ -40,10 +40,10 @@ import org.opensaml.security.x509.X509Support;
import org.slf4j.Logger;
import org.springframework.beans.FatalBeanException;
-import org.springframework.core.io.Resource;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.primitive.LoggerFactory;
+import net.shibboleth.shared.resource.Resource;
import net.shibboleth.shared.spring.factory.AbstractComponentAwareFactoryBean;
/**
diff --git a/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticPKIXFactoryBean.java b/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticPKIXFactoryBean.java
index 961a526a5..4bb0bd5a1 100644
--- a/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticPKIXFactoryBean.java
+++ b/opensaml-spring/src/main/java/org/opensaml/spring/trust/StaticPKIXFactoryBean.java
@@ -44,12 +44,12 @@ import org.opensaml.security.x509.impl.X509CredentialNameEvaluator;
import org.slf4j.Logger;
import org.springframework.beans.FatalBeanException;
-import org.springframework.core.io.Resource;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.primitive.StringSupport;
+import net.shibboleth.shared.resource.Resource;
import net.shibboleth.shared.spring.factory.AbstractComponentAwareFactoryBean;
/**
diff --git a/opensaml-spring/src/test/java/org/opensaml/spring/credential/BasicX509CredentialFactoryBeanTest.java b/opensaml-spring/src/test/java/org/opensaml/spring/credential/BasicX509CredentialFactoryBeanTest.java
index cb2e474fd..55ee4d978 100644
--- a/opensaml-spring/src/test/java/org/opensaml/spring/credential/BasicX509CredentialFactoryBeanTest.java
+++ b/opensaml-spring/src/test/java/org/opensaml/spring/credential/BasicX509CredentialFactoryBeanTest.java
@@ -36,29 +36,28 @@ public class BasicX509CredentialFactoryBeanTest {
*/
@Test public void bean() {
final GenericApplicationContext context = new FilesystemGenericApplicationContext();
- context.setDisplayName("ApplicationContext: X509Credential");
- final SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
- new SchemaTypeAwareXMLBeanDefinitionReader(context);
-
- beanDefinitionReader.loadBeanDefinitions("org/opensaml/spring/credential/bean.xml");
-
- context.refresh();
-
- final BasicX509Credential cred1 = context.getBean("Credential", BasicX509Credential.class);
-
- final BasicX509Credential cred2 = context.getBean("EncCredential", BasicX509Credential.class);
-
- Assert.assertEquals("http://example.org/enc", cred2.getEntityId());
-
- final byte[] cb1 = Constraint.isNotNull(cred1.getPrivateKey(), "Private key was null").getEncoded();
- final byte[] cb2 = Constraint.isNotNull(cred2.getPrivateKey(), "Private key was null").getEncoded();
-
- Assert.assertEquals(cb1.length, cb2.length);
-
- for (int i = 0; i< cb1.length; i++)Assert.assertEquals(cb1[i], cb2[i]);
-
- Assert.assertEquals(cred2.getPublicKey(), cred2.getPublicKey());
-
+ context.setDisplayName("ApplicationContext: X509Credential");
+ final SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
+ new SchemaTypeAwareXMLBeanDefinitionReader(context);
+
+ beanDefinitionReader.loadBeanDefinitions("org/opensaml/spring/credential/bean.xml");
+
+ context.refresh();
+
+ final BasicX509Credential cred1 = context.getBean("Credential", BasicX509Credential.class);
+
+ final BasicX509Credential cred2 = context.getBean("EncCredential", BasicX509Credential.class);
+
+ Assert.assertEquals("http://example.org/enc", cred2.getEntityId());
+
+ final byte[] cb1 = Constraint.isNotNull(cred1.getPrivateKey(), "Private key was null").getEncoded();
+ final byte[] cb2 = Constraint.isNotNull(cred2.getPrivateKey(), "Private key was null").getEncoded();
+
+ Assert.assertEquals(cb1.length, cb2.length);
+
+ for (int i = 0; i< cb1.length; i++)Assert.assertEquals(cb1[i], cb2[i]);
+
+ Assert.assertEquals(cred2.getPublicKey(), cred2.getPublicKey());
}
}
\ No newline at end of file
diff --git a/opensaml-spring/src/test/resources/org/opensaml/spring/credential/bean.xml b/opensaml-spring/src/test/resources/org/opensaml/spring/credential/bean.xml
index 9a2d0d2d2..cd1315952 100644
--- a/opensaml-spring/src/test/resources/org/opensaml/spring/credential/bean.xml
+++ b/opensaml-spring/src/test/resources/org/opensaml/spring/credential/bean.xml
@@ -12,6 +12,15 @@
default-init-method="initialize"
default-destroy-method="destroy">
+ <!-- This bean MUST be called "conversionService" to work properly. -->
+ <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
+ <property name="converters">
+ <set>
+ <bean class="net.shibboleth.shared.spring.config.StringToResourceConverter" />
+ </set>
+ </property>
+ </bean>
+
<bean id="Credential"
class="org.opensaml.spring.credential.BasicX509CredentialFactoryBean"
p:privateKeyResource="org/opensaml/spring/credential/idp-signing.key"
diff --git a/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-custom-success.xml b/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-custom-success.xml
index 22e93f04c..dd6969aa7 100644
--- a/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-custom-success.xml
+++ b/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-custom-success.xml
@@ -12,6 +12,15 @@
default-init-method="initialize"
default-destroy-method="destroy">
+ <!-- This bean MUST be called "conversionService" to work properly. -->
+ <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
+ <property name="converters">
+ <set>
+ <bean class="net.shibboleth.shared.spring.config.StringToResourceConverter" />
+ </set>
+ </property>
+ </bean>
+
<bean id="StaticPKIXX509CredentialTrustEngine"
class="org.opensaml.spring.trust.StaticPKIXFactoryBean">
<property name="certificates">
diff --git a/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-defaults.xml b/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-defaults.xml
index cf186faec..35665472b 100644
--- a/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-defaults.xml
+++ b/opensaml-spring/src/test/resources/org/opensaml/spring/trust/static-pkix-factory-defaults.xml
@@ -12,6 +12,15 @@
default-init-method="initialize"
default-destroy-method="destroy">
+ <!-- This bean MUST be called "conversionService" to work properly. -->
+ <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
+ <property name="converters">
+ <set>
+ <bean class="net.shibboleth.shared.spring.config.StringToResourceConverter" />
+ </set>
+ </property>
+ </bean>
+
<bean id="StaticPKIXX509CredentialTrustEngine"
class="org.opensaml.spring.trust.StaticPKIXFactoryBean">
<property name="certificates">
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list