Class ServletRequestX509CredentialAdapter

java.lang.Object
org.opensaml.security.credential.AbstractCredential
org.opensaml.security.messaging.ServletRequestX509CredentialAdapter
All Implemented Interfaces:
Credential, X509Credential

public class ServletRequestX509CredentialAdapter extends AbstractCredential implements X509Credential
An adapter that exposes the X.509 certificates contained in the servlet request attribute.
  • Field Details

    • X509_CERT_REQUEST_ATTRIBUTE

      public static final String X509_CERT_REQUEST_ATTRIBUTE
      Servlet request attribute to pull certificate info from.
      See Also:
    • JAKARTA_X509_CERT_REQUEST_ATTRIBUTE

      public static final String JAKARTA_X509_CERT_REQUEST_ATTRIBUTE
      Servlet request attribute to pull certificate info from.
      See Also:
    • cert

      private X509Certificate cert
      The entity certificate.
    • certChain

      private List<X509Certificate> certChain
      The certificate chain.
  • Constructor Details

    • ServletRequestX509CredentialAdapter

      public ServletRequestX509CredentialAdapter(javax.servlet.ServletRequest request) throws SecurityException
      Constructor.
      Parameters:
      request - the servlet request
      Throws:
      SecurityException - if request does not contain an X.509 client certificate in request attribute 'javax.servlet.request.X509Certificate'
  • Method Details

    • getCredentialType

      public Class<? extends Credential> getCredentialType()
      Get the primary type of the credential instance. This will usually be the primary sub-interface of Credential implemented by an implementation.
      Specified by:
      getCredentialType in interface Credential
      Returns:
      the credential type
    • getEntityCertificate

      public X509Certificate getEntityCertificate()
      Gets the public key certificate for the entity. The public key of this certificate will be the same key obtained from Credential.getPublicKey().
      Specified by:
      getEntityCertificate in interface X509Credential
      Returns:
      the public key certificate for the entity
    • getEntityCertificateChain

      public Collection<X509Certificate> getEntityCertificateChain()
      Gets an immutable collection of certificates in the entity's trust chain. The entity certificate is contained within this list. No specific ordering of the certificates is guaranteed.
      Specified by:
      getEntityCertificateChain in interface X509Credential
      Returns:
      entities certificate chain
    • getCRLs

      public Collection<X509CRL> getCRLs()
      Gets a collection of CRLs associated with the credential.
      Specified by:
      getCRLs in interface X509Credential
      Returns:
      CRLs associated with the credential
    • getPublicKey

      public PublicKey getPublicKey()
      Gets the public key for the entity.
      Specified by:
      getPublicKey in interface Credential
      Overrides:
      getPublicKey in class AbstractCredential
      Returns:
      public key for the entity