diff --git a/src/Microsoft.AspNet.Http.Core/Authentication/AuthenticationDescription.cs b/src/Microsoft.AspNet.Http.Core/Authentication/AuthenticationDescription.cs
index 16b2c43247..97ca3fe18e 100644
--- a/src/Microsoft.AspNet.Http.Core/Authentication/AuthenticationDescription.cs
+++ b/src/Microsoft.AspNet.Http.Core/Authentication/AuthenticationDescription.cs
@@ -20,17 +20,17 @@ namespace Microsoft.AspNet.Http.Authentication
/// Initializes a new instance of the class
///
public AuthenticationDescription()
+ : this(items: null)
{
- Items = new Dictionary(StringComparer.Ordinal);
}
///
/// Initializes a new instance of the class
///
///
- public AuthenticationDescription([NotNull] IDictionary items)
+ public AuthenticationDescription(IDictionary items)
{
- Items = items;
+ Items = items ?? new Dictionary(StringComparer.Ordinal); ;
}
///
diff --git a/src/Microsoft.AspNet.Http/Authentication/DefaultAuthenticationManager.cs b/src/Microsoft.AspNet.Http/Authentication/DefaultAuthenticationManager.cs
index e21bea9634..6f1c3ba419 100644
--- a/src/Microsoft.AspNet.Http/Authentication/DefaultAuthenticationManager.cs
+++ b/src/Microsoft.AspNet.Http/Authentication/DefaultAuthenticationManager.cs
@@ -61,6 +61,11 @@ namespace Microsoft.AspNet.Http.Authentication
throw new InvalidOperationException($"The following authentication scheme was not accepted: {authenticationScheme}");
}
+ if (authenticateContext.Principal == null)
+ {
+ return null;
+ }
+
return new AuthenticationResult(authenticateContext.Principal,
new AuthenticationProperties(authenticateContext.Properties),
new AuthenticationDescription(authenticateContext.Description));
@@ -82,6 +87,11 @@ namespace Microsoft.AspNet.Http.Authentication
throw new InvalidOperationException($"The following authentication scheme was not accepted: {authenticationScheme}");
}
+ if (authenticateContext.Principal == null)
+ {
+ return null;
+ }
+
return new AuthenticationResult(authenticateContext.Principal,
new AuthenticationProperties(authenticateContext.Properties),
new AuthenticationDescription(authenticateContext.Description));