Remove Response wrapper from /v2/directory/auth
This commit is contained in:
parent
c8993c4da8
commit
95abda4870
|
@ -13,7 +13,6 @@ import jakarta.ws.rs.GET;
|
||||||
import jakarta.ws.rs.Path;
|
import jakarta.ws.rs.Path;
|
||||||
import jakarta.ws.rs.Produces;
|
import jakarta.ws.rs.Produces;
|
||||||
import jakarta.ws.rs.core.MediaType;
|
import jakarta.ws.rs.core.MediaType;
|
||||||
import jakarta.ws.rs.core.Response;
|
|
||||||
import java.time.Clock;
|
import java.time.Clock;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import org.whispersystems.textsecuregcm.auth.AuthenticatedDevice;
|
import org.whispersystems.textsecuregcm.auth.AuthenticatedDevice;
|
||||||
|
@ -58,9 +57,8 @@ public class DirectoryV2Controller {
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
@ApiResponse(responseCode = "200", description = "`JSON` with generated credentials.", useReturnTypeSchema = true)
|
@ApiResponse(responseCode = "200", description = "`JSON` with generated credentials.", useReturnTypeSchema = true)
|
||||||
public Response getAuthToken(final @ReadOnly @Auth AuthenticatedDevice auth) {
|
public ExternalServiceCredentials getAuthToken(final @ReadOnly @Auth AuthenticatedDevice auth) {
|
||||||
final UUID uuid = auth.getAccount().getUuid();
|
final UUID uuid = auth.getAccount().getUuid();
|
||||||
final ExternalServiceCredentials credentials = directoryServiceTokenGenerator.generateForUuid(uuid);
|
return directoryServiceTokenGenerator.generateForUuid(uuid);
|
||||||
return Response.ok().entity(credentials).build();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,11 +37,11 @@ class DirectoryControllerV2Test {
|
||||||
final UUID uuid = UUID.fromString("11111111-1111-1111-1111-111111111111");
|
final UUID uuid = UUID.fromString("11111111-1111-1111-1111-111111111111");
|
||||||
when(account.getUuid()).thenReturn(uuid);
|
when(account.getUuid()).thenReturn(uuid);
|
||||||
|
|
||||||
final ExternalServiceCredentials credentials = (ExternalServiceCredentials) controller.getAuthToken(
|
final ExternalServiceCredentials credentials = controller.getAuthToken(
|
||||||
new AuthenticatedDevice(account, mock(Device.class))).getEntity();
|
new AuthenticatedDevice(account, mock(Device.class)));
|
||||||
|
|
||||||
assertEquals(credentials.username(), "d369bc712e2e0dd36258");
|
assertEquals("d369bc712e2e0dd36258", credentials.username());
|
||||||
assertEquals(credentials.password(), "1633738643:4433b0fab41f25f79dd4");
|
assertEquals("1633738643:4433b0fab41f25f79dd4", credentials.password());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue