@@ -503,34 +503,33 @@ public ByteArray signedBytes() {
503
503
class Step21 implements Step <Finished > {
504
504
private final String username ;
505
505
private final RegisteredCredential credential ;
506
+ private final long assertionSignatureCount ;
506
507
private final long storedSignatureCountBefore ;
507
508
508
509
public Step21 (String username , RegisteredCredential credential ) {
509
510
this .username = username ;
510
511
this .credential = credential ;
512
+ this .assertionSignatureCount =
513
+ response .getResponse ().getParsedAuthenticatorData ().getSignatureCounter ();
511
514
this .storedSignatureCountBefore = credential .getSignatureCount ();
512
515
}
513
516
514
517
@ Override
515
518
public void validate () throws InvalidSignatureCountException {
516
519
if (validateSignatureCounter && !signatureCounterValid ()) {
517
520
throw new InvalidSignatureCountException (
518
- response .getId (), storedSignatureCountBefore + 1 , assertionSignatureCount () );
521
+ response .getId (), storedSignatureCountBefore + 1 , assertionSignatureCount );
519
522
}
520
523
}
521
524
522
525
private boolean signatureCounterValid () {
523
- return (assertionSignatureCount () == 0 && storedSignatureCountBefore == 0 )
524
- || assertionSignatureCount () > storedSignatureCountBefore ;
526
+ return (assertionSignatureCount == 0 && storedSignatureCountBefore == 0 )
527
+ || assertionSignatureCount > storedSignatureCountBefore ;
525
528
}
526
529
527
530
@ Override
528
531
public Finished nextStep () {
529
- return new Finished (credential , username , assertionSignatureCount (), signatureCounterValid ());
530
- }
531
-
532
- private long assertionSignatureCount () {
533
- return response .getResponse ().getParsedAuthenticatorData ().getSignatureCounter ();
532
+ return new Finished (credential , username , assertionSignatureCount , signatureCounterValid ());
534
533
}
535
534
}
536
535
0 commit comments