diff --git a/Sustainsys.Saml2.Owin/Saml2AuthenticationHandler.cs b/Sustainsys.Saml2.Owin/Saml2AuthenticationHandler.cs index 88cf37b48..1fab27ca5 100644 --- a/Sustainsys.Saml2.Owin/Saml2AuthenticationHandler.cs +++ b/Sustainsys.Saml2.Owin/Saml2AuthenticationHandler.cs @@ -65,6 +65,9 @@ private AuthenticationTicket CreateErrorAuthenticationTicket(HttpRequestData htt { authProperties = new AuthenticationProperties( httpRequestData.StoredRequestState.RelayData); + } else + { + authProperties = new AuthenticationProperties(); } if (httpRequestData.StoredRequestState?.ReturnUrl != null) @@ -86,10 +89,7 @@ private AuthenticationTicket CreateErrorAuthenticationTicket(HttpRequestData htt redirectUrl = httpRequestData.ApplicationUrl; } - authProperties = new AuthenticationProperties - { - RedirectUri = redirectUrl.OriginalString - }; + authProperties.RedirectUri = redirectUrl.OriginalString; } // The Google middleware adds this, so let's follow that example.