mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 19:18:04 +01:00
Handle "transport not allowed" responses from the registration service
This commit is contained in:
committed by
Jon Chambers
parent
3e53884979
commit
300ac16cf1
@@ -74,6 +74,7 @@ import org.whispersystems.textsecuregcm.registration.MessageTransport;
|
||||
import org.whispersystems.textsecuregcm.registration.RegistrationServiceClient;
|
||||
import org.whispersystems.textsecuregcm.registration.RegistrationServiceException;
|
||||
import org.whispersystems.textsecuregcm.registration.RegistrationServiceSenderException;
|
||||
import org.whispersystems.textsecuregcm.registration.TransportNotAllowedException;
|
||||
import org.whispersystems.textsecuregcm.registration.VerificationSession;
|
||||
import org.whispersystems.textsecuregcm.spam.Extract;
|
||||
import org.whispersystems.textsecuregcm.spam.FilterSpam;
|
||||
@@ -488,8 +489,13 @@ public class VerificationController {
|
||||
|
||||
throw registrationServiceException.getRegistrationSession()
|
||||
.map(s -> buildResponse(s, verificationSession))
|
||||
.map(verificationSessionResponse -> new ClientErrorException(
|
||||
Response.status(Response.Status.CONFLICT).entity(verificationSessionResponse).build()))
|
||||
.map(verificationSessionResponse -> {
|
||||
final Response response = registrationServiceException instanceof TransportNotAllowedException
|
||||
? Response.status(418).entity(verificationSessionResponse).build()
|
||||
: Response.status(Response.Status.CONFLICT).entity(verificationSessionResponse).build();
|
||||
|
||||
return new ClientErrorException(response);
|
||||
})
|
||||
.orElseGet(NotFoundException::new);
|
||||
|
||||
} else if (unwrappedException instanceof RegistrationServiceSenderException) {
|
||||
|
||||
Reference in New Issue
Block a user