Example #1
0
        public static void UseFirebase(this IExtendableConfigurationBuilder builder, string credentialsJson)
        {
            var feature = new FirebaseIntegrationFeature();

            feature.WithConfig(configuration => { configuration.CredentialsJson = credentialsJson; });

            builder.AddOrUpdateFeature(feature);
            builder.UseUserHandlerWithCustomProfile <EmptyProfile, FirebaseUserHandler>();
            builder.UseAccountLinking <FirebaseLinkHandler>();
            builder.UseAccountRecovery <FirebaseRecoveryHandler>();
        }
        /// <summary>
        ///     Enables GIGYA authorization process with <see cref="GigyaUserHandler{TProfile}" /> and provided profile model
        /// </summary>
        /// <param name="builder">builder</param>
        /// <param name="dataCenter">
        ///     Gigya data center servers (us1, eu1 and etc.) If you are not sure of your site's data center,
        ///     <see cref="https://developers.gigya.com/display/GD/Finding+Your+Data+Center">Finding Your Data Center</see>.
        /// </param>
        /// <param name="apiKey">Gigya API key</param>
        /// <param name="secret">Gigya Secret key</param>
        /// <param name="userKey">Gigya User key (optional)</param>
        /// <param name="loginType">Login result. Cookie session or JWT ID Token</param>
        /// <typeparam name="TProfile">User profile model</typeparam>
        public static void UseGigya <TProfile>(this IExtendableConfigurationBuilder builder, string dataCenter,
                                               string apiKey, string secret, string userKey = null, GigyaLoginType loginType = GigyaLoginType.Session)
            where TProfile : class, IGigyaUserProfile
        {
            builder.Services.AddHttpClient();
            var gigyaFeature = new GigyaIntegrationFeature();

            gigyaFeature.WithConfig <TProfile>(x =>
            {
                x.DataCenter = dataCenter;
                x.ApiKey     = apiKey;
                x.SecretKey  = secret;
                x.UserKey    = userKey;
                x.LoginType  = loginType;
            });

            builder.AddOrUpdateFeature(gigyaFeature);
            builder.UseUserHandlerWithCustomProfile <GigyaUserProfile, GigyaUserHandler <GigyaUserProfile> >();
            builder.UseAccountLinking <GigyaAccountLinkHandler <GigyaUserProfile> >();
            builder.UseAccountRecovery <GigyaAccountRecoveryHandler <GigyaUserProfile> >();
        }