Class BasicX509CredentialFactoryBean

All Implemented Interfaces:
Aware, BeanClassLoaderAware, BeanFactoryAware, DisposableBean, FactoryBean<BasicX509Credential>, InitializingBean

public class BasicX509CredentialFactoryBean extends AbstractX509CredentialFactoryBean
Spring bean factory for producing a BasicX509Credential from Resources.

This factory bean supports DER and PEM encoded certificate resources and encrypted and non-encrypted PKCS8, DER, or PEM encoded private key resources.

  • Field Details

    • log

      private final org.slf4j.Logger log
      log.
    • entityResource

      private Resource entityResource
      The specification of where the entity Resource is to be found.
    • certificateResources

      private List<Resource> certificateResources
      Where the certificates are to be found.
    • privateKeyResource

      private Resource privateKeyResource
      Where the private key is to be found.
    • crlResources

      private List<Resource> crlResources
      Where the crls are to be found.
  • Constructor Details

    • BasicX509CredentialFactoryBean

      public BasicX509CredentialFactoryBean()
  • Method Details

    • setEntity

      public void setEntity(@Nonnull Resource what)
      Set the Resource with the entity certificate.
      Parameters:
      what - The Resource to set.
    • setCertificates

      public void setCertificates(@Nullable @NotEmpty List<Resource> what)
      Sets the Resources which contain the certificates.
      Parameters:
      what - The values to set.
    • setPrivateKey

      public void setPrivateKey(@Nullable Resource what)
      Set the Resource with the entity certificate.
      Parameters:
      what - The resource to set.
    • setCRLs

      public void setCRLs(@Nullable @NotEmpty List<Resource> what)
      Sets the Resources which contain the crls.
      Parameters:
      what - The value to set.
    • setPrivateKeyResource

      public void setPrivateKeyResource(@Nonnull Resource res)
      Set the resource containing the private key.
      Parameters:
      res - private key resource, never null
    • setPrivateKeyPassword

      public void setPrivateKeyPassword(@Nullable String password)
      Set the password for the private key.
      Parameters:
      password - password for the private key, may be null if the key is not encrypted
    • setCertificateResource

      public void setCertificateResource(@Nonnull Resource res)
      Set the certificate resource.
      Parameters:
      res - certificate resource
    • setEntityId

      public void setEntityId(@Nullable String id)
      Set the entityID for the credential.
      Parameters:
      id - entityID
    • isSingleton

      public boolean isSingleton()
      Specified by:
      isSingleton in interface FactoryBean<BasicX509Credential>
      Overrides:
      isSingleton in class AbstractFactoryBean<BasicX509Credential>
    • getEntityCertificate

      @Nullable protected X509Certificate getEntityCertificate()
      return the explicitly configured entity certificate..
      Specified by:
      getEntityCertificate in class AbstractX509CredentialFactoryBean
      Returns:
      the certificate, or none if not configured.
    • getCertificates

      @Nonnull protected List<X509Certificate> getCertificates()
      Get the configured certificates. This MUST include the entity certificate if it was configured.
      Specified by:
      getCertificates in class AbstractX509CredentialFactoryBean
      Returns:
      the certificates.
    • getPrivateKey

      @Nullable protected PrivateKey getPrivateKey()
      Get the configured private key.
      Specified by:
      getPrivateKey in class AbstractX509CredentialFactoryBean
      Returns:
      the key or null if non configured
    • getCRLs

      @Nullable protected List<X509CRL> getCRLs()
      Get the configured CRL list.
      Specified by:
      getCRLs in class AbstractX509CredentialFactoryBean
      Returns:
      the crls or null