From 235d1a0cf02a124f0e2d81f85caf0fe6d8425f90 Mon Sep 17 00:00:00 2001 From: Emanuel Albu <42834028+ealbu@users.noreply.github.com> Date: Thu, 12 Sep 2024 13:34:33 +0300 Subject: [PATCH] SDLCOM-6184: Authenticating 2024: IDX12729: Unable to decode the header * Remove unused code * Increase version to 2.0.2.0 --- .../Properties/AssemblyInfo.cs | 2 +- .../Service/MicrosoftService.cs | 13 ++----------- .../pluginpackage.manifest.xml | 2 +- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/MicrosoftTranslatorProvider/Properties/AssemblyInfo.cs b/MicrosoftTranslatorProvider/Properties/AssemblyInfo.cs index 9e77b5899..b6ba15071 100644 --- a/MicrosoftTranslatorProvider/Properties/AssemblyInfo.cs +++ b/MicrosoftTranslatorProvider/Properties/AssemblyInfo.cs @@ -29,4 +29,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0.0")] -[assembly: AssemblyFileVersion("2.0.1.0")] \ No newline at end of file +[assembly: AssemblyFileVersion("2.0.2.0")] \ No newline at end of file diff --git a/MicrosoftTranslatorProvider/Service/MicrosoftService.cs b/MicrosoftTranslatorProvider/Service/MicrosoftService.cs index cc964257c..5514f46f4 100644 --- a/MicrosoftTranslatorProvider/Service/MicrosoftService.cs +++ b/MicrosoftTranslatorProvider/Service/MicrosoftService.cs @@ -39,7 +39,6 @@ public static async Task AuthenticateUser(MicrosoftCredentials credentials var response = await httpClient.SendAsync(request); response.EnsureSuccessStatusCode(); var tokenString = await response.Content.ReadAsStringAsync(); - var token = ReadToken(tokenString); credentials.AccessToken = "Bearer " + tokenString; return true; } @@ -50,7 +49,7 @@ public static async Task AuthenticateUser(MicrosoftCredentials credentials } } - public async static Task> GetSupportedLanguages() + public static async Task> GetSupportedLanguages() { var httpClientHandler = ProxyHelper.GetHttpClientHandler(CredentialsManager.GetProxySettings(), true); var httpClient = new HttpClient(httpClientHandler); @@ -70,21 +69,13 @@ public async static Task> GetSupportedLanguages() return output; } - public async static Task> GetSupportedLanguageCodes() + public static async Task> GetSupportedLanguageCodes() { var supportedLanguages = await GetSupportedLanguages(); var supportedCodes = new HashSet(supportedLanguages.Select(x => x.LanguageCode)); return supportedCodes; } - private static JwtSecurityToken ReadToken(string token) - { - var jwtHandler = new JwtSecurityTokenHandler(); - var readableToken = jwtHandler.CanReadToken(token); - return readableToken ? jwtHandler.ReadJwtToken(token) - : null; - } - public static async Task TranslateAsync(PairModel pairModel, string textToTranslate, MicrosoftCredentials microsoftCredentials) { var sourceLanguage = pairModel.SourceLanguageCode; diff --git a/MicrosoftTranslatorProvider/pluginpackage.manifest.xml b/MicrosoftTranslatorProvider/pluginpackage.manifest.xml index b32a9a388..bb5d37e58 100644 --- a/MicrosoftTranslatorProvider/pluginpackage.manifest.xml +++ b/MicrosoftTranslatorProvider/pluginpackage.manifest.xml @@ -1,7 +1,7 @@ Microsoft Translator Provider - 2.0.1.0 + 2.0.2.0 Microsoft Translator Provider Trados AppStore Team