From 65dd1d95621db2a55566c97cd664ee1be916aaa2 Mon Sep 17 00:00:00 2001 From: Malhar Khimsaria <96malhar@gmail.com> Date: Mon, 15 Apr 2024 21:43:56 -0700 Subject: [PATCH] chore: Update User-Agent string (#142) --- ...on.Extensions.CognitoAuthentication.csproj | 6 +-- .../Properties/AssemblyInfo.cs | 2 +- .../Util/CognitoAuthHelper.cs | 39 +++++++------------ ...nitoAuthentication.IntegrationTests.csproj | 6 +-- 4 files changed, 22 insertions(+), 31 deletions(-) diff --git a/src/Amazon.Extensions.CognitoAuthentication/Amazon.Extensions.CognitoAuthentication.csproj b/src/Amazon.Extensions.CognitoAuthentication/Amazon.Extensions.CognitoAuthentication.csproj index 597cf87..c1a3817 100644 --- a/src/Amazon.Extensions.CognitoAuthentication/Amazon.Extensions.CognitoAuthentication.csproj +++ b/src/Amazon.Extensions.CognitoAuthentication/Amazon.Extensions.CognitoAuthentication.csproj @@ -28,7 +28,7 @@ false false true - 2.5.2 + 2.5.3 @@ -36,8 +36,8 @@ - - + + diff --git a/src/Amazon.Extensions.CognitoAuthentication/Properties/AssemblyInfo.cs b/src/Amazon.Extensions.CognitoAuthentication/Properties/AssemblyInfo.cs index aeaa14a..c44bec5 100644 --- a/src/Amazon.Extensions.CognitoAuthentication/Properties/AssemblyInfo.cs +++ b/src/Amazon.Extensions.CognitoAuthentication/Properties/AssemblyInfo.cs @@ -16,4 +16,4 @@ [assembly: AssemblyVersion("1.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly: AssemblyFileVersion("2.5.3.0")] \ No newline at end of file diff --git a/src/Amazon.Extensions.CognitoAuthentication/Util/CognitoAuthHelper.cs b/src/Amazon.Extensions.CognitoAuthentication/Util/CognitoAuthHelper.cs index df7b2c1..a74ffca 100644 --- a/src/Amazon.Extensions.CognitoAuthentication/Util/CognitoAuthHelper.cs +++ b/src/Amazon.Extensions.CognitoAuthentication/Util/CognitoAuthHelper.cs @@ -27,7 +27,9 @@ internal static class CognitoAuthHelper { [ThreadStatic] private static SHA256 sha256 = null; - private static string assemblyFileVersion = null; + private static readonly string _assemblyVersion = GetAssemblyFileVersion(); + + private static readonly string _userAgentSuffix = $"lib/AWSDotNetCognito#{_assemblyVersion}"; /// /// Property to access the thread-safe SHA256 member variable. /// Creates a SHA256 instance if one does not exist. @@ -44,23 +46,7 @@ internal static SHA256 Sha256 return sha256; } } - - internal static string AssemblyFileVersion - { - get - { - if (assemblyFileVersion == null) - { - var assembly = typeof(CognitoAuthHelper).GetTypeInfo().Assembly; - AssemblyFileVersionAttribute attribute = assembly.GetCustomAttribute(typeof(AssemblyFileVersionAttribute)) as AssemblyFileVersionAttribute; - assemblyFileVersion = attribute == null ? "Unknown" : attribute.Version; - } - - return assemblyFileVersion; - } - } - /// /// Computes the secret hash for the user pool using the corresponding userID, clientID, /// and client secret @@ -161,15 +147,20 @@ internal static List CreateAttributeList(IDictionary - - - + + +