Class RequestCertificate

  • All Implemented Interfaces:
    Certificate

    class RequestCertificate
    extends java.lang.Object
    implements Certificate
    The RequestCertificate represents a certificate for an HTTP request. It basically wraps the raw SSL certificate that comes with the Channel. Wrapping the raw certificate allows us to enforce the HTTPS workflow for SSL renegotiation, which requires some rather weird behaviour. Most importantly we only allow a challenge when the response has not been sent.
    See Also:
    CertificateChallenge
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  RequestCertificate.Challenge
      The Challenge provides a basic wrapper around the challenge provided by the SSL connection.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Certificate certificate
      This is the raw underlying certificate for the SSL channel.
      private CertificateChallenge challenge
      This is used to challenge the client for an X509 certificate.
      private Channel channel
      This is the channel representing the client connection.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.security.cert.X509Certificate[] getChain()
      This will return the X509 certificate chain, if any, that has been sent by the client.
      CertificateChallenge getChallenge()
      This returns a challenge for the certificate.
      boolean isChainPresent()
      This is used to determine if the X509 certificate chain is present for the request.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • challenge

        private final CertificateChallenge challenge
        This is used to challenge the client for an X509 certificate.
      • certificate

        private final Certificate certificate
        This is the raw underlying certificate for the SSL channel.
      • channel

        private final Channel channel
        This is the channel representing the client connection.
    • Constructor Detail

      • RequestCertificate

        public RequestCertificate​(BodyObserver observer,
                                  Entity entity)
        Constructor for the RequestCertificate. This is used to create a wrapper for the raw SSL certificate that is provided by the underlying SSL session.
        Parameters:
        observer - the observer used to observe the transaction
        entity - the request entity containing the data
    • Method Detail

      • getChain

        public javax.security.cert.X509Certificate[] getChain()
                                                       throws java.lang.Exception
        This will return the X509 certificate chain, if any, that has been sent by the client. A certificate chain is typically only send when the server explicitly requests the certificate on the initial connection or when it is challenged for.
        Specified by:
        getChain in interface Certificate
        Returns:
        this returns the clients X509 certificate chain
        Throws:
        java.lang.Exception
      • getChallenge

        public CertificateChallenge getChallenge()
                                          throws java.lang.Exception
        This returns a challenge for the certificate. A challenge is issued by providing a Runnable task which is to be executed when the challenge has completed. Typically this task should be used to drive completion of an HTTPS request.
        Specified by:
        getChallenge in interface Certificate
        Returns:
        this returns a challenge for the client certificate
        Throws:
        java.lang.Exception
      • isChainPresent

        public boolean isChainPresent()
                               throws java.lang.Exception
        This is used to determine if the X509 certificate chain is present for the request. If it is not present then a challenge can be used to request the certificate.
        Specified by:
        isChainPresent in interface Certificate
        Returns:
        true if the certificate chain is present
        Throws:
        java.lang.Exception