@@ -122,20 +122,18 @@ public async Task<VerifyAssertionResult> VerifyAsync(
122
122
var rpid = Raw . Extensions ? . AppID ?? false ? options . Extensions ? . GetAppID ( ) : options . RpId ;
123
123
byte [ ] hashedRpId = CryptoUtils . HashData ( HashAlgorithmName . SHA256 , Encoding . UTF8 . GetBytes ( rpid ?? string . Empty ) ) ;
124
124
byte [ ] hash = CryptoUtils . HashData ( HashAlgorithmName . SHA256 , Raw . Response . ClientDataJson ) ;
125
+ bool conformanceTesting = metadataService != null && metadataService . ConformanceTesting ( ) ;
125
126
126
127
if ( ! authData . RpIdHash . SequenceEqual ( hashedRpId ) )
127
128
throw new Fido2VerificationException ( Fido2ErrorCode . InvalidRpidHash , Fido2ErrorMessages . InvalidRpidHash ) ;
128
129
129
- if ( options . UserVerification is UserVerificationRequirement . Required )
130
- {
131
- // 14. Verify that the UP bit of the flags in authData is set.
132
- if ( ! authData . UserPresent )
133
- throw new Fido2VerificationException ( Fido2ErrorCode . UserPresentFlagNotSet , Fido2ErrorMessages . UserPresentFlagNotSet ) ;
130
+ // 14. Verify that the UP bit of the flags in authData is set.
131
+ if ( ! authData . UserPresent && ( ! conformanceTesting || options . UserVerification is UserVerificationRequirement . Required ) )
132
+ throw new Fido2VerificationException ( Fido2ErrorCode . UserPresentFlagNotSet , Fido2ErrorMessages . UserPresentFlagNotSet ) ;
134
133
135
- // 15. If the Relying Party requires user verification for this assertion, verify that the UV bit of the flags in authData is set.
136
- if ( ! authData . UserVerified )
137
- throw new Fido2VerificationException ( Fido2ErrorCode . UserVerificationRequirementNotMet , Fido2ErrorMessages . UserVerificationRequirementNotMet ) ;
138
- }
134
+ // 15. If the Relying Party requires user verification for this assertion, verify that the UV bit of the flags in authData is set.
135
+ if ( options . UserVerification is UserVerificationRequirement . Required && ! authData . UserVerified )
136
+ throw new Fido2VerificationException ( Fido2ErrorCode . UserVerificationRequirementNotMet , Fido2ErrorMessages . UserVerificationRequirementNotMet ) ;
139
137
140
138
// 16. If the credential backup state is used as part of Relying Party business logic or policy, let currentBe and currentBs be the values of the BE and BS bits, respectively, of the flags in authData.
141
139
// Compare currentBe and currentBs with credentialRecord.BE and credentialRecord.BS and apply Relying Party policy, if any.
0 commit comments