-
-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce wrapping objects for Options-methods (#562)
* RequestNewCredentialParams * Create wrapper objects for GetAssertionOptinos * format * remove empty comment
- Loading branch information
Showing
7 changed files
with
123 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Fido2NetLib.Objects; | ||
|
||
namespace Fido2NetLib; | ||
|
||
/// <summary> | ||
/// The input arguments for generating AssertionOptions | ||
/// </summary> | ||
public sealed class GetAssertionOptionsParams | ||
{ | ||
/// <summary> | ||
/// This OPTIONAL member is used by the client to find authenticators eligible for this authentication ceremony. It can be used in two ways: | ||
/// | ||
/// * If the user account to authenticate is already identified (e.g., if the user has entered a username), then the Relying Party SHOULD use this member to list credential descriptors for credential records in the user account. This SHOULD usually include all credential records in the user account. | ||
/// The items SHOULD specify transports whenever possible. This helps the client optimize the user experience for any given situation. Also note that the Relying Party does not need to filter the list when requesting user verification — the client will automatically ignore non-eligible credentials if userVerification is set to required. | ||
/// See also the § 14.6.3 Privacy leak via credential IDs privacy consideration. | ||
/// * If the user account to authenticate is not already identified, then the Relying Party MAY leave this member empty or unspecified. In this case, only discoverable credentials will be utilized in this authentication ceremony, and the user account MAY be identified by the userHandle of the resulting AuthenticatorAssertionResponse. If the available authenticators contain more than one discoverable credential scoped to the Relying Party, the credentials are displayed by the client platform or authenticator for the user to select from (see step 7 of § 6.3.3 The authenticatorGetAssertion Operation). | ||
/// | ||
/// If not empty, the client MUST return an error if none of the listed credentials can be used. | ||
/// | ||
/// The list is ordered in descending order of preference: the first item in the list is the most preferred credential, and the last is the least preferred. | ||
/// </summary> | ||
public IReadOnlyList<PublicKeyCredentialDescriptor> AllowedCredentials { get; init; } = Array.Empty<PublicKeyCredentialDescriptor>(); | ||
|
||
/// <summary> | ||
/// This OPTIONAL member specifies the Relying Party's requirements regarding user verification for the get() operation. The value SHOULD be a member of UserVerificationRequirement but client platforms MUST ignore unknown values, treating an unknown value as if the member does not exist. Eligible authenticators are filtered to only those capable of satisfying this requirement. | ||
/// </summary> | ||
public UserVerificationRequirement? UserVerification { get; init; } | ||
|
||
/// <summary> | ||
/// The Relying Party MAY use this OPTIONAL member to provide client extension inputs requesting additional processing by the client and authenticator. | ||
/// </summary> | ||
public AuthenticationExtensionsClientInputs? Extensions { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Fido2NetLib.Objects; | ||
|
||
namespace Fido2NetLib; | ||
|
||
/// <summary> | ||
/// The input arguments for generating CredentialCreateOptions | ||
/// </summary> | ||
public sealed class RequestNewCredentialParams | ||
{ | ||
/// <summary> | ||
/// This member contains names and an identifier for the user account performing the registration. Its value’s name, displayName and id members are REQUIRED. id can be returned as the userHandle in some future authentication ceremonies, and is used to overwrite existing discoverable credentials that have the same rp.id and user.id on the same authenticator. name and displayName MAY be used by the authenticator and client in future authentication ceremonies to help the user select a credential, but are not returned to the Relying Party as a result of future authentication ceremonies | ||
/// </summary> | ||
public required Fido2User User { get; init; } | ||
|
||
/// <summary> | ||
/// The Relying Party SHOULD use this OPTIONAL member to list any existing credentials mapped to this user account (as identified by user.id). This ensures that the new credential is not created on an authenticator that already contains a credential mapped to this user account. If it would be, the client is requested to instead guide the user to use a different authenticator, or return an error if that fails. | ||
/// </summary> | ||
public IReadOnlyList<PublicKeyCredentialDescriptor> ExcludeCredentials { get; init; } = | ||
Array.Empty<PublicKeyCredentialDescriptor>(); | ||
|
||
/// <summary> | ||
/// The Relying Party MAY use this OPTIONAL member to specify capabilities and settings that the authenticator MUST or SHOULD satisfy to participate in the create() operation. See § 5.4.4 Authenticator Selection Criteria (dictionary AuthenticatorSelectionCriteria). | ||
/// </summary> | ||
public AuthenticatorSelection AuthenticatorSelection { get; init; } = AuthenticatorSelection.Default; | ||
|
||
/// <summary> | ||
/// The Relying Party MAY use this OPTIONAL member to specify a preference regarding attestation conveyance. Its value SHOULD be a member of AttestationConveyancePreference. Client platforms MUST ignore unknown values, treating an unknown value as if the member does not exist. | ||
/// </summary> | ||
public AttestationConveyancePreference AttestationPreference { get; init; } = AttestationConveyancePreference.None; | ||
|
||
/// <summary> | ||
/// The Relying Party MAY use this OPTIONAL member to provide client extension inputs requesting additional processing by the client and authenticator. For example, the Relying Party may request that the client returns additional information about the credential that was created. | ||
/// </summary> | ||
public AuthenticationExtensionsClientInputs? Extensions { get; init; } | ||
} |