Adds messages api

This commit is contained in:
Jonathan Bourdon
2024-06-27 12:37:59 -04:00
parent 891597fb08
commit 72e243cf84
21 changed files with 485 additions and 61 deletions

View File

@@ -1,3 +1,4 @@
using System.Diagnostics;
using Google.Apis.Oauth2.v2.Data;
using System.Security.Claims;
using Hutopy.Application.Common.Interfaces;
@@ -220,14 +221,20 @@ public class IdentityService(
}
var user = await GetUserByUserNameAsync(userName);
if (user is null) throw new InvalidOperationException();
var jwtSection = configuration.GetRequiredSection("Authentication:Jwt");
var token = JwtTokenHelper.GenerateJwtToken(
issuer: jwtSection["Issuer"] ?? "",
audience: jwtSection["Audience"] ?? "",
key: jwtSection["Key"] ?? "",
userId: user?.Id ?? "");
userId: user.Id,
email: user.Email,
firstname: user.FirstName,
lastname: user.LastName,
portraitUrl: user.PortraitUrl);
return token;
}