4444import at .asit .pdfover .gui .composites .mobilebku .MobileBKUEnterNumberComposite ;
4545import at .asit .pdfover .gui .composites .mobilebku .MobileBKUEnterTANComposite ;
4646import at .asit .pdfover .gui .composites .mobilebku .MobileBKUFido2Composite ;
47- import at .asit .pdfover .gui .composites .mobilebku .MobileBKUFingerprintComposite ;
47+ import at .asit .pdfover .gui .composites .mobilebku .MobileBKUNeedsAppComposite ;
4848import at .asit .pdfover .gui .composites .mobilebku .MobileBKUQRComposite ;
49- import at .asit .pdfover .gui .composites .mobilebku .WaitingForAppComposite ;
5049import at .asit .pdfover .gui .controls .Dialog .BUTTONS ;
5150import at .asit .pdfover .gui .controls .Dialog .ICON ;
5251import at .asit .pdfover .gui .utils .HttpClientUtils ;
@@ -71,16 +70,6 @@ public MobileBKUState(StateMachine stateMachine) {
7170
7271 MobileBKUEnterTANComposite mobileBKUEnterTANComposite = null ;
7372
74- WaitingForAppComposite waitingForAppComposite = null ;
75- WaitingForAppComposite getWaitingForAppComposite () {
76- if (this .waitingForAppComposite == null ) {
77- this .waitingForAppComposite = getStateMachine ()
78- .createComposite (WaitingForAppComposite .class , SWT .RESIZE , this );
79- }
80-
81- return this .waitingForAppComposite ;
82- }
83-
8473 WaitingComposite waitingComposite = null ;
8574 WaitingComposite getWaitingComposite () {
8675 if (this .waitingComposite == null ) {
@@ -120,14 +109,14 @@ MobileBKUEnterNumberComposite getMobileBKUEnterNumberComposite() {
120109 return this .mobileBKUEnterNumberComposite ;
121110 }
122111
123- MobileBKUFingerprintComposite mobileBKUFingerprintComposite = null ;
124- MobileBKUFingerprintComposite getMobileBKUFingerprintComposite () {
125- if (this .mobileBKUFingerprintComposite == null ) {
126- this .mobileBKUFingerprintComposite = getStateMachine ()
127- .createComposite (MobileBKUFingerprintComposite .class , SWT .RESIZE , this );
112+ MobileBKUNeedsAppComposite mobileBKUNeedsAppComposite = null ;
113+ MobileBKUNeedsAppComposite getMobileBKUNeedsAppComposite () {
114+ if (this .mobileBKUNeedsAppComposite == null ) {
115+ this .mobileBKUNeedsAppComposite = getStateMachine ()
116+ .createComposite (MobileBKUNeedsAppComposite .class , SWT .RESIZE , this );
128117 }
129118
130- return this .mobileBKUFingerprintComposite ;
119+ return this .mobileBKUNeedsAppComposite ;
131120 }
132121
133122 MobileBKUFido2Composite mobileBKUFido2Composite = null ;
@@ -430,64 +419,9 @@ public void signalQRScanned() {
430419 getMobileBKUQRComposite ().signalPollingDone ();
431420 }
432421
433- /**
434- * start showing the "waiting for app" screen
435- * this method will return immediately */
436- public void showWaitingForAppOpen (final @ NonNull String referenceValue , URI signatureDataURI , final boolean showSmsTan , final boolean showFido2 ) {
437- Display .getDefault ().syncExec (() -> {
438- WaitingForAppComposite wfa = getWaitingForAppComposite ();
439- wfa .reset ();
440-
441- // TODO composite does not currently support: refval, signature data
442- wfa .setSMSEnabled (showSmsTan );
443- wfa .setFIDO2Enabled (showFido2 );
444- getStateMachine ().display (wfa );
445- });
446- }
447-
448- public enum AppOpenResult {
449- /* the user has pressed the FIDO2 button */
450- TO_FIDO2 ,
451- /* the user has pressed the SMS button */
452- TO_SMS ,
453- /* signalAppOpened has been called; this indicates that we should refresh the page */
454- UPDATE
455- };
456-
457- public @ NonNull AppOpenResult waitForAppOpen () throws UserCancelledException {
458- return Display .getDefault ().syncCall (() -> {
459- WaitingForAppComposite wfa = getWaitingForAppComposite ();
460-
461- readAndDispatchSWTUntil (() -> wfa .isDone ());
462-
463- getStateMachine ().display (this .getWaitingComposite ());
464-
465- if (wfa .wasCancelClicked ()) {
466- clearRememberedPassword ();
467- throw new UserCancelledException ();
468- }
469-
470- if (wfa .wasSMSClicked ())
471- return AppOpenResult .TO_SMS ;
472-
473- if (wfa .wasFIDO2Clicked ())
474- return AppOpenResult .TO_FIDO2 ;
475-
476- return AppOpenResult .UPDATE ;
477- });
478- }
479-
480- /**
481- * indicate that the long polling operation completed
482- * (any ongoing waitForAppOpen call will then return)
483- */
484- public void signalAppOpened () {
485- getWaitingForAppComposite ().signalPollingDone ();
486- }
487-
488- public void showWaitingForAppBiometry (final @ NonNull String referenceValue , URI signatureDataURI , final boolean showSmsTan , final boolean showFido2 ) {
422+ public void showWaitingForApp2FA (final @ NonNull String referenceValue , URI signatureDataURI , final boolean showSmsTan , final boolean showFido2 ) {
489423 Display .getDefault ().syncExec (() -> {
490- MobileBKUFingerprintComposite bio = getMobileBKUFingerprintComposite ();
424+ MobileBKUNeedsAppComposite bio = getMobileBKUNeedsAppComposite ();
491425 bio .reset ();
492426
493427 bio .setRefVal (referenceValue );
@@ -501,18 +435,18 @@ public void showWaitingForAppBiometry(final @NonNull String referenceValue, URI
501435
502436 // TODO can we maybe deduplicate the various waiting screens' logic?
503437
504- public enum AppBiometryResult {
438+ public enum App2FAResult {
505439 /* the user has pressed the FIDO2 button */
506440 TO_FIDO2 ,
507441 /* the user has pressed the SMS button */
508442 TO_SMS ,
509- /* signalAppBiometryDone has been called; this indicates that we should refresh the page */
443+ /* signalApp2FADone has been called; this indicates that we should refresh the page */
510444 UPDATE
511445 };
512446
513- public @ NonNull AppBiometryResult waitForAppBiometry () throws UserCancelledException {
447+ public @ NonNull App2FAResult waitForApp2FA () throws UserCancelledException {
514448 return Display .getDefault ().syncCall (() -> {
515- MobileBKUFingerprintComposite bio = getMobileBKUFingerprintComposite ();
449+ MobileBKUNeedsAppComposite bio = getMobileBKUNeedsAppComposite ();
516450
517451 readAndDispatchSWTUntil (() -> bio .isDone ());
518452
@@ -524,17 +458,17 @@ public enum AppBiometryResult {
524458 }
525459
526460 if (bio .wasSMSClicked ())
527- return AppBiometryResult .TO_SMS ;
461+ return App2FAResult .TO_SMS ;
528462
529463 if (bio .wasFIDO2Clicked ())
530- return AppBiometryResult .TO_FIDO2 ;
464+ return App2FAResult .TO_FIDO2 ;
531465
532- return AppBiometryResult .UPDATE ;
466+ return App2FAResult .UPDATE ;
533467 });
534468 }
535469
536- public void signalAppBiometryDone () {
537- getMobileBKUFingerprintComposite ().signalPollingDone ();
470+ public void signalApp2FADone () {
471+ getMobileBKUNeedsAppComposite ().signalPollingDone ();
538472 }
539473
540474 public static class FIDO2Result {
@@ -613,8 +547,6 @@ public void cleanUp() {
613547 this .mobileBKUEnterTANComposite .dispose ();
614548 if (this .waitingComposite != null )
615549 this .waitingComposite .dispose ();
616- if (this .waitingForAppComposite != null )
617- this .waitingForAppComposite .dispose ();
618550 }
619551
620552 /*
0 commit comments