diff --git a/src/main/java/biz/nynja/account/components/Validator.java b/src/main/java/biz/nynja/account/components/Validator.java index fcf8b0c143fe1c8b450cb016ea7f11a6ecf3d28a..4100ff2d8f53127c88527596d6a9abe737b723a0 100644 --- a/src/main/java/biz/nynja/account/components/Validator.java +++ b/src/main/java/biz/nynja/account/components/Validator.java @@ -129,7 +129,7 @@ public class Validator { case MISSING_TYPE: return Cause.MISSING_AUTH_PROVIDER_TYPE; case PHONE: - // We expect to receive phone number in the following format : ":" + // We expect to receive phone number in the following format : ":" String[] provider = authProvider.split(":"); if (provider == null || provider.length != 2) { return Cause.PHONE_NUMBER_INVALID; diff --git a/src/main/java/biz/nynja/account/services/AccountServiceImpl.java b/src/main/java/biz/nynja/account/services/AccountServiceImpl.java index e2cbdd8702c40e820178122cec888970d49f847c..0e612e9c1035ad36ec77a0016a58aad6d3108ace 100644 --- a/src/main/java/biz/nynja/account/services/AccountServiceImpl.java +++ b/src/main/java/biz/nynja/account/services/AccountServiceImpl.java @@ -656,6 +656,11 @@ public class AccountServiceImpl extends AccountServiceGrpc.AccountServiceImplBas AuthenticationProvider authenticationProviderToDelete = AuthenticationProvider .createAuthenticationProviderFromProto(request.getAuthenticationProvider()); + if (request.getAuthenticationProvider().getAuthenticationType() == AuthenticationType.PHONE) { + authenticationProviderToDelete.setValue(phoneNumberValidator + .getNormalizedPhoneNumber(request.getAuthenticationProvider().getAuthenticationProvider())); + } + boolean removedFromObject = profile.removeAuthenticationProvider(authenticationProviderToDelete); if(!removedFromObject) { logAndBuildGrpcStatusResponse(responseObserver, StatusResponse.newBuilder(), "Authentication provider {} is not used by this profile.",