From 6da96ec6eacb011d86b85b9e4050e1909f20f3aa Mon Sep 17 00:00:00 2001 From: mary-dcouto Date: Mon, 14 Feb 2022 11:52:52 +0530 Subject: [PATCH 1/2] fix for the data format issue in the generate mfa command --- DesktopEdge/Views/Screens/MFAScreen.xaml.cs | 4 ++-- ZitiDesktopEdge.Client/DataStructures/DataStructures.cs | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/DesktopEdge/Views/Screens/MFAScreen.xaml.cs b/DesktopEdge/Views/Screens/MFAScreen.xaml.cs index e3eb89d9..d758995e 100644 --- a/DesktopEdge/Views/Screens/MFAScreen.xaml.cs +++ b/DesktopEdge/Views/Screens/MFAScreen.xaml.cs @@ -258,7 +258,7 @@ namespace ZitiDesktopEdge { this.OnError?.Invoke("Authentication Failed"); this._executing = false; } else { - this._identity.RecoveryCodes = codeResponse.Data; + this._identity.RecoveryCodes = codeResponse.Data.RecoveryCodes; this.OnClose?.Invoke(true); this._executing = false; } @@ -283,7 +283,7 @@ namespace ZitiDesktopEdge { this.OnError?.Invoke("Authentication Failed"); this._executing = false; } else { - this._identity.RecoveryCodes = codeResponse.Data; + this._identity.RecoveryCodes = codeResponse.Data.RecoveryCodes; this.OnClose?.Invoke(true); this._executing = false; } diff --git a/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs b/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs index fc1c7d6c..9c7cf927 100644 --- a/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs +++ b/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs @@ -506,9 +506,14 @@ namespace ZitiDesktopEdge.DataStructures { public string Identifier { get; set; } } + public class MfaRecoveryCodes { + public string[] RecoveryCodes { get; set; } + public string Identifier { get; set; } + + } public class MfaRecoveryCodesResponse : SvcResponse { - public string[] Data { get; set; } + public MfaRecoveryCodes Data { get; set; } } public class ConfigPayload From 929522395563fed42d0a381da923e671c03b7ef5 Mon Sep 17 00:00:00 2001 From: mary-dcouto Date: Mon, 14 Feb 2022 12:30:13 +0530 Subject: [PATCH 2/2] updating the Get MFA codes command --- DesktopEdge/Views/Screens/Debugging.xaml.cs | 2 +- DesktopEdge/Views/Screens/MFAScreen.xaml.cs | 6 +++--- .../DataStructures/DataStructures.cs | 12 ++++++------ ZitiDesktopEdge.Client/ServiceClient/DataClient.cs | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/DesktopEdge/Views/Screens/Debugging.xaml.cs b/DesktopEdge/Views/Screens/Debugging.xaml.cs index ea1c4c6a..0e43a8b7 100644 --- a/DesktopEdge/Views/Screens/Debugging.xaml.cs +++ b/DesktopEdge/Views/Screens/Debugging.xaml.cs @@ -70,7 +70,7 @@ namespace Ziti.Desktop.Edge.Views.Screens { } async private void btn5_Click(object sender, RoutedEventArgs e) { - await client.ReturnMFACodes(FingerPrint.Text, TheMFACode.Text); + await client.GetMFACodes(FingerPrint.Text, TheMFACode.Text); } async private void btn6_Click(object sender, RoutedEventArgs e) { diff --git a/DesktopEdge/Views/Screens/MFAScreen.xaml.cs b/DesktopEdge/Views/Screens/MFAScreen.xaml.cs index a0f0b462..ec3a029b 100644 --- a/DesktopEdge/Views/Screens/MFAScreen.xaml.cs +++ b/DesktopEdge/Views/Screens/MFAScreen.xaml.cs @@ -178,11 +178,11 @@ namespace ZitiDesktopEdge { } } - async private void ReturnMFACodes(object sender, MouseButtonEventArgs e) { + async private void GetMFACodes(object sender, MouseButtonEventArgs e) { DataClient serviceClient = serviceClient = (DataClient)Application.Current.Properties["ServiceClient"]; string code = AuthCode.Text; Logger.Debug("AuthMFA successful."); - MfaRecoveryCodesResponse getcodes = await serviceClient.ReturnMFACodes(this._identity.Identifier, code); + MfaRecoveryCodesResponse getcodes = await serviceClient.GetMFACodes(this._identity.Identifier, code); if (getcodes.Code != 0) { Logger.Error("AuthMFA failed. " + getcodes.Error); } @@ -256,7 +256,7 @@ namespace ZitiDesktopEdge { } this.OnLoad?.Invoke(true, "", ""); } else if (this.Type == 2) { - MfaRecoveryCodesResponse codeResponse = await serviceClient.ReturnMFACodes(this._identity.Identifier, code); + MfaRecoveryCodesResponse codeResponse = await serviceClient.GetMFACodes(this._identity.Identifier, code); if (codeResponse?.Code != 0) { Logger.Error("AuthMFA failed. " + codeResponse.Error); AuthCode.Text = ""; diff --git a/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs b/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs index 9c7cf927..b7fd15a0 100644 --- a/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs +++ b/ZitiDesktopEdge.Client/DataStructures/DataStructures.cs @@ -159,17 +159,17 @@ namespace ZitiDesktopEdge.DataStructures { public string Code { get; set; } } - public class ReturnMFACodesFunction : ServiceFunction { - public ReturnMFACodesFunction(string identifier, string code) { - this.Command = "ReturnMFACodes"; - this.Data = new ReturnMFACodesFunctionPayload() { + public class GetMFACodesFunction : ServiceFunction { + public GetMFACodesFunction(string identifier, string code) { + this.Command = "GetMFACodes"; + this.Data = new GetMFACodesFunctionPayload() { Identifier = identifier, Code = code, }; } - public ReturnMFACodesFunctionPayload Data { get; set; } + public GetMFACodesFunctionPayload Data { get; set; } } - public class ReturnMFACodesFunctionPayload { + public class GetMFACodesFunctionPayload { public string Identifier { get; set; } public string Code { get; set; } } diff --git a/ZitiDesktopEdge.Client/ServiceClient/DataClient.cs b/ZitiDesktopEdge.Client/ServiceClient/DataClient.cs index 77ec0d5a..9e279b6f 100644 --- a/ZitiDesktopEdge.Client/ServiceClient/DataClient.cs +++ b/ZitiDesktopEdge.Client/ServiceClient/DataClient.cs @@ -274,9 +274,9 @@ namespace ZitiDesktopEdge.ServiceClient { return null; } - async public Task ReturnMFACodes(string identifier, string totpOrRecoveryCode) { + async public Task GetMFACodes(string identifier, string totpOrRecoveryCode) { try { - await sendAsync(new ReturnMFACodesFunction(identifier, totpOrRecoveryCode)); + await sendAsync(new GetMFACodesFunction(identifier, totpOrRecoveryCode)); MfaRecoveryCodesResponse mfa = await readAsync(ipcReader); return mfa; } catch (Exception ioe) {