Skip to content

Commit 0ff5003

Browse files
committed
feat: add support for .NET SDK V4
1 parent d07e806 commit 0ff5003

File tree

7 files changed

+38
-44
lines changed

7 files changed

+38
-44
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"Projects": [
3+
{
4+
"Name": "Amazon.Extensions.CognitoAuthentication",
5+
"Type": "Patch",
6+
"ChangelogMessages": [
7+
"Added .NET 8 target framework and marked as trimmable",
8+
"Updated the .NET SDK dependencies to the latest version 4.0.0-preview.4",
9+
"Add SourceLink support"
10+
]
11+
}
12+
]
13+
}

src/Amazon.Extensions.CognitoAuthentication/Amazon.Extensions.CognitoAuthentication.csproj

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,37 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
55
<AssemblyName>Amazon.Extensions.CognitoAuthentication</AssemblyName>
66
<RootNamespace>Amazon.Extensions.CognitoAuthentication</RootNamespace>
77
<PackageId>Amazon.Extensions.CognitoAuthentication</PackageId>
8-
<Title>Amazon Cognito Authentication Extension Library</Title>
9-
<Product>Amazon.Extensions.CognitoAuthentication</Product>
8+
<Product>Amazon Cognito Authentication Extension Library</Product>
109
<Authors>Amazon Web Services</Authors>
11-
<Copyright>2018-2023</Copyright>
1210
<Description>An extension library to assist in the Amazon Cognito User Pools authentication process.</Description>
13-
<PackageTags>AWS;Amazon;aws-sdk-v3;Cognito</PackageTags>
11+
<PackageTags>AWS;Amazon;aws-sdk-v4;Cognito</PackageTags>
1412
<PackageProjectUrl>https://github.com/aws/aws-sdk-net-extensions-cognito/</PackageProjectUrl>
1513
<PackageLicenseFile>LICENSE</PackageLicenseFile>
1614
<PackageIcon>icon.png</PackageIcon>
1715
<RepositoryUrl>https://github.com/aws/aws-sdk-net-extensions-cognito/</RepositoryUrl>
1816
<Company>Amazon Web Services</Company>
1917
<SignAssembly>true</SignAssembly>
20-
21-
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
22-
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
23-
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
24-
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
25-
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
26-
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
27-
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
28-
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
29-
<DelaySign>false</DelaySign>
18+
<AssemblyOriginatorKeyFile>..\..\public.snk</AssemblyOriginatorKeyFile>
3019
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
31-
<Version>2.5.5</Version>
20+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
21+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
22+
<IncludeSymbols>true</IncludeSymbols>
23+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
24+
<Version>3.0.0-preview.1</Version>
3225
</PropertyGroup>
3326

34-
<PropertyGroup>
35-
<AssemblyOriginatorKeyFile>..\..\public.snk</AssemblyOriginatorKeyFile>
27+
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
28+
<IsTrimmable>true</IsTrimmable>
3629
</PropertyGroup>
3730

3831
<ItemGroup>
39-
<PackageReference Include="AWSSDK.CognitoIdentity" Version="3.7.300.74" />
40-
<PackageReference Include="AWSSDK.CognitoIdentityProvider" Version="3.7.303.19" />
32+
<PackageReference Include="AWSSDK.CognitoIdentity" Version="4.0.0-preview.4" />
33+
<PackageReference Include="AWSSDK.CognitoIdentityProvider" Version="4.0.0-preview.4" />
34+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
4135
</ItemGroup>
4236

4337
<ItemGroup>

src/Amazon.Extensions.CognitoAuthentication/CognitoDevice.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@ public partial class CognitoDevice
4141
/// The creation time for the device. CreateDate can only be configured
4242
/// through the constructor and once set cannot be changed.
4343
/// </summary>
44-
public DateTime CreateDate { get; private set; }
44+
public DateTime? CreateDate { get; private set; }
4545

