Files
yavsc/src/Yavsc/Services/ExternalIdentityManager.cs
Paul Schneider 0aeff6118b
Some checks failed
Dotnet build and test / log-the-inputs (push) Successful in 4s
Dotnet build and test / build (push) Failing after 1m23s
External Login
2025-07-10 19:14:17 +01:00

33 lines
1.1 KiB
C#

using System.Security.Claims;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Yavsc.Interfaces;
using Yavsc.Models;
public class ExternalIdentityManager : IExternalIdentityManager
{
private ApplicationDbContext _applicationDbContext;
private SignInManager<ApplicationUser> _signInManager;
public ExternalIdentityManager(ApplicationDbContext applicationDbContext, SignInManager<ApplicationUser> signInManager)
{
_applicationDbContext = applicationDbContext;
_signInManager = signInManager;
}
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.UserLogins
.FirstOrDefaultAsync(
i => (i.LoginProvider == provider) && (i.ProviderKey == providerUserId)
);
if (user == null) return null;
return await _applicationDbContext.Users.FirstOrDefaultAsync(u=>u.Id == user.UserId);
}
}