From a341dc7cc1f5c395634e703425d5e06a18157088 Mon Sep 17 00:00:00 2001 From: Tomas Herceg Date: Tue, 22 Apr 2014 19:32:37 +0200 Subject: [PATCH] NullReferenceException bug in OpenID fixed --- .../OpenID/OpenIDAuthenticationHandler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Owin.Security.Providers/OpenID/OpenIDAuthenticationHandler.cs b/Owin.Security.Providers/OpenID/OpenIDAuthenticationHandler.cs index 7b9e26b..342ed5e 100644 --- a/Owin.Security.Providers/OpenID/OpenIDAuthenticationHandler.cs +++ b/Owin.Security.Providers/OpenID/OpenIDAuthenticationHandler.cs @@ -247,10 +247,14 @@ namespace Owin.Security.Providers.OpenID { nameValue = lastValue; } - else + else if (!string.IsNullOrEmpty(emailValue) && emailValue.Contains("@")) { nameValue = emailValue.Substring(0, emailValue.IndexOf('@')); } + else + { + nameValue = claimedID; + } } identity.AddClaim(new Claim(ClaimTypes.Name, nameValue, "http://www.w3.org/2001/XMLSchema#string", Options.AuthenticationType));