[java-identity-provider COMMIT] in /trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/factory:...

noreply at shibboleth.net noreply at shibboleth.net
Tue Jan 5 07:57:59 EST 2016


Author: rdw
Date: Tue Jan  5 07:57:59 2016
New Revision: 8067

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=8067&view=rev
Log:
IDP-895 Make Credential factories publicly visible

https://issues.shibboleth.net/jira/browse/IDP-895

rename of X509ResourceCredentialFactoryBean to (previously visible) BasicX509CredentialFactoryBean will happen next

Modified:
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/BasicX509CredentialFactoryBean.java
    trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/X509ResourceCredentialFactoryBean.java

Modified: trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/BasicX509CredentialFactoryBean.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/BasicX509CredentialFactoryBean.java?rev=8067&r1=8066&r2=8067&view=diff
==============================================================================
--- trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/BasicX509CredentialFactoryBean.java	(original)
+++ trunk/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/factory/BasicX509CredentialFactoryBean.java	Tue Jan  5 07:57:59 2016
@@ -17,6 +17,30 @@
 
 package net.shibboleth.idp.profile.spring.factory;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.KeyException;
+import java.security.PrivateKey;
+import java.security.cert.CRLException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509CRL;
+import java.security.cert.X509Certificate;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.collection.LazyList;
+
+import org.opensaml.security.crypto.KeySupport;
+import org.opensaml.security.x509.X509Support;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+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.
@@ -26,6 +50,169 @@
  * PEM encoded private key resources.
  * </p>
  */
-public class BasicX509CredentialFactoryBean extends X509ResourceCredentialFactoryBean  {
-
-}
+public class BasicX509CredentialFactoryBean extends AbstractX509CredentialFactoryBean {
+
+    /** log. */
+    private final Logger log = LoggerFactory.getLogger(BasicX509CredentialFactoryBean.class);
+
+    /** The specification of where the entity Resource is to be found. */
+    private Resource entityResource;
+
+    /** Where the certificates are to be found. */
+    private List<Resource> certificateResources;
+
+    /** Where the private key is to be found. */
+    private Resource privateKeyResource;
+
+    /** Where the crls are to be found. */
+    private List<Resource> crlResources;
+
+    /**
+     * Set the Resource with the entity certificate.
+     * 
+     * @param what The Resource to set.
+     */
+    public void setEntity(@Nonnull final Resource what) {
+        entityResource = what;
+    }
+
+    /**
+     * Sets the Resources which contain the certificates.
+     * 
+     * @param what The values to set.
+     */
+    public void setCertificates(@Nullable @NotEmpty final List<Resource> what) {
+        certificateResources = what;
+    }
+
+    /**
+     * Set the Resource with the entity certificate.
+     * 
+     * @param what The resource to set.
+     */
+    public void setPrivateKey(@Nullable final Resource what) {
+        privateKeyResource = what;
+    }
+
+    /**
+     * Sets the Resources which contain the crls.
+     * 
+     * @param what The value to set.
+     */
+    public void setCRLs(@Nullable @NotEmpty final List<Resource> what) {
+        crlResources = what;
+    }
+    
+    //
+    // BasicX509CredentialFactoryBean
+    //
+    /**
+     * Set the resource containing the private key.
+     * 
+     * @param res private key resource, never <code>null</code>
+     */
+    public void setPrivateKeyResource(@Nonnull final Resource res) {
+        setPrivateKey(res);
+    }
+
+    /**
+     * Set the password for the private key.
+     * 
+     * @param password password for the private key, may be null if the key is not encrypted
+     */
+    public void setPrivateKeyPassword(@Nullable final String password) {
+        setPrivateKeyPassword(password.toCharArray());
+    }
+
+    /**
+     * Set the certificate resource.
+     * 
+     * @param res certificate resource
+     */
+    public void setCertificateResource(@Nonnull final Resource res) {
+        setCertificates(Collections.singletonList(res));
+    }
+
+    /**
+     * Set the entityID for the credential.
+     * 
+     * @param id entityID
+     */
+    public void setEntityId(@Nullable final String id) {

[... 78 lines stripped ...]


More information about the commits mailing list