React to identity/security/options changes
This commit is contained in:
parent
b1ca5d41d8
commit
d147f259a8
|
|
@ -31,7 +31,7 @@ namespace MusicStore.Models
|
||||||
|
|
||||||
private static async Task CreateAdminUser(IServiceProvider serviceProvider)
|
private static async Task CreateAdminUser(IServiceProvider serviceProvider)
|
||||||
{
|
{
|
||||||
var settings = serviceProvider.GetService<IOptions<SiteSettings>>().Options;
|
var settings = serviceProvider.GetService<IOptions<SiteSettings>>().Value;
|
||||||
const string adminRole = "Administrator";
|
const string adminRole = "Administrator";
|
||||||
|
|
||||||
var userManager = serviceProvider.GetService<UserManager<ApplicationUser>>();
|
var userManager = serviceProvider.GetService<UserManager<ApplicationUser>>();
|
||||||
|
|
|
||||||
|
|
@ -57,34 +57,32 @@ namespace MusicStore
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Identity services to the services container
|
// Add Identity services to the services container
|
||||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
services.AddIdentity<ApplicationUser, IdentityRole>(options =>
|
||||||
|
{
|
||||||
|
options.ApplicationCookie.AccessDeniedPath = new PathString("/Home/AccessDenied");
|
||||||
|
})
|
||||||
.AddEntityFrameworkStores<MusicStoreContext>()
|
.AddEntityFrameworkStores<MusicStoreContext>()
|
||||||
.AddDefaultTokenProviders();
|
.AddDefaultTokenProviders();
|
||||||
|
|
||||||
services.ConfigureCookieAuthentication(options =>
|
services.AddFacebookAuthentication(options =>
|
||||||
{
|
|
||||||
options.AccessDeniedPath = new PathString("/Home/AccessDenied");
|
|
||||||
});
|
|
||||||
|
|
||||||
services.ConfigureFacebookAuthentication(options =>
|
|
||||||
{
|
{
|
||||||
options.AppId = "550624398330273";
|
options.AppId = "550624398330273";
|
||||||
options.AppSecret = "10e56a291d6b618da61b1e0dae3a8954";
|
options.AppSecret = "10e56a291d6b618da61b1e0dae3a8954";
|
||||||
});
|
});
|
||||||
|
|
||||||
services.ConfigureGoogleAuthentication(options =>
|
services.AddGoogleAuthentication(options =>
|
||||||
{
|
{
|
||||||
options.ClientId = "977382855444.apps.googleusercontent.com";
|
options.ClientId = "977382855444.apps.googleusercontent.com";
|
||||||
options.ClientSecret = "NafT482F70Vjj_9q1PU4B0pN";
|
options.ClientSecret = "NafT482F70Vjj_9q1PU4B0pN";
|
||||||
});
|
});
|
||||||
|
|
||||||
services.ConfigureTwitterAuthentication(options =>
|
services.AddTwitterAuthentication(options =>
|
||||||
{
|
{
|
||||||
options.ConsumerKey = "9J3j3pSwgbWkgPFH7nAf0Spam";
|
options.ConsumerKey = "9J3j3pSwgbWkgPFH7nAf0Spam";
|
||||||
options.ConsumerSecret = "jUBYkQuBFyqp7G3CUB9SW3AfflFr9z3oQBiNvumYy87Al0W4h8";
|
options.ConsumerSecret = "jUBYkQuBFyqp7G3CUB9SW3AfflFr9z3oQBiNvumYy87Al0W4h8";
|
||||||
});
|
});
|
||||||
|
|
||||||
services.ConfigureMicrosoftAccountAuthentication(options =>
|
services.AddMicrosoftAccountAuthentication(options =>
|
||||||
{
|
{
|
||||||
options.Caption = "MicrosoftAccount - Requires project changes";
|
options.Caption = "MicrosoftAccount - Requires project changes";
|
||||||
options.ClientId = "000000004012C08A";
|
options.ClientId = "000000004012C08A";
|
||||||
|
|
|
||||||
|
|
@ -68,16 +68,16 @@ namespace MusicStore
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Identity services to the services container
|
// Add Identity services to the services container
|
||||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
services.AddIdentity<ApplicationUser, IdentityRole>(options =>
|
||||||
|
{
|
||||||
|
options.ApplicationCookie.AccessDeniedPath = new PathString("/Home/AccessDenied");
|
||||||
|
})
|
||||||
.AddEntityFrameworkStores<MusicStoreContext>()
|
.AddEntityFrameworkStores<MusicStoreContext>()
|
||||||
.AddDefaultTokenProviders();
|
.AddDefaultTokenProviders();
|
||||||
|
|
||||||
services.ConfigureCookieAuthentication(options =>
|
services.AddCookieAuthentication();
|
||||||
{
|
|
||||||
options.AccessDeniedPath = new PathString("/Home/AccessDenied");
|
|
||||||
});
|
|
||||||
|
|
||||||
services.ConfigureFacebookAuthentication(options =>
|
services.AddFacebookAuthentication(options =>
|
||||||
{
|
{
|
||||||
options.AppId = "[AppId]";
|
options.AppId = "[AppId]";
|
||||||
options.AppSecret = "[AppSecret]";
|
options.AppSecret = "[AppSecret]";
|
||||||
|
|
@ -94,7 +94,7 @@ namespace MusicStore
|
||||||
options.Scope.Add("user_checkins");
|
options.Scope.Add("user_checkins");
|
||||||
});
|
});
|
||||||
|
|
||||||
services.ConfigureGoogleAuthentication(options =>
|
services.AddGoogleAuthentication(options =>
|
||||||
{
|
{
|
||||||
options.ClientId = "[ClientId]";
|
options.ClientId = "[ClientId]";
|
||||||
options.ClientSecret = "[ClientSecret]";
|
options.ClientSecret = "[ClientSecret]";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue