Class AttestationTrustDiagnostics

java.lang.Object
io.jans.fido2.service.trust.AttestationTrustDiagnostics

public final class AttestationTrustDiagnostics extends Object
Recovers the trust diagnostic, if any, from the exception that failed a registration.

The code is read from a Fido2TrustException in the cause chain rather than matched against the exception message. Message matching would silently stop classifying rejections the moment someone rewords a log or error string, and the wording is not something the metrics contract should depend on.

Registration failures that are not trust related resolve to null, and the caller keeps the original message — nothing is lost for them.

Author:
Janssen Project
  • Method Details

    • find

      public static Fido2TrustException find(Throwable error)
      Finds the trust failure behind a registration error.
      Parameters:
      error - the exception that failed the registration; may be null
      Returns:
      the Fido2TrustException that describes the trust failure, or null when the failure was not trust related
    • resolveCode

      public static String resolveCode(Throwable error)
      The diagnostic code to record for a registration failure.
      Parameters:
      error - the exception that failed the registration; may be null
      Returns:
      the code name, or null when the failure was not trust related
    • resolveAaguid

      public static String resolveAaguid(Throwable error)
      The AAGUID a trust rejection concerns.
      Parameters:
      error - the exception that failed the registration; may be null
      Returns:
      the AAGUID, or null when the failure is not trust related or is not tied to a specific authenticator model
    • resolve

      public static AttestationTrustDiagnostic resolve(Throwable error)
      Convenience for the enum constant itself, for callers that need more than the name.