From 99831ff262bfb264dcaa567bc20f1513c6b7b755 Mon Sep 17 00:00:00 2001 From: Brock Allen Date: Fri, 23 Sep 2022 10:25:24 -0400 Subject: [PATCH 1/3] nuget updates, including Duende ATM --- migrations/UserSessionDb/UserSessionDb.csproj | 6 +++--- samples/Api/Api.csproj | 4 ++-- samples/Blazor6/Client/Blazor6.Client.csproj | 6 +++--- samples/Blazor6/Server/Blazor6.Server.csproj | 6 +++--- samples/IdentityServer/IdentityServer.csproj | 4 ++-- samples/JS.Yarp/JS.Yarp.csproj | 4 ++-- samples/JS6.EF/JS6.EF.csproj | 8 ++++---- samples/JS6/JS6.csproj | 4 ++-- .../Duende.Bff.EntityFramework.csproj | 2 +- src/Duende.Bff/Duende.Bff.csproj | 2 +- .../Duende.Bff.EntityFramework.Tests.csproj | 14 +++++++------- test/Duende.Bff.Tests/Duende.Bff.Tests.csproj | 14 +++++++------- 12 files changed, 37 insertions(+), 37 deletions(-) diff --git a/migrations/UserSessionDb/UserSessionDb.csproj b/migrations/UserSessionDb/UserSessionDb.csproj index 508ac1b3..040bbe29 100644 --- a/migrations/UserSessionDb/UserSessionDb.csproj +++ b/migrations/UserSessionDb/UserSessionDb.csproj @@ -5,12 +5,12 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/samples/Api/Api.csproj b/samples/Api/Api.csproj index c9eaf6cf..2a106267 100644 --- a/samples/Api/Api.csproj +++ b/samples/Api/Api.csproj @@ -5,7 +5,7 @@ - - + + diff --git a/samples/Blazor6/Client/Blazor6.Client.csproj b/samples/Blazor6/Client/Blazor6.Client.csproj index e0bccea0..8b2fa414 100644 --- a/samples/Blazor6/Client/Blazor6.Client.csproj +++ b/samples/Blazor6/Client/Blazor6.Client.csproj @@ -7,9 +7,9 @@ - - - + + + diff --git a/samples/Blazor6/Server/Blazor6.Server.csproj b/samples/Blazor6/Server/Blazor6.Server.csproj index df1c2fe1..f49d3535 100644 --- a/samples/Blazor6/Server/Blazor6.Server.csproj +++ b/samples/Blazor6/Server/Blazor6.Server.csproj @@ -7,10 +7,10 @@ - - + + - + diff --git a/samples/IdentityServer/IdentityServer.csproj b/samples/IdentityServer/IdentityServer.csproj index 7e2b24bd..c86dd4a9 100644 --- a/samples/IdentityServer/IdentityServer.csproj +++ b/samples/IdentityServer/IdentityServer.csproj @@ -6,8 +6,8 @@ - - + + \ No newline at end of file diff --git a/samples/JS.Yarp/JS.Yarp.csproj b/samples/JS.Yarp/JS.Yarp.csproj index 3dc663e8..de8e25c4 100644 --- a/samples/JS.Yarp/JS.Yarp.csproj +++ b/samples/JS.Yarp/JS.Yarp.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/samples/JS6.EF/JS6.EF.csproj b/samples/JS6.EF/JS6.EF.csproj index 8fa1582b..dacd8db0 100644 --- a/samples/JS6.EF/JS6.EF.csproj +++ b/samples/JS6.EF/JS6.EF.csproj @@ -5,10 +5,10 @@ - - - - + + + + diff --git a/samples/JS6/JS6.csproj b/samples/JS6/JS6.csproj index ee1beeae..2c9853f5 100644 --- a/samples/JS6/JS6.csproj +++ b/samples/JS6/JS6.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/Duende.Bff.EntityFramework/Duende.Bff.EntityFramework.csproj b/src/Duende.Bff.EntityFramework/Duende.Bff.EntityFramework.csproj index 62b04002..b12b12b4 100644 --- a/src/Duende.Bff.EntityFramework/Duende.Bff.EntityFramework.csproj +++ b/src/Duende.Bff.EntityFramework/Duende.Bff.EntityFramework.csproj @@ -40,7 +40,7 @@ - + diff --git a/src/Duende.Bff/Duende.Bff.csproj b/src/Duende.Bff/Duende.Bff.csproj index 58091203..c10bbcfb 100644 --- a/src/Duende.Bff/Duende.Bff.csproj +++ b/src/Duende.Bff/Duende.Bff.csproj @@ -35,7 +35,7 @@ - + diff --git a/test/Duende.Bff.EntityFramework.Tests/Duende.Bff.EntityFramework.Tests.csproj b/test/Duende.Bff.EntityFramework.Tests/Duende.Bff.EntityFramework.Tests.csproj index e5cd5cd4..69d72212 100644 --- a/test/Duende.Bff.EntityFramework.Tests/Duende.Bff.EntityFramework.Tests.csproj +++ b/test/Duende.Bff.EntityFramework.Tests/Duende.Bff.EntityFramework.Tests.csproj @@ -4,23 +4,23 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + - + diff --git a/test/Duende.Bff.Tests/Duende.Bff.Tests.csproj b/test/Duende.Bff.Tests/Duende.Bff.Tests.csproj index 3ae63607..51c91e27 100644 --- a/test/Duende.Bff.Tests/Duende.Bff.Tests.csproj +++ b/test/Duende.Bff.Tests/Duende.Bff.Tests.csproj @@ -6,22 +6,22 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - - + + + From 748d907a564dfc08364c1cf4697dd89abec51075 Mon Sep 17 00:00:00 2001 From: Brock Allen Date: Fri, 23 Sep 2022 10:37:54 -0400 Subject: [PATCH 2/3] update FluentAssertions --- .../Duende.Bff.EntityFramework.Tests.csproj | 2 +- .../UserSessionStoreTests.cs | 10 +++++----- test/Duende.Bff.Tests/Duende.Bff.Tests.csproj | 2 +- .../Endpoints/Management/LoginEndpointTests.cs | 4 ++-- .../Management/LogoutEndpointTests.cs | 18 +++++++++--------- .../Management/ManagementBasePathTests.cs | 3 ++- .../Endpoints/Management/UserEndpointTests.cs | 5 +++-- .../Endpoints/RemoteEndpointTests.cs | 8 ++++---- test/Duende.Bff.Tests/GenericHostTests.cs | 3 ++- .../TestFramework/GenericHost.cs | 5 +++-- .../TestFramework/TestBrowserClient.cs | 2 +- test/Duende.Bff.Tests/TestHosts/BffHost.cs | 16 ++++++++-------- .../BffHostUsingResourceNamedTokens.cs | 16 ++++++++-------- 13 files changed, 49 insertions(+), 45 deletions(-) diff --git a/test/Duende.Bff.EntityFramework.Tests/Duende.Bff.EntityFramework.Tests.csproj b/test/Duende.Bff.EntityFramework.Tests/Duende.Bff.EntityFramework.Tests.csproj index 69d72212..ab3fbe0c 100644 --- a/test/Duende.Bff.EntityFramework.Tests/Duende.Bff.EntityFramework.Tests.csproj +++ b/test/Duende.Bff.EntityFramework.Tests/Duende.Bff.EntityFramework.Tests.csproj @@ -10,7 +10,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/test/Duende.Bff.EntityFramework.Tests/UserSessionStoreTests.cs b/test/Duende.Bff.EntityFramework.Tests/UserSessionStoreTests.cs index ba041844..8b79dda5 100644 --- a/test/Duende.Bff.EntityFramework.Tests/UserSessionStoreTests.cs +++ b/test/Duende.Bff.EntityFramework.Tests/UserSessionStoreTests.cs @@ -486,10 +486,10 @@ await _subject.CreateUserSessionAsync(new UserSession } } [Fact] - public void GetUserSessionsAsync_for_missing_sub_and_sid_should_throw() + public async Task GetUserSessionsAsync_for_missing_sub_and_sid_should_throw() { Func f = () => _subject.GetUserSessionsAsync(new UserSessionsFilter()); - f.Should().Throw(); + await f.Should().ThrowAsync(); } @@ -801,10 +801,10 @@ await _subject.CreateUserSessionAsync(new UserSession } } [Fact] - public void DeleteUserSessionsAsync_for_missing_sub_and_sid_should_throw() + public async Task DeleteUserSessionsAsync_for_missing_sub_and_sid_should_throw() { Func f = () => _subject.DeleteUserSessionsAsync(new UserSessionsFilter()); - f.Should().Throw(); + await f.Should().ThrowAsync(); } [Fact] @@ -841,7 +841,7 @@ public async Task concurrent_deletes_with_exception_handler_and_detatching_shoul await ctx1.SaveChangesAsync(); Func f1 = async () => await ctx2.SaveChangesAsync(); - f1.Should().Throw(); + await f1.Should().ThrowAsync(); try { diff --git a/test/Duende.Bff.Tests/Duende.Bff.Tests.csproj b/test/Duende.Bff.Tests/Duende.Bff.Tests.csproj index 51c91e27..58567d9a 100644 --- a/test/Duende.Bff.Tests/Duende.Bff.Tests.csproj +++ b/test/Duende.Bff.Tests/Duende.Bff.Tests.csproj @@ -12,7 +12,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/test/Duende.Bff.Tests/Endpoints/Management/LoginEndpointTests.cs b/test/Duende.Bff.Tests/Endpoints/Management/LoginEndpointTests.cs index a41740e5..56df5183 100644 --- a/test/Duende.Bff.Tests/Endpoints/Management/LoginEndpointTests.cs +++ b/test/Duende.Bff.Tests/Endpoints/Management/LoginEndpointTests.cs @@ -149,10 +149,10 @@ public async Task login_endpoint_should_accept_returnUrl() } [Fact] - public void login_endpoint_should_not_accept_non_local_returnUrl() + public async Task login_endpoint_should_not_accept_non_local_returnUrl() { Func f = () => BffHost.BrowserClient.GetAsync(BffHost.Url("/bff/login") + "?returnUrl=https://foo"); - f.Should().Throw().And.Message.Should().Contain("returnUrl"); + (await f.Should().ThrowAsync()).And.Message.Should().Contain("returnUrl"); } } } diff --git a/test/Duende.Bff.Tests/Endpoints/Management/LogoutEndpointTests.cs b/test/Duende.Bff.Tests/Endpoints/Management/LogoutEndpointTests.cs index fd4c55c2..26e8d42f 100644 --- a/test/Duende.Bff.Tests/Endpoints/Management/LogoutEndpointTests.cs +++ b/test/Duende.Bff.Tests/Endpoints/Management/LogoutEndpointTests.cs @@ -48,7 +48,7 @@ public async Task logout_endpoint_for_authenticated_should_require_sid() await BffHost.BffLoginAsync("alice", "sid123"); Func f = () => BffHost.BffLogoutAsync(); - f.Should().Throw(); + await f.Should().ThrowAsync(); (await BffHost.GetIsUserLoggedInAsync()).Should().BeTrue(); } @@ -61,7 +61,7 @@ public async Task logout_endpoint_for_authenticated_when_require_otpion_is_false BffHost.BffOptions.RequireLogoutSessionId = false; var response = await BffHost.BrowserClient.GetAsync(BffHost.Url("/bff/logout")); - response.StatusCode.Should().Be(302); // endsession + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // endsession response.Headers.Location.ToString().ToLowerInvariant().Should().StartWith(IdentityServerHost.Url("/connect/endsession")); } @@ -79,7 +79,7 @@ public async Task logout_endpoint_for_authenticated_user_without_sid_should_succ await BffHost.IssueSessionCookieAsync("alice"); var response = await BffHost.BrowserClient.GetAsync(BffHost.Url("/bff/logout")); - response.StatusCode.Should().Be(302); // endsession + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // endsession response.Headers.Location.ToString().ToLowerInvariant().Should().StartWith(IdentityServerHost.Url("/connect/endsession")); } @@ -87,7 +87,7 @@ public async Task logout_endpoint_for_authenticated_user_without_sid_should_succ public async Task logout_endpoint_for_anonymous_user_without_sid_should_succeed() { var response = await BffHost.BrowserClient.GetAsync(BffHost.Url("/bff/logout")); - response.StatusCode.Should().Be(302); // endsession + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // endsession response.Headers.Location.ToString().ToLowerInvariant().Should().StartWith(IdentityServerHost.Url("/connect/endsession")); } @@ -108,19 +108,19 @@ public async Task logout_endpoint_should_accept_returnUrl() await BffHost.BffLoginAsync("alice", "sid123"); var response = await BffHost.BrowserClient.GetAsync(BffHost.Url("/bff/logout") + "?sid=sid123&returnUrl=/foo"); - response.StatusCode.Should().Be(302); // endsession + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // endsession response.Headers.Location.ToString().ToLowerInvariant().Should().StartWith(IdentityServerHost.Url("/connect/endsession")); response = await IdentityServerHost.BrowserClient.GetAsync(response.Headers.Location.ToString()); - response.StatusCode.Should().Be(302); // logout + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // logout response.Headers.Location.ToString().ToLowerInvariant().Should().StartWith(IdentityServerHost.Url("/account/logout")); response = await IdentityServerHost.BrowserClient.GetAsync(response.Headers.Location.ToString()); - response.StatusCode.Should().Be(302); // post logout redirect uri + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // post logout redirect uri response.Headers.Location.ToString().ToLowerInvariant().Should().StartWith(BffHost.Url("/signout-callback-oidc")); response = await BffHost.BrowserClient.GetAsync(response.Headers.Location.ToString()); - response.StatusCode.Should().Be(302); // root + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // root response.Headers.Location.ToString().ToLowerInvariant().Should().Be("/foo"); } @@ -130,7 +130,7 @@ public async Task logout_endpoint_should_reject_non_local_returnUrl() await BffHost.BffLoginAsync("alice", "sid123"); Func f = () => BffHost.BrowserClient.GetAsync(BffHost.Url("/bff/logout") + "?sid=sid123&returnUrl=https://foo"); - f.Should().Throw().And.Message.Should().Contain("returnUrl"); + (await f.Should().ThrowAsync()).And.Message.Should().Contain("returnUrl"); } } } diff --git a/test/Duende.Bff.Tests/Endpoints/Management/ManagementBasePathTests.cs b/test/Duende.Bff.Tests/Endpoints/Management/ManagementBasePathTests.cs index bd1ffcc7..b405dcab 100644 --- a/test/Duende.Bff.Tests/Endpoints/Management/ManagementBasePathTests.cs +++ b/test/Duende.Bff.Tests/Endpoints/Management/ManagementBasePathTests.cs @@ -8,6 +8,7 @@ using Xunit; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; +using System.Net; namespace Duende.Bff.Tests.Endpoints.Management { @@ -33,7 +34,7 @@ public async Task custom_ManagementBasePath_should_affect_basepath(string path) var response = await BffHost.BrowserClient.SendAsync(req); - response.StatusCode.Should().NotBe(404); + response.StatusCode.Should().NotBe(HttpStatusCode.NotFound); } } } diff --git a/test/Duende.Bff.Tests/Endpoints/Management/UserEndpointTests.cs b/test/Duende.Bff.Tests/Endpoints/Management/UserEndpointTests.cs index 4b4b9fe7..1e272fc6 100644 --- a/test/Duende.Bff.Tests/Endpoints/Management/UserEndpointTests.cs +++ b/test/Duende.Bff.Tests/Endpoints/Management/UserEndpointTests.cs @@ -8,6 +8,7 @@ using System.Security.Claims; using System.Threading.Tasks; using Xunit; +using System.Net; namespace Duende.Bff.Tests.Endpoints.Management { @@ -58,7 +59,7 @@ public async Task user_endpoint_for_authenticated_user_without_csrf_header_shoul var req = new HttpRequestMessage(HttpMethod.Get, BffHost.Url("/bff/user")); var response = await BffHost.BrowserClient.SendAsync(req); - response.StatusCode.Should().Be(401); + response.StatusCode.Should().Be(HttpStatusCode.Unauthorized); } [Fact] @@ -68,7 +69,7 @@ public async Task user_endpoint_for_unauthenticated_user_should_fail() req.Headers.Add("x-csrf", "1"); var response = await BffHost.BrowserClient.SendAsync(req); - response.StatusCode.Should().Be(401); + response.StatusCode.Should().Be(HttpStatusCode.Unauthorized); } [Fact] diff --git a/test/Duende.Bff.Tests/Endpoints/RemoteEndpointTests.cs b/test/Duende.Bff.Tests/Endpoints/RemoteEndpointTests.cs index 529ba957..8f6686a0 100644 --- a/test/Duende.Bff.Tests/Endpoints/RemoteEndpointTests.cs +++ b/test/Duende.Bff.Tests/Endpoints/RemoteEndpointTests.cs @@ -331,21 +331,21 @@ public async Task endpoints_that_disable_csrf_should_not_require_csrf_header() } [Fact] - public void calls_to_endpoint_without_bff_metadata_should_fail() + public async Task calls_to_endpoint_without_bff_metadata_should_fail() { var req = new HttpRequestMessage(HttpMethod.Get, BffHost.Url("/not_bff_endpoint")); Func f = () => BffHost.BrowserClient.SendAsync(req); - f.Should().Throw(); + await f.Should().ThrowAsync(); } [Fact] - public void calls_to_bff_not_in_endpoint_routing_should_fail() + public async Task calls_to_bff_not_in_endpoint_routing_should_fail() { var req = new HttpRequestMessage(HttpMethod.Get, BffHost.Url("/invalid_endpoint/test")); Func f = () => BffHost.BrowserClient.SendAsync(req); - f.Should().Throw(); + await f.Should().ThrowAsync(); } } } diff --git a/test/Duende.Bff.Tests/GenericHostTests.cs b/test/Duende.Bff.Tests/GenericHostTests.cs index 5d04052e..2346821b 100644 --- a/test/Duende.Bff.Tests/GenericHostTests.cs +++ b/test/Duende.Bff.Tests/GenericHostTests.cs @@ -4,6 +4,7 @@ using Duende.Bff.Tests.TestFramework; using FluentAssertions; using Microsoft.AspNetCore.Builder; +using System.Net; using System.Threading.Tasks; using Xunit; @@ -23,7 +24,7 @@ public async Task Test1() var response = await host.HttpClient.GetAsync("/test"); - response.StatusCode.Should().Be(204); + response.StatusCode.Should().Be(HttpStatusCode.NoContent); } } } diff --git a/test/Duende.Bff.Tests/TestFramework/GenericHost.cs b/test/Duende.Bff.Tests/TestFramework/GenericHost.cs index 6818856e..6b08e78f 100644 --- a/test/Duende.Bff.Tests/TestFramework/GenericHost.cs +++ b/test/Duende.Bff.Tests/TestFramework/GenericHost.cs @@ -11,6 +11,7 @@ using Microsoft.Extensions.Logging; using System; using System.Linq; +using System.Net; using System.Net.Http; using System.Reflection; using System.Security.Claims; @@ -131,7 +132,7 @@ void ConfigureSignout(IApplicationBuilder app) public async Task RevokeSessionCookieAsync() { var response = await BrowserClient.GetAsync(Url("__signout")); - response.StatusCode.Should().Be(204); + response.StatusCode.Should().Be(HttpStatusCode.NoContent); } @@ -165,7 +166,7 @@ public async Task IssueSessionCookieAsync(params Claim[] claims) { _userToSignIn = new ClaimsPrincipal(new ClaimsIdentity(claims, "test", "name", "role")); var response = await BrowserClient.GetAsync(Url("__signin")); - response.StatusCode.Should().Be(204); + response.StatusCode.Should().Be(HttpStatusCode.NoContent); } public Task IssueSessionCookieAsync(AuthenticationProperties props, params Claim[] claims) { diff --git a/test/Duende.Bff.Tests/TestFramework/TestBrowserClient.cs b/test/Duende.Bff.Tests/TestFramework/TestBrowserClient.cs index 5ec262c2..a3648cf0 100644 --- a/test/Duende.Bff.Tests/TestFramework/TestBrowserClient.cs +++ b/test/Duende.Bff.Tests/TestFramework/TestBrowserClient.cs @@ -91,7 +91,7 @@ public void RemoveCookie(string uri, string name) public async Task FollowRedirectAsync() { - LastResponse.StatusCode.Should().Be(302); + LastResponse.StatusCode.Should().Be(HttpStatusCode.Redirect); var location = LastResponse.Headers.Location.ToString(); await GetAsync(location); } diff --git a/test/Duende.Bff.Tests/TestHosts/BffHost.cs b/test/Duende.Bff.Tests/TestHosts/BffHost.cs index a5e4da4f..b1bb6d19 100644 --- a/test/Duende.Bff.Tests/TestHosts/BffHost.cs +++ b/test/Duende.Bff.Tests/TestHosts/BffHost.cs @@ -335,7 +335,7 @@ public async Task> CallUserEndpointAsync() var response = await BrowserClient.SendAsync(req); - response.StatusCode.Should().Be(200); + response.StatusCode.Should().Be(HttpStatusCode.OK); response.Content.Headers.ContentType.MediaType.Should().Be("application/json"); var json = await response.Content.ReadAsStringAsync(); @@ -351,16 +351,16 @@ public async Task BffLoginAsync(string sub, string sid = nu public async Task BffOidcLoginAsync() { var response = await BrowserClient.GetAsync(Url("/bff/login")); - response.StatusCode.Should().Be(302); // authorize + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // authorize response.Headers.Location.ToString().ToLowerInvariant().Should() .StartWith(_identityServerHost.Url("/connect/authorize")); response = await _identityServerHost.BrowserClient.GetAsync(response.Headers.Location.ToString()); - response.StatusCode.Should().Be(302); // client callback + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // client callback response.Headers.Location.ToString().ToLowerInvariant().Should().StartWith(Url("/signin-oidc")); response = await BrowserClient.GetAsync(response.Headers.Location.ToString()); - response.StatusCode.Should().Be(302); // root + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // root response.Headers.Location.ToString().ToLowerInvariant().Should().Be("/"); (await GetIsUserLoggedInAsync()).Should().BeTrue(); @@ -372,21 +372,21 @@ public async Task BffOidcLoginAsync() public async Task BffLogoutAsync(string sid = null) { var response = await BrowserClient.GetAsync(Url("/bff/logout") + "?sid=" + sid); - response.StatusCode.Should().Be(302); // endsession + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // endsession response.Headers.Location.ToString().ToLowerInvariant().Should() .StartWith(_identityServerHost.Url("/connect/endsession")); response = await _identityServerHost.BrowserClient.GetAsync(response.Headers.Location.ToString()); - response.StatusCode.Should().Be(302); // logout + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // logout response.Headers.Location.ToString().ToLowerInvariant().Should() .StartWith(_identityServerHost.Url("/account/logout")); response = await _identityServerHost.BrowserClient.GetAsync(response.Headers.Location.ToString()); - response.StatusCode.Should().Be(302); // post logout redirect uri + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // post logout redirect uri response.Headers.Location.ToString().ToLowerInvariant().Should().StartWith(Url("/signout-callback-oidc")); response = await BrowserClient.GetAsync(response.Headers.Location.ToString()); - response.StatusCode.Should().Be(302); // root + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // root response.Headers.Location.ToString().ToLowerInvariant().Should().Be("/"); (await GetIsUserLoggedInAsync()).Should().BeFalse(); diff --git a/test/Duende.Bff.Tests/TestHosts/BffHostUsingResourceNamedTokens.cs b/test/Duende.Bff.Tests/TestHosts/BffHostUsingResourceNamedTokens.cs index d2498618..608aef7b 100644 --- a/test/Duende.Bff.Tests/TestHosts/BffHostUsingResourceNamedTokens.cs +++ b/test/Duende.Bff.Tests/TestHosts/BffHostUsingResourceNamedTokens.cs @@ -176,7 +176,7 @@ public async Task> CallUserEndpointAsync() var response = await BrowserClient.SendAsync(req); - response.StatusCode.Should().Be(200); + response.StatusCode.Should().Be(HttpStatusCode.OK); response.Content.Headers.ContentType.MediaType.Should().Be("application/json"); var json = await response.Content.ReadAsStringAsync(); @@ -192,16 +192,16 @@ public async Task BffLoginAsync(string sub, string sid = nu public async Task BffOidcLoginAsync() { var response = await BrowserClient.GetAsync(Url("/bff/login")); - response.StatusCode.Should().Be(302); // authorize + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // authorize response.Headers.Location.ToString().ToLowerInvariant().Should() .StartWith(_identityServerHost.Url("/connect/authorize")); response = await _identityServerHost.BrowserClient.GetAsync(response.Headers.Location.ToString()); - response.StatusCode.Should().Be(302); // client callback + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // client callback response.Headers.Location.ToString().ToLowerInvariant().Should().StartWith(Url("/signin-oidc")); response = await BrowserClient.GetAsync(response.Headers.Location.ToString()); - response.StatusCode.Should().Be(302); // root + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // root response.Headers.Location.ToString().ToLowerInvariant().Should().Be("/"); (await GetIsUserLoggedInAsync()).Should().BeTrue(); @@ -213,21 +213,21 @@ public async Task BffOidcLoginAsync() public async Task BffLogoutAsync(string sid = null) { var response = await BrowserClient.GetAsync(Url("/bff/logout") + "?sid=" + sid); - response.StatusCode.Should().Be(302); // endsession + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // endsession response.Headers.Location.ToString().ToLowerInvariant().Should() .StartWith(_identityServerHost.Url("/connect/endsession")); response = await _identityServerHost.BrowserClient.GetAsync(response.Headers.Location.ToString()); - response.StatusCode.Should().Be(302); // logout + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // logout response.Headers.Location.ToString().ToLowerInvariant().Should() .StartWith(_identityServerHost.Url("/account/logout")); response = await _identityServerHost.BrowserClient.GetAsync(response.Headers.Location.ToString()); - response.StatusCode.Should().Be(302); // post logout redirect uri + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // post logout redirect uri response.Headers.Location.ToString().ToLowerInvariant().Should().StartWith(Url("/signout-callback-oidc")); response = await BrowserClient.GetAsync(response.Headers.Location.ToString()); - response.StatusCode.Should().Be(302); // root + response.StatusCode.Should().Be(HttpStatusCode.Redirect); // root response.Headers.Location.ToString().ToLowerInvariant().Should().Be("/"); (await GetIsUserLoggedInAsync()).Should().BeFalse(); From fe3fad0b95fc930ae66819eb4535314f5e8c36a6 Mon Sep 17 00:00:00 2001 From: Brock Allen Date: Fri, 23 Sep 2022 13:50:26 -0400 Subject: [PATCH 3/3] update MinVer --- .../Duende.Bff.EntityFramework.csproj | 2 +- src/Duende.Bff.Yarp/Duende.Bff.Yarp.csproj | 2 +- src/Duende.Bff/Duende.Bff.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Duende.Bff.EntityFramework/Duende.Bff.EntityFramework.csproj b/src/Duende.Bff.EntityFramework/Duende.Bff.EntityFramework.csproj index b12b12b4..b9a05823 100644 --- a/src/Duende.Bff.EntityFramework/Duende.Bff.EntityFramework.csproj +++ b/src/Duende.Bff.EntityFramework/Duende.Bff.EntityFramework.csproj @@ -44,7 +44,7 @@ - + diff --git a/src/Duende.Bff.Yarp/Duende.Bff.Yarp.csproj b/src/Duende.Bff.Yarp/Duende.Bff.Yarp.csproj index 8cc10733..fec733ce 100644 --- a/src/Duende.Bff.Yarp/Duende.Bff.Yarp.csproj +++ b/src/Duende.Bff.Yarp/Duende.Bff.Yarp.csproj @@ -31,7 +31,7 @@ - + diff --git a/src/Duende.Bff/Duende.Bff.csproj b/src/Duende.Bff/Duende.Bff.csproj index c10bbcfb..d89c0c18 100644 --- a/src/Duende.Bff/Duende.Bff.csproj +++ b/src/Duende.Bff/Duende.Bff.csproj @@ -32,7 +32,7 @@ - +