//
// Copyright (c) alveus.dev. All rights reserved. Licensed under the MIT License.
//
using Astral.Core.Options;
using TimeSpanParserUtil;
namespace Astral.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 JwtOptions 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 JwtOptions configuration)
{
return DateTime.UtcNow.Add(TimeSpanParser.Parse(configuration.RefreshTokenExpiration));
}
}