Skip to content

Commit

Permalink
Support "credProps" / "rk" (#152)
Browse files Browse the repository at this point in the history
* CredPropr RK wip

* Deprecated ResidentKey property
  • Loading branch information
jonashendrickx authored Oct 24, 2023
1 parent 269b6c7 commit 5e0ca26
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Service/Fido2ServiceEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public async Task<SessionResponse<CredentialCreateOptions>> RegisterBegin(FidoRe
// Selection
var authenticatorSelection = new AuthenticatorSelection
{
RequireResidentKey = token.Discoverable,
ResidentKey = token.Discoverable ? ResidentKeyRequirement.Required : ResidentKeyRequirement.Discouraged,
UserVerification = token.UserVerification.ToEnum<UserVerificationRequirement>(),
AuthenticatorAttachment = token.AuthenticatorType?.ToEnum<AuthenticatorAttachment>()
};
Expand All @@ -106,14 +106,22 @@ public async Task<SessionResponse<CredentialCreateOptions>> RegisterBegin(FidoRe

var attestation = token.Attestation.ToEnum<AttestationConveyancePreference>();

var options = _fido2.RequestNewCredential(user, keyIds, authenticatorSelection, attestation);
var options = _fido2.RequestNewCredential(
user,
keyIds,
authenticatorSelection,
attestation,
new AuthenticationExtensionsClientInputs
{
CredProps = true
});

var session = _tokenService.EncodeToken(new RegisterSession { Options = options, Aliases = token.Aliases, AliasHashing = token.AliasHashing }, "session_", true);

_eventLogger.LogRegistrationBeganEvent(userId);

// return options to client
return new SessionResponse<CredentialCreateOptions>() { Data = options, Session = session };
return new SessionResponse<CredentialCreateOptions> { Data = options, Session = session };
}
catch (ArgumentException e)
{
Expand Down

0 comments on commit 5e0ca26

Please sign in to comment.