Add documentation for /v2/directory/auth

This commit is contained in:
Chris Eager authored and Chris Eager committed 2025-01-02 13:12:38 -06:00
1 parent d096798340
commit c8993c4da8
1 file changed
+10
@@ -6,6 +6,8 @@ package org.whispersystems.textsecuregcm.controllers;
import com.google.common.annotations.VisibleForTesting;
import io.dropwizard.auth.Auth;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
@@ -48,6 +50,14 @@ public class DirectoryV2Controller {
@GET
@Path("/auth")
@Produces(MediaType.APPLICATION_JSON)
@Operation(
summary = "Generate credentials for Contact Discovery Service",
description = """
Generate Contact Discovery Service credentials. Generated credentials have an expiration time of 24 hours\s
(however, the TTL is fully controlled by the server and may change even for already generated credentials).
"""
)
@ApiResponse(responseCode = "200", description = "`JSON` with generated credentials.", useReturnTypeSchema = true)
public Response getAuthToken(final @ReadOnly @Auth AuthenticatedDevice auth) {
final UUID uuid = auth.getAccount().getUuid();
final ExternalServiceCredentials credentials = directoryServiceTokenGenerator.generateForUuid(uuid);