refactor(gateway): simplify prefix extraction in TicketValidator

Read the prefix claim via ClaimsIdentity.FindFirst instead of a three-part
ternary over the claims dictionary, and drop the XML summary.
This commit is contained in:
2026-07-05 21:59:55 +02:00
parent 3e03fbf078
commit f6bab8c0d8
@@ -34,10 +34,6 @@ public sealed class TicketValidator : IDisposable
}; };
} }
/// <summary>
/// Validates the stream ticket and returns the authorized object-key prefix,
/// or <see langword="null"/> if the ticket is missing, invalid, or carries no prefix.
/// </summary>
public async Task<string?> ValidateTicketAsync(string? token) public async Task<string?> ValidateTicketAsync(string? token)
{ {
if (string.IsNullOrWhiteSpace(token)) if (string.IsNullOrWhiteSpace(token))
@@ -47,11 +43,8 @@ public sealed class TicketValidator : IDisposable
if (!result.IsValid) if (!result.IsValid)
return null; return null;
return result.Claims.TryGetValue("prefix", out var claim) var prefix = result.ClaimsIdentity?.FindFirst("prefix")?.Value;
&& claim is string prefix return string.IsNullOrEmpty(prefix) ? null : prefix;
&& !string.IsNullOrEmpty(prefix)
? prefix
: null;
} }
public void Dispose() => _rsa.Dispose(); public void Dispose() => _rsa.Dispose();