Skip to content

Commit

Permalink
Rename tag in GroupUserAuthenticator.credentialsVersion metric
Browse files Browse the repository at this point in the history
  • Loading branch information
eager-signal committed Dec 12, 2024
1 parent 39c78e1 commit 31f8989
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@

package org.signal.storageservice.auth;

import static com.codahale.metrics.MetricRegistry.name;

import com.google.protobuf.ByteString;
import io.dropwizard.auth.Authenticator;
import io.dropwizard.auth.basic.BasicCredentials;
import io.micrometer.core.instrument.Metrics;
import java.util.Optional;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.signal.libsignal.zkgroup.InvalidInputException;
Expand All @@ -17,10 +20,6 @@
import org.signal.libsignal.zkgroup.auth.ServerZkAuthOperations;
import org.signal.libsignal.zkgroup.groups.GroupPublicParams;

import java.util.Optional;

import static com.codahale.metrics.MetricRegistry.name;

public class GroupUserAuthenticator implements Authenticator<BasicCredentials, GroupUser> {

private static final String CREDENTIALS_VERSION_COUNTER_NAME = name(GroupUserAuthenticator.class,
Expand All @@ -41,7 +40,7 @@ public Optional<GroupUser> authenticate(BasicCredentials basicCredentials) {
GroupPublicParams groupPublicKey = new GroupPublicParams(Hex.decodeHex(encodedGroupPublicKey));
AuthCredentialPresentation presentation = new AuthCredentialPresentation(Hex.decodeHex(encodedPresentation));

Metrics.counter(CREDENTIALS_VERSION_COUNTER_NAME, "version", presentation.getVersion().toString())
Metrics.counter(CREDENTIALS_VERSION_COUNTER_NAME, "credentialsVersion", presentation.getVersion().toString())
.increment();

serverZkAuthOperations.verifyAuthCredentialPresentation(groupPublicKey, presentation);
Expand Down

0 comments on commit 31f8989

Please sign in to comment.