Class TerminalLocalAPIHostnameVerifier

  • All Implemented Interfaces:
    HostnameVerifier

    public final class TerminalLocalAPIHostnameVerifier
    extends Object
    implements HostnameVerifier
    A custom HostnameVerifier implementation for verifying SSL connections to Adyen Terminal Local APIs. This verifier ensures the peer certificate's common name (CN) matches expected patterns based on the current Environment.

    This is typically used to verify secure connections to payment terminals on local networks.

    It validates the hostname by inspecting the leaf certificate (first in the chain) and checking it against allowed CNs using TerminalCommonNameValidator.

    See Also:
    TerminalCommonNameValidator, Environment
    • Constructor Detail

      • TerminalLocalAPIHostnameVerifier

        public TerminalLocalAPIHostnameVerifier​(Environment environment)
        Constructs a new TerminalLocalAPIHostnameVerifier with the specified environment.
        Parameters:
        environment - The Adyen environment used for validating terminal hostnames.
    • Method Detail

      • verify

        public boolean verify​(String hostname,
                              SSLSession session)
        Verifies the hostname of an SSL session by inspecting the peer's certificate and validating its common name against expected values for the given environment.
        Specified by:
        verify in interface HostnameVerifier
        Parameters:
        hostname - the hostname to verify.
        session - the SSL session associated with the connection.
        Returns:
        true if the hostname is valid for the given environment; false otherwise.