Skip to content

Commit

Permalink
Add xmldocs
Browse files Browse the repository at this point in the history
  • Loading branch information
vanbukin committed Dec 12, 2023
1 parent cb302e7 commit 5aa4fbc
Show file tree
Hide file tree
Showing 13 changed files with 412 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace WebAuthn.Net.Models.Protocol.RegistrationCeremony.CreateCredential;

/// <summary>
/// Information About Public Key Credential
/// Information about Public Key Credential
/// </summary>
/// <remarks>
/// <para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
namespace WebAuthn.Net.Services.AuthenticationCeremony;

/// <summary>
/// The service responsible for verifying and processing an <a href="https://www.w3.org/TR/webauthn-3/#authentication-assertion">authentication assertion</a>
/// to perform the <a href="https://www.w3.org/TR/webauthn-3/#authentication-ceremony">authentication ceremony</a>.
/// The service responsible for verifying and processing an <a href="https://www.w3.org/TR/2023/WD-webauthn-3-20230927/#authentication-assertion">authentication assertion</a>
/// to perform the <a href="https://www.w3.org/TR/2023/WD-webauthn-3-20230927/#authentication-ceremony">authentication ceremony</a>.
/// </summary>
/// <remarks>
/// <a href="https://www.w3.org/TR/webauthn-3/#sctn-verifying-assertion">Web Authentication: An API for accessing Public Key Credentials Level 3 - §7.2. Verifying an Authentication Assertion</a>
/// <a href="https://www.w3.org/TR/2023/WD-webauthn-3-20230927/#sctn-verifying-assertion">Web Authentication: An API for accessing Public Key Credentials Level 3 - §7.2. Verifying an Authentication Assertion</a>
/// </remarks>
public interface IAuthenticationCeremonyService
{
/// <summary>
/// Asynchronously initiates the authentication ceremony, generating options in order to execute it.
/// Asynchronously initiates the authentication ceremony, generating parameters for its execution.
/// </summary>
/// <param name="httpContext">The context of the HTTP request in which the WebAuthn operation is being processed.</param>
/// <param name="request">A request containing the parameters for generating options for the authentication ceremony.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class DefaultAuthenticationCeremonyService<TContext> : IAuthenticationCer
/// <param name="timeProvider">Current time provider.</param>
/// <param name="publicKeyCredentialRequestOptionsEncoder">Encoder for transforming <see cref="PublicKeyCredentialRequestOptions" /> into a model suitable for JSON serialization.</param>
/// <param name="credentialStorage">Credential storage. This is where the credentials are located, providing methods for storing credentials that are created during the registration ceremony, as well as methods for accessing them during the authentication ceremony.</param>
/// <param name="ceremonyStorage">Storage for authentication ceremony data. Used for storing options used in the authentication ceremony.</param>
/// <param name="ceremonyStorage">Storage for authentication ceremony data.</param>
/// <param name="authenticationResponseDecoder">Decoder for <see cref="AuthenticationResponseJSON" /> (<a href="https://www.w3.org/TR/2023/WD-webauthn-3-20230927/#iface-pkcredential">PublicKeyCredential</a>) from a model suitable for JSON serialization into a typed representation.</param>
/// <param name="clientDataDecoder">Decoder for <a href="https://www.w3.org/TR/2023/WD-webauthn-3-20230927/#dictionary-client-data">clientData</a> from JSON into a typed representation.</param>
/// <param name="attestationObjectDecoder">Decoder for <a href="https://www.w3.org/TR/2023/WD-webauthn-3-20230927/#fig-attStructs">attestationObject</a> from binary into a typed representation.</param>
Expand Down Expand Up @@ -179,7 +179,7 @@ public DefaultAuthenticationCeremonyService(
protected ICredentialStorage<TContext> CredentialStorage { get; }

/// <summary>
/// Storage for authentication ceremony data. Used for storing options used in the authentication ceremony.
/// Storage for authentication ceremony data.
/// </summary>
protected IAuthenticationCeremonyStorage<TContext> CeremonyStorage { get; }

Expand Down Expand Up @@ -276,7 +276,7 @@ public async Task<BeginAuthenticationCeremonyResult> BeginCeremonyAsync(
var expectedRpParameters = new AuthenticationCeremonyRpParameters(rpId, origins, allowIframe, topOrigins);
var timeout = GetTimeout(request);
var createdAt = TimeProvider.GetRoundUtcDateTime();
var expiresAt = ComputeExpiresAtUtc(createdAt, timeout);
var expiresAt = GetExpiresAtUtc(createdAt, timeout);
var options = CreatePublicKeyCredentialRequestOptions(request, timeout, rpId, challenge, credentialsToInclude);
var outputOptions = PublicKeyCredentialRequestOptionsEncoder.Encode(options);
var authenticationCeremonyOptions = new AuthenticationCeremonyParameters(
Expand Down Expand Up @@ -723,12 +723,12 @@ public async Task<CompleteAuthenticationCeremonyResult> CompleteCeremonyAsync(
}

/// <summary>
/// Computes the expiration date of the authentication ceremony.
/// Computes the expiration date of the authentication ceremony's lifetime.
/// </summary>
/// <param name="createdAt">Creation date of the authentication ceremony.</param>
/// <param name="timeout">Authentication ceremony timeout in milliseconds.</param>
/// <returns>The expiration date of the authentication ceremony, after which it will be considered that its data has been deleted.</returns>
protected virtual DateTimeOffset ComputeExpiresAtUtc(DateTimeOffset createdAt, uint timeout)
/// <returns>Expiration date of the authentication ceremony's lifetime, after which its data is expected to be deleted.</returns>
protected virtual DateTimeOffset GetExpiresAtUtc(DateTimeOffset createdAt, uint timeout)
{
var expiresAtMilliseconds = createdAt.ToUnixTimeMilliseconds() + timeout;
return DateTimeOffset.FromUnixTimeMilliseconds(expiresAtMilliseconds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class CompleteAuthenticationCeremonyRequest
/// Constructs <see cref="CompleteAuthenticationCeremonyRequest" />.
/// </summary>
/// <param name="authenticationCeremonyId">Unique identifier of the authentication ceremony.</param>
/// <param name="response">The result of executing the authentication ceremony, serialized into JSON according to the rules described in the specification.</param>
/// <param name="response">The result of performing the authentication ceremony serialized into a model suitable for JSON serialization in accordance with the rules described in the specification.</param>
/// <exception cref="ArgumentNullException"><paramref name="authenticationCeremonyId" /> is <see langword="null" /></exception>
/// <exception cref="ArgumentException"><paramref name="authenticationCeremonyId" /> is empty</exception>
/// <exception cref="ArgumentNullException"><paramref name="response" /> is <see langword="null" /></exception>
Expand All @@ -38,7 +38,7 @@ public CompleteAuthenticationCeremonyRequest(string authenticationCeremonyId, Au
public string AuthenticationCeremonyId { get; }

/// <summary>
/// The result of executing the authentication ceremony, serialized into JSON according to the rules described in the specification.
/// The result of performing the authentication ceremony serialized into a model suitable for JSON serialization in accordance with the rules described in the specification.
/// </summary>
public AuthenticationResponseJSON Response { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public interface IPublicKeyCredentialRequestOptionsEncoder
/// Converts <see cref="PublicKeyCredentialRequestOptions" /> into a model suitable for serialization into JSON.
/// </summary>
/// <param name="options"><see cref="PublicKeyCredentialRequestOptions" /> that need to be converted into a model suitable for serialization into JSON.</param>
/// <returns>A model suitable for serialization into JSON.</returns>
/// <returns>Model suitable for serialization into JSON.</returns>
PublicKeyCredentialRequestOptionsJSON Encode(PublicKeyCredentialRequestOptions options);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,33 @@

namespace WebAuthn.Net.Services.RegistrationCeremony;

/// <summary>
/// The service responsible for <a href="https://www.w3.org/TR/2023/WD-webauthn-3-20230927/#registration-ceremony">creating a public key credential and associating it with a user account</a>.
/// </summary>
/// <remarks>
/// <a href="https://www.w3.org/TR/2023/WD-webauthn-3-20230927/#sctn-registering-a-new-credential">Web Authentication: An API for accessing Public Key Credentials Level 3 - §7.1. Registering a New Credential</a>
/// </remarks>
public interface IRegistrationCeremonyService
{
/// <summary>
/// Asynchronously initiates the registration ceremony, generating parameters for its execution.
/// </summary>
/// <param name="httpContext">The context of the HTTP request in which the WebAuthn operation is being processed.</param>
/// <param name="request">Request containing parameters for generating the registration ceremony options.</param>
/// <param name="cancellationToken">Cancellation token for an asynchronous operation.</param>
/// <returns>The result of initiating the registration ceremony.</returns>
Task<BeginRegistrationCeremonyResult> BeginCeremonyAsync(
HttpContext httpContext,
BeginRegistrationCeremonyRequest request,
CancellationToken cancellationToken);

/// <summary>
/// Asynchronously completes the registration ceremony.
/// </summary>
/// <param name="httpContext">The context of the HTTP request in which the WebAuthn operation is being processed.</param>
/// <param name="request">Request containing parameters for completing the registration ceremony.</param>
/// <param name="cancellationToken">Cancellation token for an asynchronous operation.</param>
/// <returns>The result of completing the registration ceremony.</returns>
Task<CompleteRegistrationCeremonyResult> CompleteCeremonyAsync(
HttpContext httpContext,
CompleteRegistrationCeremonyRequest request,
Expand Down
Loading

0 comments on commit 5aa4fbc

Please sign in to comment.