using System.Security.Claims; namespace Infrastructure.Jwt; /// /// Service for generating and validating JSON Web Tokens (JWTs) used for authentication. /// public interface ITokenInfrastructure { /// /// Generates a signed JWT for the given user. /// /// The unique identifier of the user the token is issued for. /// The username of the user, included as a claim. /// The date and time at which the token expires. /// The symmetric secret used to sign the token. /// The serialized, signed JWT string. string GenerateJwt( Guid userId, string username, DateTime expiry, string secret ); /// /// Validates a JWT and returns the resulting claims principal. /// /// The JWT string to validate. /// The symmetric secret used to verify the token's signature. /// A representing the validated token's claims. /// /// Thrown when the token is invalid, expired, or fails /// validation. /// Task ValidateJwtAsync(string token, string secret); }