Skip to content

Commit 40f1e45

Browse files
committed
update xml docs
1 parent f10eb83 commit 40f1e45

20 files changed

+288
-124
lines changed

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ indent_style = space
99
indent_size = 4
1010
insert_final_newline = true
1111
trim_trailing_whitespace = true
12+
vsspell_section_id = main
13+
vsspell_ignored_words_main = File:dictionary.dic
1214

1315
# XML Configuration Files
1416
[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct,refactorlog,runsettings}]

dictionary.dic

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
accessor
2+
app
3+
awaitable
4+
cacheable
5+
clr
6+
csv
7+
deconstruct
8+
deserialization
9+
deserializer
10+
inline
11+
json
12+
linq
13+
middleware
14+
mvc
15+
nullable
16+
queryable
17+
serialization
18+
serializer
19+
upsert
20+
validator

src/AspNetCore.SecurityKey/ApplicationBuilderExtensions.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33
namespace AspNetCore.SecurityKey;
44

55
/// <summary>
6-
/// Extension methods for the <see cref="SecurityKeyMiddleware"/>.
6+
/// Provides extension methods for integrating <see cref="SecurityKeyMiddleware"/> into the ASP.NET Core request pipeline.
77
/// </summary>
88
public static class ApplicationBuilderExtensions
99
{
1010
/// <summary>
11-
/// Adds middleware for requiring security API key for all requests.
11+
/// Registers the <see cref="SecurityKeyMiddleware"/> in the application's request pipeline.
12+
/// This middleware enforces the presence of a valid security API key for all incoming HTTP requests.
1213
/// </summary>
13-
/// <param name="builder">The <see cref="IApplicationBuilder" /> instance this method extends</param>
14+
/// <param name="builder">The <see cref="IApplicationBuilder"/> to configure.</param>
1415
/// <returns>
15-
/// The <see cref="IApplicationBuilder" /> for requiring security API keys
16+
/// The <see cref="IApplicationBuilder"/> instance for chaining further middleware registrations.
1617
/// </returns>
17-
/// <exception cref="System.ArgumentNullException">builder is null</exception>
18+
/// <exception cref="ArgumentNullException">
19+
/// Thrown when <paramref name="builder"/> is <c>null</c>.
20+
/// </exception>
1821
public static IApplicationBuilder UseSecurityKey(this IApplicationBuilder builder)
1922
{
2023
ArgumentNullException.ThrowIfNull(builder);

src/AspNetCore.SecurityKey/AspNetCore.SecurityKey.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
4+
<TargetFrameworks>net6.0;net8.0;net9.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>

src/AspNetCore.SecurityKey/AuthenticationBuilderExtensions.cs

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,69 @@
44
namespace AspNetCore.SecurityKey;
55

66
/// <summary>
7-
/// Extension methods to configure security API key authentication.
7+
/// Provides extension methods for configuring security API key authentication in ASP.NET Core applications.
88
/// </summary>
99
public static class AuthenticationBuilderExtensions
1010
{
1111
/// <summary>
12-
/// Adds security API key authentication to <see cref="AuthenticationBuilder"/> using the default scheme.
13-
/// The default scheme is specified by <see cref="SecurityKeyAuthenticationDefaults.AuthenticationScheme"/>.
12+
/// Registers security API key authentication using the default scheme.
13+
/// The default scheme is defined by <see cref="SecurityKeyAuthenticationDefaults.AuthenticationScheme"/>.
1414
/// </summary>
15-
/// <param name="builder">The <see cref="AuthenticationBuilder"/>.</param>
16-
/// <returns>A reference to <paramref name="builder"/> after the operation has completed.</returns>
15+
/// <param name="builder">The <see cref="AuthenticationBuilder"/> to configure.</param>
16+
/// <returns>
17+
/// The <see cref="AuthenticationBuilder"/> instance for chaining further authentication configuration.
18+
/// </returns>
1719
public static AuthenticationBuilder AddSecurityKey(this AuthenticationBuilder builder)
1820
=> builder.AddSecurityKey(SecurityKeyAuthenticationDefaults.AuthenticationScheme);
1921

2022
/// <summary>
21-
/// Adds security API key authentication to <see cref="AuthenticationBuilder"/> using the specified scheme.
23+
/// Registers security API key authentication using a specified scheme.
2224
/// </summary>
23-
/// <param name="builder">The <see cref="AuthenticationBuilder"/>.</param>
24-
/// <param name="authenticationScheme">The authentication scheme.</param>
25-
/// <returns>A reference to <paramref name="builder"/> after the operation has completed.</returns>
25+
/// <param name="builder">The <see cref="AuthenticationBuilder"/> to configure.</param>
26+
/// <param name="authenticationScheme">The name of the authentication scheme to use.</param>
27+
/// <returns>
28+
/// The <see cref="AuthenticationBuilder"/> instance for chaining further authentication configuration.
29+
/// </returns>
2630
public static AuthenticationBuilder AddSecurityKey(this AuthenticationBuilder builder, string authenticationScheme)
2731
=> builder.AddSecurityKey(authenticationScheme, configureOptions: null);
2832

2933
/// <summary>
30-
/// Adds security API key authentication to <see cref="AuthenticationBuilder"/> using the default scheme.
31-
/// The default scheme is specified by <see cref="SecurityKeyAuthenticationDefaults.AuthenticationScheme"/>.
34+
/// Registers security API key authentication using the default scheme and allows configuration of options.
35+
/// The default scheme is defined by <see cref="SecurityKeyAuthenticationDefaults.AuthenticationScheme"/>.
3236
/// </summary>
33-
/// <param name="builder">The <see cref="AuthenticationBuilder"/>.</param>
37+
/// <param name="builder">The <see cref="AuthenticationBuilder"/> to configure.</param>
3438
/// <param name="configureOptions">A delegate to configure <see cref="SecurityKeyAuthenticationSchemeOptions"/>.</param>
35-
/// <returns>A reference to <paramref name="builder"/> after the operation has completed.</returns>
39+
/// <returns>
40+
/// The <see cref="AuthenticationBuilder"/> instance for chaining further authentication configuration.
41+
/// </returns>
3642
public static AuthenticationBuilder AddSecurityKey(this AuthenticationBuilder builder, Action<SecurityKeyAuthenticationSchemeOptions>? configureOptions)
3743
=> builder.AddSecurityKey(SecurityKeyAuthenticationDefaults.AuthenticationScheme, configureOptions);
3844

3945
/// <summary>
40-
/// Adds security API key authentication to <see cref="AuthenticationBuilder"/> using the specified scheme.
46+
/// Registers security API key authentication using a specified scheme and allows configuration of options.
4147
/// </summary>
42-
/// <param name="builder">The <see cref="AuthenticationBuilder"/>.</param>
43-
/// <param name="authenticationScheme">The authentication scheme.</param>
48+
/// <param name="builder">The <see cref="AuthenticationBuilder"/> to configure.</param>
49+
/// <param name="authenticationScheme">The name of the authentication scheme to use.</param>
4450
/// <param name="configureOptions">A delegate to configure <see cref="SecurityKeyAuthenticationSchemeOptions"/>.</param>
45-
/// <returns>A reference to <paramref name="builder"/> after the operation has completed.</returns>
51+
/// <returns>
52+
/// The <see cref="AuthenticationBuilder"/> instance for chaining further authentication configuration.
53+
/// </returns>
4654
public static AuthenticationBuilder AddSecurityKey(this AuthenticationBuilder builder, string authenticationScheme, Action<SecurityKeyAuthenticationSchemeOptions>? configureOptions)
4755
=> builder.AddSecurityKey(authenticationScheme, displayName: null, configureOptions: configureOptions);
4856

4957
/// <summary>
50-
/// Adds security API key authentication to <see cref="AuthenticationBuilder"/> using the specified scheme.
58+
/// Registers security API key authentication using a specified scheme, display name, and configuration options.
5159
/// </summary>
52-
/// <param name="builder">The <see cref="AuthenticationBuilder"/>.</param>
53-
/// <param name="authenticationScheme">The authentication scheme.</param>
54-
/// <param name="displayName">A display name for the authentication handler.</param>
60+
/// <param name="builder">The <see cref="AuthenticationBuilder"/> to configure.</param>
61+
/// <param name="authenticationScheme">The name of the authentication scheme to use.</param>
62+
/// <param name="displayName">A display name for the authentication handler, used for UI or logging purposes.</param>
5563
/// <param name="configureOptions">A delegate to configure <see cref="SecurityKeyAuthenticationSchemeOptions"/>.</param>
56-
/// <returns>A reference to <paramref name="builder"/> after the operation has completed.</returns>
64+
/// <returns>
65+
/// The <see cref="AuthenticationBuilder"/> instance for chaining further authentication configuration.
66+
/// </returns>
67+
/// <exception cref="ArgumentNullException">
68+
/// Thrown when <paramref name="builder"/> is <c>null</c>.
69+
/// </exception>
5770
public static AuthenticationBuilder AddSecurityKey(this AuthenticationBuilder builder, string authenticationScheme, string? displayName, Action<SecurityKeyAuthenticationSchemeOptions>? configureOptions)
5871
{
5972
ArgumentNullException.ThrowIfNull(builder);

src/AspNetCore.SecurityKey/DependencyInjectionExtensions.cs

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,49 @@
55
namespace AspNetCore.SecurityKey;
66

77
/// <summary>
8-
/// Extension methods for setting up security API key services
8+
/// Provides extension methods for registering security API key services in an ASP.NET Core application.
99
/// </summary>
1010
public static class DependencyInjectionExtensions
1111
{
1212
/// <summary>
13-
/// Adds the security API key services to the specified <see cref="IServiceCollection"/>.
13+
/// Registers the default security API key services and configuration in the specified <see cref="IServiceCollection"/>.
14+
/// Uses <see cref="SecurityKeyValidator"/> for validation and <see cref="SecurityKeyExtractor"/> for extraction.
1415
/// </summary>
15-
/// <param name="services">The <see cref="IServiceCollection"/> to add services.</param>
16-
/// <param name="configure">An action delegate to configure the provided <see cref="SecurityKeyOptions"/>.</param>
16+
/// <param name="services">The <see cref="IServiceCollection"/> to which the services are added.</param>
17+
/// <param name="configure">An optional delegate to configure <see cref="SecurityKeyOptions"/>.</param>
1718
/// <returns>
18-
/// The <see cref="IServiceCollection"/> so that additional calls can be chained.
19+
/// The same <see cref="IServiceCollection"/> instance for chaining further service registrations.
1920
/// </returns>
2021
public static IServiceCollection AddSecurityKey(this IServiceCollection services, Action<SecurityKeyOptions>? configure = null)
2122
=> AddSecurityKey<SecurityKeyValidator, SecurityKeyExtractor>(services, configure);
2223

2324
/// <summary>
24-
/// Adds the security API key services to the specified <see cref="IServiceCollection" />.
25+
/// Registers security API key services with a custom validator in the specified <see cref="IServiceCollection"/>.
26+
/// Uses <see cref="SecurityKeyExtractor"/> for extraction.
2527
/// </summary>
26-
/// <typeparam name="TValidator">The type for validating the security API key.</typeparam>
27-
/// <param name="services">The <see cref="IServiceCollection" /> to add services.</param>
28-
/// <param name="configure">An action delegate to configure the provided <see cref="SecurityKeyOptions" />.</param>
28+
/// <typeparam name="TValidator">The type implementing <see cref="ISecurityKeyValidator"/> for validating the security API key.</typeparam>
29+
/// <param name="services">The <see cref="IServiceCollection"/> to which the services are added.</param>
30+
/// <param name="configure">An optional delegate to configure <see cref="SecurityKeyOptions"/>.</param>
2931
/// <returns>
30-
/// The <see cref="IServiceCollection" /> so that additional calls can be chained.
32+
/// The same <see cref="IServiceCollection"/> instance for chaining further service registrations.
3133
/// </returns>
3234
public static IServiceCollection AddSecurityKey<TValidator>(this IServiceCollection services, Action<SecurityKeyOptions>? configure = null)
3335
where TValidator : class, ISecurityKeyValidator
3436
=> AddSecurityKey<TValidator, SecurityKeyExtractor>(services, configure);
3537

3638
/// <summary>
37-
/// Adds the security API key services to the specified <see cref="IServiceCollection" />.
39+
/// Registers security API key services with custom validator and extractor types in the specified <see cref="IServiceCollection"/>.
3840
/// </summary>
39-
/// <typeparam name="TValidator">The type for validating the security API key.</typeparam>
40-
/// <typeparam name="TExtractor">The type for extracting the security API key.</typeparam>
41-
/// <param name="services">The <see cref="IServiceCollection" /> to add services.</param>
42-
/// <param name="configure">An action delegate to configure the provided <see cref="SecurityKeyOptions" />.</param>
41+
/// <typeparam name="TValidator">The type implementing <see cref="ISecurityKeyValidator"/> for validating the security API key.</typeparam>
42+
/// <typeparam name="TExtractor">The type implementing <see cref="ISecurityKeyExtractor"/> for extracting the security API key.</typeparam>
43+
/// <param name="services">The <see cref="IServiceCollection"/> to which the services are added.</param>
44+
/// <param name="configure">An optional delegate to configure <see cref="SecurityKeyOptions"/>.</param>
4345
/// <returns>
44-
/// The <see cref="IServiceCollection" /> so that additional calls can be chained.
46+
/// The same <see cref="IServiceCollection"/> instance for chaining further service registrations.
4547
/// </returns>
48+
/// <exception cref="ArgumentNullException">
49+
/// Thrown when <paramref name="services"/> is <c>null</c>.
50+
/// </exception>
4651
public static IServiceCollection AddSecurityKey<TValidator, TExtractor>(this IServiceCollection services, Action<SecurityKeyOptions>? configure = null)
4752
where TValidator : class, ISecurityKeyValidator
4853
where TExtractor : class, ISecurityKeyExtractor

src/AspNetCore.SecurityKey/EndpointFilterExtensions.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@
55
namespace AspNetCore.SecurityKey;
66

77
/// <summary>
8-
/// Extension methods for adding <see cref="IEndpointFilter" /> to a route handler.
8+
/// Provides extension methods for attaching <see cref="IEndpointFilter"/> implementations to route handlers.
99
/// </summary>
1010
public static class EndpointFilterExtensions
1111
{
1212
/// <summary>
13-
/// Registers an endpoint filter requiring security API key for the specified route handler.
13+
/// Adds an endpoint filter to the specified <see cref="RouteHandlerBuilder"/> that enforces a security API key requirement.
14+
/// The filter uses <see cref="SecurityKeyEndpointFilter"/> to validate requests for the presence of a valid API key.
1415
/// </summary>
15-
/// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
16+
/// <param name="builder">The <see cref="RouteHandlerBuilder"/> to configure.</param>
1617
/// <returns>
17-
/// A <see cref="RouteHandlerBuilder"/> that can be used to further customize the route handler.
18+
/// The same <see cref="RouteHandlerBuilder"/> instance for further route customization.
1819
/// </returns>
20+
/// <exception cref="ArgumentNullException">
21+
/// Thrown when <paramref name="builder"/> is <c>null</c>.
22+
/// </exception>
1923
public static RouteHandlerBuilder RequireSecurityKey(this RouteHandlerBuilder builder)
2024
{
2125
ArgumentNullException.ThrowIfNull(builder);

src/AspNetCore.SecurityKey/ISecurityKeyExtractor.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
namespace AspNetCore.SecurityKey;
44

55
/// <summary>
6-
/// An interface for extracting the security API key
6+
/// Defines a contract for extracting a security API key from an HTTP request context.
7+
/// Implementations should provide logic to retrieve the API key from headers, query parameters, or other request data.
78
/// </summary>
89
public interface ISecurityKeyExtractor
910
{
1011
/// <summary>
11-
/// Gets the security API key from the specified <see cref="HttpContent"/>.
12+
/// Attempts to extract the security API key from the specified <see cref="HttpContext"/>.
13+
/// Implementations may inspect headers, query parameters, or other request properties to locate the key.
1214
/// </summary>
13-
/// <param name="context">The <see cref="HttpContent"/> to get security key from.</param>
14-
/// <returns>The security API key if found; otherwise null</returns>
15+
/// <param name="context">The <see cref="HttpContext"/> representing the current HTTP request.</param>
16+
/// <returns>
17+
/// The extracted security API key if found; otherwise, <c>null</c>.
18+
/// </returns>
1519
string? GetKey(HttpContext? context);
1620
}

src/AspNetCore.SecurityKey/ISecurityKeyValidator.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,29 @@
33
namespace AspNetCore.SecurityKey;
44

55
/// <summary>
6-
/// An interface for validating the security API key
6+
/// Defines a contract for validating and authenticating security API keys in an HTTP request context.
7+
/// Implementations should provide logic to verify the key's validity and produce authentication identities.
78
/// </summary>
89
public interface ISecurityKeyValidator
910
{
1011
/// <summary>
11-
/// Validates the specified security API key.
12+
/// Asynchronously validates the specified security API key.
1213
/// </summary>
13-
/// <param name="value">The security API key to validate.</param>
14-
/// <param name="cancellationToken">The cancellation token.</param>
14+
/// <param name="value">The security API key to validate. May be <c>null</c> if not provided in the request.</param>
15+
/// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe while waiting for the task to complete.</param>
1516
/// <returns>
16-
/// true if security API key is valid; otherwise false
17+
/// A <see cref="ValueTask{Boolean}"/> that resolves to <c>true</c> if the security API key is valid; otherwise, <c>false</c>.
1718
/// </returns>
1819
ValueTask<bool> Validate(string? value, CancellationToken cancellationToken = default);
1920

2021
/// <summary>
21-
/// Authenticate the specified security API key.
22+
/// Asynchronously authenticates the specified security API key and produces a <see cref="ClaimsIdentity"/> if valid.
2223
/// </summary>
23-
/// <param name="value">The security API key to validate.</param>
24-
/// <param name="cancellationToken">The cancellation token.</param>
24+
/// <param name="value">The security API key to authenticate. May be <c>null</c> if not provided in the request.</param>
25+
/// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe while waiting for the task to complete.</param>
2526
/// <returns>
26-
/// <see cref="ClaimsIdentity" /> result of the authentication
27+
/// A <see cref="ValueTask{ClaimsIdentity}"/> representing the result of the authentication.
28+
/// The returned <see cref="ClaimsIdentity"/> should reflect the authenticated principal if the key is valid.
2729
/// </returns>
2830
ValueTask<ClaimsIdentity> Authenticate(string? value, CancellationToken cancellationToken = default);
2931
}

src/AspNetCore.SecurityKey/SecurityKeyAttribute.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
namespace AspNetCore.SecurityKey;
44

55
/// <summary>
6-
/// Specifies that the class or method that this attribute is applied to requires security API key authorization.
6+
/// Indicates that the decorated controller or action requires security API key authorization.
7+
/// When applied, requests must provide a valid API key to access the resource.
8+
/// This attribute uses <see cref="SecurityKeyAuthorizationFilter"/> to enforce authorization.
79
/// </summary>
810
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
911
public class SecurityKeyAttribute : ServiceFilterAttribute
1012
{
1113
/// <summary>
12-
/// Initializes a new instance of the <see cref="SecurityKeyAttribute"/> class.
14+
/// Initializes a new instance of the <see cref="SecurityKeyAttribute"/> class,
15+
/// configuring it to use <see cref="SecurityKeyAuthorizationFilter"/> for API key validation.
1316
/// </summary>
1417
public SecurityKeyAttribute() : base(typeof(SecurityKeyAuthorizationFilter))
1518
{

0 commit comments

Comments
 (0)