Remove deprecated AddCookieAuthentication methods
This commit is contained in:
parent
e0464c9508
commit
2b259e8b99
|
|
@ -1,57 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using Microsoft.AspNet.Authentication.Cookies;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
|
|
||||||
namespace Microsoft.Extensions.DependencyInjection
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Extension methods for setting up cookie authentication services in an <see cref="IServiceCollection" />.
|
|
||||||
/// </summary>
|
|
||||||
public static class CookieServiceCollectionExtensions
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Adds cookie authentication services to the specified <see cref="IServiceCollection" />.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="services">The <see cref="IServiceCollection" /> to add services to.</param>
|
|
||||||
/// <param name="configure">An action delegate to configure the provided <see cref="CookieAuthenticationOptions"/>.</param>
|
|
||||||
/// <returns>A reference to this instance after the operation has completed.</returns>
|
|
||||||
public static IServiceCollection AddCookieAuthentication(this IServiceCollection services, Action<CookieAuthenticationOptions> configure)
|
|
||||||
{
|
|
||||||
if (services == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(services));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (configure == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(configure));
|
|
||||||
}
|
|
||||||
|
|
||||||
return services.Configure(configure);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds cookie authentication services to the specified <see cref="IServiceCollection" />.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="services">The <see cref="IServiceCollection" /> to add services to.</param>
|
|
||||||
/// <param name="config">An <see cref="IConfiguration"/> instance that contains configuration data representing a <see cref="CookieAuthenticationOptions"/>.</param>
|
|
||||||
/// <returns>A reference to this instance after the operation has completed.</returns>
|
|
||||||
public static IServiceCollection AddCookieAuthentication(this IServiceCollection services, IConfiguration config)
|
|
||||||
{
|
|
||||||
if (services == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(services));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(config));
|
|
||||||
}
|
|
||||||
|
|
||||||
return services.Configure<CookieAuthenticationOptions>(config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue