PR recommendations: added null checks where FindByX was added, using the same exception as ASP.NET Identity 2

This commit is contained in:
Scott Brady
2020-04-30 15:48:32 +01:00
parent 643c249386
commit 077cf57abc
5 changed files with 10 additions and 32 deletions

View File

@@ -12,22 +12,14 @@ namespace Umbraco.Web.Security
where TResult : class, IDisposable
where TOptions : IdentityFactoryOptions<TResult>
{
/// <summary>
/// Constructor
/// </summary>
/// <param name="next">The next middleware in the OWIN pipeline to invoke</param>
/// <param name="options">Configuration options for the middleware</param>
public IdentityFactoryMiddleware(OwinMiddleware next, TOptions options)
: base(next)
{
if (options == null)
{
throw new ArgumentNullException(nameof(options));
}
if (options.Provider == null)
{
throw new ArgumentNullException("options.Provider");
}
if (options == null) throw new ArgumentNullException(nameof(options));
if (options.Provider == null) throw new ArgumentException("options.Provider");
Options = options;
}
@@ -74,9 +66,6 @@ namespace Umbraco.Web.Security
public class IdentityFactoryProvider<T> where T : class, IDisposable
{
/// <summary>
/// Constructor
/// </summary>
public IdentityFactoryProvider()
{
OnDispose = (options, instance) => { };