Class X509TlsConnectorCustomizer

java.lang.Object
com.irurueta.authserver.authorization.api.web.x509.X509TlsConnectorCustomizer
All Implemented Interfaces:
org.springframework.boot.web.server.WebServerFactoryCustomizer<org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory>

public class X509TlsConnectorCustomizer extends Object implements org.springframework.boot.web.server.WebServerFactoryCustomizer<org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory>
Adds the dedicated TLS port that requests a client certificate, when authserver.x509.port is set. The main port is left as it is, so the rest of the application never asks a browser for a certificate. The connector requests a certificate without requiring one and without validating it against a CA (optionalNoCA): the TLS handshake proves that the client holds the private key, and what identifies the client is the fingerprint of the certificate, which has to be bound to an account. The servlet container leaves the certificate in the request attribute that the X.509 filter reads. The connector's trust manager (AnyClientCertificateTrustManager) advertises no certificate authority: without it the handshake lists the authorities of the JVM's default trust store, and a client offers only a certificate issued by a listed authority, so the certificate of a private authority would never be presented.
  • Field Details

    • CERTIFICATE_VERIFICATION

      static final String CERTIFICATE_VERIFICATION
      Value of the certificate verification that asks for a certificate but does not validate it.
      See Also:
    • SCHEME

      private static final String SCHEME
      Scheme of the connector.
      See Also:
    • properties

      private final X509Properties properties
      Settings of the sign-in with a certificate.
    • keyStoreResolver

      private final X509TlsKeyStoreResolver keyStoreResolver
      Finds the key store with the server certificate.
  • Constructor Details

    • X509TlsConnectorCustomizer

      public X509TlsConnectorCustomizer()
  • Method Details

    • customize

      public void customize(org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory factory)
      Adds the connector to the server, when the port is configured.
      Specified by:
      customize in interface org.springframework.boot.web.server.WebServerFactoryCustomizer<org.springframework.boot.tomcat.servlet.TomcatServletWebServerFactory>
      Parameters:
      factory - the factory of the embedded Tomcat.
    • connector

      org.apache.catalina.connector.Connector connector(X509TlsKeyStore keyStore)
      Builds the connector.
      Parameters:
      keyStore - the key store with the server certificate.
      Returns:
      the connector.