From a0ad8d732d39ea659796951cda90cd74c4fb5364 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Tue, 14 Jan 2025 17:04:54 +0100 Subject: [PATCH] =?UTF-8?q?refactor(RSATokenDescriptor):=20Lifetime-Eigens?= =?UTF-8?q?chaft=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Security/IAsymmetricTokenDescriptor.cs | 2 ++ DigitalData.Core.Security/RSAKey/RSATokenDescriptor.cs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/DigitalData.Core.Abstractions/Security/IAsymmetricTokenDescriptor.cs b/DigitalData.Core.Abstractions/Security/IAsymmetricTokenDescriptor.cs index e1f2242..bfe0c27 100644 --- a/DigitalData.Core.Abstractions/Security/IAsymmetricTokenDescriptor.cs +++ b/DigitalData.Core.Abstractions/Security/IAsymmetricTokenDescriptor.cs @@ -11,6 +11,8 @@ namespace DigitalData.Core.Abstractions.Security string? ApiRoute { get; } + TimeSpan Lifetime { get; init; } + #region SecurityTokenDescriptor Map /// /// Defines the compression algorithm that will be used to compress the JWT token payload. diff --git a/DigitalData.Core.Security/RSAKey/RSATokenDescriptor.cs b/DigitalData.Core.Security/RSAKey/RSATokenDescriptor.cs index a4ab6e7..224e449 100644 --- a/DigitalData.Core.Security/RSAKey/RSATokenDescriptor.cs +++ b/DigitalData.Core.Security/RSAKey/RSATokenDescriptor.cs @@ -14,6 +14,8 @@ namespace DigitalData.Core.Security.RSAKey public IAsymmetricTokenValidator Validator => _lazyTokenValidator.Value; + public required TimeSpan Lifetime { get; init; } + #region SecurityTokenDescriptor Map /// /// Gets or sets the value of the 'audience' claim. @@ -32,8 +34,9 @@ namespace DigitalData.Core.Security.RSAKey /// /// Gets or sets the value of the 'expiration' claim. This value should be in UTC. + /// The expiration time is the sum of DateTime.Now and LifeTime. /// - public DateTime? Expires { get; set; } + public DateTime? Expires => DateTime.Now.AddTicks(Lifetime.Ticks); /// /// Gets or sets the issuer of this .