remove support for GET /v1/accounts/me

This commit is contained in:
Jonathan Klabunde Tomer 2024-12-27 12:23:14 -08:00 committed by GitHub
parent 8c3ebdcbab
commit 541bf968e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 12 deletions

View File

@ -263,14 +263,6 @@ public class AccountController {
registrationRecoveryPasswordsManager.store(updatedAccount.getIdentifier(IdentityType.PNI), registrationRecoveryPassword)); registrationRecoveryPasswordsManager.store(updatedAccount.getIdentifier(IdentityType.PNI), registrationRecoveryPassword));
} }
@GET
@Path("/me")
@Deprecated() // use whoami
@Produces(MediaType.APPLICATION_JSON)
public AccountIdentityResponse getMe(@ReadOnly @Auth AuthenticatedDevice auth) {
return AccountIdentityResponseBuilder.fromAccount(auth.getAccount());
}
@GET @GET
@Path("/whoami") @Path("/whoami")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)

View File

@ -324,9 +324,8 @@ class AccountControllerTest {
} }
} }
@ParameterizedTest @Test
@ValueSource(strings = {"/v1/accounts/whoami", "/v1/accounts/me"}) void testWhoAmI() {
void testWhoAmI(final String path) {
final Instant expiration = Instant.now().plus(Duration.ofHours(1)).plusMillis(101); final Instant expiration = Instant.now().plus(Duration.ofHours(1)).plusMillis(101);
final Instant truncatedExpiration = Instant.ofEpochSecond(expiration.getEpochSecond()); final Instant truncatedExpiration = Instant.ofEpochSecond(expiration.getEpochSecond());
final AccountBadge badge1 = new AccountBadge("badge1", expiration, true); final AccountBadge badge1 = new AccountBadge("badge1", expiration, true);
@ -337,7 +336,7 @@ class AccountControllerTest {
when(AuthHelper.VALID_ACCOUNT.getBadges()).thenReturn(List.of(badge1, badge2)); when(AuthHelper.VALID_ACCOUNT.getBadges()).thenReturn(List.of(badge1, badge2));
try (final Response response = resources.getJerseyTest() try (final Response response = resources.getJerseyTest()
.target(path) .target("/v1/accounts/whoami")
.request() .request()
.header(HttpHeaders.AUTHORIZATION, AuthHelper.getAuthHeader(AuthHelper.VALID_UUID, AuthHelper.VALID_PASSWORD)) .header(HttpHeaders.AUTHORIZATION, AuthHelper.getAuthHeader(AuthHelper.VALID_UUID, AuthHelper.VALID_PASSWORD))
.get()) { .get()) {