|
| 1 | +/* |
| 2 | + * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) |
| 3 | + * See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers |
| 4 | + * for more information concerning the license and the contributors participating to this project. |
| 5 | + */ |
| 6 | + |
| 7 | +using AspNet.Security.OAuth.Douyin; |
| 8 | + |
| 9 | +namespace Microsoft.Extensions.DependencyInjection; |
| 10 | + |
| 11 | +/// <summary> |
| 12 | +/// Extension methods to add Douyin authentication capabilities to an HTTP application pipeline. |
| 13 | +/// </summary> |
| 14 | +public static class DouyinAuthenticationExtensions |
| 15 | +{ |
| 16 | + /// <summary> |
| 17 | + /// Adds <see cref="DouyinAuthenticationHandler"/> to the specified |
| 18 | + /// <see cref="AuthenticationBuilder"/>, which enables Douyin authentication capabilities. |
| 19 | + /// </summary> |
| 20 | + /// <param name="builder">The authentication builder.</param> |
| 21 | + /// <returns>The <see cref="AuthenticationBuilder"/>.</returns> |
| 22 | + public static AuthenticationBuilder AddDouyin([NotNull] this AuthenticationBuilder builder) |
| 23 | + { |
| 24 | + return builder.AddDouyin(DouyinAuthenticationDefaults.AuthenticationScheme, options => { }); |
| 25 | + } |
| 26 | + |
| 27 | + /// <summary> |
| 28 | + /// Adds <see cref="DouyinAuthenticationHandler"/> to the specified |
| 29 | + /// <see cref="AuthenticationBuilder"/>, which enables Douyin authentication capabilities. |
| 30 | + /// </summary> |
| 31 | + /// <param name="builder">The authentication builder.</param> |
| 32 | + /// <param name="configuration">The delegate used to configure the OpenID 2.0 options.</param> |
| 33 | + /// <returns>The <see cref="AuthenticationBuilder"/>.</returns> |
| 34 | + public static AuthenticationBuilder AddDouyin( |
| 35 | + [NotNull] this AuthenticationBuilder builder, |
| 36 | + [NotNull] Action<DouyinAuthenticationOptions> configuration) |
| 37 | + { |
| 38 | + return builder.AddDouyin(DouyinAuthenticationDefaults.AuthenticationScheme, configuration); |
| 39 | + } |
| 40 | + |
| 41 | + /// <summary> |
| 42 | + /// Adds <see cref="DouyinAuthenticationHandler"/> to the specified |
| 43 | + /// <see cref="AuthenticationBuilder"/>, which enables Douyin authentication capabilities. |
| 44 | + /// </summary> |
| 45 | + /// <param name="builder">The authentication builder.</param> |
| 46 | + /// <param name="scheme">The authentication scheme associated with this instance.</param> |
| 47 | + /// <param name="configuration">The delegate used to configure the Douyin options.</param> |
| 48 | + /// <returns>The <see cref="AuthenticationBuilder"/>.</returns> |
| 49 | + public static AuthenticationBuilder AddDouyin( |
| 50 | + [NotNull] this AuthenticationBuilder builder, |
| 51 | + [NotNull] string scheme, |
| 52 | + [NotNull] Action<DouyinAuthenticationOptions> configuration) |
| 53 | + { |
| 54 | + return builder.AddDouyin(scheme, DouyinAuthenticationDefaults.DisplayName, configuration); |
| 55 | + } |
| 56 | + |
| 57 | + /// <summary> |
| 58 | + /// Adds <see cref="DouyinAuthenticationHandler"/> to the specified |
| 59 | + /// <see cref="AuthenticationBuilder"/>, which enables Douyin authentication capabilities. |
| 60 | + /// </summary> |
| 61 | + /// <param name="builder">The authentication builder.</param> |
| 62 | + /// <param name="scheme">The authentication scheme associated with this instance.</param> |
| 63 | + /// <param name="caption">The optional display name associated with this instance.</param> |
| 64 | + /// <param name="configuration">The delegate used to configure the Douyin options.</param> |
| 65 | + /// <returns>The <see cref="AuthenticationBuilder"/>.</returns> |
| 66 | + public static AuthenticationBuilder AddDouyin( |
| 67 | + [NotNull] this AuthenticationBuilder builder, |
| 68 | + [NotNull] string scheme, |
| 69 | + [CanBeNull] string caption, |
| 70 | + [NotNull] Action<DouyinAuthenticationOptions> configuration) |
| 71 | + { |
| 72 | + return builder.AddOAuth<DouyinAuthenticationOptions, DouyinAuthenticationHandler>(scheme, caption, configuration); |
| 73 | + } |
| 74 | +} |
0 commit comments