diff options
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku')
6 files changed, 0 insertions, 1218 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterNumberComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterNumberComposite.java deleted file mode 100644 index 7c02eda0..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterNumberComposite.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.gui.composites.mobilebku; - -// Imports -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.asit.pdfover.commons.Constants; -import at.asit.pdfover.gui.bku.mobile.MobileBKUValidator; -import at.asit.pdfover.gui.composites.StateComposite; -import at.asit.pdfover.gui.exceptions.InvalidPasswordException; -import at.asit.pdfover.gui.utils.SWTUtils; -import at.asit.pdfover.commons.Messages; -import at.asit.pdfover.gui.workflow.states.State; - -/** - * Composite for entering the phone number for the mobile BKU - */ -public class MobileBKUEnterNumberComposite extends StateComposite { - /** - * SLF4J Logger instance - **/ - static final Logger log = LoggerFactory.getLogger(MobileBKUEnterNumberComposite.class); - - /** - * - */ - private final SelectionListener okListener = new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!MobileBKUEnterNumberComposite.this.btn_ok.isEnabled()) { - return; - } - - try { - String number = MobileBKUEnterNumberComposite.this.txt_number.getText(); - - MobileBKUEnterNumberComposite.this.setMobileNumber(number); - - String password = MobileBKUEnterNumberComposite.this.txt_password.getText(); - - MobileBKUValidator.validatePassword(password); - - MobileBKUEnterNumberComposite.this.mobilePassword = password; - MobileBKUEnterNumberComposite.this.userAck = true; - - MobileBKUEnterNumberComposite.this.btn_ok.setEnabled(false); - - } catch(InvalidPasswordException ex) { - log.info("Validating input for Mobile BKU failed!", ex); - MobileBKUEnterNumberComposite.this.setErrorMessage(ex.getMessage()); - MobileBKUEnterNumberComposite.this.txt_password.setFocus(); - } catch (Exception ex) { - log.info("Validating input for Mobile BKU failed!", ex); - MobileBKUEnterNumberComposite.this.setErrorMessage(Messages.getString("error.InvalidPhoneNumber")); - MobileBKUEnterNumberComposite.this.txt_number.setFocus(); - return; - } - } - }; - - /** - * - */ - private final SelectionListener cancelListener = new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MobileBKUEnterNumberComposite.this.userCancel = true; - } - }; - - - String mobileNumber; - - String mobilePassword; - - Text txt_number; - - Text txt_password; - - String errorMessage = null; - - public boolean userAck = false; - public boolean userCancel = false; - - - private Label lbl_error; - private Label lbl_password; - private Label lbl_number; - - Button btn_ok; - Button btn_cancel; - Button btn_remember; - - /** - * @return the errorMessage - */ - public String getErrorMessage() { - return this.errorMessage; - } - - /** - * @param errorMessage - * the errorMessage to set - */ - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - - if (this.errorMessage != null) { - this.lbl_error.setText(this.errorMessage); - } else { - this.lbl_error.setText(""); - } - } - - public boolean isRememberPassword() { return this.btn_remember.getSelection(); } - public void setRememberPassword(boolean state) { this.btn_remember.setSelection(state); } - - /** - * Create the composite. - * - * @param parent - * @param style - * @param state - */ - public MobileBKUEnterNumberComposite(Composite parent, int style, State state) { - super(parent, style, state); - setLayout(new FormLayout()); - - final Composite containerComposite = new Composite(this, SWT.NATIVE); - containerComposite.addPaintListener(e -> { - Rectangle clientArea = containerComposite.getClientArea(); - - //e.gc.setForeground(); - e.gc.setForeground(Constants.MAINBAR_ACTIVE_BACK_DARK); - e.gc.setLineWidth(3); - e.gc.setLineStyle(SWT.LINE_SOLID); - e.gc.drawRoundRectangle(clientArea.x, - clientArea.y, clientArea.width - 2, clientArea.height - 2, - 10, 10); - }); - containerComposite.setLayout(new FormLayout()); - SWTUtils.anchor(containerComposite).top(50, -120).bottom(50, 120).left(50, -200).right(50, 200); - - this.txt_number = new Text(containerComposite, SWT.SINGLE | SWT.NATIVE | SWT.BORDER); - SWTUtils.anchor(txt_number).bottom(50, -10).left(50, 10).right(100, -20); - this.txt_number.setEditable(true); - - this.lbl_number = new Label(containerComposite, SWT.NATIVE); - this.lbl_number.setAlignment(SWT.RIGHT); - SWTUtils.anchor(lbl_number).bottom(50, -10).right(50, -10); - - ImageData mobileIconData = new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_MOBILE)); - Image mobileIcon = new Image(getDisplay(), mobileIconData); - - Label lbl_image = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(lbl_image).top(20, -1 * (mobileIconData.width / 2)).bottom(20, mobileIconData.width / 2).left(0, 10).width(mobileIconData.width); - lbl_image.setImage(mobileIcon); - - this.txt_password = new Text(containerComposite, SWT.SINGLE | SWT.PASSWORD | SWT.BORDER | SWT.NATIVE); - SWTUtils.anchor(txt_password).top(50, 10).left(50, 10).right(100, -20); - this.txt_password.setEditable(true); - - this.lbl_password = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(lbl_password).top(50, 10).right(50, -10); - this.lbl_password.setAlignment(SWT.RIGHT); - - this.btn_ok = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btn_ok).bottom(100, -20).right(100, -20); - this.btn_ok.addSelectionListener(this.okListener); - - this.btn_cancel = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btn_cancel).bottom(100, -20).right(btn_ok, -10); - this.btn_cancel.addSelectionListener(this.cancelListener); - - this.lbl_error = new Label(containerComposite, SWT.WRAP | SWT.NATIVE ); - SWTUtils.anchor(lbl_error).bottom(103, -20).left(5, 0).right(btn_cancel, -10); - - this.btn_remember = new Button(containerComposite, SWT.CHECK); - SWTUtils.anchor(btn_remember).right(100, -10).top(0, 5); - } - - @Override public void onDisplay() { - getShell().setDefaultButton(this.btn_ok); - if (this.txt_number.getText().isEmpty()) { - this.txt_number.setFocus(); - } else { - this.txt_password.setFocus(); - } - } - - /** - * enables submit button - */ - public void enableButton() { - this.btn_ok.setEnabled(true); - } - - /** - * @return the mobileNumber - */ - public String getMobileNumber() { - return this.mobileNumber; - } - - /** - * @param mobileNumber - * the mobileNumber to set - */ - public void setMobileNumber(String mobileNumber) { - this.mobileNumber = mobileNumber; - - if (this.mobileNumber != null && !this.mobileNumber.isEmpty()) { - this.txt_number.setText(this.mobileNumber); - } else { - this.txt_number.setText(""); - } - } - - /** - * @return the mobilePassword - */ - public String getMobilePassword() { - return this.mobilePassword; - } - - - - /** - * @param mobilePassword - * the mobilePassword to set - */ - public void setMobilePassword(String mobilePassword) { - this.mobilePassword = mobilePassword; - - if (this.mobilePassword != null) { - this.txt_password.setText(this.mobilePassword); - } else { - this.txt_password.setText(""); - } - } - - /** (non-Javadoc) - * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() - */ - @Override - public void reloadResources() { - SWTUtils.setLocalizedText(lbl_number, "mobileBKU.number"); - SWTUtils.setLocalizedText(lbl_password, "mobileBKU.password"); - SWTUtils.setLocalizedText(btn_remember, "mobileBKU.rememberPassword"); - SWTUtils.setLocalizedText(btn_ok, "common.Ok"); - SWTUtils.setLocalizedText(btn_cancel, "common.Cancel"); - - SWTUtils.setLocalizedToolTipText(btn_remember, "mobileBKU.rememberPasswordNote"); - } - -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterTANComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterTANComposite.java deleted file mode 100644 index a1e90f51..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUEnterTANComposite.java +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.gui.composites.mobilebku; - -// Imports -import java.net.URI; -import java.util.Objects; - -import javax.annotation.CheckForNull; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.PaintEvent; -import org.eclipse.swt.events.PaintListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.eclipse.swt.widgets.Text; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.beust.jcommander.internal.Nullable; - -import at.asit.pdfover.commons.Constants; -import at.asit.pdfover.commons.Messages; -import at.asit.pdfover.gui.composites.StateComposite; -import at.asit.pdfover.gui.utils.SWTUtils; -import at.asit.pdfover.gui.workflow.states.State; -import at.asit.webauthn.WebAuthN; - -/** - * Composite for entering the TAN for the mobile BKU - */ -public class MobileBKUEnterTANComposite extends StateComposite { - - private void validateAndConfirmTAN() { - String tan = this.txt_tan.getText(); - - tan = tan.trim(); - - if (tan.isEmpty()) { - this.setMessage(Messages.getString("error.NoTan")); - return; - } - - if (MobileBKUEnterTANComposite.this.refVal.startsWith(tan)) { - this.setMessage(Messages.getString("error.EnteredReferenceValue")); - return; - } - - if (tan.length() > 6) { - this.setMessage(Messages.getString("error.TanTooLong")); - return; - } - - this.tan = tan; - this.userAck = true; - } - - /** - * SLF4J Logger instance - **/ - static final Logger log = LoggerFactory.getLogger(MobileBKUEnterTANComposite.class); - - private Text txt_tan; - - private boolean userAck = false; - private boolean userCancel = false; - private boolean userFido2 = false; - - private Label lblRefVal; - - private String refVal; - - private URI signatureDataURI; - - /** - * @param signatureData - * the signatureData to set - */ - public void setSignatureDataURI(@Nullable URI uri) { - this.signatureDataURI = uri; - this.lnk_sig_data.setVisible(uri != null); - } - - private String tan; - - private Link lnk_sig_data; - - private Label lblMessage; - private Label lblRefValLabel; - private Label lblTan; - - private Button btn_ok; - private Button btn_cancel; - private Button btn_fido2; - - public boolean isDone() { return (this.userAck || this.userCancel || this.userFido2); } - public boolean isUserAck() { return this.userAck; } - public boolean isUserCancel() { return this.userCancel; } - public boolean isUserFido2() { return this.userFido2; } - - public void reset() { this.userAck = this.userCancel = this.userFido2 = false; } - - /** - * Set an error message - * @param errorMessage the error message - */ - public void setErrorMessage(String errorMessage) { - if (errorMessage == null) - this.lblMessage.setText(""); - else - this.lblMessage.setText( - Messages.getString("error.Title") + ": " + errorMessage); - } - - public void setFIDO2Enabled(boolean state) { - this.btn_fido2.setEnabled(state); - } - - /** - * Sets the message - * - * @param msg - */ - public void setMessage(String msg) { - this.lblMessage.setText(msg); - this.lblMessage.redraw(); - this.lblMessage.getParent().layout(true, true); - } - - public String getRefVal() { return this.refVal; } - public void setRefVal(@CheckForNull String refVal) { - this.refVal = (refVal != null) ? refVal.trim() : null; - this.lblRefVal.setText(Objects.requireNonNullElse(this.refVal, "")); - } - - /** - * @return the tan - */ - public String getTan() { - return this.tan; - } - - /** - * @param tan - * the tan to set - */ - public void setTan(String tan) { - this.tan = tan; - - if (this.tan == null) { - this.txt_tan.setText(""); - } else { - this.txt_tan.setText(this.tan); - } - } - - /** - * Create the composite. - * - * @param parent - * @param style - * @param state - */ - public MobileBKUEnterTANComposite(Composite parent, int style, State state) { - super(parent, style, state); - setLayout(new FormLayout()); - - final Composite containerComposite = new Composite(this, SWT.NATIVE); - containerComposite.addPaintListener(new PaintListener() { - @Override - public void paintControl(PaintEvent e) { - Rectangle clientArea = containerComposite.getClientArea(); - - // e.gc.setForeground(); - e.gc.setForeground(Constants.MAINBAR_ACTIVE_BACK_DARK); - e.gc.setLineWidth(3); - e.gc.setLineStyle(SWT.LINE_SOLID); - e.gc.drawRoundRectangle(clientArea.x, clientArea.y, - clientArea.width - 2, clientArea.height - 2, 10, 10); - } - }); - containerComposite.setLayout(new FormLayout()); - SWTUtils.anchor(containerComposite).top(50, -120).bottom(50, 120).left(50, -200).right(50, 200); - - this.lblRefValLabel = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(lblRefValLabel).right(50, -10).bottom(50,-10); - SWTUtils.setLocalizedText(lblRefValLabel, "tanEnter.ReferenceValue"); - this.lblRefValLabel.setAlignment(SWT.RIGHT); - - ImageData mobileIcon = new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_MOBILE)); - Label lbl_image = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(lbl_image).top(50, -1 * (mobileIcon.width / 2)).bottom(50, mobileIcon.width / 2).left(0, 10).width(mobileIcon.width); - lbl_image.setImage(new Image(getDisplay(), mobileIcon)); - - this.lblRefVal = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(lblRefVal).left(50,10).right(100,-20).bottom(50,-10); - this.lblRefVal.setText(""); - - this.lblTan = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(lblTan).right(50,-10).top(50,10); - SWTUtils.setLocalizedText(lblTan, "tanEnter.TAN"); - this.lblTan.setAlignment(SWT.RIGHT); - - this.txt_tan = new Text(containerComposite, SWT.BORDER | SWT.NATIVE); - SWTUtils.anchor(txt_tan).left(50,10).right(100,-20).top(50,10); - this.txt_tan.setEditable(true); - - this.txt_tan.addTraverseListener((e) -> { - if (e.detail == SWT.TRAVERSE_RETURN) { - validateAndConfirmTAN(); - } - }); - - this.txt_tan.addModifyListener((e) -> { - String text = this.txt_tan.getText(); - if (text.length() > 3 && this.getRefVal().startsWith(text.trim())) - this.setMessage(Messages.getString("error.EnteredReferenceValue")); - }); - - this.lnk_sig_data = new Link(containerComposite, SWT.NATIVE | SWT.RESIZE); - SWTUtils.anchor(lnk_sig_data).right(100,-20).top(0,20); - lnk_sig_data.setEnabled(true); - SWTUtils.addSelectionListener(lnk_sig_data, (e) -> { SWTUtils.openURL(this.signatureDataURI); }); - - this.btn_ok = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btn_ok).right(100,-20).bottom(100,-20); - SWTUtils.addSelectionListener(btn_ok, (e) -> { validateAndConfirmTAN(); }); - - this.btn_cancel = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btn_cancel).right(btn_ok, -20).bottom(100, -20); - SWTUtils.addSelectionListener(btn_cancel, (e) -> { this.userCancel = true; }); - - this.btn_fido2 = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btn_fido2).right(btn_cancel, -20).bottom(100, -20); - SWTUtils.addSelectionListener(btn_fido2, (e) -> { this.userFido2 = true; }); - this.btn_fido2.setVisible(WebAuthN.isAvailable()); - - this.lblMessage = new Label(containerComposite, SWT.WRAP | SWT.NATIVE); - SWTUtils.anchor(lblMessage).right(btn_fido2, -10).bottom(100, -20); - } - - @Override public void onDisplay() { getShell().setDefaultButton(btn_ok); txt_tan.setFocus(); } - - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() - */ - @Override - public void reloadResources() { - SWTUtils.setLocalizedText(lnk_sig_data, "mobileBKU.show"); - SWTUtils.setLocalizedToolTipText(lnk_sig_data, "mobileBKU.show_tooltip"); - SWTUtils.setLocalizedText(lblRefValLabel, "tanEnter.ReferenceValue"); - SWTUtils.setLocalizedText(lblTan, "tanEnter.TAN"); - SWTUtils.setLocalizedText(btn_cancel, "common.Cancel"); - SWTUtils.setLocalizedText(btn_ok, "common.Ok"); - SWTUtils.setLocalizedText(btn_fido2, "tanEnter.FIDO2"); - } -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFido2Composite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFido2Composite.java deleted file mode 100644 index b0506596..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFido2Composite.java +++ /dev/null @@ -1,133 +0,0 @@ -package at.asit.pdfover.gui.composites.mobilebku; - -import java.net.URI; - -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.asit.pdfover.commons.Constants; -import at.asit.pdfover.gui.composites.StateComposite; -import at.asit.pdfover.gui.utils.SWTUtils; -import at.asit.pdfover.gui.workflow.states.State; -import at.asit.webauthn.PublicKeyCredential; -import at.asit.webauthn.WebAuthN; -import at.asit.webauthn.exceptions.WebAuthNUserCancelled; -import at.asit.webauthn.responsefields.AuthenticatorAssertionResponse; - -public class MobileBKUFido2Composite extends StateComposite { - private static final Logger log = LoggerFactory.getLogger(MobileBKUFido2Composite.class); - - private @Nonnull String fido2OptionsString = ""; - - private PublicKeyCredential<AuthenticatorAssertionResponse> credential; - private boolean userCancel; - private boolean userSms; - - private Button btn_authenticate; - private Button btn_cancel; - private Button btn_sms; - public void setSMSEnabled(boolean state) { this.btn_sms.setEnabled(state); } - - private @CheckForNull URI signatureDataURI; - private Link lnk_sigData; - public void setSignatureDataURI(URI uri) { this.signatureDataURI = uri; this.lnk_sigData.setVisible(uri != null); } - - public void initialize(@Nonnull String fido2Options) { - this.fido2OptionsString = fido2Options; - this.credential = null; - this.userCancel = this.userSms = false; - } - - public boolean isDone() { return ((this.credential != null) || this.userCancel || this.userSms); } - public PublicKeyCredential<AuthenticatorAssertionResponse> getResultingCredential() { return this.credential; } - public boolean wasUserCancelClicked() { return userCancel; } - public boolean wasUserSMSClicked() { return userSms; } - - public void beginAuthentication() { - if (!btn_authenticate.isEnabled()) return; - - SWTUtils.setLocalizedText(btn_authenticate, "common.working"); - btn_authenticate.setEnabled(false); - new Thread(() -> { - try { - this.credential = WebAuthN.buildGetFromJSON(this.fido2OptionsString).get("https://service.a-trust.at"); - } catch (Throwable t) { - if (!(t instanceof WebAuthNUserCancelled)) { - log.warn("webauthn operation failed", t); - } - } finally { - this.getDisplay().syncExec(() -> { btn_authenticate.setEnabled(true); this.reloadResources(); }); - this.getDisplay().wake(); - } - }).start(); - } - - public MobileBKUFido2Composite(Composite parent, int style, State state) { - super(parent, style, state); - setLayout(new FormLayout()); - - final Composite containerComposite = new Composite(this, SWT.NATIVE); - containerComposite.addPaintListener((e) -> { - Rectangle clientArea = containerComposite.getClientArea(); - e.gc.setForeground(Constants.MAINBAR_ACTIVE_BACK_DARK); - e.gc.setLineWidth(3); - e.gc.setLineStyle(SWT.LINE_SOLID); - e.gc.drawRoundRectangle(clientArea.x, clientArea.y+25, - clientArea.width - 2, clientArea.height - 27, 10, 10); - - }); - containerComposite.setLayout(new FormLayout()); - SWTUtils.anchor(containerComposite).top(50, -145).bottom(50, 120).left(50, -200).right(50, 200); - - ImageData webauthnLogoImg = new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_WEBAUTHN)); - Label webauthnLogo = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(webauthnLogo).top(0,0).left(0, 10).height(50).width(187); - webauthnLogo.setBackground(getBackground()); - webauthnLogo.setImage(new Image(getDisplay(), webauthnLogoImg.scaledTo(187, 50))); - - ImageData fidoLogoImg = new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_FIDO2)); - Label fidoLogo = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(fidoLogo).left(0, 10).bottom(100, -10).height(50).width(81); - fidoLogo.setImage(new Image(getDisplay(), fidoLogoImg.scaledTo(81, 50))); - - this.btn_authenticate = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btn_authenticate).top(50, -15).left(0, 90).right(100, -90); - SWTUtils.addSelectionListener(btn_authenticate, this::beginAuthentication); - btn_authenticate.setEnabled(WebAuthN.isAvailable()); - - this.btn_cancel = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btn_cancel).bottom(100, -10).right(100, -10); - SWTUtils.addSelectionListener(btn_cancel, () -> { this.userCancel = true; }); - - this.btn_sms = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btn_sms).bottom(100, -10).right(btn_cancel, -10); - SWTUtils.addSelectionListener(btn_sms, () -> { this.userSms = true; }); - - this.lnk_sigData = new Link(containerComposite, SWT.NATIVE | SWT.RESIZE); - SWTUtils.anchor(lnk_sigData).top(0, 45).right(100, -20); - SWTUtils.addSelectionListener(lnk_sigData, (e) -> { SWTUtils.openURL(this.signatureDataURI); }); - } - - @Override public void onDisplay() { getShell().setDefaultButton(this.btn_authenticate); beginAuthentication(); } - - @Override - public void reloadResources() { - SWTUtils.setLocalizedText(btn_authenticate, WebAuthN.isAvailable() ? "mobileBKU.authorize" : "common.unavailable"); - SWTUtils.setLocalizedText(btn_cancel, "common.Cancel"); - SWTUtils.setLocalizedText(btn_sms, "tanEnter.SMS"); - SWTUtils.setLocalizedText(lnk_sigData, "mobileBKU.show"); - SWTUtils.setLocalizedToolTipText(lnk_sigData, "mobileBKU.show_tooltip"); - } -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFingerprintComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFingerprintComposite.java deleted file mode 100644 index ee9d9a0c..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUFingerprintComposite.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.gui.composites.mobilebku; - -import java.net.URI; -import java.util.Objects; - -import javax.annotation.CheckForNull; - -// Imports -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.PaintEvent; -import org.eclipse.swt.events.PaintListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; - -import at.asit.pdfover.commons.Constants; -import at.asit.pdfover.commons.Messages; -import at.asit.pdfover.gui.composites.StateComposite; -import at.asit.pdfover.gui.utils.SWTUtils; -import at.asit.pdfover.gui.workflow.states.State; -import at.asit.webauthn.WebAuthN; - -/** - * Composite for displaying the QR code for the mobile BKU - */ -public class MobileBKUFingerprintComposite extends StateComposite { - private Label lblError; - private Label lblRefValLabel; - private Label lblFPLabel; - private Label lblRefVal; - private Button btn_sms; - private Button btn_fido2; - private Button btn_cancel; - private Link lnk_sig_data; - public URI signatureDataURI; - private String refVal; - - private boolean userCancelClicked = false; - private boolean userSMSClicked = false; - private boolean userFido2Clicked = false; - private boolean pollingDone = false; - - public void signalPollingDone() { this.pollingDone = true; getDisplay().wake(); } - public boolean isDone() { return (this.userCancelClicked || this.userSMSClicked || this.userFido2Clicked || this.pollingDone); } - public boolean wasCancelClicked() { return this.userCancelClicked; } - public boolean wasSMSClicked() { return this.userSMSClicked; } - public boolean wasFIDO2Clicked() { return this.userFido2Clicked; } - public void reset() { this.userCancelClicked = this.userSMSClicked = this.userFido2Clicked = this.pollingDone = false; } - - public void setSMSEnabled(boolean state) { - this.btn_sms.setEnabled(state); - } - - public void setFIDO2Enabled(boolean state) { - this.btn_fido2.setEnabled(state); - } - - /** - * Set an error message - * @param errorMessage the error message - */ - public void setErrorMessage(String errorMessage) { - if (errorMessage == null) - this.lblError.setText(""); - else - this.lblError.setText(Messages.getString("error.Title") + ": " + errorMessage); - } - - public String getRefVal() { return this.refVal; } - public void setRefVal(@CheckForNull String refVal) { - this.refVal = (refVal != null) ? refVal.trim() : null; - this.lblRefVal.setText(Objects.requireNonNullElse(this.refVal, "")); - } - - /** - * Create the composite. - * - * @param parent - * @param style - * @param state - */ - public MobileBKUFingerprintComposite(Composite parent, int style, State state) { - super(parent, style, state); - setLayout(new FormLayout()); - - final Composite containerComposite = new Composite(this, SWT.NATIVE); - containerComposite.addPaintListener(new PaintListener() { - @Override - public void paintControl(PaintEvent e) { - Rectangle clientArea = containerComposite.getClientArea(); - - // e.gc.setForeground(); - e.gc.setForeground(Constants.MAINBAR_ACTIVE_BACK_DARK); - e.gc.setLineWidth(3); - e.gc.setLineStyle(SWT.LINE_SOLID); - e.gc.drawRoundRectangle(clientArea.x, clientArea.y, - clientArea.width - 2, clientArea.height - 2, 10, 10); - } - }); - containerComposite.setLayout(new FormLayout()); - SWTUtils.anchor(containerComposite).top(50, -140).bottom(50, 140).left(50, -200).right(50, 200); - - this.lblRefValLabel = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(lblRefValLabel).right(50, -10).top(30, -10); - this.lblRefValLabel.setAlignment(SWT.RIGHT); - - ImageData mobileIcon = new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_MOBILE)); - Label lbl_image = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(lbl_image).top(50, -1 * (mobileIcon.width / 2)).bottom(50, mobileIcon.width / 2).left(0, 10).width(mobileIcon.width); - lbl_image.setImage(new Image(getDisplay(), mobileIcon)); - - this.lblRefVal = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(lblRefVal).left(50, 10).right(100, -20).top(30, -10); - - this.lblFPLabel = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(lblFPLabel).left(25, 10).top(lblRefValLabel, 10); - this.lblFPLabel.setAlignment(SWT.LEFT); - - this.lnk_sig_data = new Link(containerComposite, SWT.NATIVE | SWT.RESIZE); - SWTUtils.anchor(lnk_sig_data).right(100, -20).top(0, 20); - this.lnk_sig_data.setEnabled(true); - SWTUtils.addSelectionListener(lnk_sig_data, (e) -> { SWTUtils.openURL(this.signatureDataURI); }); - - this.btn_cancel = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btn_cancel).right(100, -20).bottom(100, -20); - SWTUtils.addSelectionListener(btn_cancel, () -> { this.userCancelClicked = true; }); - - this.btn_sms = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btn_sms).right(btn_cancel, -20).bottom(100, -20); - SWTUtils.addSelectionListener(btn_sms, () -> { this.userSMSClicked = true; }); - - this.btn_fido2 = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btn_fido2).right(btn_sms, -20).bottom(100, -20); - SWTUtils.addSelectionListener(btn_fido2, () -> { this.userFido2Clicked = true; }); - this.btn_fido2.setVisible(WebAuthN.isAvailable()); - - this.lblError = new Label(containerComposite, SWT.WRAP | SWT.NATIVE); - SWTUtils.anchor(lblError).right(btn_sms, -10).bottom(100, -20); - - reloadResources(); - } - - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() - */ - @Override - public void reloadResources() { - SWTUtils.setLocalizedText(lblRefValLabel, "tanEnter.ReferenceValue"); - SWTUtils.setLocalizedText(lblFPLabel, "tanEnter.FP"); - SWTUtils.setLocalizedText(lnk_sig_data, "mobileBKU.show"); - SWTUtils.setLocalizedToolTipText(lnk_sig_data, "mobileBKU.show_tooltip"); - SWTUtils.setLocalizedText(btn_cancel, "common.Cancel"); - SWTUtils.setLocalizedText(btn_sms, "tanEnter.SMS"); - SWTUtils.setLocalizedText(btn_fido2, "tanEnter.FIDO2"); - } -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUQRComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUQRComposite.java deleted file mode 100644 index 135bb775..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/MobileBKUQRComposite.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.gui.composites.mobilebku; - -// Imports -import java.io.ByteArrayInputStream; -import java.net.URI; -import java.util.Objects; - -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.SWTException; -import org.eclipse.swt.events.PaintEvent; -import org.eclipse.swt.events.PaintListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Link; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.asit.pdfover.commons.Constants; -import at.asit.pdfover.commons.Messages; -import at.asit.pdfover.gui.composites.StateComposite; -import at.asit.pdfover.gui.utils.SWTUtils; -import at.asit.pdfover.gui.workflow.states.State; -import at.asit.webauthn.WebAuthN; - -/** - * Composite for displaying the QR code for the mobile BKU - */ -public class MobileBKUQRComposite extends StateComposite { - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(MobileBKUQRComposite.class); - - private Label lblQR; - - private boolean userCancelClicked = false; - private boolean userSMSClicked = false; - private boolean userFIDO2Clicked = false; - private boolean pollingDone = false; - - private Label lblRefVal; - - private String refVal; - - private ImageData currentQRImage; - - private URI signatureDataURI; - - private Label lblError; - private Label lblRefValLabel; - private Label lblQRLabel; - - private Button btn_fido2; - private Button btn_sms; - private Button btn_cancel; - - private Link lnk_sig_data; - - public void signalPollingDone() { this.pollingDone = true; getDisplay().wake(); } - public boolean isDone() { return (this.userCancelClicked || this.userSMSClicked || this.userFIDO2Clicked || this.pollingDone); } - public boolean wasCancelClicked() { return this.userCancelClicked; } - public boolean wasSMSClicked() { return this.userSMSClicked; } - public boolean wasFIDO2Clicked() { return this.userFIDO2Clicked; } - public void reset() { this.userCancelClicked = this.userSMSClicked = this.userFIDO2Clicked = this.pollingDone = false; } - - /** - * Set an error message - * @param errorMessage the error message - */ - public void setErrorMessage(String errorMessage) { - if (errorMessage == null) - this.lblError.setText(""); - else - this.lblError.setText( - Messages.getString("error.Title") + ": " + errorMessage); - } - - public String getRefVal() { return this.refVal; } - public void setRefVal(@CheckForNull String refVal) { - this.refVal = (refVal != null) ? refVal.trim() : null; - this.lblRefVal.setText(Objects.requireNonNullElse(this.refVal, "")); - } - - private void updateQRImage() { - if (this.currentQRImage == null) - return; - - Point availableSize = this.lblQR.getSize(); - int targetSize = Math.min(availableSize.x, availableSize.y); - if (targetSize <= 0) - return; - - this.lblQR.setImage(new Image(this.lblQR.getDisplay(), this.currentQRImage.scaledTo(targetSize, targetSize))); - } - - /** - * @param qrcode - * the qrcode to set - */ - public void setQR(byte[] qrcode) { - if (qrcode == null) { - setErrorMessage(Messages.getString("error.FailedToLoadQRCode")); - return; - } - try { - this.currentQRImage = new ImageData(new ByteArrayInputStream(qrcode)); - } catch (SWTException e) { - log.warn("Failed to load QR code", e); - setErrorMessage(Messages.getString("error.FailedToLoadQRCode")); - return; - } - updateQRImage(); - } - - public void setSMSEnabled(boolean state) { - this.btn_sms.setEnabled(state); - } - - public void setFIDO2Enabled(boolean state) { - this.btn_fido2.setEnabled(state); - } - - public void setSignatureDataURI(@Nullable URI uri) { - this.signatureDataURI = uri; - this.lnk_sig_data.setVisible(uri != null); - } - - /** - * Create the composite. - * - * @param parent - * @param style - * @param state - */ - public MobileBKUQRComposite(Composite parent, int style, State state) { - super(parent, style, state); - setLayout(new FormLayout()); - - final Composite containerComposite = new Composite(this, SWT.NATIVE); - SWTUtils.anchor(containerComposite).top(50, -140).bottom(50, 140).left(50, -200).right(50, 200); - containerComposite.addPaintListener(new PaintListener() { - @Override - public void paintControl(PaintEvent e) { - Rectangle clientArea = containerComposite.getClientArea(); - - // e.gc.setForeground(); - e.gc.setForeground(Constants.MAINBAR_ACTIVE_BACK_DARK); - e.gc.setLineWidth(3); - e.gc.setLineStyle(SWT.LINE_SOLID); - e.gc.drawRoundRectangle(clientArea.x, clientArea.y, - clientArea.width - 2, clientArea.height - 2, 10, 10); - } - }); - containerComposite.setLayout(new FormLayout()); - - this.lblRefValLabel = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(lblRefValLabel).right(50, -10).top(30, -10); - this.lblRefValLabel.setAlignment(SWT.RIGHT); - - ImageData mobileIcon = new ImageData(this.getClass().getResourceAsStream(Constants.RES_IMG_MOBILE)); - Label lbl_image = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(lbl_image).top(50, -1 * (mobileIcon.width / 2)).bottom(50, mobileIcon.width / 2).left(0, 10).width(mobileIcon.width); - lbl_image.setImage(new Image(getDisplay(), mobileIcon)); - - this.lblRefVal = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(lblRefVal).left(50, 10).right(100, -20).top(30, -10); - - this.lblQRLabel = new Label(containerComposite, SWT.NATIVE); - SWTUtils.anchor(lblQRLabel).right(50, -10).top(lblRefValLabel, 10); - this.lblQRLabel.setAlignment(SWT.RIGHT); - - this.lblQR = new Label(containerComposite, SWT.NATIVE); - this.lblQR.addListener(SWT.Resize, (e) -> { updateQRImage(); }); - - this.lnk_sig_data = new Link(containerComposite, SWT.NATIVE | SWT.RESIZE); - SWTUtils.anchor(lnk_sig_data).right(100, -20).top(0, 20); - SWTUtils.addSelectionListener(lnk_sig_data, (e) -> { SWTUtils.openURL(this.signatureDataURI); }); - - this.btn_cancel = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btn_cancel).right(100, -20).bottom(100, -5); - SWTUtils.addSelectionListener(btn_cancel, (e) -> { this.userCancelClicked = true; }); - - this.btn_sms = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btn_sms).right(btn_cancel, -20).bottom(100, -5); - SWTUtils.addSelectionListener(btn_sms, (e) -> { this.userSMSClicked = true; }); - - this.btn_fido2 = new Button(containerComposite, SWT.NATIVE); - SWTUtils.anchor(btn_fido2).right(btn_sms, -20).bottom(100, -5); - SWTUtils.addSelectionListener(btn_fido2, (e) -> { this.userFIDO2Clicked = true; }); - this.btn_fido2.setVisible(WebAuthN.isAvailable()); - - SWTUtils.anchor(lblQR).left(50, 10).right(100, -20).top(lblRefVal, 10).bottom(btn_sms, -10); - - this.lblError = new Label(containerComposite, SWT.WRAP | SWT.NATIVE); - SWTUtils.anchor(lblError).right(btn_sms, -10).bottom(100, -20); - - reloadResources(); - } - - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() - */ - @Override - public void reloadResources() { - SWTUtils.setLocalizedText(lblRefValLabel, "tanEnter.ReferenceValue"); - SWTUtils.setLocalizedText(lblQRLabel, "tanEnter.QR"); - SWTUtils.setLocalizedText(lnk_sig_data, "mobileBKU.show"); - SWTUtils.setLocalizedToolTipText(lnk_sig_data, "mobileBKU.show_tooltip"); - SWTUtils.setLocalizedText(btn_cancel, "common.Cancel"); - SWTUtils.setLocalizedText(btn_sms, "tanEnter.SMS"); - SWTUtils.setLocalizedText(btn_fido2, "tanEnter.FIDO2"); - } -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/WaitingForAppComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/WaitingForAppComposite.java deleted file mode 100644 index 24529452..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/mobilebku/WaitingForAppComposite.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2012 by A-SIT, Secure Information Technology Center Austria - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://joinup.ec.europa.eu/software/page/eupl - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - */ -package at.asit.pdfover.gui.composites.mobilebku; - - -// Imports -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.ProgressBar; - -import at.asit.pdfover.gui.composites.StateComposite; -import at.asit.pdfover.gui.utils.SWTUtils; -import at.asit.pdfover.gui.workflow.states.State; -import at.asit.webauthn.WebAuthN; - -import org.eclipse.swt.widgets.Button; - -/** - * - */ -public class WaitingForAppComposite extends StateComposite { - private Label lbl_description; - private Button btn_sms; - private Button btn_cancel; - private Button btn_fido2; - private boolean userSMSClicked = false; - private boolean userCancelClicked = false; - private boolean userFIDO2Clicked = false; - private boolean pollingDone = false; - - public void signalPollingDone() { this.pollingDone = true; getDisplay().wake(); } - public boolean isDone() { return (this.userCancelClicked || this.userSMSClicked || this.userFIDO2Clicked || this.pollingDone); } - public boolean wasCancelClicked() { return this.userCancelClicked; } - public boolean wasSMSClicked() { return this.userSMSClicked; } - public boolean wasFIDO2Clicked() { return this.userFIDO2Clicked; } - public void reset() { this.userCancelClicked = this.userSMSClicked = this.userFIDO2Clicked = this.pollingDone = false; } - - public void setSMSEnabled(boolean state) { - this.btn_sms.setEnabled(state); - } - - public void setFIDO2Enabled(boolean state) { - this.btn_fido2.setEnabled(state); - } - - /** - * Create the composite. - * @param parent - * @param style - * @param state - */ - public WaitingForAppComposite(Composite parent, int style, State state) { - super(parent, style, state); - setLayout(new FormLayout()); - - this.lbl_description = new Label(this, SWT.NATIVE); - SWTUtils.anchor(lbl_description).bottom(50, -1).left(0, 10).right(100, -10); - this.lbl_description.setAlignment(SWT.CENTER); - SWTUtils.setLocalizedText(lbl_description, "waiting_for_app.message"); - - ProgressBar progressBar = new ProgressBar(this, SWT.HORIZONTAL | SWT.INDETERMINATE); - SWTUtils.anchor(progressBar).top(50, 10).bottom(50, 40).left(50,-100).right(50,100); - - this.btn_sms = new Button(this, SWT.NONE); - SWTUtils.anchor(btn_sms).top(progressBar, 24).right(progressBar, 0, SWT.RIGHT); - SWTUtils.addSelectionListener(btn_sms, (e) -> { this.userSMSClicked = true; }); - - this.btn_cancel = new Button(this, SWT.NONE); - SWTUtils.anchor(btn_cancel).top(btn_sms, 0, SWT.TOP).right(btn_sms, -6); - SWTUtils.addSelectionListener(btn_cancel, (e) -> { this.userCancelClicked = true; }); - - this.btn_fido2 = new Button(this, SWT.NONE); - SWTUtils.anchor(btn_fido2).top(btn_cancel, 0, SWT.TOP).right(btn_cancel, -6); - SWTUtils.addSelectionListener(btn_fido2, (e) -> { this.userFIDO2Clicked = true; }); - this.btn_fido2.setVisible(WebAuthN.isAvailable()); - - reloadResources(); - - } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.StateComposite#reloadResources() - */ - @Override - public void reloadResources() { - SWTUtils.setLocalizedText(lbl_description, "waiting_for_app.message"); - SWTUtils.setLocalizedText(btn_sms, "tanEnter.SMS"); - SWTUtils.setLocalizedText(btn_fido2, "tanEnter.FIDO2"); - SWTUtils.setLocalizedText(btn_cancel, "common.Cancel"); - } -} |