Example #1
0
        public void Configure(IWebHostBuilder builder)
        {
            builder.ConfigureServices((context, services) =>
            {
                services.AddDbContext<FrontEndIdentityContext>(options =>
                    options.UseSqlServer(
                        context.Configuration.GetConnectionString("FrontEndIdentityContextConnection")));

                services.AddDefaultIdentity<FrontEndUser>()
                    .AddRoles<IdentityRole>()
                    .AddEntityFrameworkStores<FrontEndIdentityContext>();

                Microsoft.AspNetCore.Authentication.AuthenticationBuilder authBuilder = services.AddAuthentication();

                IConfigurationSection twitterConfig = context.Configuration.GetSection("twitter");
                if (twitterConfig["consumerKey"] != null)
                {
                    authBuilder.AddTwitter(options => twitterConfig.Bind(options));
                }

                IConfigurationSection googleConfig = context.Configuration.GetSection("google");
                if (googleConfig["clientID"] != null)
                {
                    authBuilder.AddGoogle(options => googleConfig.Bind(options));
                }
            });
        }
        /// <summary>
        /// Configures AuthenticationCookie
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="optionsAction"></param>
        /// <returns></returns>
        public static IdentityUIServicesBuilder AddAuth(this IdentityUIServicesBuilder builder, Action <CookieAuthenticationOptions> optionsAction)
        {
            builder.Services.ConfigureApplicationCookie(optionsAction);

            Microsoft.AspNetCore.Authentication.AuthenticationBuilder authenticationBuilder = builder.Services.AddAuthentication();

            if (!string.IsNullOrEmpty(builder.Configuration["IdentityUI:Microsoft:ClientId"]) && !string.IsNullOrEmpty(builder.Configuration["IdentityUI:Microsoft:ClientSecret"]))
            {
                authenticationBuilder.AddMicrosoftAccount(options =>
                {
                    options.ClientId     = builder.Configuration["IdentityUI:Microsoft:ClientId"];
                    options.ClientSecret = builder.Configuration["IdentityUI:Microsoft:ClientSecret"];
                });
            }

            if (!string.IsNullOrEmpty(builder.Configuration["IdentityUI:Google:ClientId"]) && !string.IsNullOrEmpty(builder.Configuration["IdentityUI:Google:ClientSecret"]))
            {
                authenticationBuilder.AddGoogle(options =>
                {
                    options.ClientId     = builder.Configuration["IdentityUI:Google:ClientId"];
                    options.ClientSecret = builder.Configuration["IdentityUI:Google:ClientSecret"];
                });
            }

            if (!string.IsNullOrEmpty(builder.Configuration["IdentityUI:Facebook:AppId"]) && !string.IsNullOrEmpty(builder.Configuration["IdentityUI:Facebook:AppSecret"]))
            {
                authenticationBuilder.AddFacebook(options =>
                {
                    options.AppId     = builder.Configuration["IdentityUI:Facebook:AppId"];
                    options.AppSecret = builder.Configuration["IdentityUI:Facebook:AppSecret"];
                });
            }

            if (!string.IsNullOrEmpty(builder.Configuration["IdentityUI:Twitter:ConsumerKey"]) && !string.IsNullOrEmpty(builder.Configuration["IdentityUI:Twitter:ConsumerSecret"]))
            {
                authenticationBuilder.AddTwitter(options =>
                {
                    options.ConsumerKey         = builder.Configuration["IdentityUI:Twitter:ConsumerKey"];
                    options.ConsumerSecret      = builder.Configuration["IdentityUI:Twitter:ConsumerSecret"];
                    options.RetrieveUserDetails = builder.Configuration["IdentityUI:Twitter:RetrieveUserDetails"] == "True";
                });
            }

            if (!string.IsNullOrEmpty(builder.Configuration["IdentityUI:WsFederation:Wtrealm"]))
            {
                authenticationBuilder.AddWsFederation(options =>
                {
                    options.MetadataAddress = builder.Configuration["IdentityUI:WsFederation:MetadataAddress"];
                    options.Wtrealm         = builder.Configuration["IdentityUI:WsFederation:Wtrealm"];
                });
            }

            return(builder);
        }
 public static Microsoft.AspNetCore.Identity.IdentityCookiesBuilder AddIdentityCookies(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Identity.IdentityCookiesBuilder AddIdentityCookies(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, System.Action <Microsoft.AspNetCore.Identity.IdentityCookiesBuilder> configureCookies)
 {
     throw null;
 }
Example #5
0
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddNegotiate(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, System.Action <Microsoft.AspNetCore.Authentication.Negotiate.NegotiateOptions> configureOptions)
 {
     throw null;
 }
Example #6
0
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddJwtBearer(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string authenticationScheme, System.Action <Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerOptions> configureOptions)
 {
     throw null;
 }
Example #7
0
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddOpenIdConnect(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder)
 {
     throw null;
 }
Example #8
0
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddCookie <TService>(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string authenticationScheme, System.Action <Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationOptions, TService> configureOptions) where TService : class
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddGoogle(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, System.Action <Microsoft.AspNetCore.Authentication.Google.GoogleOptions> configureOptions)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddCertificate(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string authenticationScheme)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddAzureADB2C(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, System.Action <Microsoft.AspNetCore.Authentication.AzureADB2C.UI.AzureADB2COptions> configureOptions)
 {
     throw null;
 }
 public static Microsoft.Extensions.Options.OptionsBuilder <Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationOptions> AddTwoFactorUserIdCookie(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddAzureADB2CBearer(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string scheme, string jwtBearerScheme, System.Action <Microsoft.AspNetCore.Authentication.AzureADB2C.UI.AzureADB2COptions> configureOptions)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddAzureADB2C(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string scheme, string openIdConnectScheme, string cookieScheme, string displayName, System.Action <Microsoft.AspNetCore.Authentication.AzureADB2C.UI.AzureADB2COptions> configureOptions)
 {
     throw null;
 }
Example #15
0
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddFacebook(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string authenticationScheme, System.Action <Microsoft.AspNetCore.Authentication.Facebook.FacebookOptions> configureOptions)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddTwitter(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, System.Action <Microsoft.AspNetCore.Authentication.Twitter.TwitterOptions> configureOptions)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddOAuth <TService>(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string authenticationScheme, string displayName, System.Action <Microsoft.AspNetCore.Authentication.OAuth.OAuthOptions, TService> configureOptions) where TService : class
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddGoogle(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder)
 {
     throw null;
 }
Example #19
0
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddMicrosoftAccount(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string authenticationScheme, System.Action <Microsoft.AspNetCore.Authentication.MicrosoftAccount.MicrosoftAccountOptions> configureOptions)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddGoogle(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string authenticationScheme, string displayName, System.Action <Microsoft.AspNetCore.Authentication.Google.GoogleOptions> configureOptions)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddIdentityServerJwt(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder)
 {
     throw null;
 }
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddCertificate(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string authenticationScheme, System.Action <Microsoft.AspNetCore.Authentication.Certificate.CertificateAuthenticationOptions> configureOptions)
 {
     throw null;
 }
Example #23
0
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddOAuth <TOptions, THandler>(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string authenticationScheme, string displayName, System.Action <TOptions> configureOptions) where TOptions : Microsoft.AspNetCore.Authentication.OAuth.OAuthOptions, new() where THandler : Microsoft.AspNetCore.Authentication.OAuth.OAuthHandler <TOptions>
 {
     throw null;
 }
Example #24
0
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddOpenIdConnect(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, string authenticationScheme, string displayName, System.Action <Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions> configureOptions)
 {
     throw null;
 }
Example #25
0
 public static Microsoft.AspNetCore.Authentication.AuthenticationBuilder AddWsFederation(this Microsoft.AspNetCore.Authentication.AuthenticationBuilder builder, System.Action <Microsoft.AspNetCore.Authentication.WsFederation.WsFederationOptions> configureOptions)
 {
     throw null;
 }