From ba55d6caeb916cdcc3e09d6067f4f38293a09267 Mon Sep 17 00:00:00 2001 From: Alex Konradi Date: Thu, 14 Nov 2024 15:23:25 -0500 Subject: [PATCH] Only vend new credential format Remove the flag that controlled which format was requested, and always return the new thing. --- .../controllers/CertificateController.java | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/CertificateController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/CertificateController.java index 5dc654afd..508a2aea6 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/CertificateController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/CertificateController.java @@ -11,7 +11,6 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.net.HttpHeaders; import io.dropwizard.auth.Auth; import io.micrometer.core.instrument.Metrics; -import io.micrometer.core.instrument.Tags; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.BadRequestException; import jakarta.ws.rs.DefaultValue; @@ -39,7 +38,6 @@ import org.whispersystems.textsecuregcm.auth.AuthenticatedDevice; import org.whispersystems.textsecuregcm.auth.CertificateGenerator; import org.whispersystems.textsecuregcm.entities.DeliveryCertificate; import org.whispersystems.textsecuregcm.entities.GroupCredentials; -import org.whispersystems.textsecuregcm.metrics.UserAgentTagUtil; import org.whispersystems.websocket.auth.ReadOnly; @SuppressWarnings("OptionalUsedAsFieldOrParameterType") @@ -56,8 +54,6 @@ public class CertificateController { public static final Duration MAX_REDEMPTION_DURATION = Duration.ofDays(7); private static final String GENERATE_DELIVERY_CERTIFICATE_COUNTER_NAME = name(CertificateGenerator.class, "generateCertificate"); private static final String INCLUDE_E164_TAG_NAME = "includeE164"; - private static final String GET_GROUP_AUTHENTICATION_CREDENTIALS_COUNTER_NAME = name(CertificateController.class, - "getGroupAuthenticationCredentials"); public CertificateController( @Nonnull CertificateGenerator certificateGenerator, @@ -91,8 +87,7 @@ public class CertificateController { @ReadOnly @Auth AuthenticatedDevice auth, @HeaderParam(HttpHeaders.USER_AGENT) String userAgent, @QueryParam("redemptionStartSeconds") long startSeconds, - @QueryParam("redemptionEndSeconds") long endSeconds, - @QueryParam("zkcCredential") boolean zkcCredential) { + @QueryParam("redemptionEndSeconds") long endSeconds) { final Instant startOfDay = clock.instant().truncatedTo(ChronoUnit.DAYS); final Instant redemptionStart = Instant.ofEpochSecond(startSeconds); @@ -107,11 +102,6 @@ public class CertificateController { throw new BadRequestException(); } - Metrics - .counter(GET_GROUP_AUTHENTICATION_CREDENTIALS_COUNTER_NAME, - Tags.of(UserAgentTagUtil.getPlatformTag(userAgent)).and("zkcCredential", String.valueOf(zkcCredential))) - .increment(); - final List credentials = new ArrayList<>(); final List callLinkAuthCredentials = new ArrayList<>(); @@ -121,12 +111,7 @@ public class CertificateController { ServiceId.Pni pni = new ServiceId.Pni(auth.getAccount().getPhoneNumberIdentifier()); while (!redemption.isAfter(redemptionEnd)) { - AuthCredentialWithPniResponse authCredentialWithPni; - if (zkcCredential) { - authCredentialWithPni = serverZkAuthOperations.issueAuthCredentialWithPniZkc(aci, pni, redemption); - } else { - authCredentialWithPni = serverZkAuthOperations.issueAuthCredentialWithPniAsServiceId(aci, pni, redemption); - } + AuthCredentialWithPniResponse authCredentialWithPni = serverZkAuthOperations.issueAuthCredentialWithPniZkc(aci, pni, redemption); credentials.add(new GroupCredentials.GroupCredential( authCredentialWithPni.serialize(), (int) redemption.getEpochSecond()));