Class MetricService

java.lang.Object
io.jans.service.metric.MetricService
io.jans.fido2.service.shared.MetricService
All Implemented Interfaces:
Serializable

@ApplicationScoped @Named("metricService") public class MetricService extends io.jans.service.metric.MetricService
Store and retrieve metric
Author:
Yuriy Movchan Date: 05/13/2020
See Also:
  • Field Details

  • Constructor Details

    • MetricService

      public MetricService()
  • Method Details

    • initTimer

      public void initTimer()
    • baseDn

      public String baseDn()
      Specified by:
      baseDn in class io.jans.service.metric.MetricService
    • getMetricServiceInstance

      public io.jans.service.metric.MetricService getMetricServiceInstance()
      Specified by:
      getMetricServiceInstance in class io.jans.service.metric.MetricService
    • isMetricReporterEnabled

      public boolean isMetricReporterEnabled()
      Specified by:
      isMetricReporterEnabled in class io.jans.service.metric.MetricService
    • getString

      public String getString()
      Specified by:
      getString in class io.jans.service.metric.MetricService
    • getEntryManager

      public io.jans.orm.PersistenceEntryManager getEntryManager()
      Specified by:
      getEntryManager in class io.jans.service.metric.MetricService
    • getNodeIdentifier

      public String getNodeIdentifier()
      Specified by:
      getNodeIdentifier in class io.jans.service.metric.MetricService
    • recordPasskeyRegistrationAttempt

      public void recordPasskeyRegistrationAttempt(String username, jakarta.servlet.http.HttpServletRequest request, long startTime)
      Record passkey registration attempt
      Parameters:
      username - Username attempting registration
      request - HTTP request for device info extraction
      startTime - Start time of the operation
    • recordPasskeyRegistrationSuccess

      public void recordPasskeyRegistrationSuccess(String username, jakarta.servlet.http.HttpServletRequest request, long startTime, String authenticatorType)
      Record successful passkey registration
      Parameters:
      username - Username who completed registration
      request - HTTP request for device info extraction
      startTime - Start time of the operation
      authenticatorType - Type of authenticator used
    • recordPasskeyRegistrationFailure

      public void recordPasskeyRegistrationFailure(String username, jakarta.servlet.http.HttpServletRequest request, long startTime, String errorReason, String authenticatorType)
      Record failed passkey registration
      Parameters:
      username - Username who failed registration
      request - HTTP request for device info extraction
      startTime - Start time of the operation
      errorReason - Reason for failure
      authenticatorType - Type of authenticator used (if known)
    • recordPasskeyRegistrationFailure

      public void recordPasskeyRegistrationFailure(String username, jakarta.servlet.http.HttpServletRequest request, long startTime, String errorReason, String authenticatorType, String aaguid)
      Record failed passkey registration, attributing it to an authenticator model.
      Parameters:
      username - Username who failed registration
      request - HTTP request for device info extraction
      startTime - Start time of the operation
      errorReason - Reason for failure
      authenticatorType - Type of authenticator used (if known)
      aaguid - AAGUID the failure concerns, or null when the failure is not tied to one. Recorded so attestation rejections can be broken down by authenticator model.
    • recordPasskeyAuthenticationAttempt

      public void recordPasskeyAuthenticationAttempt(String username, jakarta.servlet.http.HttpServletRequest request, long startTime)
      Record passkey authentication attempt
      Parameters:
      username - Username attempting authentication
      request - HTTP request for device info extraction
      startTime - Start time of the operation
    • recordPasskeyAuthenticationSuccess

      public void recordPasskeyAuthenticationSuccess(String username, jakarta.servlet.http.HttpServletRequest request, long startTime, String authenticatorType)
      Record successful passkey authentication
      Parameters:
      username - Username who completed authentication
      request - HTTP request for device info extraction
      startTime - Start time of the operation
      authenticatorType - Type of authenticator used
    • recordPasskeyAuthenticationFailure

      public void recordPasskeyAuthenticationFailure(String username, jakarta.servlet.http.HttpServletRequest request, long startTime, String errorReason, String authenticatorType)
      Record failed passkey authentication
      Parameters:
      username - Username who failed authentication
      request - HTTP request for device info extraction
      startTime - Start time of the operation
      errorReason - Reason for failure
      authenticatorType - Type of authenticator used (if known)
    • recordPasskeyAuthenticationAbandoned

      public void recordPasskeyAuthenticationAbandoned(String username, long ceremonyStartTime)
      Record a passkey authentication that was started and never completed.

      Unlike the success and failure recorders this runs on the sweep timer rather than a request thread, so there is no request to take device details from — snapshotRequest yields an empty snapshot. The ceremony's own start time is passed in so the recorded duration is how long the ceremony stayed open, not how long the sweep took.

      Parameters:
      username - the ceremony user, or null for a conditional-UI ceremony that never had one
      ceremonyStartTime - when the ceremony was issued, in epoch millis
    • recordPasskeyFallback

      public void recordPasskeyFallback(String username, String fallbackMethod, String reason)
      Record passkey fallback event (when user switches to password or other method)
      Parameters:
      username - Username who fell back
      fallbackMethod - Method user fell back to (e.g., "PASSWORD", "SMS")
      reason - Reason for fallback
    • categorizeError

      public String categorizeError(String errorReason)
      Categorize error reasons for analytics.

      Public so the assertion entry can be labelled with the same category that is recorded in the metrics store. Deriving both from one place is what keeps the two sources from disagreeing.