Skip to content

Commit ceb0074

Browse files
author
Tiago Brenck
committed
SameSite cookie test in other samples
1 parent c0e2ad5 commit ceb0074

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

1-WebApp-OIDC/1-5-B2C/Startup.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3030
using Microsoft.Extensions.Configuration;
3131
using Microsoft.Extensions.DependencyInjection;
3232
using Microsoft.Extensions.Hosting;
33+
using Microsoft.Identity.Web;
3334

3435
namespace WebApp_OpenIDConnect_DotNet
3536
{
@@ -49,7 +50,9 @@ public void ConfigureServices(IServiceCollection services)
4950
{
5051
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
5152
options.CheckConsentNeeded = context => true;
52-
options.MinimumSameSitePolicy = SameSiteMode.None;
53+
options.MinimumSameSitePolicy = SameSiteMode.Unspecified;
54+
// Handling SameSite cookie according to https://docs.microsoft.com/en-us/aspnet/core/security/samesite?view=aspnetcore-3.1
55+
options.HandleSameSiteCookieCompatibility();
5356
});
5457

5558
// Configuration to sign-in users with Azure AD B2C

1-WebApp-OIDC/1-5-B2C/WebApp-OpenIDConnect-DotNet.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@
2121
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureADB2C.UI" Version="3.0.0" />
2222
</ItemGroup>
2323

24+
<ItemGroup>
25+
<ProjectReference Include="..\..\Microsoft.Identity.Web\Microsoft.Identity.Web.csproj" />
26+
</ItemGroup>
27+
2428
</Project>

1-WebApp-OIDC/1-5-B2C/WebApp-OpenIDConnect-DotNet.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.29123.89
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApp-OpenIDConnect-DotNet", "WebApp-OpenIDConnect-DotNet.csproj", "{8DCFEEC2-0A85-4C7E-B96A-21C9184470B1}"
77
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Identity.Web", "..\..\Microsoft.Identity.Web\Microsoft.Identity.Web.csproj", "{DDD841C1-4657-4FE4-ABE1-529D02E03235}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
1517
{8DCFEEC2-0A85-4C7E-B96A-21C9184470B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{8DCFEEC2-0A85-4C7E-B96A-21C9184470B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{8DCFEEC2-0A85-4C7E-B96A-21C9184470B1}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{DDD841C1-4657-4FE4-ABE1-529D02E03235}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{DDD841C1-4657-4FE4-ABE1-529D02E03235}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{DDD841C1-4657-4FE4-ABE1-529D02E03235}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{DDD841C1-4657-4FE4-ABE1-529D02E03235}.Release|Any CPU.Build.0 = Release|Any CPU
1824
EndGlobalSection
1925
GlobalSection(SolutionProperties) = preSolution
2026
HideSolutionNode = FALSE

2-WebApp-graph-user/2-1-Call-MSGraph/Startup.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ public void ConfigureServices(IServiceCollection services)
3030
{
3131
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
3232
options.CheckConsentNeeded = context => true;
33-
options.MinimumSameSitePolicy = SameSiteMode.None;
33+
options.MinimumSameSitePolicy = SameSiteMode.Unspecified;
34+
// Handling SameSite cookie according to https://docs.microsoft.com/en-us/aspnet/core/security/samesite?view=aspnetcore-3.1
35+
options.HandleSameSiteCookieCompatibility();
3436
});
3537

3638
services.AddOptions();

4-WebApp-your-API/Client/Startup.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public void ConfigureServices(IServiceCollection services)
3131
{
3232
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
3333
options.CheckConsentNeeded = context => true;
34-
options.MinimumSameSitePolicy = SameSiteMode.None;
34+
options.MinimumSameSitePolicy = SameSiteMode.Unspecified;
35+
// Handling SameSite cookie according to https://docs.microsoft.com/en-us/aspnet/core/security/samesite?view=aspnetcore-3.1
36+
options.HandleSameSiteCookieCompatibility();
3537
});
3638

3739
services.AddOptions();

0 commit comments

Comments
 (0)