/*
* 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 Microsoft.AspNetCore.Authentication;
using System.Diagnostics.CodeAnalysis;
using ZeroFramework.IdentityServer.API.Infrastructure.Authentication.Weibo;
namespace Microsoft.Extensions.DependencyInjection;
///
/// Extension methods to add Weibo authentication capabilities to an HTTP application pipeline.
///
public static class WeiboAuthenticationExtensions
{
///
/// Adds to the specified
/// , which enables Weibo authentication capabilities.
///
/// The authentication builder.
/// A reference to this instance after the operation has completed.
public static AuthenticationBuilder AddWeibo([NotNull] this AuthenticationBuilder builder)
{
return builder.AddWeibo(WeiboAuthenticationDefaults.AuthenticationScheme, options => { });
}
///
/// Adds to the specified
/// , which enables Weibo authentication capabilities.
///
/// The authentication builder.
/// The delegate used to configure the OpenID 2.0 options.
/// A reference to this instance after the operation has completed.
public static AuthenticationBuilder AddWeibo(
[NotNull] this AuthenticationBuilder builder,
[NotNull] Action configuration)
{
return builder.AddWeibo(WeiboAuthenticationDefaults.AuthenticationScheme, configuration);
}
///
/// Adds to the specified
/// , which enables Weibo authentication capabilities.
///
/// The authentication builder.
/// The authentication scheme associated with this instance.
/// The delegate used to configure the Weibo options.
/// The .
public static AuthenticationBuilder AddWeibo(
[NotNull] this AuthenticationBuilder builder,
[NotNull] string scheme,
[NotNull] Action configuration)
{
return builder.AddWeibo(scheme, WeiboAuthenticationDefaults.DisplayName, configuration);
}
///
/// Adds to the specified
/// , which enables Weibo 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 Weibo options.
/// The .
public static AuthenticationBuilder AddWeibo(
[NotNull] this AuthenticationBuilder builder,
[NotNull] string scheme,
[MaybeNull] string caption,
[NotNull] Action configuration)
{
return builder.AddOAuth(scheme, caption, configuration);
}
}