diff --git a/src/Yavsc.Server/Models/ApplicationDbContext.cs b/src/Yavsc.Server/Models/ApplicationDbContext.cs index 9e2e4230..ca9bd8b8 100644 --- a/src/Yavsc.Server/Models/ApplicationDbContext.cs +++ b/src/Yavsc.Server/Models/ApplicationDbContext.cs @@ -35,8 +35,6 @@ namespace Yavsc.Models using Microsoft.EntityFrameworkCore.ChangeTracking; using Yavsc.Abstract.Models.Messaging; - using Org.BouncyCastle.Asn1.Crmf; - using Microsoft.AspNetCore.Identity; public class ApplicationDbContext : IdentityDbContext { @@ -44,10 +42,12 @@ namespace Yavsc.Models { } + public ApplicationDbContext(DbContextOptions options) : base(options) { } + protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); @@ -86,7 +86,7 @@ namespace Yavsc.Models } builder.Entity().Property(a => a.ParentCode).IsRequired(false); - builder.Entity>().HasKey(i=> new { i.LoginProvider, i.UserId, i.ProviderKey }); + // builder.Entity>().HasKey(i=> new { i.LoginProvider, i.UserId, i.ProviderKey }); } // this is not a failback procedure. @@ -301,6 +301,6 @@ namespace Yavsc.Models public DbSet Scopes { get; set; } public DbSet blogSpotPublications{ get; set; } - public DbSet> AspNetUserLogins { get; set; } + // public DbSet> AspNetUserLogins { get; set; } } } diff --git a/src/Yavsc/Services/ExternalIdentityManager.cs b/src/Yavsc/Services/ExternalIdentityManager.cs index df82ae90..ab7117a9 100644 --- a/src/Yavsc/Services/ExternalIdentityManager.cs +++ b/src/Yavsc/Services/ExternalIdentityManager.cs @@ -1,4 +1,5 @@ using System.Security.Claims; +using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Yavsc.Interfaces; using Yavsc.Models; @@ -6,10 +7,12 @@ using Yavsc.Models; public class ExternalIdentityManager : IExternalIdentityManager { private ApplicationDbContext _applicationDbContext; + private SignInManager _signInManager; - public ExternalIdentityManager(ApplicationDbContext applicationDbContext) + public ExternalIdentityManager(ApplicationDbContext applicationDbContext, SignInManager signInManager) { _applicationDbContext = applicationDbContext; + _signInManager = signInManager; } public ApplicationUser AutoProvisionUser(string provider, string providerUserId, List claims) { @@ -18,7 +21,8 @@ public class ExternalIdentityManager : IExternalIdentityManager public async Task FindByExternaleProviderAsync(string provider, string providerUserId) { - var user = await _applicationDbContext.AspNetUserLogins + + var user = await _applicationDbContext.UserLogins .FirstOrDefaultAsync( i => (i.LoginProvider == provider) && (i.ProviderKey == providerUserId) );