File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed
src/AspNetCore.SecurityKey Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,19 @@ public interface ISecurityKeyValidator
1111 /// Validates the specified security API key.
1212 /// </summary>
1313 /// <param name="value">The security API key to validate.</param>
14- /// <returns>true if security API key is valid; otherwise false</returns>
15- ValueTask < bool > Validate ( string ? value ) ;
14+ /// <param name="cancellationToken">The cancellation token.</param>
15+ /// <returns>
16+ /// true if security API key is valid; otherwise false
17+ /// </returns>
18+ ValueTask < bool > Validate ( string ? value , CancellationToken cancellationToken = default ) ;
1619
1720 /// <summary>
1821 /// Authenticate the specified security API key.
1922 /// </summary>
2023 /// <param name="value">The security API key to validate.</param>
24+ /// <param name="cancellationToken">The cancellation token.</param>
2125 /// <returns>
22- /// <see cref="ClaimsIdentity"/> result of the authentication
26+ /// <see cref="ClaimsIdentity" /> result of the authentication
2327 /// </returns>
24- ValueTask < ClaimsIdentity > Authenticate ( string ? value ) ;
28+ ValueTask < ClaimsIdentity > Authenticate ( string ? value , CancellationToken cancellationToken = default ) ;
2529}
Original file line number Diff line number Diff line change @@ -29,8 +29,7 @@ public SecurityKeyMiddleware(
2929
3030 public async Task InvokeAsync ( HttpContext context )
3131 {
32- if ( context is null )
33- throw new ArgumentNullException ( nameof ( context ) ) ;
32+ ArgumentNullException . ThrowIfNull ( context ) ;
3433
3534 var securityKey = _securityKeyExtractor . GetKey ( context ) ;
3635
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public SecurityKeyValidator(
4242 }
4343
4444 /// <inheritdoc />
45- public async ValueTask < ClaimsIdentity > Authenticate ( string ? value )
45+ public async ValueTask < ClaimsIdentity > Authenticate ( string ? value , CancellationToken cancellationToken = default )
4646 {
4747 var isValid = await Validate ( value ) ;
4848
@@ -57,7 +57,7 @@ public async ValueTask<ClaimsIdentity> Authenticate(string? value)
5757 }
5858
5959 /// <inheritdoc />
60- public ValueTask < bool > Validate ( string ? value )
60+ public ValueTask < bool > Validate ( string ? value , CancellationToken cancellationToken = default )
6161 {
6262 if ( string . IsNullOrWhiteSpace ( value ) )
6363 return ValueTask . FromResult ( false ) ;
You can’t perform that action at this time.
0 commit comments