Class OpenSamlCredential

java.lang.Object
org.opensaml.security.credential.AbstractCredential
org.opensaml.security.credential.BasicCredential
org.opensaml.security.x509.BasicX509Credential
se.swedenconnect.security.credential.opensaml.OpenSamlCredential
All Implemented Interfaces:
org.opensaml.security.credential.Credential, org.opensaml.security.credential.MutableCredential, org.opensaml.security.x509.X509Credential

public class OpenSamlCredential extends org.opensaml.security.x509.BasicX509Credential
A credential that implements OpenSAML's X509Credential interface and wraps a PkiCredential. This enables us to make use of features such as testing and re-loading (see ReloadablePkiCredential), but most importantly, it gives use a smooth way of instantiating OpenSAML credentials.
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
  • Constructor Details

    • OpenSamlCredential

      public OpenSamlCredential(X509Certificate entityCertificate, PrivateKey privateKey)
      Constructor setting up the credential by explicitly assigning the certificate and private key.
      Parameters:
      entityCertificate - the certificate
      privateKey - the private key
    • OpenSamlCredential

      public OpenSamlCredential(PkiCredential credential)
      Constructor setting up the OpenSAML credential by assigning a PkiCredential instance. This type of setting up the OpenSamlCredential is recommended since it gives the benefits of monitoring (and reloading) credentials as well as a simple way to use hardware based keys (e.g. Pkcs11Credential).
      Parameters:
      credential - the credential to wrap in a OpenSAML credential
  • Method Details

    • getPublicKey

      public PublicKey getPublicKey()
      Specified by:
      getPublicKey in interface org.opensaml.security.credential.Credential
      Overrides:
      getPublicKey in class org.opensaml.security.x509.BasicX509Credential
    • getPrivateKey

      public PrivateKey getPrivateKey()
      Specified by:
      getPrivateKey in interface org.opensaml.security.credential.Credential
      Overrides:
      getPrivateKey in class org.opensaml.security.credential.AbstractCredential
    • setPrivateKey

      public void setPrivateKey(PrivateKey privateKey)
      Specified by:
      setPrivateKey in interface org.opensaml.security.credential.MutableCredential
      Overrides:
      setPrivateKey in class org.opensaml.security.credential.BasicCredential
    • getEntityCertificate

      public X509Certificate getEntityCertificate()
      Specified by:
      getEntityCertificate in interface org.opensaml.security.x509.X509Credential
      Overrides:
      getEntityCertificate in class org.opensaml.security.x509.BasicX509Credential
    • setEntityCertificate

      public void setEntityCertificate(X509Certificate entityCertificate)
      Overrides:
      setEntityCertificate in class org.opensaml.security.x509.BasicX509Credential
    • getEntityCertificateChain

      public Collection<X509Certificate> getEntityCertificateChain()
      Specified by:
      getEntityCertificateChain in interface org.opensaml.security.x509.X509Credential
      Overrides:
      getEntityCertificateChain in class org.opensaml.security.x509.BasicX509Credential
    • setEntityCertificateChain

      public void setEntityCertificateChain(Collection<X509Certificate> certificateChain)
      Overrides:
      setEntityCertificateChain in class org.opensaml.security.x509.BasicX509Credential