From 2476bca83442dbce0d3dfce744e9c320ce802a4e Mon Sep 17 00:00:00 2001 From: tkellner Date: Mon, 2 Apr 2012 16:39:06 +0000 Subject: Renamed PersonIdentityLink to IdentityLink git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1046 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../egiz/bku/online/applet/IdentityLinkApplet.java | 8 +- .../bku/online/applet/IdentityLinkBKUWorker.java | 16 +- .../java/at/gv/egiz/bku/gui/IdentityLinkGUI.java | 301 +++++++++++++++++++++ .../at/gv/egiz/bku/gui/IdentityLinkGUIFacade.java | 56 ++++ .../at/gv/egiz/bku/gui/PersonIdentityLinkGUI.java | 301 --------------------- .../egiz/bku/gui/PersonIdentityLinkGUIFacade.java | 56 ---- .../gv/egiz/bku/gui/ActivationMessages.properties | 6 +- .../at/gv/egiz/bku/local/stal/LocalBKUWorker.java | 6 +- .../local/stal/LocalIdentityLinkSTALFactory.java | 8 +- .../egiz/bku/local/webapp/IdentityLinkServlet.java | 4 +- .../gv/egiz/bku/webstart/IdentityLinkInvoker.java | 75 +++++ .../java/at/gv/egiz/bku/webstart/Launcher.java | 4 +- .../bku/webstart/PersonIdentityLinkInvoker.java | 75 ----- .../bku/webstart/gui/BKUControllerInterface.java | 2 +- .../at/gv/egiz/bku/webstart/gui/MOCCAIcon.java | 4 +- .../at/gv/egiz/stal/ext/IdentityLinkRequest.java | 37 +++ .../at/gv/egiz/stal/ext/IdentityLinkResponse.java | 34 +++ .../egiz/stal/ext/PersonIdentityLinkRequest.java | 37 --- .../egiz/stal/ext/PersonIdentityLinkResponse.java | 34 --- .../egiz/bku/smccstal/IdentityLinkExtractor.java | 14 +- .../bku/smccstal/IdentityLinkRequestHandler.java | 119 ++++++++ .../smccstal/PersonIdentityLinkRequestHandler.java | 119 -------- 22 files changed, 658 insertions(+), 658 deletions(-) create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/IdentityLinkGUI.java create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/IdentityLinkGUIFacade.java delete mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PersonIdentityLinkGUI.java delete mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PersonIdentityLinkGUIFacade.java create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/IdentityLinkInvoker.java delete mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/PersonIdentityLinkInvoker.java create mode 100644 STALExt/src/main/java/at/gv/egiz/stal/ext/IdentityLinkRequest.java create mode 100644 STALExt/src/main/java/at/gv/egiz/stal/ext/IdentityLinkResponse.java delete mode 100644 STALExt/src/main/java/at/gv/egiz/stal/ext/PersonIdentityLinkRequest.java delete mode 100644 STALExt/src/main/java/at/gv/egiz/stal/ext/PersonIdentityLinkResponse.java create mode 100644 smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/IdentityLinkRequestHandler.java delete mode 100644 smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PersonIdentityLinkRequestHandler.java diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/IdentityLinkApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/IdentityLinkApplet.java index 08193603..279a16fa 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/IdentityLinkApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/IdentityLinkApplet.java @@ -30,8 +30,8 @@ import java.util.Locale; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.HelpListener; -import at.gv.egiz.bku.gui.PersonIdentityLinkGUI; -import at.gv.egiz.bku.gui.PersonIdentityLinkGUIFacade; +import at.gv.egiz.bku.gui.IdentityLinkGUI; +import at.gv.egiz.bku.gui.IdentityLinkGUIFacade; import at.gv.egiz.bku.gui.SwitchFocusListener; import at.gv.egiz.bku.gui.viewer.FontProvider; @@ -47,13 +47,13 @@ private static final long serialVersionUID = 1L; BKUGUIFacade.Style guiStyle, URL backgroundImgURL, FontProvider fontProvider, HelpListener helpListener, SwitchFocusListener switchFocusListener) { - return new PersonIdentityLinkGUI(contentPane, locale, + return new IdentityLinkGUI(contentPane, locale, backgroundImgURL, fontProvider, helpListener, switchFocusListener); } @Override protected AppletBKUWorker createBKUWorker(BKUApplet applet, BKUGUIFacade gui) { - return new IdentityLinkBKUWorker(applet, (PersonIdentityLinkGUIFacade) gui); + return new IdentityLinkBKUWorker(applet, (IdentityLinkGUIFacade) gui); } } diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/IdentityLinkBKUWorker.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/IdentityLinkBKUWorker.java index 5a76e935..8ede2be1 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/IdentityLinkBKUWorker.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/IdentityLinkBKUWorker.java @@ -31,24 +31,24 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; -import at.gv.egiz.bku.gui.PersonIdentityLinkGUIFacade; -import at.gv.egiz.bku.smccstal.PersonIdentityLinkRequestHandler; +import at.gv.egiz.bku.gui.IdentityLinkGUIFacade; +import at.gv.egiz.bku.smccstal.IdentityLinkRequestHandler; import at.gv.egiz.stal.ErrorResponse; import at.gv.egiz.stal.InfoboxReadRequest; import at.gv.egiz.stal.QuitRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; -import at.gv.egiz.stal.ext.PersonIdentityLinkRequest; -import at.gv.egiz.stal.ext.PersonIdentityLinkResponse; +import at.gv.egiz.stal.ext.IdentityLinkRequest; +import at.gv.egiz.stal.ext.IdentityLinkResponse; public class IdentityLinkBKUWorker extends AppletBKUWorker { private final Logger log = LoggerFactory.getLogger(IdentityLinkBKUWorker.class); - public IdentityLinkBKUWorker(BKUApplet applet, PersonIdentityLinkGUIFacade gui) { + public IdentityLinkBKUWorker(BKUApplet applet, IdentityLinkGUIFacade gui) { super(applet, gui); removeRequestHandler(InfoboxReadRequest.class); removeRequestHandler(SignRequest.class); - addRequestHandler(PersonIdentityLinkRequest.class, new PersonIdentityLinkRequestHandler()); + addRequestHandler(IdentityLinkRequest.class, new IdentityLinkRequestHandler()); } @Override @@ -59,12 +59,12 @@ public class IdentityLinkBKUWorker extends AppletBKUWorker { try { - List responses = handleRequest(Collections.singletonList(new PersonIdentityLinkRequest())); + List responses = handleRequest(Collections.singletonList(new IdentityLinkRequest())); handleRequest(Collections.singletonList(new QuitRequest())); if (responses.size() == 1) { STALResponse response = responses.get(0); - if (response instanceof PersonIdentityLinkResponse) { + if (response instanceof IdentityLinkResponse) { log.info("Identity Link dialog terminated."); } else if (response instanceof ErrorResponse) { log.info("Identity Link dialog terminated with error."); diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/IdentityLinkGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/IdentityLinkGUI.java new file mode 100644 index 00000000..378395eb --- /dev/null +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/IdentityLinkGUI.java @@ -0,0 +1,301 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint + * initiative of the Federal Chancellery Austria and Graz University of Technology. + * + * 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://www.osor.eu/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. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + +package at.gv.egiz.bku.gui; + +import java.awt.Container; +import java.awt.event.ActionListener; +import java.net.URL; +import java.text.MessageFormat; +import java.util.Locale; + +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.LayoutStyle; +import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.SwingUtilities; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.gui.viewer.FontProvider; + +/** + * Implements GUI for the identity link informations + * + * @author Andreas Fitzek + */ +public class IdentityLinkGUI extends CardMgmtGUI implements + IdentityLinkGUIFacade { + + private final Logger log = LoggerFactory + .getLogger(IdentityLinkGUI.class); + + protected JLabel mgmtLabel; + + protected JLabel firstNameLabel_description; + protected JLabel lastNameLabel_description; + protected JLabel birthdateLabel_description; + + protected JLabel firstNameLabel; + protected JLabel lastNameLabel; + protected JLabel birthdateLabel; + + protected JButton activateButton; + + public IdentityLinkGUI(Container contentPane, Locale locale, URL backgroundImgURL, FontProvider fontProvider, + HelpListener helpListener, SwitchFocusListener switchFocusListener) { + super(contentPane, locale, Style.advanced, backgroundImgURL, fontProvider, + helpListener, switchFocusListener); + // TODO Auto-generated constructor stub + this.activateButton = new JButton(); + } + + @Override + public void showIdentityLinkInformationDialog( + final ActionListener activateListener, + final String actionCommand, + final String firstName, + final String surName, + final String birthdate) { + log.debug("Scheduling Identity Link dialog."); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + log.debug("Show Identity Link dialog."); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + mgmtLabel = new JLabel(); + mgmtLabel.setFont(mgmtLabel.getFont().deriveFont( + mgmtLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + + if (renderHeaderPanel) { + titleLabel.setText(getMessage(IdentityLinkGUIFacade.TITLE_IDENITY)); + mgmtLabel.setText(getMessage(IdentityLinkGUIFacade.MESSAGE_IDENITY)); + } else { + mgmtLabel.setText(getMessage(IdentityLinkGUIFacade.TITLE_IDENITY)); + } + + activateButton.setFont(activateButton.getFont().deriveFont( + activateButton.getFont().getStyle() + & ~java.awt.Font.BOLD)); + activateButton.addActionListener(activateListener); + activateButton.setActionCommand(actionCommand); + + activateButton.setText(getMessage(BUTTON_CLOSE)); + + firstNameLabel_description = new JLabel(); + firstNameLabel_description.setText(getMessage(IdentityLinkGUIFacade.FIRSTNAME)); + lastNameLabel_description = new JLabel(); + lastNameLabel_description.setText(getMessage(IdentityLinkGUIFacade.LASTNAME)); + + birthdateLabel_description = new JLabel(); + birthdateLabel_description.setText(getMessage(IdentityLinkGUIFacade.DATEOFBIRTH)); + + + firstNameLabel = new JLabel(); + firstNameLabel.setText(firstName); + + firstNameLabel.setFont(firstNameLabel.getFont().deriveFont( + firstNameLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + + lastNameLabel = new JLabel(); + lastNameLabel.setText(surName); + + lastNameLabel.setFont(lastNameLabel.getFont().deriveFont( + lastNameLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + + birthdateLabel = new JLabel(); + birthdateLabel.setText(birthdate); + + birthdateLabel.setFont(birthdateLabel.getFont().deriveFont( + birthdateLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + + updateMethodToRunAtResize("at.gv.egiz.bku.gui.IdentityLinkGUI", "renderContentAndButtons"); + + renderContentAndButtons(); + + cancelButton.requestFocus(); + contentPanel.validate(); + + if(windowCloseAdapter != null) + { + windowCloseAdapter.registerListener(activateListener, actionCommand); + } + + + + resize(); + } + + }); + } + + public void renderContentAndButtons() { + + // It is necessary to remove old components in order to ensure + // the correct rendering of the status table and the button panel + mainPanel.removeAll(); + buttonPanel.removeAll(); + + //JScrollPane pinStatusScrollPane = new JScrollPane(pinStatusTable); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout + .createSequentialGroup().addComponent(mgmtLabel); + GroupLayout.Group messageVertical = mainPanelLayout + .createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(mgmtLabel); + + if (!renderHeaderPanel) { + + + messageHorizontal.addPreferredGap( + LayoutStyle.ComponentPlacement.UNRELATED, 0, + Short.MAX_VALUE).addComponent(switchFocusDummyLabel) + .addComponent(helpLabel); + messageVertical.addComponent(switchFocusDummyLabel).addComponent( + helpLabel); + } + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(Alignment.LEADING) + .addGroup(mainPanelLayout.createSequentialGroup() + //.addContainerGap() + .addGroup(mainPanelLayout.createParallelGroup(Alignment.LEADING) + .addGroup(messageHorizontal) + .addGroup(mainPanelLayout.createSequentialGroup() + .addGroup(mainPanelLayout.createParallelGroup(Alignment.LEADING) + .addComponent(firstNameLabel_description) + .addComponent(lastNameLabel_description) + .addComponent(birthdateLabel_description)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(Alignment.LEADING) + .addComponent(firstNameLabel) + .addComponent(lastNameLabel) + .addComponent(birthdateLabel))))) + ); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createParallelGroup(Alignment.LEADING) + .addGroup(mainPanelLayout.createSequentialGroup() + //.addContainerGap() + .addGroup(messageVertical) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(mainPanelLayout.createParallelGroup(Alignment.BASELINE) + .addComponent(firstNameLabel_description) + .addComponent(firstNameLabel)) + //.addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(mainPanelLayout.createParallelGroup(Alignment.BASELINE) + .addComponent(lastNameLabel_description) + .addComponent(lastNameLabel)) + //.addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(mainPanelLayout.createParallelGroup(Alignment.BASELINE) + .addComponent(birthdateLabel_description) + .addComponent(birthdateLabel))) + ); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout + .createSequentialGroup().addContainerGap( + GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(activateButton, GroupLayout.PREFERRED_SIZE, + buttonSize, GroupLayout.PREFERRED_SIZE); + + GroupLayout.Group buttonVertical = buttonPanelLayout + .createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(activateButton); + + buttonPanelLayout.setHorizontalGroup(buttonHorizontal); + buttonPanelLayout.setVerticalGroup(buttonVertical); + + } + + @Override + public void resize() { + + log.debug("Resizing Personal IdentityLink Applet ..."); + + float factor = getResizeFactor(); + + + if (mgmtLabel != null) { + mgmtLabel.setFont(mgmtLabel.getFont().deriveFont( + (float) ((baseFontSize)* factor))); + } + + if (activateButton != null) { + activateButton.setFont(activateButton.getFont().deriveFont( + (float) ((baseFontSize)* factor))); + } + + if (firstNameLabel_description != null) { + firstNameLabel_description.setFont(firstNameLabel_description.getFont().deriveFont( + (float) ((baseFontSize)* factor))); + } + + if (lastNameLabel_description != null) { + lastNameLabel_description.setFont(lastNameLabel_description.getFont().deriveFont( + (float) ((baseFontSize)* factor))); + } + + if (birthdateLabel_description != null) { + birthdateLabel_description.setFont(birthdateLabel_description.getFont().deriveFont( + (float) ((baseFontSize)* factor))); + } + + if (firstNameLabel != null) { + firstNameLabel.setFont(firstNameLabel.getFont().deriveFont( + (float) ((baseFontSize)* factor))); + } + + if (lastNameLabel != null) { + lastNameLabel.setFont(lastNameLabel.getFont().deriveFont( + (float) ((baseFontSize)* factor))); + } + + if (birthdateLabel != null) { + birthdateLabel.setFont(birthdateLabel.getFont().deriveFont( + (float) ((baseFontSize)* factor))); + } + + + if (activateButton != null) { + + activateButton.setFont(activateButton.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } + + super.resize(); + } +} diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/IdentityLinkGUIFacade.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/IdentityLinkGUIFacade.java new file mode 100644 index 00000000..2b96dc6e --- /dev/null +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/IdentityLinkGUIFacade.java @@ -0,0 +1,56 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint + * initiative of the Federal Chancellery Austria and Graz University of Technology. + * + * 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://www.osor.eu/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. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egiz.bku.gui; + +import java.awt.event.ActionListener; + +/** + * + * @author Andreas Fitzek + */ +public interface IdentityLinkGUIFacade extends BKUGUIFacade { + + public static final String FIRSTNAME = "identity.firstname"; + public static final String DATEOFBIRTH = "identity.dateofbirth"; + public static final String LASTNAME = "identity.lastname"; + public static final String TITLE_IDENITY = "title.identity"; + + public static final String MESSAGE_IDENITY = "identity.msg"; + + public static final String ERR_INFOBOX_INVALID = "err.infobox.invalid"; + + /** + * Currently dummy method to display anything ... + * + * @param firstName + * @param surName + */ + public void showIdentityLinkInformationDialog( + ActionListener activateListener, + String actionCommand, + String firstName, + String surName, + String birthdate); +} diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PersonIdentityLinkGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PersonIdentityLinkGUI.java deleted file mode 100644 index 32259746..00000000 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PersonIdentityLinkGUI.java +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint - * initiative of the Federal Chancellery Austria and Graz University of Technology. - * - * 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://www.osor.eu/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. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - -package at.gv.egiz.bku.gui; - -import java.awt.Container; -import java.awt.event.ActionListener; -import java.net.URL; -import java.text.MessageFormat; -import java.util.Locale; - -import javax.swing.GroupLayout; -import javax.swing.GroupLayout.Alignment; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.LayoutStyle; -import javax.swing.LayoutStyle.ComponentPlacement; -import javax.swing.SwingUtilities; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.gv.egiz.bku.gui.viewer.FontProvider; - -/** - * Implements GUI for the person identity link informations - * - * @author Andreas Fitzek - */ -public class PersonIdentityLinkGUI extends CardMgmtGUI implements - PersonIdentityLinkGUIFacade { - - private final Logger log = LoggerFactory - .getLogger(PersonIdentityLinkGUI.class); - - protected JLabel mgmtLabel; - - protected JLabel firstNameLabel_description; - protected JLabel lastNameLabel_description; - protected JLabel birthdateLabel_description; - - protected JLabel firstNameLabel; - protected JLabel lastNameLabel; - protected JLabel birthdateLabel; - - protected JButton activateButton; - - public PersonIdentityLinkGUI(Container contentPane, Locale locale, URL backgroundImgURL, FontProvider fontProvider, - HelpListener helpListener, SwitchFocusListener switchFocusListener) { - super(contentPane, locale, Style.advanced, backgroundImgURL, fontProvider, - helpListener, switchFocusListener); - // TODO Auto-generated constructor stub - this.activateButton = new JButton(); - } - - @Override - public void showPersonIdentityLinkInformationDialog( - final ActionListener activateListener, - final String actionCommand, - final String firstName, - final String surName, - final String birthdate) { - log.debug("Scheduling Person Identity Link dialog."); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - log.debug("Show Person Identity Link dialog."); - - mainPanel.removeAll(); - buttonPanel.removeAll(); - - mgmtLabel = new JLabel(); - mgmtLabel.setFont(mgmtLabel.getFont().deriveFont( - mgmtLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - - if (renderHeaderPanel) { - titleLabel.setText(getMessage(PersonIdentityLinkGUIFacade.TITLE_IDENITY)); - mgmtLabel.setText(getMessage(PersonIdentityLinkGUIFacade.MESSAGE_IDENITY)); - } else { - mgmtLabel.setText(getMessage(PersonIdentityLinkGUIFacade.TITLE_IDENITY)); - } - - activateButton.setFont(activateButton.getFont().deriveFont( - activateButton.getFont().getStyle() - & ~java.awt.Font.BOLD)); - activateButton.addActionListener(activateListener); - activateButton.setActionCommand(actionCommand); - - activateButton.setText(getMessage(BUTTON_CLOSE)); - - firstNameLabel_description = new JLabel(); - firstNameLabel_description.setText(getMessage(PersonIdentityLinkGUIFacade.FIRSTNAME)); - lastNameLabel_description = new JLabel(); - lastNameLabel_description.setText(getMessage(PersonIdentityLinkGUIFacade.LASTNAME)); - - birthdateLabel_description = new JLabel(); - birthdateLabel_description.setText(getMessage(PersonIdentityLinkGUIFacade.DATEOFBIRTH)); - - - firstNameLabel = new JLabel(); - firstNameLabel.setText(firstName); - - firstNameLabel.setFont(firstNameLabel.getFont().deriveFont( - firstNameLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - - lastNameLabel = new JLabel(); - lastNameLabel.setText(surName); - - lastNameLabel.setFont(lastNameLabel.getFont().deriveFont( - lastNameLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - - birthdateLabel = new JLabel(); - birthdateLabel.setText(birthdate); - - birthdateLabel.setFont(birthdateLabel.getFont().deriveFont( - birthdateLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - - updateMethodToRunAtResize("at.gv.egiz.bku.gui.PersonIdentityLinkGUI", "renderContentAndButtons"); - - renderContentAndButtons(); - - cancelButton.requestFocus(); - contentPanel.validate(); - - if(windowCloseAdapter != null) - { - windowCloseAdapter.registerListener(activateListener, actionCommand); - } - - - - resize(); - } - - }); - } - - public void renderContentAndButtons() { - - // It is necessary to remove old components in order to ensure - // the correct rendering of the status table and the button panel - mainPanel.removeAll(); - buttonPanel.removeAll(); - - //JScrollPane pinStatusScrollPane = new JScrollPane(pinStatusTable); - - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); - - GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout - .createSequentialGroup().addComponent(mgmtLabel); - GroupLayout.Group messageVertical = mainPanelLayout - .createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(mgmtLabel); - - if (!renderHeaderPanel) { - - - messageHorizontal.addPreferredGap( - LayoutStyle.ComponentPlacement.UNRELATED, 0, - Short.MAX_VALUE).addComponent(switchFocusDummyLabel) - .addComponent(helpLabel); - messageVertical.addComponent(switchFocusDummyLabel).addComponent( - helpLabel); - } - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(Alignment.LEADING) - .addGroup(mainPanelLayout.createSequentialGroup() - //.addContainerGap() - .addGroup(mainPanelLayout.createParallelGroup(Alignment.LEADING) - .addGroup(messageHorizontal) - .addGroup(mainPanelLayout.createSequentialGroup() - .addGroup(mainPanelLayout.createParallelGroup(Alignment.LEADING) - .addComponent(firstNameLabel_description) - .addComponent(lastNameLabel_description) - .addComponent(birthdateLabel_description)) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(Alignment.LEADING) - .addComponent(firstNameLabel) - .addComponent(lastNameLabel) - .addComponent(birthdateLabel))))) - ); - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createParallelGroup(Alignment.LEADING) - .addGroup(mainPanelLayout.createSequentialGroup() - //.addContainerGap() - .addGroup(messageVertical) - .addPreferredGap(ComponentPlacement.UNRELATED) - .addGroup(mainPanelLayout.createParallelGroup(Alignment.BASELINE) - .addComponent(firstNameLabel_description) - .addComponent(firstNameLabel)) - //.addPreferredGap(ComponentPlacement.UNRELATED) - .addGroup(mainPanelLayout.createParallelGroup(Alignment.BASELINE) - .addComponent(lastNameLabel_description) - .addComponent(lastNameLabel)) - //.addPreferredGap(ComponentPlacement.UNRELATED) - .addGroup(mainPanelLayout.createParallelGroup(Alignment.BASELINE) - .addComponent(birthdateLabel_description) - .addComponent(birthdateLabel))) - ); - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout - .createSequentialGroup().addContainerGap( - GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(activateButton, GroupLayout.PREFERRED_SIZE, - buttonSize, GroupLayout.PREFERRED_SIZE); - - GroupLayout.Group buttonVertical = buttonPanelLayout - .createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(activateButton); - - buttonPanelLayout.setHorizontalGroup(buttonHorizontal); - buttonPanelLayout.setVerticalGroup(buttonVertical); - - } - - @Override - public void resize() { - - log.debug("Resizing Personal IdentityLink Applet ..."); - - float factor = getResizeFactor(); - - - if (mgmtLabel != null) { - mgmtLabel.setFont(mgmtLabel.getFont().deriveFont( - (float) ((baseFontSize)* factor))); - } - - if (activateButton != null) { - activateButton.setFont(activateButton.getFont().deriveFont( - (float) ((baseFontSize)* factor))); - } - - if (firstNameLabel_description != null) { - firstNameLabel_description.setFont(firstNameLabel_description.getFont().deriveFont( - (float) ((baseFontSize)* factor))); - } - - if (lastNameLabel_description != null) { - lastNameLabel_description.setFont(lastNameLabel_description.getFont().deriveFont( - (float) ((baseFontSize)* factor))); - } - - if (birthdateLabel_description != null) { - birthdateLabel_description.setFont(birthdateLabel_description.getFont().deriveFont( - (float) ((baseFontSize)* factor))); - } - - if (firstNameLabel != null) { - firstNameLabel.setFont(firstNameLabel.getFont().deriveFont( - (float) ((baseFontSize)* factor))); - } - - if (lastNameLabel != null) { - lastNameLabel.setFont(lastNameLabel.getFont().deriveFont( - (float) ((baseFontSize)* factor))); - } - - if (birthdateLabel != null) { - birthdateLabel.setFont(birthdateLabel.getFont().deriveFont( - (float) ((baseFontSize)* factor))); - } - - - if (activateButton != null) { - - activateButton.setFont(activateButton.getFont().deriveFont( - (float) (baseFontSize * factor))); - - } - - super.resize(); - } -} diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PersonIdentityLinkGUIFacade.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PersonIdentityLinkGUIFacade.java deleted file mode 100644 index d0332284..00000000 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PersonIdentityLinkGUIFacade.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint - * initiative of the Federal Chancellery Austria and Graz University of Technology. - * - * 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://www.osor.eu/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. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egiz.bku.gui; - -import java.awt.event.ActionListener; - -/** - * - * @author Andreas Fitzek - */ -public interface PersonIdentityLinkGUIFacade extends BKUGUIFacade { - - public static final String FIRSTNAME = "identity.firstname"; - public static final String DATEOFBIRTH = "identity.dateofbirth"; - public static final String LASTNAME = "identity.lastname"; - public static final String TITLE_IDENITY = "title.identity"; - - public static final String MESSAGE_IDENITY = "identity.msg"; - - public static final String ERR_INFOBOX_INVALID = "err.infobox.invalid"; - - /** - * Currently dummy method to display anything ... - * - * @param firstName - * @param surName - */ - public void showPersonIdentityLinkInformationDialog( - ActionListener activateListener, - String actionCommand, - String firstName, - String surName, - String birthdate); -} diff --git a/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties index 764e678b..64906c24 100644 --- a/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties +++ b/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties @@ -28,14 +28,14 @@ title.unblock.pin=Unblock PIN title.activate.success=Success title.change.success=Success title.unblock.success=Success -title.identity=Person Identity Link +title.identity=Identity Link title.certificate.save=Save certificate title.get.certificate=Save certificates title.hardwareinfo = Hardware Information # removed message.* prefix to reuse keys as help keys pin.mgmt={0} PINs available -identity.msg=The person identity link +identity.msg=The identity link identity.button=Cancel identity.firstname=First name identity.dateofbirth=Date of birth @@ -101,7 +101,7 @@ err.pin.format=Invalid {0} length, {1} digit(s) required. err.pin.confirmation={0} and confirmation do not match. err.pin.operation.aborted=The operation on {0} was aborted. err.unsupported.card=This card is not supported -err.infobox.invalid=Unable to interpret person identity link +err.infobox.invalid=Unable to interpret identity link status.not.active=NOT ACTIVE status.active=ACTIVE diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java index 27a5d8ca..7947c117 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java @@ -29,13 +29,13 @@ import at.gv.egiz.bku.smccstal.AbstractBKUWorker; import at.gv.egiz.bku.smccstal.GETCertificateRequestHandler; import at.gv.egiz.bku.smccstal.GETHardwareInfoRequestHandler; import at.gv.egiz.bku.smccstal.PINManagementRequestHandler; -import at.gv.egiz.bku.smccstal.PersonIdentityLinkRequestHandler; +import at.gv.egiz.bku.smccstal.IdentityLinkRequestHandler; import at.gv.egiz.stal.QuitRequest; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; -import at.gv.egiz.stal.ext.PersonIdentityLinkRequest; +import at.gv.egiz.stal.ext.IdentityLinkRequest; import at.gv.egiz.stal.ext.GETCertificateRequest; import at.gv.egiz.stal.ext.GETHardwareInfoRequest; import at.gv.egiz.stal.ext.PINManagementRequest; @@ -56,7 +56,7 @@ public class LocalBKUWorker extends AbstractBKUWorker { addRequestHandler(SignRequest.class, new LocalSignRequestHandler(new LocalSecureViewer(gui))); addRequestHandler(PINManagementRequest.class, new PINManagementRequestHandler()); - addRequestHandler(PersonIdentityLinkRequest.class, new PersonIdentityLinkRequestHandler()); + addRequestHandler(IdentityLinkRequest.class, new IdentityLinkRequestHandler()); addRequestHandler(GETCertificateRequest.class, new GETCertificateRequestHandler()); addRequestHandler(GETHardwareInfoRequest.class, new GETHardwareInfoRequestHandler()); } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalIdentityLinkSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalIdentityLinkSTALFactory.java index c64f029c..8dc0ad50 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalIdentityLinkSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalIdentityLinkSTALFactory.java @@ -37,8 +37,8 @@ import org.slf4j.LoggerFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUIcons; -import at.gv.egiz.bku.gui.PersonIdentityLinkGUI; -import at.gv.egiz.bku.gui.PersonIdentityLinkGUIFacade; +import at.gv.egiz.bku.gui.IdentityLinkGUI; +import at.gv.egiz.bku.gui.IdentityLinkGUIFacade; import at.gv.egiz.bku.local.gui.GUIProxy; import at.gv.egiz.bku.local.gui.LocalHelpListener; import at.gv.egiz.bku.viewer.ResourceFontLoader; @@ -78,13 +78,13 @@ public class LocalIdentityLinkSTALFactory implements STALFactory { } else { log.warn("No HELP URL configured, help system disabled."); } - PersonIdentityLinkGUIFacade gui = new PersonIdentityLinkGUI(dialog.getContentPane(), + IdentityLinkGUIFacade gui = new IdentityLinkGUI(dialog.getContentPane(), dialog.getLocale(), null, new ResourceFontLoader(), helpListener, null); - BKUGUIFacade proxy = (BKUGUIFacade) GUIProxy.newInstance(gui, dialog, new Class[] { PersonIdentityLinkGUIFacade.class} ); + BKUGUIFacade proxy = (BKUGUIFacade) GUIProxy.newInstance(gui, dialog, new Class[] { IdentityLinkGUIFacade.class} ); stal = new LocalBKUWorker(proxy, dialog); dialog.setPreferredSize(PREFERRED_SIZE); dialog.pack(); diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/IdentityLinkServlet.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/IdentityLinkServlet.java index 31c78cb0..197f868b 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/IdentityLinkServlet.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/IdentityLinkServlet.java @@ -41,7 +41,7 @@ import at.gv.egiz.bku.local.stal.LocalIdentityLinkSTALFactory; import at.gv.egiz.stal.QuitRequest; import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.STALResponse; -import at.gv.egiz.stal.ext.PersonIdentityLinkRequest; +import at.gv.egiz.stal.ext.IdentityLinkRequest; /** * IdentityLink BKU Worker for non-applet version @@ -86,7 +86,7 @@ public class IdentityLinkServlet extends HttpServlet { HttpServletResponse response) throws ServletException, IOException { log.info("processRequest: IdentityLinkServlet"); STAL pinMgmtSTAL = stalFactory.createSTAL(); - List stalResps = pinMgmtSTAL.handleRequest(Collections.singletonList(new PersonIdentityLinkRequest())); + List stalResps = pinMgmtSTAL.handleRequest(Collections.singletonList(new IdentityLinkRequest())); log.debug("Received STAL reponse {}.", stalResps.get(0).getClass()); pinMgmtSTAL.handleRequest(Collections.singletonList(new QuitRequest())); diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/IdentityLinkInvoker.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/IdentityLinkInvoker.java new file mode 100644 index 00000000..9709a01f --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/IdentityLinkInvoker.java @@ -0,0 +1,75 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint + * initiative of the Federal Chancellery Austria and Graz University of Technology. + * + * 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://www.osor.eu/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. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egiz.bku.webstart; + +import java.io.IOException; +import java.net.HttpURLConnection; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.webstart.gui.StatusNotifier; + +/** + * + * @author Andreas Fitzek + */ +public class IdentityLinkInvoker implements Runnable { + + private static final Logger log = LoggerFactory.getLogger(IdentityLinkInvoker.class); + + private StatusNotifier status; + + public IdentityLinkInvoker(StatusNotifier status) { + this.status = status; + } + + @Override + public void run() { + HttpURLConnection connection = null; + try { + log.debug("Connecting to: " + Launcher.IDENTITY_LINK_URL); + + connection = (HttpURLConnection) Launcher.IDENTITY_LINK_URL.openConnection(); + + connection.setRequestMethod("GET"); + connection.setReadTimeout(0); + connection.connect(); + + if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) { + log.debug("identity link dialog returned"); + } else { + log.error("unexpected response from identity link: " + connection.getResponseMessage()); + } + } catch (IOException ex) { + log.error("Failed to connect to identity link", ex); + status.error(StatusNotifier.ERROR_IDENTITY_LINK); + } finally { + if (connection != null) { + connection.disconnect(); + } + } + } +} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java index 0e510e2f..4cf5ed1f 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java @@ -321,8 +321,8 @@ public class Launcher implements BKUControllerInterface { } @Override - public void personIdentityLink(Locale locale) { - new Thread(new PersonIdentityLinkInvoker(status)).start(); + public void getIdentityLink(Locale locale) { + new Thread(new IdentityLinkInvoker(status)).start(); } @Override diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/PersonIdentityLinkInvoker.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/PersonIdentityLinkInvoker.java deleted file mode 100644 index 249d7a15..00000000 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/PersonIdentityLinkInvoker.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint - * initiative of the Federal Chancellery Austria and Graz University of Technology. - * - * 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://www.osor.eu/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. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egiz.bku.webstart; - -import java.io.IOException; -import java.net.HttpURLConnection; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.gv.egiz.bku.webstart.gui.StatusNotifier; - -/** - * - * @author Andreas Fitzek - */ -public class PersonIdentityLinkInvoker implements Runnable { - - private static final Logger log = LoggerFactory.getLogger(PersonIdentityLinkInvoker.class); - - private StatusNotifier status; - - public PersonIdentityLinkInvoker(StatusNotifier status) { - this.status = status; - } - - @Override - public void run() { - HttpURLConnection connection = null; - try { - log.info("Connecting to: " + Launcher.IDENTITY_LINK_URL); - - connection = (HttpURLConnection) Launcher.IDENTITY_LINK_URL.openConnection(); - - connection.setRequestMethod("GET"); - connection.setReadTimeout(0); - connection.connect(); - - if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) { - log.info("person identity link dialog returned"); - } else { - log.error("unexpected response from person identity link: " + connection.getResponseMessage()); - } - } catch (IOException ex) { - log.error("Failed to connect to person identity link", ex); - status.error(StatusNotifier.ERROR_IDENTITY_LINK); - } finally { - if (connection != null) { - connection.disconnect(); - } - } - } -} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java index 8c05f137..48704a3c 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java @@ -38,7 +38,7 @@ public interface BKUControllerInterface { public void getCertificate(Locale locale); - public void personIdentityLink(Locale locale); + public void getIdentityLink(Locale locale); public void hardwareInfo(Locale locale); diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/MOCCAIcon.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/MOCCAIcon.java index f0b60877..eaf2bee5 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/MOCCAIcon.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/MOCCAIcon.java @@ -274,8 +274,8 @@ public class MOCCAIcon implements StatusNotifier, ActionListener, ItemListener { break; case IDENTITYLINK_COMMAND: - log.debug("person identity link dialog requested via tray menu"); - controller.personIdentityLink(messages.getLocale()); + log.debug("identity link dialog requested via tray menu"); + controller.getIdentityLink(messages.getLocale()); break; default: diff --git a/STALExt/src/main/java/at/gv/egiz/stal/ext/IdentityLinkRequest.java b/STALExt/src/main/java/at/gv/egiz/stal/ext/IdentityLinkRequest.java new file mode 100644 index 00000000..65f0b3fe --- /dev/null +++ b/STALExt/src/main/java/at/gv/egiz/stal/ext/IdentityLinkRequest.java @@ -0,0 +1,37 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint + * initiative of the Federal Chancellery Austria and Graz University of Technology. + * + * 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://www.osor.eu/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. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egiz.stal.ext; + +import at.gv.egiz.stal.STALRequest; + + +/** + * Dummy STAL request to trigger display of identity link. + * + * @author Andreas Fitzek + */ +public class IdentityLinkRequest extends STALRequest { + +} diff --git a/STALExt/src/main/java/at/gv/egiz/stal/ext/IdentityLinkResponse.java b/STALExt/src/main/java/at/gv/egiz/stal/ext/IdentityLinkResponse.java new file mode 100644 index 00000000..8d1d25d5 --- /dev/null +++ b/STALExt/src/main/java/at/gv/egiz/stal/ext/IdentityLinkResponse.java @@ -0,0 +1,34 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint + * initiative of the Federal Chancellery Austria and Graz University of Technology. + * + * 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://www.osor.eu/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. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + +package at.gv.egiz.stal.ext; + +import at.gv.egiz.stal.STALResponse; + +/** + * + * @author Andreas Fitzek + */ +public class IdentityLinkResponse extends STALResponse { + +} diff --git a/STALExt/src/main/java/at/gv/egiz/stal/ext/PersonIdentityLinkRequest.java b/STALExt/src/main/java/at/gv/egiz/stal/ext/PersonIdentityLinkRequest.java deleted file mode 100644 index 17aba1ad..00000000 --- a/STALExt/src/main/java/at/gv/egiz/stal/ext/PersonIdentityLinkRequest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint - * initiative of the Federal Chancellery Austria and Graz University of Technology. - * - * 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://www.osor.eu/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. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - - -package at.gv.egiz.stal.ext; - -import at.gv.egiz.stal.STALRequest; - - -/** - * Dummy STAL request to trigger display of person identity link. - * - * @author Andreas Fitzek - */ -public class PersonIdentityLinkRequest extends STALRequest { - -} diff --git a/STALExt/src/main/java/at/gv/egiz/stal/ext/PersonIdentityLinkResponse.java b/STALExt/src/main/java/at/gv/egiz/stal/ext/PersonIdentityLinkResponse.java deleted file mode 100644 index fb7fd721..00000000 --- a/STALExt/src/main/java/at/gv/egiz/stal/ext/PersonIdentityLinkResponse.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint - * initiative of the Federal Chancellery Austria and Graz University of Technology. - * - * 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://www.osor.eu/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. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - -package at.gv.egiz.stal.ext; - -import at.gv.egiz.stal.STALResponse; - -/** - * - * @author Andreas Fitzek - */ -public class PersonIdentityLinkResponse extends STALResponse { - -} diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/IdentityLinkExtractor.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/IdentityLinkExtractor.java index b1aa9326..6fbeda1d 100644 --- a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/IdentityLinkExtractor.java +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/IdentityLinkExtractor.java @@ -35,7 +35,7 @@ public class IdentityLinkExtractor { private static final Logger log = LoggerFactory.getLogger(IdentityLinkExtractor.class); - private static ASN1 getPersonData(ASN1 identityLink) throws IOException + private static ASN1 getData(ASN1 identityLink) throws IOException { if(identityLink.getSize() > 4 ) { @@ -54,9 +54,9 @@ public class IdentityLinkExtractor { } } - public static String getPersonFirstName(ASN1 identityLink) throws IOException + public static String getFirstName(ASN1 identityLink) throws IOException { - ASN1 personData = getPersonData(identityLink); + ASN1 personData = getData(identityLink); if(personData != null) { return personData.getElementAt(1).gvString(); @@ -64,9 +64,9 @@ public class IdentityLinkExtractor { return null; } - public static String getPersonLastName(ASN1 identityLink) throws IOException + public static String getLastName(ASN1 identityLink) throws IOException { - ASN1 personData = getPersonData(identityLink); + ASN1 personData = getData(identityLink); if(personData != null) { return personData.getElementAt(2).gvString(); @@ -74,9 +74,9 @@ public class IdentityLinkExtractor { return null; } - public static String getPersonDateOfBirth(ASN1 identityLink) throws IOException + public static String getDateOfBirth(ASN1 identityLink) throws IOException { - ASN1 personData = getPersonData(identityLink); + ASN1 personData = getData(identityLink); if(personData != null) { return personData.getElementAt(3).gvString(); diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/IdentityLinkRequestHandler.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/IdentityLinkRequestHandler.java new file mode 100644 index 00000000..9ba63a89 --- /dev/null +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/IdentityLinkRequestHandler.java @@ -0,0 +1,119 @@ +/* + * Copyright 2011 by Graz University of Technology, Austria + * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint + * initiative of the Federal Chancellery Austria and Graz University of Technology. + * + * 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://www.osor.eu/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. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + +package at.gv.egiz.bku.smccstal; + +import iaik.me.asn1.ASN1; + +import java.io.IOException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.gui.PINManagementGUIFacade; +import at.gv.egiz.bku.gui.IdentityLinkGUIFacade; +import at.gv.egiz.bku.pin.gui.VerifyPINGUI; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.stal.ErrorResponse; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.ext.IdentityLinkRequest; +import at.gv.egiz.stal.ext.IdentityLinkResponse; + +/** + * + * @author Andreas Fitzek + */ +public class IdentityLinkRequestHandler extends AbstractRequestHandler { + + private final static String IdentityInfoBox = "IdentityLink"; + + private final Logger log = LoggerFactory.getLogger(IdentityLinkRequestHandler.class); + + //IdentityLinkGUIFacade il_gui = (IdentityLinkGUIFacade) this.gui; + + @Override + public boolean requireCard() { + return true; + } + + @Override + public STALResponse handleRequest(STALRequest request) + throws InterruptedException { + if(request instanceof IdentityLinkRequest) + { + try + { + byte[] identity_asn1 = card.getInfobox(IdentityInfoBox, new VerifyPINGUI(gui), ""); + + ASN1 identity_object = new ASN1(identity_asn1); + + String firstname = IdentityLinkExtractor.getFirstName(identity_object); + String lastname = IdentityLinkExtractor.getLastName(identity_object); + String dateofBirth = IdentityLinkExtractor.getDateOfBirth(identity_object); + + // TODO: correct error handling ... + IdentityLinkGUIFacade il_gui = null; + + if(gui instanceof IdentityLinkGUIFacade) + { + il_gui = (IdentityLinkGUIFacade) gui; + } + + if(il_gui == null) + { + log.warn("Failed to cast gui to IdentityLinkGUIFacade!"); + return new ErrorResponse(1000); + } + + il_gui.showIdentityLinkInformationDialog(this, "ok_action", + firstname, + lastname, + dateofBirth); + + waitForAction(); + + return new IdentityLinkResponse(); + } + catch(SignatureCardException ex) + { + log.error(ex.getMessage(), ex); + gui.showErrorDialog(PINManagementGUIFacade.ERR_CARD_NOTACTIVATED, + null, this, "cancel"); + waitForAction(); + return new ErrorResponse(1000); + } catch (IOException ex) { + log.error(ex.getMessage(), ex); + gui.showErrorDialog(IdentityLinkGUIFacade.ERR_INFOBOX_INVALID, + null, this, "cancel"); + waitForAction(); + return new ErrorResponse(1000); + } + } + else + { + log.error("Got unexpected STAL request: {}.", request); + return new ErrorResponse(1000); + } + } +} diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PersonIdentityLinkRequestHandler.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PersonIdentityLinkRequestHandler.java deleted file mode 100644 index d8873f77..00000000 --- a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PersonIdentityLinkRequestHandler.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2011 by Graz University of Technology, Austria - * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint - * initiative of the Federal Chancellery Austria and Graz University of Technology. - * - * 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://www.osor.eu/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. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - -package at.gv.egiz.bku.smccstal; - -import iaik.me.asn1.ASN1; - -import java.io.IOException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.gv.egiz.bku.gui.PINManagementGUIFacade; -import at.gv.egiz.bku.gui.PersonIdentityLinkGUIFacade; -import at.gv.egiz.bku.pin.gui.VerifyPINGUI; -import at.gv.egiz.smcc.SignatureCardException; -import at.gv.egiz.stal.ErrorResponse; -import at.gv.egiz.stal.STALRequest; -import at.gv.egiz.stal.STALResponse; -import at.gv.egiz.stal.ext.PersonIdentityLinkRequest; -import at.gv.egiz.stal.ext.PersonIdentityLinkResponse; - -/** - * - * @author Andreas Fitzek - */ -public class PersonIdentityLinkRequestHandler extends AbstractRequestHandler { - - private final static String IdentityInfoBox = "IdentityLink"; - - private final Logger log = LoggerFactory.getLogger(PersonIdentityLinkRequestHandler.class); - - //PersonIdentityLinkGUIFacade person_gui = (PersonIdentityLinkGUIFacade) this.gui; - - @Override - public boolean requireCard() { - return true; - } - - @Override - public STALResponse handleRequest(STALRequest request) - throws InterruptedException { - if(request instanceof PersonIdentityLinkRequest) - { - try - { - byte[] identity_asn1 = card.getInfobox(IdentityInfoBox, new VerifyPINGUI(gui), ""); - - ASN1 identity_object = new ASN1(identity_asn1); - - String firstname = IdentityLinkExtractor.getPersonFirstName(identity_object); - String lastname = IdentityLinkExtractor.getPersonLastName(identity_object); - String dateofBirth = IdentityLinkExtractor.getPersonDateOfBirth(identity_object); - - // TODO: correct error handling ... - PersonIdentityLinkGUIFacade person_gui = null; - - if(gui instanceof PersonIdentityLinkGUIFacade) - { - person_gui = (PersonIdentityLinkGUIFacade) gui; - } - - if(person_gui == null) - { - log.warn("Failed to cast gui to PersonIdentityLinkGUIFacade!"); - return new ErrorResponse(1000); - } - - person_gui.showPersonIdentityLinkInformationDialog(this, "ok_action", - firstname, - lastname, - dateofBirth); - - waitForAction(); - - return new PersonIdentityLinkResponse(); - } - catch(SignatureCardException ex) - { - log.error(ex.getMessage(), ex); - gui.showErrorDialog(PINManagementGUIFacade.ERR_CARD_NOTACTIVATED, - null, this, "cancel"); - waitForAction(); - return new ErrorResponse(1000); - } catch (IOException ex) { - log.error(ex.getMessage(), ex); - gui.showErrorDialog(PersonIdentityLinkGUIFacade.ERR_INFOBOX_INVALID, - null, this, "cancel"); - waitForAction(); - return new ErrorResponse(1000); - } - } - else - { - log.error("Got unexpected STAL request: {}.", request); - return new ErrorResponse(1000); - } - } -} -- cgit v1.2.3