/*
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
* See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers
* for more information concerning the license and the contributors participating to this project.
*/
using AspNet.Security.OAuth.<%= name %>;
namespace Microsoft.Extensions.DependencyInjection;
///
/// Extension methods to add <%= name %> authentication capabilities to an HTTP application pipeline.
///
public static class <%= name %>AuthenticationExtensions
{
///
/// Adds to the specified
/// , which enables <%= name %> authentication capabilities.
///
/// The authentication builder.
/// The .
public static AuthenticationBuilder Add<%= name %>([NotNull] this AuthenticationBuilder builder)
{
return builder.Add<%= name %>(<%= name %>AuthenticationDefaults.AuthenticationScheme, options => { });
}
///
/// Adds to the specified
/// , which enables <%= name %> authentication capabilities.
///
/// The authentication builder.
/// The delegate used to configure the <%= name %> options.
/// The .
public static AuthenticationBuilder Add<%= name %>(
[NotNull] this AuthenticationBuilder builder,
[NotNull] Action<<%= name %>AuthenticationOptions> configuration)
{
return builder.Add<%= name %>(<%= name %>AuthenticationDefaults.AuthenticationScheme, configuration);
}
///
/// Adds to the specified
/// , which enables <%= name %> authentication capabilities.
///
/// The authentication builder.
/// The authentication scheme associated with this instance.
/// The delegate used to configure the <%= name %> options.
/// The .
public static AuthenticationBuilder Add<%= name %>(
[NotNull] this AuthenticationBuilder builder,
[NotNull] string scheme,
[NotNull] Action<<%= name %>AuthenticationOptions> configuration)
{
return builder.Add<%= name %>(scheme, <%= name %>AuthenticationDefaults.DisplayName, configuration);
}
///
/// Adds to the specified
/// , which enables <%= name %> authentication capabilities.
///
/// The authentication builder.
/// The authentication scheme associated with this instance.
/// The optional display name associated with this instance.
/// The delegate used to configure the <%= name %> options.
/// The .
public static AuthenticationBuilder Add<%= name %>(
[NotNull] this AuthenticationBuilder builder,
[NotNull] string scheme,
[CanBeNull] string caption,
[NotNull] Action<<%= name %>AuthenticationOptions> configuration)
{
return builder.AddOAuth<<%= name %>AuthenticationOptions, <%= name %>AuthenticationHandler>(scheme, caption, configuration);
}
}