Sakura.AspNetCore.Extensions/Sakura.AspNetCore.Authentication.ExternalCookie/ServiceCollectionExtensions.cs
/// <summary>
///     Add external signing-in manager service for application.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection" /> instance.</param>
/// <param name="setupOptions">A setup method for configuring identity options.</param>
Add external signing-in manager service for application.
Add external signing - in manager service for application .
[PublicAPI]
		public static void AddExternalSignInManager([NotNull] this IServiceCollection services,
			Action<IdentityOptions> setupOptions = null)
		{
			if (services == null)
				throw new ArgumentNullException(nameof(services));
			services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
			services.TryAddSingleton<ISecurityStampValidator, ExternalSecurityStampValidator>();
			services.TryAddScoped<ExternalSignInManager>();
			if (setupOptions != null)
				services.Configure(setupOptions);
#if NETSTANDARD2_0
			services.AddAuthentication(IdentityConstants.ApplicationScheme)
				.AddCookie(IdentityConstants.ApplicationScheme)
				.AddCookie(IdentityConstants.ExternalScheme)
				.AddCookie(IdentityConstants.TwoFactorUserIdScheme)
				.AddCookie(IdentityConstants.TwoFactorRememberMeScheme);
#endif
		}
[ PublicAPI ] public static void AddExternalSignInManager ( [ NotNull ] this IServiceCollection services , Action < IdentityOptions > setupOptions = null ) { if ( services == null ) throw new ArgumentNullException ( nameof ( services ) ) ; services . TryAddSingleton < IHttpContextAccessor , HttpContextAccessor > ( ) ; services . TryAddSingleton < ISecurityStampValidator , ExternalSecurityStampValidator > ( ) ; services . TryAddScoped < ExternalSignInManager > ( ) ; if ( setupOptions != null ) services . Configure ( setupOptions ) ; if NETSTANDARD2_0 services . AddAuthentication ( IdentityConstants . ApplicationScheme ) . AddCookie ( IdentityConstants . ApplicationScheme ) . AddCookie ( IdentityConstants . ExternalScheme ) . AddCookie ( IdentityConstants . TwoFactorUserIdScheme ) . AddCookie ( IdentityConstants . TwoFactorRememberMeScheme ) ; endif }
Add external signing-in manager service for application.
Add external signing - in manager service for application .
this
[NotNull]
setupOptions
Action<IdentityOptions>
A setup method for configuring identity options.
A setup method for configuring identity options .
services
None