Begin work on user confirmation workflow

This commit is contained in:
Aaron Po
2026-02-21 20:44:49 -05:00
parent 17eb04e20c
commit 0ab2eaaec9
15 changed files with 233 additions and 41 deletions

View File

@@ -2,5 +2,10 @@ namespace Infrastructure.Jwt;
public interface ITokenInfrastructure
{
string GenerateJwt(Guid userId, string username, DateTime expiry);
string GenerateJwt(
Guid userId,
string username,
DateTime expiry,
string secret
);
}

View File

@@ -8,16 +8,17 @@ namespace Infrastructure.Jwt;
public class JwtInfrastructure : ITokenInfrastructure
{
private readonly string? _secret = Environment.GetEnvironmentVariable(
"JWT_SECRET"
);
public string GenerateJwt(Guid userId, string username, DateTime expiry)
public string GenerateJwt(
Guid userId,
string username,
DateTime expiry,
string secret
)
{
var handler = new JsonWebTokenHandler();
var key = Encoding.UTF8.GetBytes(
_secret ?? throw new InvalidOperationException("secret not set")
secret ?? throw new InvalidOperationException("secret not set")
);
// Base claims (always present)