Class TlsDirectives

    • Constructor Detail

      • TlsDirectives

        public TlsDirectives()
    • Method Detail

      • extractClientCertificate

        public Route extractClientCertificate​(java.util.function.Function<java.security.cert.X509Certificate,​Route> inner)
        Extract the client certificate, or reject the request with a TlsClientUnverifiedRejection.

        Using this directives requires tls-session info parsing to be enabled: akka.http.server.parsing.tls-session-info-header = on

        The SSLEngine for the server needs to be set up with setWantClientAuth(true) or setNeedClientAuth(true) or else every request will be failed.

        Parameters:
        inner - (undocumented)
        Returns:
        (undocumented)
      • extractSslSession

        public Route extractSslSession​(java.util.function.Function<javax.net.ssl.SSLSession,​Route> inner)
        Extract the current SSLSession.

        Note: Using this directives requires tls-session info parsing to be enabled: akka.http.server.parsing.tls-session-info-header = on

        Parameters:
        inner - (undocumented)
        Returns:
        (undocumented)
      • requireClientCertificateIdentity

        public Route requireClientCertificateIdentity​(java.lang.String cnRegex,
                                                      java.util.function.Supplier<Route> inner)
        Require the client to be authenticated, if not reject the request with a TlsClientUnverifiedRejection, also require the one of the client certificate ip or dns SANs (Subject Alternative Name) or if non exists, the CN (Common Name) to match the given regular expression, if not the request is rejected with a TlsClientIdentityRejection

        Using this directives requires tls-session info parsing to be enabled: akka.http.server.parsing.tls-session-info-header = on

        The SSLEngine for the server needs to be set up with setWantClientAuth(true) or setNeedClientAuth(true) or else every request will be failed.

        Parameters:
        cnRegex - (undocumented)
        inner - (undocumented)
        Returns:
        (undocumented)