Skip to content

Commit 71f56db

Browse files
committed
More Fixes
1 parent cabb9d6 commit 71f56db

6 files changed

Lines changed: 28 additions & 55 deletions

File tree

‎tests/CodeBeam.UltimateAuth.IdentityLab.Tests/CodeBeam.UltimateAuth.IdentityLab.Tests.csproj‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFramework>net10.0</TargetFramework>
44
<IsPackable>false</IsPackable>
@@ -8,7 +8,7 @@
88
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
99
<PackageReference Include="xunit" Version="2.9.3" />
1010
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" PrivateAssets="all" />
11-
<PackageReference Include="coverlet.collector" Version="6.0.4" PrivateAssets="all" />
11+
<PackageReference Include="coverlet.collector" Version="10.1.0" PrivateAssets="all" />
1212
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.12" />
1313
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.12" />
1414
<PackageReference Include="bunit" Version="2.11.3" />

‎tests/CodeBeam.UltimateAuth.Tests.Integration.EfCore/CodeBeam.UltimateAuth.Tests.Integration.EfCore.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="coverlet.collector" Version="6.0.4" />
11+
<PackageReference Include="coverlet.collector" Version="10.1.0" />
1212
<PackageReference Include="AwesomeAssertions" Version="9.6.0" />
1313
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
1414
<PackageReference Include="xunit" Version="2.9.3" />

‎tests/CodeBeam.UltimateAuth.Tests.Integration/CodeBeam.UltimateAuth.Tests.Integration.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="coverlet.collector" Version="6.0.4" />
11+
<PackageReference Include="coverlet.collector" Version="10.1.0" />
1212
<PackageReference Include="AwesomeAssertions" Version="9.6.0" />
1313
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.5" />
1414
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="10.0.12" />

‎tests/CodeBeam.UltimateAuth.Tests.Integration/LogoutTests.cs‎

Lines changed: 19 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,8 @@ public async Task Logout_ShouldNotRevokeDeviceChain()
514514
var chainBefore = before!.Items.Single(x => x.IsCurrentDevice);
515515
var chainId = chainBefore.ChainId;
516516

517-
await CsrfTestClient.PostAsync(client, "/auth/logout", null);
517+
var logout = await CsrfTestClient.PostAsync(client, "/auth/logout", null);
518+
logout.StatusCode.Should().Be(HttpStatusCode.Found);
518519

519520
using var reloginClient = CreateClient(device);
520521

@@ -979,46 +980,6 @@ await CsrfTestClient.PostJsonAsync(device2Client,
979980
device2After.IsRevoked.Should().BeFalse();
980981
}
981982

982-
[Fact]
983-
public async Task Logout_WithAlreadyLoggedOutSession_ShouldRemainSafe()
984-
{
985-
_factory.Clock.Reset();
986-
987-
var user = await _factory.CreateLoginUserAsync();
988-
var device = $"logout-idempotent-{Guid.NewGuid():N}";
989-
990-
using var client = CreateClient(device);
991-
992-
var login = await LoginAsync(
993-
client,
994-
user.Identifier,
995-
user.Secret);
996-
997-
login.StatusCode.Should().Be(HttpStatusCode.Found);
998-
999-
var cookie = GetSessionCookie(login);
1000-
1001-
client.DefaultRequestHeaders.Add("Cookie", cookie);
1002-
1003-
var firstLogout = await CsrfTestClient.PostAsync(client, "/auth/logout", null);
1004-
1005-
firstLogout.StatusCode.Should().Be(HttpStatusCode.Found);
1006-
1007-
var secondLogout = await CsrfTestClient.PostAsync(client, "/auth/logout", null);
1008-
1009-
secondLogout.StatusCode.Should().BeOneOf(HttpStatusCode.Unauthorized, HttpStatusCode.Found);
1010-
1011-
var authenticatedRequest = await CsrfTestClient.PostJsonAsync(client,
1012-
"/auth/me/sessions/chains",
1013-
new PageRequest
1014-
{
1015-
PageNumber = 1,
1016-
PageSize = 50
1017-
});
1018-
1019-
authenticatedRequest.StatusCode.Should().Be(HttpStatusCode.Unauthorized);
1020-
}
1021-
1022983
[Fact]
1023984
public async Task Logout_ShouldNotReturnAuthenticationCredentials()
1024985
{
@@ -1276,15 +1237,23 @@ public async Task ConcurrentLogout_WithSameSession_ShouldLeaveSessionInvalid()
12761237
CsrfTestClient.PostAsync(client1, "/auth/logout", null),
12771238
CsrfTestClient.PostAsync(client2, "/auth/logout", null));
12781239

1279-
//
1280-
// Depending on where stale-session rejection occurs,
1281-
// one request may observe the session after the other revoked it.
1282-
//
1283-
// What must never happen is an infrastructure failure.
1284-
//
1285-
responses.Should().OnlyContain(x =>
1286-
x.StatusCode == HttpStatusCode.Found ||
1287-
x.StatusCode == HttpStatusCode.Unauthorized);
1240+
foreach (var response in responses)
1241+
{
1242+
if (response.StatusCode == HttpStatusCode.BadRequest)
1243+
{
1244+
var body = await response.Content.ReadAsStringAsync();
1245+
1246+
body.Should().Contain("invalid_antiforgery_token");
1247+
continue;
1248+
}
1249+
1250+
response.StatusCode.Should().BeOneOf(
1251+
HttpStatusCode.Found,
1252+
HttpStatusCode.Unauthorized);
1253+
}
1254+
1255+
responses.Should().Contain(x =>
1256+
x.StatusCode == HttpStatusCode.Found);
12881257

12891258
//
12901259
// Final state is the actual security invariant.

‎tests/CodeBeam.UltimateAuth.Tests.RateLimiting.Compatibility/CodeBeam.UltimateAuth.Tests.RateLimiting.Compatibility.csproj‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
99
<PackageReference Include="xunit" Version="2.9.3" />
1010
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
11+
<PackageReference Include="coverlet.collector" Version="10.1.0">
12+
<PrivateAssets>all</PrivateAssets>
13+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14+
</PackageReference>
1115
<Using Include="Xunit" />
1216
<ProjectReference Include="../../src/bundle/CodeBeam.UltimateAuth.InMemory.Bundle/CodeBeam.UltimateAuth.InMemory.Bundle.csproj" />
1317
<!-- Reuse the actual pipeline contracts, without the net10-only sample host or duplicated test code. -->

‎tests/CodeBeam.UltimateAuth.Tests.Unit/CodeBeam.UltimateAuth.Tests.Unit.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="bunit" Version="2.11.3" />
12-
<PackageReference Include="coverlet.collector" Version="10.0.1">
12+
<PackageReference Include="coverlet.collector" Version="10.1.0">
1313
<PrivateAssets>all</PrivateAssets>
1414
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1515
</PackageReference>

0 commit comments

Comments
 (0)