Class Fido2MetricsController

java.lang.Object
io.jans.fido2.ws.rs.controller.Fido2MetricsController

@ApplicationScoped @Path("/metrics") public class Fido2MetricsController extends Object
REST API controller for FIDO2/Passkey metrics Provides endpoints to fetch metrics data for dashboards and analytics tools SECURITY NOTE: Authentication and authorization for these endpoints should be enforced at the infrastructure level (API gateway, OAuth interceptor, or reverse proxy). User-specific endpoints (e.g., /entries/user/{userId}) are particularly sensitive and should restrict access to authorized users or administrators only. If security is enforced at deployment time, ensure proper documentation is maintained. GitHub Issue #11922
Author:
FIDO2 Team
  • Constructor Details

    • Fido2MetricsController

      public Fido2MetricsController()
  • Method Details

    • getMetricsEntries

      @GET @Path("/entries") @Produces("application/json") public jakarta.ws.rs.core.Response getMetricsEntries(@QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime)
      Get raw metrics entries within a time range
      Parameters:
      startTime - Start time in ISO format (e.g., 2024-01-01T00:00:00)
      endTime - End time in ISO format
      Returns:
      List of metrics entries
    • getMetricsEntriesByUser

      @GET @Path("/entries/user/{userId}") @Produces("application/json") public jakarta.ws.rs.core.Response getMetricsEntriesByUser(@PathParam("userId") String userId, @QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime)
      Get metrics entries for a specific user
      Parameters:
      userId - User ID
      startTime - Start time in ISO format
      endTime - End time in ISO format
      Returns:
      List of user-specific metrics entries
    • getMetricsEntriesByOperation

      @GET @Path("/entries/operation/{operationType}") @Produces("application/json") public jakarta.ws.rs.core.Response getMetricsEntriesByOperation(@PathParam("operationType") String operationType, @QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime)
      Get metrics entries by operation type (REGISTRATION or AUTHENTICATION)
      Parameters:
      operationType - Operation type
      startTime - Start time in ISO format
      endTime - End time in ISO format
      Returns:
      List of operation-specific metrics entries
    • getAggregations

      @GET @Path("/aggregations/{aggregationType}") @Produces("application/json") public jakarta.ws.rs.core.Response getAggregations(@PathParam("aggregationType") String aggregationType, @QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime)
      Get aggregated metrics data
      Parameters:
      aggregationType - Aggregation type (HOURLY, DAILY, WEEKLY, MONTHLY)
      startTime - Start time in ISO format
      endTime - End time in ISO format
      Returns:
      List of aggregated metrics
    • getAggregationSummary

      @GET @Path("/aggregations/{aggregationType}/summary") @Produces("application/json") public jakarta.ws.rs.core.Response getAggregationSummary(@PathParam("aggregationType") String aggregationType, @QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime)
      Ge/t aggregation summary statistics
      Parameters:
      aggregationType - Aggregation type (HOURLY, DAILY, WEEKLY, MONTHLY)
      startTime - Start time in ISO format
      endTime - End time in ISO format
      Returns:
      Summary statistics
    • getUserAdoptionMetrics

      @GET @Path("/analytics/adoption") @Produces("application/json") public jakarta.ws.rs.core.Response getUserAdoptionMetrics(@QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime)
      Get user adoption metrics
      Parameters:
      startTime - Start time in ISO format
      endTime - End time in ISO format
      Returns:
      User adoption statistics
    • getPerformanceMetrics

      @GET @Path("/analytics/performance") @Produces("application/json") public jakarta.ws.rs.core.Response getPerformanceMetrics(@QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime)
      Get performance metrics (average durations, success rates)
      Parameters:
      startTime - Start time in ISO format
      endTime - End time in ISO format
      Returns:
      Performance statistics
    • getDeviceAnalytics

      @GET @Path("/analytics/devices") @Produces("application/json") public jakarta.ws.rs.core.Response getDeviceAnalytics(@QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime)
      Get device analytics (platform distribution, authenticator types)
      Parameters:
      startTime - Start time in ISO format
      endTime - End time in ISO format
      Returns:
      Device analytics data
    • getErrorAnalysis

      @GET @Path("/analytics/errors") @Produces("application/json") public jakarta.ws.rs.core.Response getErrorAnalysis(@QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime, @QueryParam("operationType") String operationType)
      Get error analysis (error categories, frequencies)
      Parameters:
      startTime - Start time in ISO format
      endTime - End time in ISO format
      operationType - REGISTRATION or AUTHENTICATION to report that ceremony alone; omit to report both together, which is what this endpoint has always done
      Returns:
      Error analysis data
    • getAttestationRejectionAnalysis

      @GET @Path("/analytics/attestation-rejections") @Produces("application/json") public jakarta.ws.rs.core.Response getAttestationRejectionAnalysis(@QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime)
      Get attestation rejections broken down by trust diagnostic code.

      Answers "why are registrations being rejected" — an unknown AAGUID, an authenticator blocked by an MDS status report and an untrusted root are otherwise indistinguishable once they reach the metrics store. Reads the same store as /analytics/errors.

      Parameters:
      startTime - Start time in ISO format
      endTime - End time in ISO format
      Returns:
      Attestation rejection analysis
    • getTrendAnalysis

      @GET @Path("/analytics/trends/{aggregationType}") @Produces("application/json") public jakarta.ws.rs.core.Response getTrendAnalysis(@PathParam("aggregationType") String aggregationType, @QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime)
      Get trend analysis for metrics over time
      Parameters:
      aggregationType - Aggregation type for trend analysis
      startTime - Start time in ISO format
      endTime - End time in ISO format
      Returns:
      Trend analysis data
    • getPeriodOverPeriodComparison

      @GET @Path("/analytics/comparison/{aggregationType}") @Produces("application/json") public jakarta.ws.rs.core.Response getPeriodOverPeriodComparison(@PathParam("aggregationType") String aggregationType, @QueryParam("periods") @DefaultValue("2") int periods)
      Get period-over-period comparison
      Parameters:
      aggregationType - Aggregation type for comparison
      periods - Number of periods to compare (default: 2)
      Returns:
      Period comparison data
    • getMetricsConfig

      @GET @Path("/config") @Produces("application/json") public jakarta.ws.rs.core.Response getMetricsConfig()
      Get metrics configuration and status
      Returns:
      Configuration information
    • getHealth

      @GET @Path("/health") @Produces("application/json") public jakarta.ws.rs.core.Response getHealth()
      Health check endpoint for metrics service Verifies that the metrics service is functional and can connect to the database
      Returns:
      Health status