Work around ambiguous calls

This commit is contained in:
2026-01-13 10:00:08 +01:00
parent a7df221777
commit 3864e17bb0

View File

@@ -487,7 +487,7 @@ public class AuthenticationApiController : ControllerBase
await _dbContext.SaveChangesAsync(); await _dbContext.SaveChangesAsync();
} }
// Perform sign-in // Perform sign-in
var userPrincipal = new ClaimsPrincipal(new ClaimsIdentity([new("id", user.Id.ToString())])); var userPrincipal = new ClaimsPrincipal(new ClaimsIdentity(claims: [new("id", user.Id.ToString())]));
await HttpContext.SignInAsync(userPrincipal); await HttpContext.SignInAsync(userPrincipal);
var token = userPrincipal.FindFirstValue("token") var token = userPrincipal.FindFirstValue("token")
?? throw new InvalidOperationException("Sign in handler did not add token"); ?? throw new InvalidOperationException("Sign in handler did not add token");
@@ -540,7 +540,7 @@ public class AuthenticationApiController : ControllerBase
// Verify the account // Verify the account
user.EmailVerified = true; user.EmailVerified = true;
// Create a session // Create a session
var userPrincipal = new ClaimsPrincipal(new ClaimsIdentity([new("id", user.Id.ToString())])); var userPrincipal = new ClaimsPrincipal(new ClaimsIdentity(claims: [new("id", user.Id.ToString())]));
await HttpContext.SignInAsync(userPrincipal); await HttpContext.SignInAsync(userPrincipal);
var token = userPrincipal.FindFirstValue("token") var token = userPrincipal.FindFirstValue("token")
?? throw new InvalidOperationException("Sign in handler did not add token"); ?? throw new InvalidOperationException("Sign in handler did not add token");
@@ -720,7 +720,7 @@ public class AuthenticationApiController : ControllerBase
{ {
user.EmailVerified = true; user.EmailVerified = true;
await _dbContext.SaveChangesAsync(); await _dbContext.SaveChangesAsync();
var userPrincipal = new ClaimsPrincipal(new ClaimsIdentity([new("id", user.Id.ToString())])); var userPrincipal = new ClaimsPrincipal(new ClaimsIdentity(claims: [new("id", user.Id.ToString())]));
await HttpContext.SignInAsync(userPrincipal); await HttpContext.SignInAsync(userPrincipal);
token = userPrincipal.FindFirstValue("token") token = userPrincipal.FindFirstValue("token")
?? throw new InvalidOperationException("Sign in handler did not add token"); ?? throw new InvalidOperationException("Sign in handler did not add token");