|
8 | 8 | import com.fasterxml.jackson.annotation.JsonUnwrapped; |
9 | 9 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
10 | 10 | import com.google.common.annotations.VisibleForTesting; |
11 | | -import io.micrometer.core.instrument.Metrics; |
12 | 11 | import io.swagger.v3.oas.annotations.media.Schema; |
13 | 12 | import jakarta.validation.Valid; |
14 | 13 | import jakarta.validation.constraints.AssertTrue; |
15 | 14 | import java.util.Optional; |
16 | 15 | import java.util.Set; |
17 | 16 | import javax.annotation.Nullable; |
18 | 17 | import org.whispersystems.textsecuregcm.auth.UnidentifiedAccessUtil; |
19 | | -import org.whispersystems.textsecuregcm.metrics.MetricsUtil; |
20 | 18 | import org.whispersystems.textsecuregcm.storage.DeviceCapability; |
21 | 19 | import org.whispersystems.textsecuregcm.util.ByteArrayAdapter; |
22 | 20 | import org.whispersystems.textsecuregcm.util.ExactlySize; |
23 | 21 |
|
24 | 22 | public class AccountAttributes { |
25 | 23 |
|
26 | | - private static final String UAK_VALIDATION_COUNTER_NAME = MetricsUtil.name(AccountAttributes.class, "uakValidation"); |
27 | | - |
28 | 24 | @JsonUnwrapped |
29 | 25 | @Valid |
30 | 26 | private DeviceAttributes deviceAttributes; |
@@ -132,23 +128,10 @@ public AccountAttributes setUnrestrictedUnidentifiedAccess(final boolean unrestr |
132 | 128 | return this; |
133 | 129 | } |
134 | 130 |
|
135 | | - @VisibleForTesting |
136 | | - public static final boolean ENFORCE_VALID_UNRESTRICTED_UAK = false; |
137 | | - |
138 | 131 | @AssertTrue |
139 | 132 | @Schema(hidden = true) |
140 | 133 | public boolean isUnrestrictedUakValid() { |
141 | 134 |
|
142 | | - final boolean valid = unrestrictedUnidentifiedAccess || |
143 | | - (!unrestrictedUnidentifiedAccess && (unidentifiedAccessKey != null |
144 | | - && unidentifiedAccessKey.length == 16)); |
145 | | - |
146 | | - Metrics.counter(UAK_VALIDATION_COUNTER_NAME, |
147 | | - "valid", String.valueOf(valid), |
148 | | - "unrestricted", String.valueOf(unrestrictedUnidentifiedAccess) |
149 | | - ).increment(); |
150 | | - |
151 | | - // initially, only gather metrics |
152 | | - return true; |
| 135 | + return unrestrictedUnidentifiedAccess || (unidentifiedAccessKey != null && unidentifiedAccessKey.length == 16); |
153 | 136 | } |
154 | 137 | } |
0 commit comments