diff --git a/Packages.props b/Packages.props
index 32d434b51..68ad28f6a 100644
--- a/Packages.props
+++ b/Packages.props
@@ -27,13 +27,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/samples/Balosar/Balosar.Server/Controllers/AuthorizationController.cs b/samples/Balosar/Balosar.Server/Controllers/AuthorizationController.cs
index c5a412b18..d40e8e9be 100644
--- a/samples/Balosar/Balosar.Server/Controllers/AuthorizationController.cs
+++ b/samples/Balosar/Balosar.Server/Controllers/AuthorizationController.cs
@@ -75,7 +75,8 @@ public async Task Authorize()
// If a max_age parameter was provided, ensure that the cookie is not too old.
// If the user principal can't be extracted or the cookie is too old, redirect the user to the login page.
var result = await HttpContext.AuthenticateAsync(IdentityConstants.ApplicationScheme);
- if (result == null || !result.Succeeded || HasCookieExpired(request, result))
+ if (result == null || !result.Succeeded || (request.MaxAge != null && result.Properties?.IssuedUtc != null &&
+ DateTimeOffset.UtcNow - result.Properties.IssuedUtc > TimeSpan.FromSeconds(request.MaxAge.Value)))
{
// If the client application requested promptless authentication,
// return an error indicating that the user is not logged in.
@@ -336,12 +337,6 @@ public async Task Exchange()
throw new InvalidOperationException("The specified grant type is not supported.");
}
- private bool HasCookieExpired(OpenIddictRequest request, AuthenticateResult result)
- {
- return request.MaxAge != null && result.Properties?.IssuedUtc != null &&
- DateTimeOffset.UtcNow - result.Properties.IssuedUtc > TimeSpan.FromSeconds(request.MaxAge.Value);
- }
-
private IEnumerable GetDestinations(Claim claim, ClaimsPrincipal principal)
{
// Note: by default, claims are NOT automatically included in the access and identity tokens.
diff --git a/samples/Velusia/Velusia.Server/Controllers/AuthorizationController.cs b/samples/Velusia/Velusia.Server/Controllers/AuthorizationController.cs
index 13444fca1..5b256ab0c 100644
--- a/samples/Velusia/Velusia.Server/Controllers/AuthorizationController.cs
+++ b/samples/Velusia/Velusia.Server/Controllers/AuthorizationController.cs
@@ -81,7 +81,8 @@ public async Task Authorize()
// If a max_age parameter was provided, ensure that the cookie is not too old.
// If the user principal can't be extracted or the cookie is too old, redirect the user to the login page.
var result = await HttpContext.AuthenticateAsync(IdentityConstants.ApplicationScheme);
- if (result == null || !result.Succeeded || HasCookieExpired(request, result))
+ if (result == null || !result.Succeeded || (request.MaxAge != null && result.Properties?.IssuedUtc != null &&
+ DateTimeOffset.UtcNow - result.Properties.IssuedUtc > TimeSpan.FromSeconds(request.MaxAge.Value)))
{
// If the client application requested promptless authentication,
// return an error indicating that the user is not logged in.
@@ -341,12 +342,6 @@ public async Task Exchange()
throw new InvalidOperationException("The specified grant type is not supported.");
}
- private bool HasCookieExpired(OpenIddictRequest request, AuthenticateResult result)
- {
- return request.MaxAge != null && result.Properties?.IssuedUtc != null &&
- DateTimeOffset.UtcNow - result.Properties.IssuedUtc > TimeSpan.FromSeconds(request.MaxAge.Value);
- }
-
private IEnumerable GetDestinations(Claim claim, ClaimsPrincipal principal)
{
// Note: by default, claims are NOT automatically included in the access and identity tokens.