From 40105639662de11d3633817f0cb89514e7da8d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Sat, 16 Apr 2022 19:25:10 +0200 Subject: [PATCH] Update the client OWIN host to restore AuthenticationProperties.RedirectUri --- .../Controllers/AuthenticationController.cs | 7 +++---- src/OpenIddict.Client.Owin/OpenIddictClientOwinHandler.cs | 6 +++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/sandbox/OpenIddict.Sandbox.AspNet.Client/Controllers/AuthenticationController.cs b/sandbox/OpenIddict.Sandbox.AspNet.Client/Controllers/AuthenticationController.cs index 9331ad58..6cc3def3 100644 --- a/sandbox/OpenIddict.Sandbox.AspNet.Client/Controllers/AuthenticationController.cs +++ b/sandbox/OpenIddict.Sandbox.AspNet.Client/Controllers/AuthenticationController.cs @@ -112,8 +112,7 @@ namespace OpenIddict.Sandbox.AspNet.Client.Controllers // The antiforgery components require both the nameidentifier and identityprovider claims // so the latter is manually added using the issuer identity resolved from the remote server. - claims.Add(new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider", - result.Identity.FindFirst(Claims.Subject).Issuer)); + claims.Add(new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider", claims[0].Issuer)); var identity = new ClaimsIdentity(claims, authenticationType: CookieAuthenticationDefaults.AuthenticationType, @@ -133,8 +132,8 @@ namespace OpenIddict.Sandbox.AspNet.Client.Controllers context.Authentication.SignIn(properties, identity); return Redirect(properties.RedirectUri); - static string? GetProperty(AuthenticationProperties properties, string name) - => properties.Dictionary.TryGetValue(name, out var value) ? value : null; + static string GetProperty(AuthenticationProperties properties, string name) + => properties.Dictionary.TryGetValue(name, out var value) ? value : string.Empty; } [AcceptVerbs("GET", "POST"), Route("~/logout")] diff --git a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandler.cs b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandler.cs index 774cd188..26862619 100644 --- a/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandler.cs +++ b/src/OpenIddict.Client.Owin/OpenIddictClientOwinHandler.cs @@ -176,7 +176,11 @@ public class OpenIddictClientOwinHandler : AuthenticationHandler