Browse Source

Facebook credentials added to appsettings. Adding Facebook authentication moved to abpDeskWebMvcModule class.

pull/188/head
Alper Ebicoglu 8 years ago
parent
commit
bd082f2366
  1. 14
      src/AbpDesk/AbpDesk.Web.Mvc/AbpDeskWebMvcModule.cs
  2. 11
      src/AbpDesk/AbpDesk.Web.Mvc/Startup.cs
  3. 7
      src/AbpDesk/AbpDesk.Web.Mvc/appsettings.json

14
src/AbpDesk/AbpDesk.Web.Mvc/AbpDeskWebMvcModule.cs

@ -66,6 +66,20 @@ namespace AbpDesk.Web.Mvc
//services.Configure<RemoteServiceOptions>(configuration); //Needed when we use Volo.Abp.Identity.HttpApi.Client //services.Configure<RemoteServiceOptions>(configuration); //Needed when we use Volo.Abp.Identity.HttpApi.Client
//Adding Facebook authentication
if (bool.Parse(configuration["Authentication:Facebook:IsEnabled"]))
{
services.AddAuthentication().AddFacebook(options =>
{
options.AppId = configuration["Authentication:Facebook:AppId"];
options.AppSecret = configuration["Authentication:Facebook:AppSecret"];
options.Scope.Add("email");
options.Scope.Add("public_profile");
});
}
services.AddAssemblyOf<AbpDeskWebMvcModule>(); services.AddAssemblyOf<AbpDeskWebMvcModule>();
services.Configure<BundlingOptions>(options => services.Configure<BundlingOptions>(options =>

11
src/AbpDesk/AbpDesk.Web.Mvc/Startup.cs

@ -1,12 +1,10 @@
using System; using System;
using System.IO;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Serilog; using Serilog;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Modularity.PlugIns;
namespace AbpDesk.Web.Mvc namespace AbpDesk.Web.Mvc
{ {
@ -37,15 +35,6 @@ namespace AbpDesk.Web.Mvc
//); //);
}); });
services.AddAuthentication().AddFacebook(facebookOptions =>
{
facebookOptions.AppId = "911417875702990";
facebookOptions.AppSecret = "adea0bff222ae340d8fb0ce3e6275d6b";
});
//TODO: This is needed because ASP.NET Core does not use IServiceProviderFactory! //TODO: This is needed because ASP.NET Core does not use IServiceProviderFactory!
return services.BuildServiceProviderFromFactory(); return services.BuildServiceProviderFromFactory();
} }

7
src/AbpDesk/AbpDesk.Web.Mvc/appsettings.json

@ -7,5 +7,12 @@
"AbpIdentity": { "AbpIdentity": {
"BaseUrl": "http://localhost:63290/" "BaseUrl": "http://localhost:63290/"
} }
},
"Authentication": {
"Facebook": {
"IsEnabled": "true",
"AppId": "911417875702990",
"AppSecret": "adea0bff222ae340d8fb0ce3e6275d6b"
}
} }
} }

Loading…
Cancel
Save