in src/Relecloud.Web.CallCenter/Startup.cs [273:295]
private static async Task CreateOrUpdateUserInformation(TokenValidatedContext ctx)
{
try
{
if (ctx.Principal?.Identity is not null)
{
// The user has signed in, ensure the information in the database is up-to-date.
var user = new User
{
Id = ctx.Principal.GetUniqueId(),
DisplayName = ctx.Principal.Identity.Name ?? "New User"
};
var concertService = ctx.HttpContext.RequestServices.GetRequiredService<IConcertContextService>();
await concertService.CreateOrUpdateUserAsync(user);
}
}
catch (Exception ex)
{
var logger = ctx.HttpContext.RequestServices.GetRequiredService<ILogger<Startup>>();
logger.LogError(ex, "Unhandled exception from Startup.CreateOrUpdateUserInformation");
}
}