Externl Login
Some checks failed
Dotnet build and test / log-the-inputs (push) Successful in 6s
Dotnet build and test / build (push) Failing after 1m26s

This commit is contained in:
Paul Schneider
2025-07-10 15:19:28 +01:00
parent 19a3ba6f87
commit 984b76b170
12 changed files with 346 additions and 35 deletions

View File

@ -0,0 +1,28 @@
using System.Security.Claims;
using Microsoft.EntityFrameworkCore;
using Yavsc.Interfaces;
using Yavsc.Models;
public class ExternalIdentityManager : IExternalIdentityManager
{
private ApplicationDbContext _applicationDbContext;
public ExternalIdentityManager(ApplicationDbContext applicationDbContext)
{
_applicationDbContext = applicationDbContext;
}
public ApplicationUser AutoProvisionUser(string provider, string providerUserId, List<Claim> claims)
{
throw new NotImplementedException();
}
public async Task<ApplicationUser?> FindByExternaleProviderAsync(string provider, string providerUserId)
{
var user = await _applicationDbContext.AspNetUserLogins
.FirstOrDefaultAsync(
i => (i.LoginProvider == provider) && (i.ProviderKey == providerUserId)
);
if (user == null) return null;
return await _applicationDbContext.Users.FirstOrDefaultAsync(u=>u.Id == user.UserId);
}
}