4646
/// <summary>
4747
/// The last modified time for the device. LastModified can only be configured
4848
/// through the constructor and the GetDevice method.
4949
/// </summary>
50-
public DateTime LastModified { get; private set; }
50+
public DateTime? LastModified { get; private set; }
5151

5252
/// <summary>
5353
/// The last authenticated time for the device. LastAuthenticated can only be configured
5454
/// through the constructor and the GetDevice method.
5555
/// </summary>
56-
public DateTime LastAuthenticated { get; private set; }
56+
public DateTime? LastAuthenticated { get; private set; }
5757

5858
/// <summary>
5959
/// The user associated with the device. User can only be configured

src/Amazon.Extensions.CognitoAuthentication/CognitoUser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ private CognitoUserSession GetCognitoUserSession(AuthenticationResultType authRe
731731
refreshToken = authResult.RefreshToken;
732732
}
733733

734-
return new CognitoUserSession(idToken, accessToken, refreshToken, currentTime, currentTime.AddSeconds(authResult.ExpiresIn));
734+
return new CognitoUserSession(idToken, accessToken, refreshToken, currentTime, currentTime.AddSeconds(authResult.ExpiresIn ?? 0));
735735
}
736736

737737
/// <summary>
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
1-
using System.Reflection;
2-
using System.Runtime.InteropServices;
3-
4-
[assembly: AssemblyTitle("AWSSDK.Extensions.CognitoAuthentication")]
5-
[assembly: AssemblyConfiguration("")]
6-
[assembly: AssemblyCompany("Amazon.com, Inc")]
7-
[assembly: AssemblyProduct("Amazon Web Services SDK for .NET extensions for Cognito Authentication")]
8-
[assembly: AssemblyDescription("Amazon Web Services SDK for .NET extensions for Cognito Authentication")]
9-
[assembly: AssemblyCopyright("Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.")]
10-
[assembly: AssemblyTrademark("")]
1+
using System.Runtime.InteropServices;
112

123
// Setting ComVisible to false makes the types in this assembly not visible
134
// to COM components. If you need to access a type in this assembly from
145
// COM, set the ComVisible attribute to true on that type.
15-
[assembly: ComVisible(false)]
16-
17-
18-
[assembly: AssemblyVersion("1.0")]
19-
[assembly: AssemblyFileVersion("2.5.3.0")]
6+
[assembly: ComVisible(false)]

test/Amazon.Extensions.CognitoAuthentication.IntegrationTests/Amazon.Extensions.CognitoAuthentication.IntegrationTests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
</ItemGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="AWSSDK.Core" Version="3.7.303.14" />
13-
<PackageReference Include="AWSSDK.IdentityManagement" Version="3.7.301" />
14-
<PackageReference Include="AWSSDK.S3" Version="3.7.307.15" />
12+
<PackageReference Include="AWSSDK.Core" Version="4.0.0-preview.4" />
13+
<PackageReference Include="AWSSDK.IdentityManagement" Version="4.0.0-preview.4" />
14+
<PackageReference Include="AWSSDK.S3" Version="4.0.0-preview.4" />
1515
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
1616
<PackageReference Include="xunit" Version="2.9.2" />
1717
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
@@ -27,5 +27,5 @@
2727
<ItemGroup>
2828
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
2929
</ItemGroup>
30-
30+
3131
</Project>

test/Amazon.Extensions.CognitoAuthentication.IntegrationTests/SessionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ await user.StartWithSrpAuthAsync(new InitiateSrpAuthRequest()
5757
GetUserResponse userDetails = await user.GetUserDetailsAsync();
5858

5959
Assert.Contains(userDetails.UserAttributes, x => string.Equals(x.Name, CognitoConstants.UserAttrEmail, StringComparison.Ordinal));
60-
Assert.Empty(userDetails.MFAOptions);
60+
Assert.Null(userDetails.MFAOptions);
6161
}
6262

6363
//Tests the GlobalSignOut method

0 commit comments

Comments
 (0)