public static LoginAuthenticationBuilder AddGoogleLogin(this LoginAuthenticationBuilder builder, Action <OAuth2ConfigurationBuilder> configure)
        {
            var configurationBuilder = new OAuth2ConfigurationBuilder();

            configure(configurationBuilder);
            builder
            .AddLogin <GoogleLogin>()
            .Services
            .AddSingleton(configurationBuilder.Build <GoogleLogin>());
            return(builder);
        }
        public static LoginAuthenticationBuilder AddPasswordAuthentication <TUserManager, TUserId, TPasswordLogin>(this LoginAuthenticationBuilder builder, Action <PasswordLoginOptionsBuilder> configure = null)
            where TUserManager : class, IUserManager <TUserId>
            where TPasswordLogin : PasswordLogin <TUserId>
        {
            var optionsBuilder = new PasswordLoginOptionsBuilder();

            configure?.Invoke(optionsBuilder);
            builder
            .AddLogin <TPasswordLogin>()
            .Services
            .AddSingleton(optionsBuilder.Build())
            .TryAddTransient <IUserManager <TUserId>, TUserManager>();
            return(builder);
        }
        public static LoginAuthenticationBuilder AddLinkedLogin <TUserManager, TLinkedUserManager, TId>(
            this LoginAuthenticationBuilder builder,
            Action <LoginAuthenticationBuilder> externalLoginConfigure)
            where TUserManager : class, IUserManager <TId>
            where TLinkedUserManager : class, ILinkedUserManager
        {
            var externalLoginBuilder = new LoginAuthenticationBuilder(builder.Services);

            externalLoginConfigure(externalLoginBuilder);
            foreach (var kv in externalLoginBuilder)
            {
                var desc = new LoginDescriptor(kv.Key, kv.Value.Type, kv.Value.args);
                builder.AddLogin <LinkedLogin <TId> >(desc.Name, desc);
            }
            builder.Services.TryAddTransient <IUserManager <TId>, TUserManager>();
            builder.Services.TryAddTransient <ILinkedUserManager, TLinkedUserManager>();
            return(builder);
        }