using Galaeth.Core.Configuration;
using TimeSpanParserUtil;
namespace Galaeth.Core.Extensions;
///
/// Extensions for .
///
public static class JwtConfigurationExtensions
{
///
/// Return when (UTC) the access token expires.
///
/// Instance of .
/// A UTC DateTime of when the expiration occurs.
public static DateTime AccessTokenExpirationDateTime(this JwtConfiguration configuration)
{
return DateTime.UtcNow.Add(TimeSpanParser.Parse(configuration.AccessTokenExpiration));
}
///
/// Return when (UTC) the refresh token expires.
///
/// Instance of .
/// A UTC DateTime of when the expiration occurs.
public static DateTime RefreshTokenExpirationDateTime(this JwtConfiguration configuration)
{
return DateTime.UtcNow.Add(TimeSpanParser.Parse(configuration.RefreshTokenExpiration));
}
}