Enum Class ProxyFailure.TlsFailed.Reason

java.lang.Object
java.lang.Enum<ProxyFailure.TlsFailed.Reason>
org.microproxy.ProxyFailure.TlsFailed.Reason
All Implemented Interfaces:
Serializable, Comparable<ProxyFailure.TlsFailed.Reason>, Constable
Enclosing class:
ProxyFailure.TlsFailed

public static enum ProxyFailure.TlsFailed.Reason extends Enum<ProxyFailure.TlsFailed.Reason>
Why a TLS handshake failed, read from the exception's cause chain: the certificate checks first, then an alert from the peer, a timeout, or anything else. code() is the snake_case name the access log's %UPSTREAM_TRANSPORT_FAILURE_REASON% starts with.
  • Enum Constant Details

  • Method Details

    • values

      public static ProxyFailure.TlsFailed.Reason[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ProxyFailure.TlsFailed.Reason valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • code

      public String code()
      Returns the reason's name in lower case: certificate_revoked, ....
      Returns:
      the reason's name in lower case: certificate_revoked, ...
    • of

      public static ProxyFailure.TlsFailed.Reason of(Throwable failure)
      Classifies a failed handshake by its exception's cause chain. A CertPathValidatorException with a CertPathValidatorException.BasicReason, a CertificateExpiredException, CertificateNotYetValidException or CertificateRevokedException anywhere in it says what was wrong with the certificate (the innermost specific one wins); any other certificate path failure means it is not trusted; a host name check that failed says so in its message (the JDK's "No subject alternative ... matching ..."); and the JDK reports an alert from the peer as "Received fatal alert: <description>".
      Parameters:
      failure - the handshake's exception, or null
      Returns:
      the reason, OTHER when none is recognized
    • alertOf

      public static String alertOf(Throwable failure)
      The description of the alert the peer ended a handshake with, as the JDK reports it: "Received fatal alert: unrecognized_name", or "Received handshake warning: ..." for a warning it does not accept during a handshake.
      Parameters:
      failure - the handshake's exception, or null
      Returns:
      the alert's description, such as "unrecognized_name", or null