From 4af6912e43237c3678f05e30c69385481f42ae76 Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 12 May 2009 14:46:41 +0000 Subject: bku web start git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@354 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../java/at/gv/egiz/bku/webstart/BKULauncher.java | 221 +++++++++++++++++++++ .../src/main/java/at/gv/egiz/bku/webstart/CA.java | 117 +++++++++++ .../java/at/gv/egiz/bku/webstart/Container.java | 86 ++++++++ .../bku/webstart/ui/BKUControllerInterface.java | 23 +++ .../at/gv/egiz/bku/webstart/ui/TrayIconDialog.java | 202 +++++++++++++++++++ .../bku/webstart/ui/TrayIconDialogInterface.java | 33 +++ BKUWebStart/src/main/jnlp/resources/logo.png | Bin 0 -> 2609 bytes BKUWebStart/src/main/jnlp/resources/logo_64x64.png | Bin 0 -> 2299 bytes BKUWebStart/src/main/jnlp/resources/logo_90x90.png | Bin 0 -> 3294 bytes BKUWebStart/src/main/jnlp/resources/splash.png | Bin 0 -> 54978 bytes BKUWebStart/src/main/jnlp/template.xml | 37 ++++ .../gv/egiz/bku/webstart/defaultConf/template.zip | Bin 0 -> 24829 bytes .../gv/egiz/bku/webstart/ui/UIMessages.properties | 13 ++ .../at/gv/egiz/bku/webstart/ui/favicon.png | Bin 0 -> 2149 bytes .../resources/at/gv/egiz/bku/webstart/ui/logo.png | Bin 0 -> 1751 bytes BKUWebStart/src/main/resources/log4j.properties | 16 ++ BKUWebStart/src/main/resources/logo.png | Bin 0 -> 2299 bytes BKUWebStart/src/main/resources/logo_32x32.png | Bin 0 -> 1522 bytes BKUWebStart/src/main/resources/logo_90x90.png | Bin 0 -> 3294 bytes BKUWebStart/src/main/resources/logo_RGB22x22.png | Bin 0 -> 1751 bytes BKUWebStart/src/main/resources/logo_RGB32x32.png | Bin 0 -> 2609 bytes BKUWebStart/src/main/resources/splash.png | Bin 0 -> 54978 bytes BKUWebStart/src/main/webapp/WEB-INF/web.xml | 7 + BKUWebStart/src/main/webapp/launch.html | 17 ++ BKUWebStart/src/main/webapp/launch.jnlp | 30 +++ BKUWebStart/src/main/webapp/mocca_tiny.png | Bin 0 -> 1025 bytes BKUWebStart/src/main/webapp/splash.png | Bin 0 -> 54978 bytes 27 files changed, 802 insertions(+) create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/CA.java create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/BKUControllerInterface.java create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialogInterface.java create mode 100644 BKUWebStart/src/main/jnlp/resources/logo.png create mode 100644 BKUWebStart/src/main/jnlp/resources/logo_64x64.png create mode 100644 BKUWebStart/src/main/jnlp/resources/logo_90x90.png create mode 100644 BKUWebStart/src/main/jnlp/resources/splash.png create mode 100644 BKUWebStart/src/main/jnlp/template.xml create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/defaultConf/template.zip create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/favicon.png create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/logo.png create mode 100644 BKUWebStart/src/main/resources/log4j.properties create mode 100644 BKUWebStart/src/main/resources/logo.png create mode 100644 BKUWebStart/src/main/resources/logo_32x32.png create mode 100644 BKUWebStart/src/main/resources/logo_90x90.png create mode 100644 BKUWebStart/src/main/resources/logo_RGB22x22.png create mode 100644 BKUWebStart/src/main/resources/logo_RGB32x32.png create mode 100644 BKUWebStart/src/main/resources/splash.png create mode 100644 BKUWebStart/src/main/webapp/WEB-INF/web.xml create mode 100644 BKUWebStart/src/main/webapp/launch.html create mode 100644 BKUWebStart/src/main/webapp/launch.jnlp create mode 100644 BKUWebStart/src/main/webapp/mocca_tiny.png create mode 100644 BKUWebStart/src/main/webapp/splash.png (limited to 'BKUWebStart/src') diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java new file mode 100644 index 00000000..854e6535 --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java @@ -0,0 +1,221 @@ +package at.gv.egiz.bku.webstart; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.security.KeyStore; +import java.util.Enumeration; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +//import org.apache.commons.cli.CommandLine; +//import org.apache.commons.cli.CommandLineParser; +//import org.apache.commons.cli.HelpFormatter; +//import org.apache.commons.cli.Options; +//import org.apache.commons.cli.ParseException; +//import org.apache.commons.cli.PosixParser; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.webstart.ui.BKUControllerInterface; +import at.gv.egiz.bku.webstart.ui.TrayIconDialog; +import at.gv.egiz.bku.utils.StreamUtil; + +public class BKULauncher implements BKUControllerInterface { + + private static Log log = LogFactory.getLog(BKULauncher.class); + + private ResourceBundle resourceBundle = null; + private Container server; +// private SplashScreen splash = SplashScreen.getSplashScreen(); + + private void startUpServer() throws Exception { + server = new Container(); + // XmlConfiguration xcfg = new XmlConfiguration(getClass().getClassLoader() + // .getResourceAsStream("at/gv/egiz/bku/local/app/jetty.xml")); + // xcfg.configure(server); + server.init(); + server.start(); + } + + private void initTrayIcon() { + Locale loc = Locale.getDefault(); + try { + resourceBundle = ResourceBundle.getBundle( + "at/gv/egiz/bku/webstart/ui/UIMessages", loc); + } catch (MissingResourceException mx) { + resourceBundle = ResourceBundle.getBundle( + "at/gv/egiz/bku/webstart/ui/UIMessages", Locale.ENGLISH); + } + TrayIconDialog.getInstance().init(resourceBundle); + TrayIconDialog.getInstance().setShutdownHook(this); + TrayIconDialog.getInstance().displayInfo("Greetings.Caption", + "Greetings.Message"); + } + + private void initStart() { + + } + + private void initFinished() { + try { +// if (splash != null) { +// try { +// splash.close(); +// } catch (IllegalStateException ex) { +// log.warn("Failed to close splash screen: " + ex.getMessage()); +// } +// } + server.join(); + } catch (InterruptedException e) { + log.info(e); + } + } + +// private void copyDirs(File srcDir, File dstDir) { +// for (File cf : srcDir.listFiles()) { +// File of = new File(dstDir, cf.getName()); +// if (cf.isDirectory()) { +// log.debug("Creating directory: " + of); +// of.mkdir(); +// copyDirs(cf, of); +// } else { +// log.debug("Writing file: " + of); +// try { +// FileInputStream fis = new FileInputStream(cf); +// FileOutputStream fos = new FileOutputStream(of); +// StreamUtil.copyStream(fis, fos); +// fis.close(); +// fos.close(); +// } catch (IOException e) { +// log.error("Cannot copy default configuration", e); +// } +// } +// } +// } + + private void unzip(File zipfile) throws IOException { + File dir = zipfile.getParentFile(); + ZipFile zipFile = new ZipFile(zipfile); + Enumeration entries = zipFile.entries(); + while (entries.hasMoreElements()) { + ZipEntry entry = entries.nextElement(); + File eF = new File(dir, entry.getName()); + if (entry.isDirectory()) { + eF.mkdirs(); + continue; + } + File f = new File(eF.getParent()); + f.mkdirs(); + StreamUtil.copyStream(zipFile.getInputStream(entry), + new FileOutputStream(eF)); + } + zipFile.close(); + } + + private void checkConfig(String[] args) { +// CommandLineParser parser = new PosixParser(); +// Options options = new Options(); +// options.addOption("c", true, "the configuration's base directory"); +// options.addOption("h", false, "print this message"); +// try { + File cfgDir = new File(System.getProperty("user.home") + "/.mocca/conf"); +// CommandLine cmd = parser.parse(options, args); +// if (cmd.hasOption("h")) { +// HelpFormatter formatter = new HelpFormatter(); +// formatter.printHelp("BKULauncher", options); +// System.exit(0); +// } +// +// if (cmd.hasOption("c")) { +// cfgDir = new File(cmd.getOptionValue("c")); +// } + log.debug("using config directory: " + cfgDir); + if (cfgDir.exists() && cfgDir.isFile()) { + log.error("Configuration directory must not be a file"); + } + if (!cfgDir.exists()) { + log.debug("Creating config directory: " + cfgDir); + cfgDir.mkdirs(); + try { + InputStream is = getClass().getClassLoader().getResourceAsStream( + "at/gv/egiz/bku/webstart/defaultConf/template.zip"); + OutputStream os = new FileOutputStream(new File(cfgDir, + "template.zip")); + StreamUtil.copyStream(is, os); + os.close(); + unzip(new File(cfgDir, "template.zip")); + } catch (IOException iox) { + log.error("Cannot create user directory", iox); + return; + } + CA ca = new CA(); + char[] password = "changeMe".toCharArray(); + KeyStore ks = ca.generateKeyStore(password); + if (ks != null) { + File ksdir = new File(cfgDir, "keystore"); + ksdir.mkdirs(); + FileOutputStream fos; + try { + fos = new FileOutputStream(new File(ksdir, "keystore.ks")); + ks.store(fos, password); + fos.close(); + } catch (Exception e) { + log.error("Cannot store keystore", e); + } + } else { + log.error("Cannot create ssl certificate"); + } + } +// } catch (ParseException e1) { +// log.error(e1); +// HelpFormatter formatter = new HelpFormatter(); +// formatter.printHelp("BKULauncher", options); +// System.exit(0); +// } + } + + /** + * @param args + */ + public static void main(String[] args) { + try { + log.warn("***** DISABLING SECURITY MANAGER *******"); + System.setSecurityManager(null); + BKULauncher launcher = new BKULauncher(); + launcher.initStart(); + launcher.checkConfig(args); + launcher.startUpServer(); + launcher.initTrayIcon(); + launcher.initFinished(); + } catch (Exception e) { + log.fatal("Cannot launch BKU", e); + System.exit(-1000); + } + + } + + public void shutDown() { + log.info("Shutting down server"); + if ((server != null) && (server.isRunning())) { + try { + if (server.isRunning()) { + server.stop(); + } + } catch (Exception e) { + log.debug(e.toString()); + } finally { + if (server.isRunning()) { + server.destroy(); + } + } + } + System.exit(0); + } + +} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/CA.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/CA.java new file mode 100644 index 00000000..f81d3d83 --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/CA.java @@ -0,0 +1,117 @@ +package at.gv.egiz.bku.webstart; + +import iaik.asn1.ObjectID; +import iaik.asn1.structures.AlgorithmID; +import iaik.asn1.structures.Name; +import iaik.x509.X509Certificate; +import iaik.x509.extensions.BasicConstraints; +import iaik.x509.extensions.KeyUsage; + +import java.math.BigInteger; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.security.GeneralSecurityException; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.KeyStore; +import java.security.NoSuchAlgorithmException; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.Random; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class CA { + private final static Log log = LogFactory.getLog(CA.class); + + private KeyPair caKeyPair; + private X509Certificate caCert; + + private KeyPair serverKeyPair; + private X509Certificate serverCert; + + public CA() { + } + + private KeyPair generateKeyPair() throws NoSuchAlgorithmException { + KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA"); + gen.initialize(2048); + return gen.generateKeyPair(); + } + + private void generateCA() throws GeneralSecurityException { + log.debug("Generating CA certificate"); + Name subject = new Name(); + subject.addRDN(ObjectID.country, "AT"); + subject.addRDN(ObjectID.organization, "MOCCA"); + subject.addRDN(ObjectID.organizationalUnit, "MOCCA-CA"); + + caKeyPair = generateKeyPair(); + caCert = new X509Certificate(); + caCert.setSerialNumber(new BigInteger(20, new Random())); + caCert.setSubjectDN(subject); + caCert.setPublicKey(caKeyPair.getPublic()); + caCert.setIssuerDN(subject); + + caCert.addExtension(new BasicConstraints(true)); + caCert.addExtension(new KeyUsage(KeyUsage.keyCertSign | KeyUsage.cRLSign + | KeyUsage.digitalSignature)); + + GregorianCalendar date = new GregorianCalendar(); + date.add(Calendar.HOUR_OF_DAY, -1); + caCert.setValidNotBefore(date.getTime()); + date.add(Calendar.YEAR, 7); + caCert.setValidNotAfter(date.getTime()); + caCert.sign(AlgorithmID.sha1WithRSAEncryption, caKeyPair.getPrivate()); + log.debug("Successfully signed CA certificate"); + } + + private void generateServerCert() throws GeneralSecurityException { + log.debug("Generating SSL certificate"); + Name subject = new Name(); + subject.addRDN(ObjectID.country, "AT"); + subject.addRDN(ObjectID.organization, "MOCCA"); + try { + subject.addRDN(ObjectID.commonName, InetAddress.getLocalHost() + .getHostName()); + } catch (UnknownHostException e) { + subject.addRDN(ObjectID.commonName, "localhost"); + } + serverKeyPair = generateKeyPair(); + serverCert = new X509Certificate(); + serverCert.setSerialNumber(new BigInteger(20, new Random())); + serverCert.setSubjectDN(subject); + serverCert.setPublicKey(serverKeyPair.getPublic()); + serverCert.setIssuerDN(caCert.getSubjectDN()); + + serverCert.addExtension(new BasicConstraints(false)); + serverCert.addExtension(new KeyUsage(KeyUsage.keyEncipherment + | KeyUsage.digitalSignature)); + + GregorianCalendar date = new GregorianCalendar(); + date.add(Calendar.HOUR_OF_DAY, -1); + serverCert.setValidNotBefore(date.getTime()); + date.add(Calendar.YEAR, 7); + date.add(Calendar.HOUR_OF_DAY, -1); + serverCert.setValidNotAfter(date.getTime()); + serverCert.sign(AlgorithmID.sha1WithRSAEncryption, caKeyPair.getPrivate()); + log.debug("Successfully signed server certificate"); + caKeyPair = null; + } + + public KeyStore generateKeyStore(char[] password) { + try { + generateCA(); + generateServerCert(); + KeyStore ks = KeyStore.getInstance("JKS"); + ks.load(null, null); + ks.setKeyEntry("server", serverKeyPair.getPrivate(), password, new X509Certificate[]{serverCert, caCert}); + return ks; + } catch (Exception e) { + log.error("Cannot generate certificate", e); + } + return null; + } + +} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java new file mode 100644 index 00000000..ef12e4fd --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java @@ -0,0 +1,86 @@ +package at.gv.egiz.bku.webstart; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.mortbay.jetty.Connector; +import org.mortbay.jetty.Handler; +import org.mortbay.jetty.Server; +import org.mortbay.jetty.handler.DefaultHandler; +import org.mortbay.jetty.handler.HandlerCollection; +import org.mortbay.jetty.nio.SelectChannelConnector; +import org.mortbay.jetty.security.SslSocketConnector; +import org.mortbay.jetty.webapp.WebAppContext; +import org.mortbay.thread.QueuedThreadPool; + +public class Container { + + public static final String HTTP_PORT = "mocca.http.port"; + public static final String HTTPS_PORT = "mocca.http.port"; + + private static Log log = LogFactory.getLog(Container.class); + + private Server server; + + public Container() { + } + + public void init() { + server = new Server(); + QueuedThreadPool qtp = new QueuedThreadPool(); + qtp.setMaxThreads(5); + qtp.setMinThreads(2); + qtp.setLowThreads(0); + server.setThreadPool(qtp); + server.setStopAtShutdown(true); + server.setGracefulShutdown(3000); + + SelectChannelConnector connector = new SelectChannelConnector(); + connector.setPort(Integer.getInteger(HTTP_PORT, 3495).intValue()); + connector.setAcceptors(1); + connector.setConfidentialPort(Integer.getInteger(HTTPS_PORT, 3496).intValue()); + + SslSocketConnector sslConnector = new SslSocketConnector(); + sslConnector.setPort(Integer.getInteger(HTTPS_PORT, 3496).intValue()); + sslConnector.setAcceptors(1); + sslConnector.setKeystore(System.getProperty("user.home") + + "/.mocca/conf/keystore/keystore.ks"); + sslConnector.setPassword("changeMe"); + sslConnector.setKeyPassword("changeMe"); + + server.setConnectors(new Connector[] { connector, sslConnector }); + +// HandlerCollection handlers = new HandlerCollection(); + WebAppContext webapp = new WebAppContext(); + webapp.setContextPath("/"); + webapp.setExtractWAR(true); //false + webapp.setParentLoaderPriority(false); + +// webappcontext.setWar("BKULocal-1.0.4-SNAPSHOT.war"); + webapp.setWar(getClass().getClassLoader().getResource("BKULocalWar/").toString()); + +// handlers.setHandlers(new Handler[] { webappcontext, new DefaultHandler() }); + + server.setHandler(webapp); + server.setGracefulShutdown(1000*3); + } + + public void start() throws Exception { + server.start(); + } + + public boolean isRunning() { + return server.isRunning(); + } + + public void stop() throws Exception { + server.stop(); + } + + public void destroy() { + server.destroy(); + } + + public void join() throws InterruptedException { + server.join(); + } +} \ No newline at end of file diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/BKUControllerInterface.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/BKUControllerInterface.java new file mode 100644 index 00000000..fd9838f9 --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/BKUControllerInterface.java @@ -0,0 +1,23 @@ +/* +* Copyright 2008 Federal Chancellery Austria and +* Graz University of Technology +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package at.gv.egiz.bku.webstart.ui; + +public interface BKUControllerInterface { + + public void shutDown(); + +} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java new file mode 100644 index 00000000..4679eac5 --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java @@ -0,0 +1,202 @@ +/* +* Copyright 2008 Federal Chancellery Austria and +* Graz University of Technology +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package at.gv.egiz.bku.webstart.ui; + +import java.awt.AWTException; +import java.awt.Image; +import java.awt.MenuItem; +import java.awt.PopupMenu; +import java.awt.SystemTray; +import java.awt.TrayIcon; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.IOException; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.ResourceBundle; + +import javax.imageio.ImageIO; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class TrayIconDialog implements TrayIconDialogInterface { + + private static Log log = LogFactory.getLog(TrayIconDialog.class); + private static TrayIconDialogInterface instance; + private boolean isSupported; + private BKUControllerInterface shutDown; + private TrayIcon trayIcon = null; + private ResourceBundle resourceBundle = null; + + private TrayIconDialog() { + } + + private void displayTrayMsg(String captionID, String messageID, + TrayIcon.MessageType type) { + if ((isSupported) && (resourceBundle != null)) { + try { + trayIcon.displayMessage(resourceBundle.getString(captionID), + resourceBundle.getString(messageID), type); + } catch (Exception ex) { + log.error(ex); + } + } + } + + /* + * (non-Javadoc) + * + * @see + * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#displayInfo(java.lang.String + * , java.lang.String) + */ + public void displayInfo(String captionID, String messageID) { + displayTrayMsg(captionID, messageID, TrayIcon.MessageType.INFO); + } + + /* + * (non-Javadoc) + * + * @see + * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#displayWarning(java.lang + * .String, java.lang.String) + */ + public void displayWarning(String captionID, String messageID) { + displayTrayMsg(captionID, messageID, TrayIcon.MessageType.WARNING); + } + + /* + * (non-Javadoc) + * + * @see + * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#displayError(java.lang. + * String, java.lang.String) + */ + public void displayError(String captionID, String messageID) { + displayTrayMsg(captionID, messageID, TrayIcon.MessageType.ERROR); + } + + /* + * (non-Javadoc) + * + * @see + * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#init(java.util.ResourceBundle + * ) + */ + public void init(ResourceBundle resourceBundel) { + this.resourceBundle = resourceBundel; + isSupported = SystemTray.isSupported(); + log.info("Trayicon supported: " + isSupported); + try { + if (isSupported) { + SystemTray tray = SystemTray.getSystemTray(); + Image image = ImageIO.read(getClass().getClassLoader() + .getResourceAsStream("at/gv/egiz/bku/webstart/ui/logo.png")); + PopupMenu popup = new PopupMenu(); + MenuItem exitItem = new MenuItem(resourceBundel + .getString("TrayMenu.Shutdown")); + popup.add(exitItem); + exitItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + log.info("Calling Shutdown"); + if (shutDown != null) { + shutDown.shutDown(); + } + } + }); + + trayIcon = new TrayIcon(image, "BKULogo", popup); + trayIcon.setImageAutoSize(true); + trayIcon.setToolTip(resourceBundel.getString("TrayMenu.Tooltip")); + try { + tray.add(trayIcon); + } catch (AWTException e) { + log.error("TrayIcon could not be added.", e); + isSupported = false; + } + } + } catch (IOException e) { + log.error(e); + } + } + + /* + * (non-Javadoc) + * + * @see + * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#setShutdownHook(at.gv.egiz + * .bku.local.ui.BKUControllerInterface) + */ + public void setShutdownHook(BKUControllerInterface shutDown) { + this.shutDown = shutDown; + } + + @SuppressWarnings("unchecked") + public synchronized static TrayIconDialogInterface getInstance() { + ClassLoader cl = TrayIconDialog.class.getClassLoader(); + if (instance == null) { + if (cl.toString().equals(cl.getParent().toString())) { + instance = new TrayIconDialog(); + return instance; + } + ClassLoader parent = cl; + while (!parent.toString().equals(cl.getParent().toString())) { + parent = parent.getParent(); + } + try { + Class otherClassInstance = (Class) parent + .loadClass(TrayIconDialog.class.getName()); + Method getInstanceMethod = otherClassInstance.getDeclaredMethod( + "getInstance", new Class[] {}); + Object otherSingleton = getInstanceMethod.invoke(null, new Object[] {}); + instance = (TrayIconDialogInterface) Proxy.newProxyInstance(cl, + new Class[] { TrayIconDialogInterface.class }, + new PassThroughProxyHandler(otherSingleton)); + } catch (ClassNotFoundException ce) { + instance = new TrayIconDialog(); + } catch (Exception e) { + log.error(e); + instance = new TrayIconDialog(); + } + return instance; + } + return instance; + } + + /** + * + * Only works for public methods + * + */ + static class PassThroughProxyHandler implements InvocationHandler { + private final Object delegate; + + public PassThroughProxyHandler(Object delegate) { + this.delegate = delegate; + } + + public Object invoke(Object proxy, Method method, Object[] args) + throws Throwable { + Method delegateMethod = delegate.getClass().getMethod(method.getName(), + method.getParameterTypes()); + return delegateMethod.invoke(delegate, args); + } + } + +} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialogInterface.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialogInterface.java new file mode 100644 index 00000000..078844cb --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialogInterface.java @@ -0,0 +1,33 @@ +/* +* Copyright 2008 Federal Chancellery Austria and +* Graz University of Technology +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package at.gv.egiz.bku.webstart.ui; + +import java.util.ResourceBundle; + +public interface TrayIconDialogInterface { + + public abstract void displayInfo(String captionID, String messageID); + + public abstract void displayWarning(String captionID, String messageID); + + public abstract void displayError(String captionID, String messageID); + + public abstract void init(ResourceBundle resourceBundel); + + public abstract void setShutdownHook(BKUControllerInterface shutDown); + +} \ No newline at end of file diff --git a/BKUWebStart/src/main/jnlp/resources/logo.png b/BKUWebStart/src/main/jnlp/resources/logo.png new file mode 100644 index 00000000..2c622d88 Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/logo.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/logo_64x64.png b/BKUWebStart/src/main/jnlp/resources/logo_64x64.png new file mode 100644 index 00000000..fa6d7f96 Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/logo_64x64.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/logo_90x90.png b/BKUWebStart/src/main/jnlp/resources/logo_90x90.png new file mode 100644 index 00000000..d7f8bbd0 Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/logo_90x90.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/splash.png b/BKUWebStart/src/main/jnlp/resources/splash.png new file mode 100644 index 00000000..72c1d868 Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/splash.png differ diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml new file mode 100644 index 00000000..0a89a036 --- /dev/null +++ b/BKUWebStart/src/main/jnlp/template.xml @@ -0,0 +1,37 @@ + + + + $project.Name + $project.Organization.Name + + $project.Description + + + + + + + +#if($offlineAllowed) + +#end + + + + +#if($allPermissions) + + + +#end + + + + + + + $dependencies + + + + \ No newline at end of file diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/defaultConf/template.zip b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/defaultConf/template.zip new file mode 100644 index 00000000..f14b0c19 Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/defaultConf/template.zip differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties new file mode 100644 index 00000000..873d03ef --- /dev/null +++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties @@ -0,0 +1,13 @@ +#-------- tray icon messages ------- +TrayMenu.Tooltip=MOCCA +TrayMenu.Shutdown=MOCCA Beenden + +Greetings.Message=MOCCA up and running +Greetings.Caption=MOCCA Started + +Message.RequestCaption=New Request +Message.InfoboxReadRequest=Reading Infobox +Message.SecureSignatureKeypair=Reading secure signature certificate +Message.CertifiedKeypair=Reading certified certificate +Message.IdentityLink=Reading Identitylink +Message.SignRequest=Creating Signature \ No newline at end of file diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/favicon.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/favicon.png new file mode 100644 index 00000000..2d0276de Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/favicon.png differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/logo.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/logo.png new file mode 100644 index 00000000..598ab00b Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/logo.png differ diff --git a/BKUWebStart/src/main/resources/log4j.properties b/BKUWebStart/src/main/resources/log4j.properties new file mode 100644 index 00000000..4df33ab5 --- /dev/null +++ b/BKUWebStart/src/main/resources/log4j.properties @@ -0,0 +1,16 @@ +# loglever DEBUG, appender STDOUT +log4j.rootLogger=TRACE, STDOUT, file + +# STDOUT appender +log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender +log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout +#log4j.appender.STDOUT.layout.ConversionPattern=%5p | %d{dd HH:mm:ss,SSS} | %20c | %10t | %m%n +#log4j.appender.STDOUT.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n +log4j.appender.STDOUT.layout.ConversionPattern=%-5p |%d | %t | %c %x- %m%n + +### FILE appender +log4j.appender.file=org.apache.log4j.DailyRollingFileAppender +log4j.appender.file.datePattern='.'yyyy-MM-dd +log4j.appender.file.File=${user.home}/.mocca/logs/webstart.log +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n \ No newline at end of file diff --git a/BKUWebStart/src/main/resources/logo.png b/BKUWebStart/src/main/resources/logo.png new file mode 100644 index 00000000..fa6d7f96 Binary files /dev/null and b/BKUWebStart/src/main/resources/logo.png differ diff --git a/BKUWebStart/src/main/resources/logo_32x32.png b/BKUWebStart/src/main/resources/logo_32x32.png new file mode 100644 index 00000000..337b144b Binary files /dev/null and b/BKUWebStart/src/main/resources/logo_32x32.png differ diff --git a/BKUWebStart/src/main/resources/logo_90x90.png b/BKUWebStart/src/main/resources/logo_90x90.png new file mode 100644 index 00000000..d7f8bbd0 Binary files /dev/null and b/BKUWebStart/src/main/resources/logo_90x90.png differ diff --git a/BKUWebStart/src/main/resources/logo_RGB22x22.png b/BKUWebStart/src/main/resources/logo_RGB22x22.png new file mode 100644 index 00000000..598ab00b Binary files /dev/null and b/BKUWebStart/src/main/resources/logo_RGB22x22.png differ diff --git a/BKUWebStart/src/main/resources/logo_RGB32x32.png b/BKUWebStart/src/main/resources/logo_RGB32x32.png new file mode 100644 index 00000000..2c622d88 Binary files /dev/null and b/BKUWebStart/src/main/resources/logo_RGB32x32.png differ diff --git a/BKUWebStart/src/main/resources/splash.png b/BKUWebStart/src/main/resources/splash.png new file mode 100644 index 00000000..72c1d868 Binary files /dev/null and b/BKUWebStart/src/main/resources/splash.png differ diff --git a/BKUWebStart/src/main/webapp/WEB-INF/web.xml b/BKUWebStart/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..9f88c1f9 --- /dev/null +++ b/BKUWebStart/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,7 @@ + + + + Archetype Created Web Application + diff --git a/BKUWebStart/src/main/webapp/launch.html b/BKUWebStart/src/main/webapp/launch.html new file mode 100644 index 00000000..6ed6feb5 --- /dev/null +++ b/BKUWebStart/src/main/webapp/launch.html @@ -0,0 +1,17 @@ + + + + Test page for launching the application via JNLP + + +

Test page for launching the application via JNLP

+ Launch the application + + + + + + diff --git a/BKUWebStart/src/main/webapp/launch.jnlp b/BKUWebStart/src/main/webapp/launch.jnlp new file mode 100644 index 00000000..d51d9d21 --- /dev/null +++ b/BKUWebStart/src/main/webapp/launch.jnlp @@ -0,0 +1,30 @@ + + + + BKU Web Start + EGIZ + + BKU WebStart (aka. Lokale BKU) + BKU WebStart + + + + + + + + + + + + + + + + + + + + + + diff --git a/BKUWebStart/src/main/webapp/mocca_tiny.png b/BKUWebStart/src/main/webapp/mocca_tiny.png new file mode 100644 index 00000000..1f125d9b Binary files /dev/null and b/BKUWebStart/src/main/webapp/mocca_tiny.png differ diff --git a/BKUWebStart/src/main/webapp/splash.png b/BKUWebStart/src/main/webapp/splash.png new file mode 100644 index 00000000..72c1d868 Binary files /dev/null and b/BKUWebStart/src/main/webapp/splash.png differ -- cgit v1.2.3 From 0d5e54423b3cbc6c16b28800890c6ee5a5aacf75 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 12 Jun 2009 12:41:58 +0000 Subject: BKU Web Start git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@360 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/webstart/conf/template.zip | Bin 0 -> 24829 bytes .../gv/egiz/bku/webstart/defaultConf/template.zip | Bin 24829 -> 0 bytes BKUWebStart/src/main/webapp/WEB-INF/web.xml | 7 ----- BKUWebStart/src/main/webapp/launch.html | 17 ------------ BKUWebStart/src/main/webapp/launch.jnlp | 30 --------------------- BKUWebStart/src/main/webapp/mocca_tiny.png | Bin 1025 -> 0 bytes BKUWebStart/src/main/webapp/splash.png | Bin 54978 -> 0 bytes 7 files changed, 54 deletions(-) create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/template.zip delete mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/defaultConf/template.zip delete mode 100644 BKUWebStart/src/main/webapp/WEB-INF/web.xml delete mode 100644 BKUWebStart/src/main/webapp/launch.html delete mode 100644 BKUWebStart/src/main/webapp/launch.jnlp delete mode 100644 BKUWebStart/src/main/webapp/mocca_tiny.png delete mode 100644 BKUWebStart/src/main/webapp/splash.png (limited to 'BKUWebStart/src') diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/template.zip b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/template.zip new file mode 100644 index 00000000..f14b0c19 Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/template.zip differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/defaultConf/template.zip b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/defaultConf/template.zip deleted file mode 100644 index f14b0c19..00000000 Binary files a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/defaultConf/template.zip and /dev/null differ diff --git a/BKUWebStart/src/main/webapp/WEB-INF/web.xml b/BKUWebStart/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 9f88c1f9..00000000 --- a/BKUWebStart/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - Archetype Created Web Application - diff --git a/BKUWebStart/src/main/webapp/launch.html b/BKUWebStart/src/main/webapp/launch.html deleted file mode 100644 index 6ed6feb5..00000000 --- a/BKUWebStart/src/main/webapp/launch.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - Test page for launching the application via JNLP - - -

Test page for launching the application via JNLP

- Launch the application - - - - - - diff --git a/BKUWebStart/src/main/webapp/launch.jnlp b/BKUWebStart/src/main/webapp/launch.jnlp deleted file mode 100644 index d51d9d21..00000000 --- a/BKUWebStart/src/main/webapp/launch.jnlp +++ /dev/null @@ -1,30 +0,0 @@ - - - - BKU Web Start - EGIZ - - BKU WebStart (aka. Lokale BKU) - BKU WebStart - - - - - - - - - - - - - - - - - - - - - - diff --git a/BKUWebStart/src/main/webapp/mocca_tiny.png b/BKUWebStart/src/main/webapp/mocca_tiny.png deleted file mode 100644 index 1f125d9b..00000000 Binary files a/BKUWebStart/src/main/webapp/mocca_tiny.png and /dev/null differ diff --git a/BKUWebStart/src/main/webapp/splash.png b/BKUWebStart/src/main/webapp/splash.png deleted file mode 100644 index 72c1d868..00000000 Binary files a/BKUWebStart/src/main/webapp/splash.png and /dev/null differ -- cgit v1.2.3 From 61366ba8efcc0cf3d36438e9ee26228e7bc66174 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 12 Jun 2009 12:42:05 +0000 Subject: BKU Web Start git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@361 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUOnline/pom.xml | 48 ++- BKUOnline/src/main/jnlp/resources/logo.png | Bin 0 -> 2609 bytes BKUOnline/src/main/jnlp/resources/logo_64x64.png | Bin 0 -> 2299 bytes BKUOnline/src/main/jnlp/resources/logo_90x90.png | Bin 0 -> 3294 bytes BKUOnline/src/main/jnlp/resources/splash.png | Bin 0 -> 54978 bytes BKUOnline/src/main/jnlp/template.xml | 38 ++ BKUOnline/src/main/webapp/WEB-INF/web.xml | 162 ++++---- BKUOnline/src/main/webapp/index.html | 11 +- BKUWebStart/pom.xml | 330 +++++++++------- .../java/at/gv/egiz/bku/webstart/BKULauncher.java | 339 +++++++++++----- .../src/main/java/at/gv/egiz/bku/webstart/CA.java | 117 ------ .../java/at/gv/egiz/bku/webstart/Container.java | 60 ++- .../java/at/gv/egiz/bku/webstart/TLSServerCA.java | 138 +++++++ .../at/gv/egiz/bku/webstart/ui/TrayIconDialog.java | 9 +- BKUWebStart/src/main/jnlp/resources/img/logo.png | Bin 0 -> 2609 bytes .../src/main/jnlp/resources/img/logo_64x64.png | Bin 0 -> 2299 bytes .../src/main/jnlp/resources/img/logo_90x90.png | Bin 0 -> 3294 bytes BKUWebStart/src/main/jnlp/resources/img/splash.png | Bin 0 -> 54978 bytes .../src/main/jnlp/resources/img/version.xml | 17 + BKUWebStart/src/main/jnlp/resources/logo.png | Bin 2609 -> 0 bytes BKUWebStart/src/main/jnlp/resources/logo_64x64.png | Bin 2299 -> 0 bytes BKUWebStart/src/main/jnlp/resources/logo_90x90.png | Bin 3294 -> 0 bytes BKUWebStart/src/main/jnlp/resources/splash.png | Bin 54978 -> 0 bytes BKUWebStart/src/main/jnlp/resources/version.xml | 186 +++++++++ BKUWebStart/src/main/jnlp/template.xml | 13 +- .../resources/at/gv/egiz/bku/webstart/ui/logo.png | Bin 1751 -> 0 bytes .../at/gv/egiz/bku/webstart/ui/trayicon.png | Bin 0 -> 2609 bytes BKUWebStart/src/main/resources/logo.png | Bin 2299 -> 0 bytes BKUWebStart/src/main/resources/splash.png | Bin 54978 -> 0 bytes pom.xml | 437 +++++++++++---------- 30 files changed, 1228 insertions(+), 677 deletions(-) create mode 100644 BKUOnline/src/main/jnlp/resources/logo.png create mode 100644 BKUOnline/src/main/jnlp/resources/logo_64x64.png create mode 100644 BKUOnline/src/main/jnlp/resources/logo_90x90.png create mode 100644 BKUOnline/src/main/jnlp/resources/splash.png create mode 100644 BKUOnline/src/main/jnlp/template.xml delete mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/CA.java create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/TLSServerCA.java create mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_64x64.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_90x90.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/splash.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/version.xml delete mode 100644 BKUWebStart/src/main/jnlp/resources/logo.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/logo_64x64.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/logo_90x90.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/splash.png create mode 100644 BKUWebStart/src/main/jnlp/resources/version.xml delete mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/logo.png create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon.png delete mode 100644 BKUWebStart/src/main/resources/logo.png delete mode 100644 BKUWebStart/src/main/resources/splash.png (limited to 'BKUWebStart/src') diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index 9ac1dac7..bd46041f 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -56,7 +56,7 @@ 1.1.2-SNAPSHOT compile - + at.gv.egiz STALService 1.1.2-SNAPSHOT @@ -146,7 +146,7 @@ - + maven-war-plugin 2.0.2 @@ -164,7 +164,6 @@ org.codehaus.mojo maven-buildnumber-plugin - 0.9.6 validate @@ -215,6 +214,49 @@ + + include-webstart + + + + maven-dependency-plugin + + + + process-resources + + unpack + + + + + at.gv.egiz + BKUWebStart + 1.0.3-SNAPSHOT + zip + + + ${project.build.directory}/${project.build.finalName}/webstart + + + + + + + + + + + com.sun.java.jnlp + jnlp-servlet + 1.6.0.10 + + + + Tomcat60 diff --git a/BKUOnline/src/main/jnlp/resources/logo.png b/BKUOnline/src/main/jnlp/resources/logo.png new file mode 100644 index 00000000..2c622d88 Binary files /dev/null and b/BKUOnline/src/main/jnlp/resources/logo.png differ diff --git a/BKUOnline/src/main/jnlp/resources/logo_64x64.png b/BKUOnline/src/main/jnlp/resources/logo_64x64.png new file mode 100644 index 00000000..fa6d7f96 Binary files /dev/null and b/BKUOnline/src/main/jnlp/resources/logo_64x64.png differ diff --git a/BKUOnline/src/main/jnlp/resources/logo_90x90.png b/BKUOnline/src/main/jnlp/resources/logo_90x90.png new file mode 100644 index 00000000..d7f8bbd0 Binary files /dev/null and b/BKUOnline/src/main/jnlp/resources/logo_90x90.png differ diff --git a/BKUOnline/src/main/jnlp/resources/splash.png b/BKUOnline/src/main/jnlp/resources/splash.png new file mode 100644 index 00000000..72c1d868 Binary files /dev/null and b/BKUOnline/src/main/jnlp/resources/splash.png differ diff --git a/BKUOnline/src/main/jnlp/template.xml b/BKUOnline/src/main/jnlp/template.xml new file mode 100644 index 00000000..c8291f61 --- /dev/null +++ b/BKUOnline/src/main/jnlp/template.xml @@ -0,0 +1,38 @@ + + + + $project.Name + $project.Organization.Name + + $project.Description + $project.Description + + + + + + + +#if($offlineAllowed) + +#end + + + + +#if($allPermissions) + + + +#end + + + + + + + $dependencies + + + + \ No newline at end of file diff --git a/BKUOnline/src/main/webapp/WEB-INF/web.xml b/BKUOnline/src/main/webapp/WEB-INF/web.xml index 46e69c4a..eda18378 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/web.xml +++ b/BKUOnline/src/main/webapp/WEB-INF/web.xml @@ -13,63 +13,63 @@ License. --> - http-security-layer-request + http-security-layer-request - - contextConfigLocation - /WEB-INF/applicationContext.xml - - - org.springframework.web.context.ContextLoaderListener - + + contextConfigLocation + /WEB-INF/applicationContext.xml + + + org.springframework.web.context.ContextLoaderListener + - - at.gv.egiz.bku.online.webapp.SessionTimeout - - - BKUServlet - at.gv.egiz.bku.online.webapp.BKURequestHandler - - - ResultServlet - at.gv.egiz.bku.online.webapp.ResultServlet - - responseEncoding - UTF-8 - - - expiredPage + + at.gv.egiz.bku.online.webapp.SessionTimeout + + + BKUServlet + at.gv.egiz.bku.online.webapp.BKURequestHandler + + + ResultServlet + at.gv.egiz.bku.online.webapp.ResultServlet + + responseEncoding + UTF-8 + + + expiredPage - expired.html - - - - BKUApplet - /applet.jsp - - - help - /help.jsp - - - BKUServlet - /http-security-layer-request - - - BKUServlet - /https-security-layer-request - - - ResultServlet - /bkuResult - - - help - /help/* - + expired.html + + + + BKUApplet + /applet.jsp + + + help + /help.jsp + + + BKUServlet + /http-security-layer-request + + + BKUServlet + /https-security-layer-request + + + ResultServlet + /bkuResult + + + help + /help/* + - - - com.sun.xml.ws.transport.http.servlet.WSServletContextListener - - - STALPort - com.sun.xml.ws.transport.http.servlet.WSServlet - 1 - - - STALPort - /stal - + + + com.sun.xml.ws.transport.http.servlet.WSServletContextListener + + + + STALPort + com.sun.xml.ws.transport.http.servlet.WSServlet + 1 + + + STALPort + /stal + - - index.html - index.jsp - + + + + + + index.html + index.jsp + - 5 - + 5 + diff --git a/BKUOnline/src/main/webapp/index.html b/BKUOnline/src/main/webapp/index.html index 653da5b1..b0e519a5 100644 --- a/BKUOnline/src/main/webapp/index.html +++ b/BKUOnline/src/main/webapp/index.html @@ -17,9 +17,10 @@ - BKU Online + MOCCA Online +
@@ -30,6 +31,14 @@ PIN Management Applet

STAL Service

STAL Service Endpoint +

diff --git a/BKUWebStart/pom.xml b/BKUWebStart/pom.xml index c61937bb..ec5fd976 100644 --- a/BKUWebStart/pom.xml +++ b/BKUWebStart/pom.xml @@ -10,35 +10,17 @@ BKUWebStart jar BKU Web Start - 1.0-SNAPSHOT - http://danu-lin.iaik.tugraz.at:8080/jnlp - Web Start Bürgerkartenumgebung (BKU) MOCCA-lokal + + 1.0.3-SNAPSHOT + http://mocca.egovlabs.gv.at/ + Web Start Bürgerkartenumgebung (MOCCA-lokal) - BKUWebStart - - - + org.apache.maven.plugins maven-dependency-plugin + ${project.build.directory}/classes/BKULocalWar false true + + + + + copy BKULocal webapp + + copy-dependencies + + + at.gv.egiz + BKULocal + war + ${project.build.directory}/classes/ + true + @@ -85,113 +99,101 @@ org.codehaus.mojo.webstart webstart-maven-plugin - - - jnlp - - package - + + + package + + + jnlp-inline + + - - - - false - - - lib - - - - - - commons-logging:commons-logging - log4j:log4j - at.gv.egiz:utils - javax.activation:activation - iaik:iaik_ecc - iaik:iaik_jce - iaik:iaik_xsect_unsigned - org.mortbay.jetty:jetty - org.mortbay.jetty:jetty-util - org.mortbay.jetty:servlet-api - - - - - - - - - - - src/main/jnlp/template.xml - mocca.jnlp - - - - at.gv.egiz.bku.webstart.BKULauncher - - 1.6+ - - - - - - - - test-applet signer - ${project.basedir}/keystore.ks - storepass - keypass - - - - - - - - true - - - - false - false - - - - - - false - false - - - true - - - true - - - true + + false + + + + + + + ${project.basedir}/src/main/jnlp + template.xml + mocca.jnlp + at.gv.egiz.bku.webstart.BKULauncher + 1.6+ + true + true + + + + test-applet signer + ${project.basedir}/keystore.ks + storepass + keypass + true + + false + false + + + + + true + + + + true + + + true + + + true + + org.codehaus.mojo + maven-buildnumber-plugin + + + validate + + create + + + + + false + false + + - - - + + org.apache.maven.plugins + maven-jar-plugin + + + + true + + + ${project.version}-r${buildNumber} + + + true + + + at.gv.egiz @@ -204,21 +206,6 @@ at.gv.egiz 1.1.2-SNAPSHOT - - iaik_jce - iaik - 3.16 - - - iaik_ecc - iaik - 2.15 - - - iaik_xsect_unsigned - iaik - 1.14 - commons-logging commons-logging @@ -231,9 +218,56 @@ - - - - + \ No newline at end of file diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java index 854e6535..3d09fb00 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java @@ -1,15 +1,23 @@ package at.gv.egiz.bku.webstart; +import iaik.asn1.CodingException; import java.io.File; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.net.MalformedURLException; import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; import java.util.Enumeration; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -25,16 +33,157 @@ import org.apache.commons.logging.LogFactory; import at.gv.egiz.bku.webstart.ui.BKUControllerInterface; import at.gv.egiz.bku.webstart.ui.TrayIconDialog; import at.gv.egiz.bku.utils.StreamUtil; +import java.awt.Desktop; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.net.URI; +import java.net.URL; +import java.security.GeneralSecurityException; +import java.util.UUID; +import java.util.jar.Attributes; +import java.util.jar.Manifest; +import java.util.zip.ZipOutputStream; public class BKULauncher implements BKUControllerInterface { + /** configurations with less than this (major) version will be backuped and updated */ + public static final String MIN_CONFIG_VERSION = "1.0.3"; + public static final String CONFIG_DIR = ".mocca/conf/"; + public static final String CONF_TEMPLATE_FILE = "template.zip"; + public static final String CONF_TEMPLATE_RESOURCE = "at/gv/egiz/bku/webstart/conf/template.zip"; + public static final String WEBAPP_RESOURCE = "BKULocal.war"; + public static final String WEBAPP_FILE = "BKULocal.war"; + public static final String KEYSTORE_FILE = "keystore.ks"; + public static final String MESSAGES_RESOURCE = "at/gv/egiz/bku/webstart/ui/UIMessages"; + public static final String PASSWD_FILE = ".secret"; + /** resource bundle messages */ + public static final String GREETING_CAPTION = "Greetings.Caption"; + public static final String GREETING_MESSAGE = "Greetings.Message"; + public static final String VERSION_FILE = ".version"; private static Log log = LogFactory.getLog(BKULauncher.class); - private ResourceBundle resourceBundle = null; private Container server; -// private SplashScreen splash = SplashScreen.getSplashScreen(); + private void createConfig(File configDir, File versionFile, String version) throws IOException, CertificateException, GeneralSecurityException, KeyStoreException, FileNotFoundException, NoSuchAlgorithmException { + log.debug("creating config directory: " + configDir); + configDir.mkdirs(); + InputStream is = getClass().getClassLoader().getResourceAsStream(CONF_TEMPLATE_RESOURCE); + OutputStream os = new FileOutputStream(new File(configDir, CONF_TEMPLATE_FILE)); + StreamUtil.copyStream(is, os); + os.close(); + File confTemplateFile = new File(configDir, CONF_TEMPLATE_FILE); + unzip(confTemplateFile); + confTemplateFile.delete(); + writeVersionFile(versionFile, version); + } + + private void createCertificates(File configDir) throws IOException, GeneralSecurityException, CodingException { + char[] password = UUID.randomUUID().toString().toCharArray(); + File passwdFile = new File(configDir, PASSWD_FILE); + FileWriter passwdWriter = new FileWriter(passwdFile); + passwdWriter.write(password); + passwdWriter.close(); + if (!passwdFile.setReadable(true, true)) { + passwdFile.delete(); + throw new IOException("failed to make " + passwdFile + " owner readable only, deleting file"); + } + TLSServerCA ca = new TLSServerCA(); + KeyStore ks = ca.generateKeyStore(password); + FileOutputStream fos = new FileOutputStream(new File(configDir, KEYSTORE_FILE)); + ks.store(fos, password); + fos.close(); + } + + private String getFileVersion(File versionFile) throws FileNotFoundException, IOException { + //TODO no file? + if (versionFile.exists() && versionFile.canRead()) { + BufferedReader versionReader = new BufferedReader(new FileReader(versionFile)); + String versionString = null; + while ((versionString = versionReader.readLine().trim()) != null) { + if (versionString.length() > 0 && !versionString.startsWith("#")) { + log.debug("found existing configuration version " + versionString); + break; + } + } + return versionString; + } + return null; + } + + private String getManifestVersion() throws MalformedURLException, IOException { + String bkuWebStartJar = BKULauncher.class.getProtectionDomain().getCodeSource().getLocation().toString(); + URL manifestURL = new URL("jar:" + bkuWebStartJar + "!/META-INF/MANIFEST.MF"); + String version = null; + if (manifestURL != null) { + Manifest manifest = new Manifest(manifestURL.openStream()); + if (log.isTraceEnabled()) { + log.trace("read version information from " + manifestURL); + } + Attributes atts = manifest.getMainAttributes(); + if (atts != null) { + version = atts.getValue("Implementation-Build"); + } + } + if (version == null) { + version = "UNKNOWN"; + } + log.debug("config version: " + version); + return version; + } + + /** + * change the + * @param oldVersion + * @param newVersion + * @return + */ + private boolean updateRequired(String oldVersion, String newVersion) { + if (oldVersion != null) { + int majorEnd = oldVersion.indexOf('-'); + if (majorEnd > 0) { + oldVersion = oldVersion.substring(0, majorEnd); + } + return (oldVersion.compareTo(MIN_CONFIG_VERSION) < 0); + } + log.debug("no old version, update required"); + return true; + } + + private boolean updateRequiredStrict(String oldVersion, String newVersion) { + String[] oldV = oldVersion.split("-"); + String[] newV = newVersion.split("-"); + log.debug("comparing " + oldV[0] + " to " + newV[0]); + if (oldV[0].compareTo(newV[0]) < 0) { + log.debug("update required"); + return true; + } else { + log.debug("comparing " + oldV[oldV.length - 1] + " to " + newV[newV.length - 1]); + if (oldV[oldV.length - 1].compareTo(newV[newV.length - 1]) < 0) { + log.debug("update required"); + return true; + } else { + log.debug("no update required"); + return false; + } + } + } + + private void writeVersionFile(File versionFile, String version) throws IOException { + BufferedWriter versionWriter = new BufferedWriter(new FileWriter(versionFile)); + versionWriter.write("# MOCCA Web Start configuration version\n"); + versionWriter.write("# DO NOT MODIFY THIS FILE\n\n"); + versionWriter.write(version); + versionWriter.close(); + } + +// private SplashScreen splash = SplashScreen.getSplashScreen(); private void startUpServer() throws Exception { + log.info("init servlet container and MOCCA webapp"); server = new Container(); // XmlConfiguration xcfg = new XmlConfiguration(getClass().getClassLoader() // .getResourceAsStream("at/gv/egiz/bku/local/app/jetty.xml")); @@ -44,25 +193,24 @@ public class BKULauncher implements BKUControllerInterface { } private void initTrayIcon() { + log.debug("init MOCCA tray icon"); Locale loc = Locale.getDefault(); try { resourceBundle = ResourceBundle.getBundle( - "at/gv/egiz/bku/webstart/ui/UIMessages", loc); + MESSAGES_RESOURCE, loc); } catch (MissingResourceException mx) { resourceBundle = ResourceBundle.getBundle( - "at/gv/egiz/bku/webstart/ui/UIMessages", Locale.ENGLISH); + MESSAGES_RESOURCE, Locale.ENGLISH); } TrayIconDialog.getInstance().init(resourceBundle); TrayIconDialog.getInstance().setShutdownHook(this); - TrayIconDialog.getInstance().displayInfo("Greetings.Caption", - "Greetings.Message"); + TrayIconDialog.getInstance().displayInfo(GREETING_CAPTION, GREETING_MESSAGE); } private void initStart() { - } - private void initFinished() { + private void initFinished(boolean installCert) { try { // if (splash != null) { // try { @@ -71,34 +219,33 @@ public class BKULauncher implements BKUControllerInterface { // log.warn("Failed to close splash screen: " + ex.getMessage()); // } // } + + log.debug("trying install MOCCA certificate on system browser"); + if (installCert) { + if (Desktop.isDesktopSupported()) { + Desktop desktop = Desktop.getDesktop(); + if (desktop.isSupported(Desktop.Action.BROWSE)) { + try { + desktop.browse(new URI("https://localhost:" + + Integer.getInteger(Container.HTTPS_PORT_PROPERTY, 3496).intValue())); + } catch (Exception ex) { + log.error("failed to open system browser, install MOCCA certificate manually", ex); + } + } else { + log.error("failed to open system browser, install MOCCA certificate manually"); + } + } else { + log.error("failed to open system browser, install MOCCA certificate manually"); + } + } + + log.info("init completed, joining server"); server.join(); } catch (InterruptedException e) { - log.info(e); + log.warn("failed to join MOCCA server: " + e.getMessage(), e); } } -// private void copyDirs(File srcDir, File dstDir) { -// for (File cf : srcDir.listFiles()) { -// File of = new File(dstDir, cf.getName()); -// if (cf.isDirectory()) { -// log.debug("Creating directory: " + of); -// of.mkdir(); -// copyDirs(cf, of); -// } else { -// log.debug("Writing file: " + of); -// try { -// FileInputStream fis = new FileInputStream(cf); -// FileOutputStream fos = new FileOutputStream(of); -// StreamUtil.copyStream(fis, fos); -// fis.close(); -// fos.close(); -// } catch (IOException e) { -// log.error("Cannot copy default configuration", e); -// } -// } -// } -// } - private void unzip(File zipfile) throws IOException { File dir = zipfile.getParentFile(); ZipFile zipFile = new ZipFile(zipfile); @@ -113,73 +260,11 @@ public class BKULauncher implements BKUControllerInterface { File f = new File(eF.getParent()); f.mkdirs(); StreamUtil.copyStream(zipFile.getInputStream(entry), - new FileOutputStream(eF)); + new FileOutputStream(eF)); } zipFile.close(); } - private void checkConfig(String[] args) { -// CommandLineParser parser = new PosixParser(); -// Options options = new Options(); -// options.addOption("c", true, "the configuration's base directory"); -// options.addOption("h", false, "print this message"); -// try { - File cfgDir = new File(System.getProperty("user.home") + "/.mocca/conf"); -// CommandLine cmd = parser.parse(options, args); -// if (cmd.hasOption("h")) { -// HelpFormatter formatter = new HelpFormatter(); -// formatter.printHelp("BKULauncher", options); -// System.exit(0); -// } -// -// if (cmd.hasOption("c")) { -// cfgDir = new File(cmd.getOptionValue("c")); -// } - log.debug("using config directory: " + cfgDir); - if (cfgDir.exists() && cfgDir.isFile()) { - log.error("Configuration directory must not be a file"); - } - if (!cfgDir.exists()) { - log.debug("Creating config directory: " + cfgDir); - cfgDir.mkdirs(); - try { - InputStream is = getClass().getClassLoader().getResourceAsStream( - "at/gv/egiz/bku/webstart/defaultConf/template.zip"); - OutputStream os = new FileOutputStream(new File(cfgDir, - "template.zip")); - StreamUtil.copyStream(is, os); - os.close(); - unzip(new File(cfgDir, "template.zip")); - } catch (IOException iox) { - log.error("Cannot create user directory", iox); - return; - } - CA ca = new CA(); - char[] password = "changeMe".toCharArray(); - KeyStore ks = ca.generateKeyStore(password); - if (ks != null) { - File ksdir = new File(cfgDir, "keystore"); - ksdir.mkdirs(); - FileOutputStream fos; - try { - fos = new FileOutputStream(new File(ksdir, "keystore.ks")); - ks.store(fos, password); - fos.close(); - } catch (Exception e) { - log.error("Cannot store keystore", e); - } - } else { - log.error("Cannot create ssl certificate"); - } - } -// } catch (ParseException e1) { -// log.error(e1); -// HelpFormatter formatter = new HelpFormatter(); -// formatter.printHelp("BKULauncher", options); -// System.exit(0); -// } - } - /** * @param args */ @@ -189,15 +274,74 @@ public class BKULauncher implements BKUControllerInterface { System.setSecurityManager(null); BKULauncher launcher = new BKULauncher(); launcher.initStart(); - launcher.checkConfig(args); + + File configDir = new File(System.getProperty("user.home") + '/' + CONFIG_DIR); + boolean installCert = launcher.ensureConfig(configDir); launcher.startUpServer(); launcher.initTrayIcon(); - launcher.initFinished(); + launcher.initFinished(installCert); } catch (Exception e) { - log.fatal("Cannot launch BKU", e); + log.fatal("Failed to launch BKU: " + e.getMessage(), e); System.exit(-1000); } + } + + private void backupAndDelete(File dir, URI relativeTo, ZipOutputStream zip) throws IOException { + if (dir.isDirectory()) { + File[] subDirs = dir.listFiles(); + for (File subDir : subDirs) { + backupAndDelete(subDir, relativeTo, zip); + subDir.delete(); + } + } else { + URI relativePath = relativeTo.relativize(dir.toURI()); + ZipEntry entry = new ZipEntry(relativePath.toString()); + zip.putNextEntry(entry); + BufferedInputStream entryIS = new BufferedInputStream(new FileInputStream(dir)); + StreamUtil.copyStream(entryIS, zip); + entryIS.close(); + zip.closeEntry(); + dir.delete(); + } + } + /** + * Checks whether the config directory already exists and creates it otherwise. + * @param configDir the config directory to be created + * @return true if a new MOCCA cert was created (and needs to be installed in the browser) + */ + private boolean ensureConfig(File configDir) throws IOException, GeneralSecurityException, CodingException { + log.debug("config directory: " + configDir); + String manifestVersion = getManifestVersion(); + File versionFile = new File(configDir, VERSION_FILE); + + if (configDir.exists()) { + if (configDir.isFile()) { + log.error("invalid config directory: " + configDir); + throw new IOException("invalid config directory: " + configDir); + } else { + String fileVersion = getFileVersion(versionFile); + if (updateRequired(fileVersion, manifestVersion)) { + if (fileVersion == null) { + fileVersion = "unknown"; + } + log.info("updating configuration from " + fileVersion + " to " + manifestVersion); + File moccaDir = configDir.getParentFile(); + File zipFile = new File(moccaDir, "conf-" + fileVersion + ".zip"); + ZipOutputStream zipOS = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile))); + backupAndDelete(configDir, moccaDir.toURI(), zipOS); + zipOS.close(); + createConfig(configDir, versionFile, manifestVersion); + createCertificates(configDir); + return true; + } + } + } else { + createConfig(configDir, versionFile, manifestVersion); + createCertificates(configDir); + return true; + } + return false; } public void shutDown() { @@ -217,5 +361,4 @@ public class BKULauncher implements BKUControllerInterface { } System.exit(0); } - } diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/CA.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/CA.java deleted file mode 100644 index f81d3d83..00000000 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/CA.java +++ /dev/null @@ -1,117 +0,0 @@ -package at.gv.egiz.bku.webstart; - -import iaik.asn1.ObjectID; -import iaik.asn1.structures.AlgorithmID; -import iaik.asn1.structures.Name; -import iaik.x509.X509Certificate; -import iaik.x509.extensions.BasicConstraints; -import iaik.x509.extensions.KeyUsage; - -import java.math.BigInteger; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.security.GeneralSecurityException; -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.KeyStore; -import java.security.NoSuchAlgorithmException; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.Random; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class CA { - private final static Log log = LogFactory.getLog(CA.class); - - private KeyPair caKeyPair; - private X509Certificate caCert; - - private KeyPair serverKeyPair; - private X509Certificate serverCert; - - public CA() { - } - - private KeyPair generateKeyPair() throws NoSuchAlgorithmException { - KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA"); - gen.initialize(2048); - return gen.generateKeyPair(); - } - - private void generateCA() throws GeneralSecurityException { - log.debug("Generating CA certificate"); - Name subject = new Name(); - subject.addRDN(ObjectID.country, "AT"); - subject.addRDN(ObjectID.organization, "MOCCA"); - subject.addRDN(ObjectID.organizationalUnit, "MOCCA-CA"); - - caKeyPair = generateKeyPair(); - caCert = new X509Certificate(); - caCert.setSerialNumber(new BigInteger(20, new Random())); - caCert.setSubjectDN(subject); - caCert.setPublicKey(caKeyPair.getPublic()); - caCert.setIssuerDN(subject); - - caCert.addExtension(new BasicConstraints(true)); - caCert.addExtension(new KeyUsage(KeyUsage.keyCertSign | KeyUsage.cRLSign - | KeyUsage.digitalSignature)); - - GregorianCalendar date = new GregorianCalendar(); - date.add(Calendar.HOUR_OF_DAY, -1); - caCert.setValidNotBefore(date.getTime()); - date.add(Calendar.YEAR, 7); - caCert.setValidNotAfter(date.getTime()); - caCert.sign(AlgorithmID.sha1WithRSAEncryption, caKeyPair.getPrivate()); - log.debug("Successfully signed CA certificate"); - } - - private void generateServerCert() throws GeneralSecurityException { - log.debug("Generating SSL certificate"); - Name subject = new Name(); - subject.addRDN(ObjectID.country, "AT"); - subject.addRDN(ObjectID.organization, "MOCCA"); - try { - subject.addRDN(ObjectID.commonName, InetAddress.getLocalHost() - .getHostName()); - } catch (UnknownHostException e) { - subject.addRDN(ObjectID.commonName, "localhost"); - } - serverKeyPair = generateKeyPair(); - serverCert = new X509Certificate(); - serverCert.setSerialNumber(new BigInteger(20, new Random())); - serverCert.setSubjectDN(subject); - serverCert.setPublicKey(serverKeyPair.getPublic()); - serverCert.setIssuerDN(caCert.getSubjectDN()); - - serverCert.addExtension(new BasicConstraints(false)); - serverCert.addExtension(new KeyUsage(KeyUsage.keyEncipherment - | KeyUsage.digitalSignature)); - - GregorianCalendar date = new GregorianCalendar(); - date.add(Calendar.HOUR_OF_DAY, -1); - serverCert.setValidNotBefore(date.getTime()); - date.add(Calendar.YEAR, 7); - date.add(Calendar.HOUR_OF_DAY, -1); - serverCert.setValidNotAfter(date.getTime()); - serverCert.sign(AlgorithmID.sha1WithRSAEncryption, caKeyPair.getPrivate()); - log.debug("Successfully signed server certificate"); - caKeyPair = null; - } - - public KeyStore generateKeyStore(char[] password) { - try { - generateCA(); - generateServerCert(); - KeyStore ks = KeyStore.getInstance("JKS"); - ks.load(null, null); - ks.setKeyEntry("server", serverKeyPair.getPrivate(), password, new X509Certificate[]{serverCert, caCert}); - return ks; - } catch (Exception e) { - log.error("Cannot generate certificate", e); - } - return null; - } - -} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java index ef12e4fd..0cd3e633 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java @@ -1,5 +1,15 @@ package at.gv.egiz.bku.webstart; +import at.gv.egiz.bku.utils.StreamUtil; +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.mortbay.jetty.Connector; @@ -14,8 +24,8 @@ import org.mortbay.thread.QueuedThreadPool; public class Container { - public static final String HTTP_PORT = "mocca.http.port"; - public static final String HTTPS_PORT = "mocca.http.port"; + public static final String HTTP_PORT_PROPERTY = "mocca.http.port"; + public static final String HTTPS_PORT_PROPERTY = "mocca.http.port"; private static Log log = LogFactory.getLog(Container.class); @@ -24,7 +34,7 @@ public class Container { public Container() { } - public void init() { + public void init() throws IOException { server = new Server(); QueuedThreadPool qtp = new QueuedThreadPool(); qtp.setMaxThreads(5); @@ -35,35 +45,51 @@ public class Container { server.setGracefulShutdown(3000); SelectChannelConnector connector = new SelectChannelConnector(); - connector.setPort(Integer.getInteger(HTTP_PORT, 3495).intValue()); + connector.setPort(Integer.getInteger(HTTP_PORT_PROPERTY, 3495).intValue()); connector.setAcceptors(1); - connector.setConfidentialPort(Integer.getInteger(HTTPS_PORT, 3496).intValue()); + connector.setConfidentialPort(Integer.getInteger(HTTPS_PORT_PROPERTY, 3496).intValue()); + connector.setHost("127.0.0.1"); SslSocketConnector sslConnector = new SslSocketConnector(); - sslConnector.setPort(Integer.getInteger(HTTPS_PORT, 3496).intValue()); + sslConnector.setPort(Integer.getInteger(HTTPS_PORT_PROPERTY, 3496).intValue()); sslConnector.setAcceptors(1); - sslConnector.setKeystore(System.getProperty("user.home") - + "/.mocca/conf/keystore/keystore.ks"); - sslConnector.setPassword("changeMe"); - sslConnector.setKeyPassword("changeMe"); + sslConnector.setHost("127.0.0.1"); + File configDir = new File(System.getProperty("user.home") + "/" + BKULauncher.CONFIG_DIR); + sslConnector.setKeystore(configDir.getPath() + "/" + BKULauncher.KEYSTORE_FILE); + File passwdFile = new File(configDir, BKULauncher.PASSWD_FILE); + BufferedReader reader = new BufferedReader(new FileReader(passwdFile)); + String pwd; + while ((pwd = reader.readLine()) != null) { + sslConnector.setPassword(pwd); + sslConnector.setKeyPassword(pwd); + } + reader.close(); server.setConnectors(new Connector[] { connector, sslConnector }); -// HandlerCollection handlers = new HandlerCollection(); WebAppContext webapp = new WebAppContext(); + webapp.setLogUrlOnStart(true); webapp.setContextPath("/"); - webapp.setExtractWAR(true); //false - webapp.setParentLoaderPriority(false); + webapp.setExtractWAR(true); + webapp.setParentLoaderPriority(false); //true); -// webappcontext.setWar("BKULocal-1.0.4-SNAPSHOT.war"); - webapp.setWar(getClass().getClassLoader().getResource("BKULocalWar/").toString()); - -// handlers.setHandlers(new Handler[] { webappcontext, new DefaultHandler() }); + webapp.setWar(copyWebapp(webapp.getTempDirectory())); //getClass().getClassLoader().getResource("BKULocalWar/").toString()); server.setHandler(webapp); server.setGracefulShutdown(1000*3); } + + private String copyWebapp(File webappDir) throws IOException { + File webapp = new File(webappDir, "BKULocal.war"); + log.debug("copying BKULocal classpath resource to " + webapp); + InputStream is = getClass().getClassLoader().getResourceAsStream("BKULocal.war"); + OutputStream os = new BufferedOutputStream(new FileOutputStream(webapp)); + StreamUtil.copyStream(is, os); + os.close(); + return webapp.getPath(); + } + public void start() throws Exception { server.start(); } diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/TLSServerCA.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/TLSServerCA.java new file mode 100644 index 00000000..97ca716b --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/TLSServerCA.java @@ -0,0 +1,138 @@ +package at.gv.egiz.bku.webstart; + +import iaik.asn1.CodingException; +import iaik.asn1.ObjectID; +import iaik.asn1.structures.AlgorithmID; +import iaik.asn1.structures.GeneralName; +import iaik.asn1.structures.GeneralNames; +import iaik.asn1.structures.Name; +import iaik.x509.X509Certificate; +import iaik.x509.extensions.AuthorityKeyIdentifier; +import iaik.x509.extensions.BasicConstraints; +import iaik.x509.extensions.ExtendedKeyUsage; +import iaik.x509.extensions.KeyUsage; + +import iaik.x509.extensions.SubjectAltName; +import iaik.x509.extensions.SubjectKeyIdentifier; +import java.io.IOException; +import java.math.BigInteger; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.security.GeneralSecurityException; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.KeyStore; +import java.security.NoSuchAlgorithmException; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.Random; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class TLSServerCA { + public static final int CA_VALIDITY_Y = 3; + public static final int SERVER_VALIDITY_Y = 3; + private final static Log log = LogFactory.getLog(TLSServerCA.class); + + private KeyPair caKeyPair; + private X509Certificate caCert; + + private KeyPair serverKeyPair; + private X509Certificate serverCert; + + private KeyPair generateKeyPair() throws NoSuchAlgorithmException { + KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA"); + gen.initialize(2048); + return gen.generateKeyPair(); + } + + private void generateCACert() throws GeneralSecurityException, CodingException { + log.debug("generating MOCCA CA certificate"); + Name subject = new Name(); + subject.addRDN(ObjectID.country, "AT"); + subject.addRDN(ObjectID.organization, "MOCCA"); + subject.addRDN(ObjectID.organizationalUnit, "MOCCA TLS Server CA"); + + caKeyPair = generateKeyPair(); + caCert = new X509Certificate(); + caCert.setSerialNumber(new BigInteger(20, new Random())); + caCert.setSubjectDN(subject); + caCert.setPublicKey(caKeyPair.getPublic()); + caCert.setIssuerDN(subject); + + caCert.addExtension(new SubjectKeyIdentifier(caKeyPair.getPublic())); + + caCert.addExtension(new BasicConstraints(true)); + caCert.addExtension(new KeyUsage(KeyUsage.keyCertSign | KeyUsage.cRLSign + | KeyUsage.digitalSignature)); + + GregorianCalendar date = new GregorianCalendar(); + date.add(Calendar.HOUR_OF_DAY, -1); + caCert.setValidNotBefore(date.getTime()); + date.add(Calendar.YEAR, CA_VALIDITY_Y); + caCert.setValidNotAfter(date.getTime()); + caCert.sign(AlgorithmID.sha1WithRSAEncryption, caKeyPair.getPrivate()); + + log.debug("successfully generated MOCCA TLS Server CA certificate " + caCert.getSubjectDN()); + } + + private void generateServerCert() throws GeneralSecurityException, CodingException { + log.debug("generating MOCCA server certificate"); + Name subject = new Name(); + subject.addRDN(ObjectID.country, "AT"); + subject.addRDN(ObjectID.organization, "MOCCA"); + subject.addRDN(ObjectID.organizationalUnit, "MOCCA TLS Server"); + subject.addRDN(ObjectID.commonName, "localhost"); + subject.addRDN(ObjectID.commonName, "127.0.0.1"); + + serverKeyPair = generateKeyPair(); + serverCert = new X509Certificate(); + serverCert.setSerialNumber(new BigInteger(20, new Random())); + serverCert.setSubjectDN(subject); + serverCert.setPublicKey(serverKeyPair.getPublic()); + serverCert.setIssuerDN(caCert.getSubjectDN()); + + serverCert.addExtension(new SubjectKeyIdentifier(serverKeyPair.getPublic())); + byte[] aki = new SubjectKeyIdentifier(caCert.getPublicKey()).get(); + serverCert.addExtension(new AuthorityKeyIdentifier(aki)); + + serverCert.addExtension(new ExtendedKeyUsage(ExtendedKeyUsage.serverAuth)); + + GeneralNames altNames = new GeneralNames(); + altNames.addName(new GeneralName(GeneralName.dNSName, "localhost")); + altNames.addName(new GeneralName(GeneralName.dNSName, "127.0.0.1")); + altNames.addName(new GeneralName(GeneralName.iPAddress, "127.0.0.1")); + serverCert.addExtension(new SubjectAltName(altNames)); + + serverCert.addExtension(new BasicConstraints(false)); + serverCert.addExtension(new KeyUsage(KeyUsage.keyEncipherment + | KeyUsage.digitalSignature)); + + GregorianCalendar date = new GregorianCalendar(); + date.add(Calendar.HOUR_OF_DAY, -1); + serverCert.setValidNotBefore(date.getTime()); + date.add(Calendar.YEAR,SERVER_VALIDITY_Y); + date.add(Calendar.HOUR_OF_DAY, -1); + serverCert.setValidNotAfter(date.getTime()); + serverCert.sign(AlgorithmID.sha1WithRSAEncryption, caKeyPair.getPrivate()); + + log.debug("successfully generated MOCCA TLS Server certificate " + serverCert.getSubjectDN()); + caKeyPair = null; + } + + public KeyStore generateKeyStore(char[] password) throws GeneralSecurityException, IOException, CodingException { +// try { + generateCACert(); + generateServerCert(); + KeyStore ks = KeyStore.getInstance("JKS"); + ks.load(null, null); + ks.setKeyEntry("server", serverKeyPair.getPrivate(), password, new X509Certificate[]{serverCert, caCert}); + return ks; +// } catch (Exception e) { +// log.error("Cannot generate certificate", e); +// } +// return null; + } + +} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java index 4679eac5..9990b2a0 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java @@ -36,6 +36,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class TrayIconDialog implements TrayIconDialogInterface { + public static final String TRAYICON_RESOURCE = "at/gv/egiz/bku/webstart/ui/trayicon.png"; + public static final String TRAYMENU_SHUTDOWN = "TrayMenu.Shutdown"; + public static final String TRAYMENU_TOOLTIP = "TrayMenu.Tooltip"; private static Log log = LogFactory.getLog(TrayIconDialog.class); private static TrayIconDialogInterface instance; @@ -107,10 +110,10 @@ public class TrayIconDialog implements TrayIconDialogInterface { if (isSupported) { SystemTray tray = SystemTray.getSystemTray(); Image image = ImageIO.read(getClass().getClassLoader() - .getResourceAsStream("at/gv/egiz/bku/webstart/ui/logo.png")); + .getResourceAsStream(TRAYICON_RESOURCE)); PopupMenu popup = new PopupMenu(); MenuItem exitItem = new MenuItem(resourceBundel - .getString("TrayMenu.Shutdown")); + .getString(TRAYMENU_SHUTDOWN)); popup.add(exitItem); exitItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -123,7 +126,7 @@ public class TrayIconDialog implements TrayIconDialogInterface { trayIcon = new TrayIcon(image, "BKULogo", popup); trayIcon.setImageAutoSize(true); - trayIcon.setToolTip(resourceBundel.getString("TrayMenu.Tooltip")); + trayIcon.setToolTip(resourceBundel.getString(TRAYMENU_TOOLTIP)); try { tray.add(trayIcon); } catch (AWTException e) { diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo.png b/BKUWebStart/src/main/jnlp/resources/img/logo.png new file mode 100644 index 00000000..2c622d88 Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/logo.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_64x64.png b/BKUWebStart/src/main/jnlp/resources/img/logo_64x64.png new file mode 100644 index 00000000..fa6d7f96 Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/logo_64x64.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_90x90.png b/BKUWebStart/src/main/jnlp/resources/img/logo_90x90.png new file mode 100644 index 00000000..d7f8bbd0 Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/logo_90x90.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/splash.png b/BKUWebStart/src/main/jnlp/resources/img/splash.png new file mode 100644 index 00000000..72c1d868 Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/splash.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/version.xml b/BKUWebStart/src/main/jnlp/resources/img/version.xml new file mode 100644 index 00000000..715b6722 --- /dev/null +++ b/BKUWebStart/src/main/jnlp/resources/img/version.xml @@ -0,0 +1,17 @@ + + + + + logo.png + 1.0-SNAPSHOT + + logo.png + + + + splash.png + 1.0-SNAPSHOT + + splash.png + + diff --git a/BKUWebStart/src/main/jnlp/resources/logo.png b/BKUWebStart/src/main/jnlp/resources/logo.png deleted file mode 100644 index 2c622d88..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/logo.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/logo_64x64.png b/BKUWebStart/src/main/jnlp/resources/logo_64x64.png deleted file mode 100644 index fa6d7f96..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/logo_64x64.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/logo_90x90.png b/BKUWebStart/src/main/jnlp/resources/logo_90x90.png deleted file mode 100644 index d7f8bbd0..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/logo_90x90.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/splash.png b/BKUWebStart/src/main/jnlp/resources/splash.png deleted file mode 100644 index 72c1d868..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/splash.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/version.xml b/BKUWebStart/src/main/jnlp/resources/version.xml new file mode 100644 index 00000000..a5b10b47 --- /dev/null +++ b/BKUWebStart/src/main/jnlp/resources/version.xml @@ -0,0 +1,186 @@ + + + + + BKUWebStart-1.0.3-SNAPSHOT.jar + 1.0.3-SNAPSHOT + + BKUWebStart-1.0.3-SNAPSHOT.jar + + + + + commons-logging-1.0.4.jar + 1.0.4 + + commons-logging-1.0.4.jar + + + + + + activation-1.1.jar + 1.1 + + activation-1.1.jar + + + + + log4j-1.2.12.jar + 1.2.12 + + log4j-1.2.12.jar + + + + + iaik_ecc_signed-2.15.jar + 2.15 + + iaik_ecc_signed-2.15.jar + + + + iaik_jce_full_signed-3.16.jar + 3.16 + + iaik_jce_full_signed-3.16.jar + + + + iaik_xsect-1.14.jar + 1.14 + + iaik_xsect-1.14.jar + + + + + + jetty-6.1.15.jar + 6.1.15 + + jetty-6.1.15.jar + + + + jetty-util-6.1.15.jar + 6.1.15 + + jetty-util-6.1.15.jar + + + + servlet-api-2.5-20081211.jar + 2.5-20081211 + + servlet-api-2.5-20081211.jar + + + + + jaxb-api-2.1.jar + 2.1 + + jaxb-api-2.1.jar + + + + jaxb-impl-2.1.9.jar + 2.1.9 + + jaxb-impl-2.1.9.jar + + + + stax-api-1.0-2.jar + 1.0-2 + + stax-api-1.0-2.jar + + + + + + utils-1.1.2-SNAPSHOT.jar + 1.1.2-SNAPSHOT + + utils-1.1.2-SNAPSHOT.jar + + + + diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml index 0a89a036..a355da77 100644 --- a/BKUWebStart/src/main/jnlp/template.xml +++ b/BKUWebStart/src/main/jnlp/template.xml @@ -1,15 +1,20 @@ - + + + $project.Name $project.Organization.Name $project.Description - - + $project.Description + + - + #if($offlineAllowed) diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/logo.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/logo.png deleted file mode 100644 index 598ab00b..00000000 Binary files a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/logo.png and /dev/null differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon.png new file mode 100644 index 00000000..2c622d88 Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon.png differ diff --git a/BKUWebStart/src/main/resources/logo.png b/BKUWebStart/src/main/resources/logo.png deleted file mode 100644 index fa6d7f96..00000000 Binary files a/BKUWebStart/src/main/resources/logo.png and /dev/null differ diff --git a/BKUWebStart/src/main/resources/splash.png b/BKUWebStart/src/main/resources/splash.png deleted file mode 100644 index 72c1d868..00000000 Binary files a/BKUWebStart/src/main/resources/splash.png and /dev/null differ diff --git a/pom.xml b/pom.xml index 99380944..d2cdb5b3 100644 --- a/pom.xml +++ b/pom.xml @@ -1,118 +1,123 @@ - 4.0.0 - at.gv.egiz - bku - pom - 1.1.2-SNAPSHOT - BKU - http://bku.egiz.gv.at - - utils - bkucommon - STAL - BKUOnline - smcc - BKULocal - BKUApplet - smccSTAL - STALService - BKUCommonGUI - BKUViewer - STALExt + 4.0.0 + at.gv.egiz + bku + pom + 1.1.2-SNAPSHOT + BKU + http://bku.egiz.gv.at + + utils + bkucommon + STAL + BKUOnline + smcc + BKULocal + BKUApplet + smccSTAL + STALService + BKUCommonGUI + BKUViewer + STALExt STALXService BKUAppletExt BKUWebStart - - - mcentner - Martin Centner - mcentner@egiz.gv.at - - - wbauer - Wolfgang Bauer - wbauer@egiz.gv.at - - - corthacker - Clemens Orthacker - corthacker@egiz.gv.at - - - - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk - scm:svn:svn+ssh://svn.egovlabs.gv.at/svnroot/mocca/trunk - svn://svn.egovlabs.gv.at/svnroot/mocca/trunk - - - E-Government Innovation Center (EGIZ) - http://www.egiz.gv.at - - - - - - maven-compiler-plugin - org.apache.maven.plugins - 2.0.2 - + + + mcentner + Martin Centner + mcentner@egiz.gv.at + + + wbauer + Wolfgang Bauer + wbauer@egiz.gv.at + + + corthacker + Clemens Orthacker + corthacker@egiz.gv.at + + + + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk + scm:svn:svn+ssh://svn.egovlabs.gv.at/svnroot/mocca/trunk + svn://svn.egovlabs.gv.at/svnroot/mocca/trunk + + + E-Government Innovation Center (EGIZ) + http://www.egiz.gv.at + + + + + + maven-compiler-plugin + org.apache.maven.plugins + 2.0.2 + - 1.6 - 1.6 - true - true - UTF-8 - - - - maven-resources-plugin - - UTF-8 - - - - maven-assembly-plugin - org.apache.maven.plugins - 2.2-beta-2 - - - maven-dependency-plugin - org.apache.maven.plugins - 2.0 - + 1.6 + 1.6 + true + true + UTF-8 + + + + maven-resources-plugin + + UTF-8 + + + + maven-assembly-plugin + org.apache.maven.plugins + 2.2-beta-2 + + + maven-dependency-plugin + org.apache.maven.plugins + 2.0 + - - jaxws-maven-plugin - org.codehaus.mojo - 1.10 - - - org.apache.maven.plugins - maven-release-plugin - 2.0-beta-7 - - - - - - maven-assembly-plugin - - - ${basedir}/src/main/assemblies/assembly-test.xml + + jaxws-maven-plugin + org.codehaus.mojo + 1.10 + + + org.apache.maven.plugins + maven-release-plugin + 2.0-beta-7 + + + org.codehaus.mojo + maven-buildnumber-plugin + 0.9.6 + + + + + + maven-assembly-plugin + + + ${basedir}/src/main/assemblies/assembly-test.xml - - + + - - - - - - mocca-egovlabs - MOCCA EGovLabs - http://mocca.egovlabs.gv.at/m2/repository/ - - - maven2-repository.dev.java.net - Java.net Repository for Maven 2 - http://download.java.net/maven/2/ - - - maven1-repository.dev.java.net - Java.net Repository for Maven 1 - http://download.java.net/maven/1/ - legacy - - - - - log4j - log4j - runtime - - - junit - junit - test - - - - - - log4j - log4j - 1.2.12 - runtime - - - commons-logging - commons-logging - 1.1.1 - compile - - - junit - junit - 4.4 - test - - - xerces - xercesImpl - 2.9.1 - - - xalan - xalan - 2.7.1 - - - iaik - iaik_jce_full_signed - 3.16 - compile - - - iaik - iaik_jce_me4se - 3.04 - - - iaik - iaik_ecc_signed - 2.15 - - - iaik - iaik_xsect - 1.14 - - - iaik - iaik_pki - 1.0-MOCCA - compile - - - commons-fileupload - commons-fileupload - 1.2.1 - compile - - - commons-httpclient - commons-httpclient - 3.1 - compile - - - org.springframework - spring-core - 2.5.5 - - - org.springframework - spring-context - 2.5.5 - - - com.sun.xml.bind - jaxb-impl - 2.1.9 - - - + + + + + + mocca-egovlabs + MOCCA EGovLabs + http://mocca.egovlabs.gv.at/m2/repository/ + + + maven2-repository.dev.java.net + Java.net Repository for Maven 2 + http://download.java.net/maven/2/ + + + maven1-repository.dev.java.net + Java.net Repository for Maven 1 + http://download.java.net/maven/1/ + legacy + + + + + log4j + log4j + runtime + + + junit + junit + test + + + + + + log4j + log4j + 1.2.12 + runtime + + + commons-logging + commons-logging + 1.1.1 + compile + + + junit + junit + 4.4 + test + + + xerces + xercesImpl + 2.9.1 + + + xalan + xalan + 2.7.1 + + + iaik + iaik_jce_full_signed + 3.16 + compile + + + iaik + iaik_jce_me4se + 3.04 + + + iaik + iaik_ecc_signed + 2.15 + + + iaik + iaik_xsect + 1.14 + + + iaik + iaik_pki + 1.0-MOCCA + compile + + + commons-fileupload + commons-fileupload + 1.2.1 + compile + + + commons-httpclient + commons-httpclient + 3.1 + compile + + + org.springframework + spring-core + 2.5.5 + + + org.springframework + spring-context + 2.5.5 + + + com.sun.xml.bind + jaxb-impl + 2.1.9 + + + -- cgit v1.2.3 From 5a45508c63ad07606fa39ac8c773d46ada353acf Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 16 Jun 2009 16:25:17 +0000 Subject: tray icon on startup, messages git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@364 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUWebStart/pom.xml | 2 +- .../java/at/gv/egiz/bku/webstart/BKULauncher.java | 10 ++- BKUWebStart/src/main/jnlp/resources/version.xml | 77 ---------------------- BKUWebStart/src/main/jnlp/template.xml | 6 +- BKUWebStart/src/main/jnlp/template_dev.xml | 39 +++++++++++ .../gv/egiz/bku/webstart/ui/UIMessages.properties | 10 +-- 6 files changed, 57 insertions(+), 87 deletions(-) create mode 100644 BKUWebStart/src/main/jnlp/template_dev.xml (limited to 'BKUWebStart/src') diff --git a/BKUWebStart/pom.xml b/BKUWebStart/pom.xml index ec5fd976..25683dba 100644 --- a/BKUWebStart/pom.xml +++ b/BKUWebStart/pom.xml @@ -15,7 +15,7 @@ |--> 1.0.3-SNAPSHOT http://mocca.egovlabs.gv.at/ - Web Start Bürgerkartenumgebung (MOCCA-lokal) + Bürgerkartenumgebung (MOCCA Web Start) diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java index 3d09fb00..b1fc29be 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java @@ -64,6 +64,8 @@ public class BKULauncher implements BKUControllerInterface { /** resource bundle messages */ public static final String GREETING_CAPTION = "Greetings.Caption"; public static final String GREETING_MESSAGE = "Greetings.Message"; + public static final String STARTUP_CAPTION = "Startup.Caption"; + public static final String STARTUP_MESSAGE = "Startup.Message"; public static final String VERSION_FILE = ".version"; private static Log log = LogFactory.getLog(BKULauncher.class); private ResourceBundle resourceBundle = null; @@ -204,7 +206,7 @@ public class BKULauncher implements BKUControllerInterface { } TrayIconDialog.getInstance().init(resourceBundle); TrayIconDialog.getInstance().setShutdownHook(this); - TrayIconDialog.getInstance().displayInfo(GREETING_CAPTION, GREETING_MESSAGE); +// TrayIconDialog.getInstance().displayInfo(GREETING_CAPTION, GREETING_MESSAGE); } private void initStart() { @@ -277,8 +279,12 @@ public class BKULauncher implements BKUControllerInterface { File configDir = new File(System.getProperty("user.home") + '/' + CONFIG_DIR); boolean installCert = launcher.ensureConfig(configDir); - launcher.startUpServer(); launcher.initTrayIcon(); + TrayIconDialog.getInstance().displayInfo(STARTUP_CAPTION, STARTUP_MESSAGE); + launcher.startUpServer(); + TrayIconDialog.getInstance().displayInfo(GREETING_CAPTION, GREETING_MESSAGE); + +// launcher.initTrayIcon(); launcher.initFinished(installCert); } catch (Exception e) { log.fatal("Failed to launch BKU: " + e.getMessage(), e); diff --git a/BKUWebStart/src/main/jnlp/resources/version.xml b/BKUWebStart/src/main/jnlp/resources/version.xml index a5b10b47..197c05b5 100644 --- a/BKUWebStart/src/main/jnlp/resources/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/version.xml @@ -15,27 +15,6 @@ commons-logging-1.0.4.jar - @@ -74,13 +53,6 @@ iaik_xsect-1.14.jar - @@ -125,34 +97,6 @@ stax-api-1.0-2.jar - @@ -161,26 +105,5 @@ utils-1.1.2-SNAPSHOT.jar - diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml index a355da77..07e1c28a 100644 --- a/BKUWebStart/src/main/jnlp/template.xml +++ b/BKUWebStart/src/main/jnlp/template.xml @@ -5,11 +5,11 @@ - $project.Name + $project.Name EarlyAccess $project.Organization.Name - $project.Description - $project.Description + $project.Description EarlyAccess + $project.Description EarlyAccess diff --git a/BKUWebStart/src/main/jnlp/template_dev.xml b/BKUWebStart/src/main/jnlp/template_dev.xml new file mode 100644 index 00000000..2d8e8133 --- /dev/null +++ b/BKUWebStart/src/main/jnlp/template_dev.xml @@ -0,0 +1,39 @@ + + + + + $project.Name + $project.Organization.Name + + $project.Description + $project.Description + + + + + + + +#if($offlineAllowed) + +#end + + + + +#if($allPermissions) + + + +#end + + + + + + + $dependencies + + + + \ No newline at end of file diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties index 873d03ef..6ee1a510 100644 --- a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties +++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties @@ -1,9 +1,11 @@ #-------- tray icon messages ------- -TrayMenu.Tooltip=MOCCA -TrayMenu.Shutdown=MOCCA Beenden +TrayMenu.Tooltip=B\u00FCrgerkartenumgebung (MOCCA Web Start) +TrayMenu.Shutdown=B\u00FCrgerkartenumgebung beenden -Greetings.Message=MOCCA up and running -Greetings.Caption=MOCCA Started +Startup.Message=B\u00FCrgerkartenumgebung wird gestartet... +Startup.Caption=B\u00FCrgerkartenumgebung (MOCCA Web Start) +Greetings.Message=B\u00FCrgerkartenumgebung erfolgreich gestartet +Greetings.Caption=B\u00FCrgerkartenumgebung (MOCCA Web Start) Message.RequestCaption=New Request Message.InfoboxReadRequest=Reading Infobox -- cgit v1.2.3 From 69e0dbee3567fc3a710d7bffad4d03e64edd7daa Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 25 Jun 2009 12:07:39 +0000 Subject: TLS CipherSuites (FF XP) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@375 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUWebStart/pom.xml | 6 ++ .../java/at/gv/egiz/bku/webstart/BKULauncher.java | 68 +++++++++++++++++----- .../java/at/gv/egiz/bku/webstart/Container.java | 47 ++++++++++++++- BKUWebStart/src/main/jnlp/resources/player.jnlp | 3 + BKUWebStart/src/main/jnlp/template.xml | 7 ++- .../gv/egiz/bku/webstart/ui/UIMessages.properties | 5 +- 6 files changed, 116 insertions(+), 20 deletions(-) create mode 100644 BKUWebStart/src/main/jnlp/resources/player.jnlp (limited to 'BKUWebStart/src') diff --git a/BKUWebStart/pom.xml b/BKUWebStart/pom.xml index 25683dba..fb72f26f 100644 --- a/BKUWebStart/pom.xml +++ b/BKUWebStart/pom.xml @@ -205,6 +205,12 @@ utils at.gv.egiz 1.1.2-SNAPSHOT + + + iaik_ecc_signed + iaik + + commons-logging diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java index b1fc29be..36c9cbb2 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java @@ -41,6 +41,7 @@ import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileReader; import java.io.FileWriter; +import java.net.BindException; import java.net.URI; import java.net.URL; import java.security.GeneralSecurityException; @@ -48,6 +49,7 @@ import java.util.UUID; import java.util.jar.Attributes; import java.util.jar.Manifest; import java.util.zip.ZipOutputStream; +import org.mortbay.util.MultiException; public class BKULauncher implements BKUControllerInterface { @@ -65,7 +67,11 @@ public class BKULauncher implements BKUControllerInterface { public static final String GREETING_CAPTION = "Greetings.Caption"; public static final String GREETING_MESSAGE = "Greetings.Message"; public static final String STARTUP_CAPTION = "Startup.Caption"; + public static final String ERROR_CAPTION = "Error.Caption"; public static final String STARTUP_MESSAGE = "Startup.Message"; + public static final String ERROR_STARTUP_MESSAGE = "Error.Startup.Message"; + public static final String ERROR_CONF_MESSAGE = "Error.Conf.Message"; + public static final String ERROR_BIND_MESSAGE = "Error.Bind.Message"; public static final String VERSION_FILE = ".version"; private static Log log = LogFactory.getLog(BKULauncher.class); private ResourceBundle resourceBundle = null; @@ -222,8 +228,8 @@ public class BKULauncher implements BKUControllerInterface { // } // } - log.debug("trying install MOCCA certificate on system browser"); if (installCert) { + log.debug("trying install MOCCA certificate on system browser"); if (Desktop.isDesktopSupported()) { Desktop desktop = Desktop.getDesktop(); if (desktop.isSupported(Desktop.Action.BROWSE)) { @@ -270,26 +276,60 @@ public class BKULauncher implements BKUControllerInterface { /** * @param args */ - public static void main(String[] args) { - try { - log.warn("***** DISABLING SECURITY MANAGER *******"); + public static void main(String[] args) throws InterruptedException { + + if (log.isDebugEnabled()) { + //System.setProperty("DEBUG", "true"); + System.setProperty("VERBOSE", "true"); + System.setProperty("javax.net.debug", "ssl,handshake"); + } + +// log.warn("***** DISABLING SECURITY MANAGER *******"); System.setSecurityManager(null); + BKULauncher launcher = new BKULauncher(); launcher.initStart(); - File configDir = new File(System.getProperty("user.home") + '/' + CONFIG_DIR); - boolean installCert = launcher.ensureConfig(configDir); + boolean installCert = false; + launcher.initTrayIcon(); TrayIconDialog.getInstance().displayInfo(STARTUP_CAPTION, STARTUP_MESSAGE); - launcher.startUpServer(); - TrayIconDialog.getInstance().displayInfo(GREETING_CAPTION, GREETING_MESSAGE); -// launcher.initTrayIcon(); - launcher.initFinished(installCert); - } catch (Exception e) { - log.fatal("Failed to launch BKU: " + e.getMessage(), e); - System.exit(-1000); - } + try { + File configDir = new File(System.getProperty("user.home") + '/' + CONFIG_DIR); + installCert = launcher.ensureConfig(configDir); + } catch (Exception ex) { + log.fatal("Failed to init MOCCA configuration, exiting", ex); + TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_CONF_MESSAGE); + Thread.sleep(5000); + System.exit(-1000); + } + + try { + launcher.startUpServer(); + TrayIconDialog.getInstance().displayInfo(GREETING_CAPTION, GREETING_MESSAGE); + launcher.initFinished(installCert); + } catch (BindException ex) { + log.fatal("Failed to launch MOCCA, " + ex.getMessage(), ex); + TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_BIND_MESSAGE); + Thread.sleep(5000); + System.exit(-1000); + } catch (MultiException ex) { + log.fatal("Failed to launch MOCCA, " + ex.getMessage(), ex); + if (ex.getThrowable(0) instanceof BindException) { + TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_BIND_MESSAGE); + } else { + TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_STARTUP_MESSAGE); + } + Thread.sleep(5000); + System.exit(-1000); + } catch (Exception e) { + log.fatal("Failed to launch MOCCA, " + e.getMessage(), e); + TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_STARTUP_MESSAGE); + Thread.sleep(5000); + System.exit(-1000); + } + } private void backupAndDelete(File dir, URI relativeTo, ZipOutputStream zip) throws IOException { diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java index 0cd3e633..89044486 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java @@ -35,6 +35,7 @@ public class Container { } public void init() throws IOException { +// System.setProperty("DEBUG", "true"); server = new Server(); QueuedThreadPool qtp = new QueuedThreadPool(); qtp.setMaxThreads(5); @@ -55,7 +56,13 @@ public class Container { sslConnector.setAcceptors(1); sslConnector.setHost("127.0.0.1"); File configDir = new File(System.getProperty("user.home") + "/" + BKULauncher.CONFIG_DIR); - sslConnector.setKeystore(configDir.getPath() + "/" + BKULauncher.KEYSTORE_FILE); + File keystoreFile = new File(configDir, BKULauncher.KEYSTORE_FILE); + if (!keystoreFile.canRead()) { + log.error("MOCCA keystore file not readable: " + keystoreFile.getAbsolutePath()); + throw new FileNotFoundException("MOCCA keystore file not readable: " + keystoreFile.getAbsolutePath()); + } + log.debug("loading MOCCA keystore from " + keystoreFile.getAbsolutePath()); + sslConnector.setKeystore(keystoreFile.getAbsolutePath()); File passwdFile = new File(configDir, BKULauncher.PASSWD_FILE); BufferedReader reader = new BufferedReader(new FileReader(passwdFile)); String pwd; @@ -64,6 +71,42 @@ public class Container { sslConnector.setKeyPassword(pwd); } reader.close(); + + //avoid jetty's ClassCastException: iaik.security.ecc.ecdsa.ECPublicKey cannot be cast to java.security.interfaces.ECPublicKey + String[] RFC4492CipherSuites = new String[] { + "TLS_ECDH_ECDSA_WITH_NULL_SHA", + "TLS_ECDH_ECDSA_WITH_RC4_128_SHA", + "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA", + "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA", + + "TLS_ECDHE_ECDSA_WITH_NULL_SHA", + "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", + "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", + "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", + + "TLS_ECDH_RSA_WITH_NULL_SHA", + "TLS_ECDH_RSA_WITH_RC4_128_SHA", + "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA", + "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA", + + "TLS_ECDHE_RSA_WITH_NULL_SHA", + "TLS_ECDHE_RSA_WITH_RC4_128_SHA", + "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", + "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", + + "TLS_ECDH_anon_WITH_NULL_SHA", + "TLS_ECDH_anon_WITH_RC4_128_SHA", + "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_anon_WITH_AES_128_CBC_SHA", + "TLS_ECDH_anon_WITH_AES_256_CBC_SHA" + }; + + sslConnector.setExcludeCipherSuites(RFC4492CipherSuites); + server.setConnectors(new Connector[] { connector, sslConnector }); @@ -71,7 +114,7 @@ public class Container { webapp.setLogUrlOnStart(true); webapp.setContextPath("/"); webapp.setExtractWAR(true); - webapp.setParentLoaderPriority(false); //true); + webapp.setParentLoaderPriority(false); webapp.setWar(copyWebapp(webapp.getTempDirectory())); //getClass().getClassLoader().getResource("BKULocalWar/").toString()); diff --git a/BKUWebStart/src/main/jnlp/resources/player.jnlp b/BKUWebStart/src/main/jnlp/resources/player.jnlp new file mode 100644 index 00000000..da08ebc2 --- /dev/null +++ b/BKUWebStart/src/main/jnlp/resources/player.jnlp @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml index 07e1c28a..4d08d4e5 100644 --- a/BKUWebStart/src/main/jnlp/template.xml +++ b/BKUWebStart/src/main/jnlp/template.xml @@ -5,11 +5,12 @@ - $project.Name EarlyAccess + + $project.Description $project.Organization.Name - $project.Description EarlyAccess - $project.Description EarlyAccess + $project.Description + $project.Description diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties index 6ee1a510..eb2b74c0 100644 --- a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties +++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties @@ -6,7 +6,10 @@ Startup.Message=B\u00FCrgerkartenumgebung wird gestartet... Startup.Caption=B\u00FCrgerkartenumgebung (MOCCA Web Start) Greetings.Message=B\u00FCrgerkartenumgebung erfolgreich gestartet Greetings.Caption=B\u00FCrgerkartenumgebung (MOCCA Web Start) - +Error.Caption=Fehler +Error.Startup.Message=B\u00FCrgerkartenumgebung konnte nicht gestartet werden +Error.Conf.Message=Konfiguration konnte nicht initialisiert werden, B\u00FCrberkartenumgebung wird nicht gestartet +Error.Bind.Message=Die f\u00FCr die B\u00FCrgerkartenumgebung reservierte Adresse wird bereits von einem anderen Dienst verwendet Message.RequestCaption=New Request Message.InfoboxReadRequest=Reading Infobox Message.SecureSignatureKeypair=Reading secure signature certificate -- cgit v1.2.3 From e75f30d8d51fa33fc778c31c1b0312cf10de8e45 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 25 Jun 2009 17:01:14 +0000 Subject: disable pinpad git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@376 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../src/main/webapp/WEB-INF/applicationContext.xml | 9 +++- .../src/main/webapp/WEB-INF/applicationContext.xml | 7 +++ BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml | 39 ++++++++++++++++ BKUOnline/src/main/webapp/WEB-INF/web.xml | 2 +- BKUOnline/src/main/webapp/index.html | 2 +- .../java/at/gv/egiz/bku/webstart/BKULauncher.java | 4 +- .../at/gv/egiz/bku/webstart/conf/configuration.zip | Bin 0 -> 25738 bytes .../at/gv/egiz/smcc/AbstractSignatureCard.java | 2 +- smcc/src/main/java/at/gv/egiz/smcc/SWCard.java | 5 +++ smcc/src/main/java/at/gv/egiz/smcc/ccid/CCID.java | 2 + .../java/at/gv/egiz/smcc/ccid/DefaultReader.java | 8 +++- .../java/at/gv/egiz/smcc/ccid/ReaderFactory.java | 50 ++++++++++++++++++--- .../at/gv/egiz/smcc/conf/SMCCConfiguration.java | 33 ++++++++++++++ 13 files changed, 149 insertions(+), 14 deletions(-) create mode 100644 BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/configuration.zip create mode 100644 smcc/src/main/java/at/gv/egiz/smcc/conf/SMCCConfiguration.java (limited to 'BKUWebStart/src') diff --git a/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml b/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml index 2ddd46a1..b219fdd8 100644 --- a/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml +++ b/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml @@ -98,6 +98,11 @@ - - + + + + \ No newline at end of file diff --git a/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml b/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml index 6a234b73..5681fa89 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml +++ b/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml @@ -103,4 +103,11 @@ + + + + \ No newline at end of file diff --git a/BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml b/BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml new file mode 100644 index 00000000..54e08e9b --- /dev/null +++ b/BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml @@ -0,0 +1,39 @@ + + + + + + + + + diff --git a/BKUOnline/src/main/webapp/WEB-INF/web.xml b/BKUOnline/src/main/webapp/WEB-INF/web.xml index a164a384..e41e2265 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/web.xml +++ b/BKUOnline/src/main/webapp/WEB-INF/web.xml @@ -111,7 +111,7 @@ include-webstart @@ -235,7 +237,6 @@ at.gv.egiz BKUWebStart - 1.0.3-SNAPSHOT zip @@ -254,6 +255,16 @@ jnlp-servlet 1.6.0.10 + + + at.gv.egiz + BKUWebStart + 1.0.4-SNAPSHOT + provided + zip + diff --git a/BKUOnline/src/main/webapp/css/main.css b/BKUOnline/src/main/webapp/css/main.css index 114b8da9..b6d6e906 100644 --- a/BKUOnline/src/main/webapp/css/main.css +++ b/BKUOnline/src/main/webapp/css/main.css @@ -24,6 +24,13 @@ h1 { font-size: 16px; } +.disabled { + /* for IE */ + filter:alpha(opacity=60); + /* CSS3 standard */ + opacity:0.4; +} + .box { margin-top: 10px; color: #292929; diff --git a/BKUOnline/src/main/webapp/img/webstart.png b/BKUOnline/src/main/webapp/img/webstart.png new file mode 100644 index 00000000..87d1cf7b Binary files /dev/null and b/BKUOnline/src/main/webapp/img/webstart.png differ diff --git a/BKUOnline/src/main/webapp/index.html b/BKUOnline/src/main/webapp/index.html index 2ec41746..fd37ce35 100644 --- a/BKUOnline/src/main/webapp/index.html +++ b/BKUOnline/src/main/webapp/index.html @@ -40,6 +40,7 @@

MOCCA Web Start

@@ -52,6 +53,5 @@

Java Cache Viewer (local installation)

- |--> diff --git a/BKUOnline/src/main/webapp/js/deployJava.js b/BKUOnline/src/main/webapp/js/deployJava.js index dbeab995..225ca80f 100644 --- a/BKUOnline/src/main/webapp/js/deployJava.js +++ b/BKUOnline/src/main/webapp/js/deployJava.js @@ -36,6 +36,11 @@ * (lines 95-99) * [#424] Web Start loading via java plugin (Sun deployment script) fails on WinXP * (lines 501-506) + * + * features: + * [#425] Disable WebStart Launch Button for MacOS + * (lines 492-504) + * */ /* @@ -75,8 +80,7 @@ var deployJava = { mimeType: 'application/npruntime-scriptable-plugin;DeploymentToolkit', // location of the Java Web Start launch button graphic - launchButtonPNG: 'http://java.sun.com/products/jfc/tsc/articles/swing2d/webstart.png', - + launchButtonPNG: 'img/webstart.png', /** * Returns an array of currently-installed JRE version strings. @@ -485,11 +489,20 @@ var deployJava = { 'if (deployJava.launch("' + jnlp + '")) {}' + '}'; - document.write('<' + 'a href="' + url + + // [#425] Disable WebStart Launch Button for MacOS + if (navigator.appVersion.toLowerCase().indexOf("mac")!=-1) { + document.write('<' + 'a disabled="disabled"' + + ' onMouseOver="window.status=\'\'; ' + + 'return true;"><' + 'img class="disabled"' + + 'src="' + deployJava.launchButtonPNG + '" ' + + 'border="0" /><' + '/' + 'a' + '>'); + } else { + document.write('<' + 'a href="' + url + '" onMouseOver="window.status=\'\'; ' + 'return true;"><' + 'img ' + - 'src="' + deployJava.launchButtonPNG + '" ' + + 'src="' + deployJava.launchButtonPNG + '" ' + 'border="0" /><' + '/' + 'a' + '>'); + } }, @@ -636,7 +649,7 @@ var deployJava = { if (deployJava.debug) { alert('userAgent -> ' + browser); } - + if ((navigator.vendor) && (navigator.vendor.toLowerCase().indexOf('apple') != -1) && (browser.indexOf('safari') != -1)) { diff --git a/BKUWebStart/pom.xml b/BKUWebStart/pom.xml index fb72f26f..09574814 100644 --- a/BKUWebStart/pom.xml +++ b/BKUWebStart/pom.xml @@ -11,9 +11,10 @@ jar BKU Web Start - 1.0.3-SNAPSHOT + 1.0.4-SNAPSHOT http://mocca.egovlabs.gv.at/ Bürgerkartenumgebung (MOCCA Web Start) @@ -276,4 +277,31 @@ --> + + + standalone (non-webstart) + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + at.gv.egiz.bku.webstart.BKULauncher + + + development + ${pom.url} + splash_standalone.png + + + + + + + + + \ No newline at end of file diff --git a/BKUWebStart/src/main/jnlp/resources/version.xml b/BKUWebStart/src/main/jnlp/resources/version.xml index 197c05b5..872b8703 100644 --- a/BKUWebStart/src/main/jnlp/resources/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/version.xml @@ -2,10 +2,10 @@ - BKUWebStart-1.0.3-SNAPSHOT.jar - 1.0.3-SNAPSHOT + BKUWebStart-1.0.4-SNAPSHOT.jar + 1.0.4-SNAPSHOT - BKUWebStart-1.0.3-SNAPSHOT.jar + BKUWebStart-1.0.4-SNAPSHOT.jar diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/template.zip b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/template.zip deleted file mode 100644 index f14b0c19..00000000 Binary files a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/template.zip and /dev/null differ diff --git a/BKUWebStart/src/main/resources/splash_standalone.png b/BKUWebStart/src/main/resources/splash_standalone.png new file mode 100644 index 00000000..72c1d868 Binary files /dev/null and b/BKUWebStart/src/main/resources/splash_standalone.png differ diff --git a/pom.xml b/pom.xml index d2cdb5b3..8cc5aa6d 100644 --- a/pom.xml +++ b/pom.xml @@ -59,9 +59,11 @@ org.apache.maven.plugins 2.0.2 - + 1.6 1.6 true -- cgit v1.2.3 From 53e29d4b811dc9dbd888e04b5dd8205b146a4d9d Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 1 Jul 2009 15:30:39 +0000 Subject: update resource version: 1.0.5-SNAPSHOT git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@388 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUWebStart/src/main/jnlp/resources/version.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'BKUWebStart/src') diff --git a/BKUWebStart/src/main/jnlp/resources/version.xml b/BKUWebStart/src/main/jnlp/resources/version.xml index 872b8703..4e263ded 100644 --- a/BKUWebStart/src/main/jnlp/resources/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/version.xml @@ -2,10 +2,10 @@ - BKUWebStart-1.0.4-SNAPSHOT.jar - 1.0.4-SNAPSHOT + BKUWebStart-1.0.5-SNAPSHOT.jar + 1.0.5-SNAPSHOT - BKUWebStart-1.0.4-SNAPSHOT.jar + BKUWebStart-1.0.5-SNAPSHOT.jar -- cgit v1.2.3 From d3f2f0b0061e1389a3d4d71468314766c446ab20 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 10 Jul 2009 15:24:10 +0000 Subject: Mac OS X (snow leopard): jvm param -d32 plugin version for webstart-maven-plugin git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@408 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUOnline/pom.xml | 2 +- BKUWebStart/pom.xml | 2 +- BKUWebStart/src/main/jnlp/resources/version.xml | 16 ++++++++-------- BKUWebStart/src/main/jnlp/template.xml | 12 +++++++----- pom.xml | 5 +++++ 5 files changed, 22 insertions(+), 15 deletions(-) (limited to 'BKUWebStart/src') diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index 258b978a..23ce4205 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -261,7 +261,7 @@ at.gv.egiz BKUWebStart - 1.0.4-SNAPSHOT + 1.0.5-SNAPSHOT provided zip diff --git a/BKUWebStart/pom.xml b/BKUWebStart/pom.xml index 0ae3feec..9ef1914f 100644 --- a/BKUWebStart/pom.xml +++ b/BKUWebStart/pom.xml @@ -11,7 +11,7 @@ jar BKU Web Start 1.0.5-SNAPSHOT diff --git a/BKUWebStart/src/main/jnlp/resources/version.xml b/BKUWebStart/src/main/jnlp/resources/version.xml index 4e263ded..763552fc 100644 --- a/BKUWebStart/src/main/jnlp/resources/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/version.xml @@ -8,6 +8,14 @@ BKUWebStart-1.0.5-SNAPSHOT.jar + + + utils-1.2.1-SNAPSHOT.jar + 1.2.1-SNAPSHOT + + utils-1.2.1-SNAPSHOT.jar + + commons-logging-1.0.4.jar @@ -98,12 +106,4 @@ stax-api-1.0-2.jar - - - utils-1.1.2-SNAPSHOT.jar - 1.1.2-SNAPSHOT - - utils-1.1.2-SNAPSHOT.jar - - diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml index 4d08d4e5..a6f6d96e 100644 --- a/BKUWebStart/src/main/jnlp/template.xml +++ b/BKUWebStart/src/main/jnlp/template.xml @@ -1,7 +1,4 @@ - @@ -31,13 +28,18 @@ #end + + + + $dependencies + + - $dependencies - + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 4a3369a7..bc0e3f4f 100644 --- a/pom.xml +++ b/pom.xml @@ -106,6 +106,11 @@ maven-buildnumber-plugin 0.9.6 + + org.codehaus.mojo.webstart + webstart-maven-plugin + 1.0-alpha-2 + -- cgit v1.2.3 From 79016a7b2f9d89e52e991b0abdfc73ad24e60979 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 13 Aug 2009 09:19:28 +0000 Subject: [#433] update BKU Web Start CertStore WebStart configuration refactored git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@423 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUWebStart/pom.xml | 337 ++++++++-------- .../java/at/gv/egiz/bku/webstart/BKULauncher.java | 418 -------------------- .../java/at/gv/egiz/bku/webstart/Configurator.java | 418 ++++++++++++++++++++ .../java/at/gv/egiz/bku/webstart/Container.java | 75 +++- .../java/at/gv/egiz/bku/webstart/Launcher.java | 230 +++++++++++ .../gv/egiz/bku/webstart/LogSecurityManager.java | 440 +++++++++++++++++++++ .../at/gv/egiz/bku/webstart/ui/TrayIconDialog.java | 2 +- BKUWebStart/src/main/jnlp/resources/img/logo.png | Bin 2609 -> 0 bytes .../src/main/jnlp/resources/img/logo_16.ico | Bin 0 -> 1406 bytes .../src/main/jnlp/resources/img/logo_16.png | Bin 0 -> 1084 bytes .../src/main/jnlp/resources/img/logo_16.xpm | 274 +++++++++++++ .../src/main/jnlp/resources/img/logo_32.png | Bin 0 -> 1522 bytes .../src/main/jnlp/resources/img/logo_64.gif | Bin 0 -> 1690 bytes .../src/main/jnlp/resources/img/logo_64.jpeg | Bin 0 -> 1347 bytes .../src/main/jnlp/resources/img/logo_64.png | Bin 0 -> 1689 bytes .../src/main/jnlp/resources/img/logo_64x64.png | Bin 2299 -> 0 bytes .../src/main/jnlp/resources/img/logo_90x90.png | Bin 3294 -> 0 bytes .../src/main/jnlp/resources/img/version.xml | 32 +- BKUWebStart/src/main/jnlp/resources/version.xml | 81 +++- BKUWebStart/src/main/jnlp/template-local.xml | 42 ++ BKUWebStart/src/main/jnlp/template.xml | 22 +- BKUWebStart/src/main/jnlp/template_dev.xml | 39 -- .../at/gv/egiz/bku/webstart/conf/conf.zip | Bin 0 -> 2944 bytes .../at/gv/egiz/bku/webstart/conf/configuration.zip | Bin 25738 -> 0 bytes .../gv/egiz/bku/webstart/ui/UIMessages.properties | 8 +- .../at/gv/egiz/bku/webstart/ui/trayicon.png | Bin 2609 -> 0 bytes .../at/gv/egiz/bku/webstart/ui/trayicon_16.png | Bin 0 -> 1084 bytes .../at/gv/egiz/bku/webstart/ui/trayicon_32.png | Bin 0 -> 2609 bytes BKUWebStart/src/main/resources/log4j.properties | 23 +- 29 files changed, 1770 insertions(+), 671 deletions(-) delete mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/LogSecurityManager.java delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_16.ico create mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_16.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_16.xpm create mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_32.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_64.gif create mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_64.jpeg create mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_64.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_64x64.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_90x90.png create mode 100644 BKUWebStart/src/main/jnlp/template-local.xml delete mode 100644 BKUWebStart/src/main/jnlp/template_dev.xml create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/conf.zip delete mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/configuration.zip delete mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon.png create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_16.png create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_32.png (limited to 'BKUWebStart/src') diff --git a/BKUWebStart/pom.xml b/BKUWebStart/pom.xml index 9ef1914f..a8e33a58 100644 --- a/BKUWebStart/pom.xml +++ b/BKUWebStart/pom.xml @@ -14,54 +14,24 @@ | IMPORTANT: update jnlp/resources/version.xml (BKUWebStart and utils) and | include-webstart profile in BKUOnline if version changes |--> - 1.0.5-SNAPSHOT + 1.0.9-SNAPSHOT http://mocca.egovlabs.gv.at/ - Bürgerkartenumgebung (MOCCA Web Start) - + Bürgerkartenumgebung + - - - + - org.apache.maven.plugins maven-dependency-plugin - - - - - - - copy BKULocal webapp - - copy-dependencies - - - at.gv.egiz - BKULocal - war - ${project.build.directory}/classes/ true + - org.codehaus.mojo.webstart webstart-maven-plugin + org.codehaus.mojo.webstart - + package - jnlp-inline @@ -113,56 +84,44 @@ - false - - - - ${project.basedir}/src/main/jnlp - template.xml - mocca.jnlp - at.gv.egiz.bku.webstart.BKULauncher + template-local.xml + mocca-local.jnlp + at.gv.egiz.bku.webstart.Launcher 1.6+ true true - test-applet signer ${project.basedir}/keystore.ks + storepass - keypass - true + keypass + true - false - false + false + false - - - true - - - - true - - + false + + false + true - - true - - org.codehaus.mojo maven-buildnumber-plugin + org.codehaus.mojo validate @@ -178,8 +137,8 @@ - org.apache.maven.plugins maven-jar-plugin + org.apache.maven.plugins @@ -194,114 +153,150 @@ - - - - at.gv.egiz - BKULocal - 1.0.6-SNAPSHOT - war - - - utils - at.gv.egiz - 1.2.1-SNAPSHOT - - - iaik_ecc_signed - iaik - - - - - commons-logging - commons-logging - 1.0.4 - - - org.mortbay.jetty - jetty - 6.1.15 - - - - + 1.0-beta-1-SNAPSHOT + + + NONE + PKCS11 + iaik.pkcs.pkcs11.provider.IAIKPkcs11 + a-sit + + true + + false + false + + + true + + true + + - - --> - - standalone (non-webstart) + include-webstart - org.apache.maven.plugins - maven-jar-plugin - - - - true - at.gv.egiz.bku.webstart.BKULauncher - - - development - ${pom.url} - splash_standalone.png - - - - + webstart-maven-plugin + org.codehaus.mojo.webstart + + + template.xml + mocca.jnlp + + false + + true + + - \ No newline at end of file + + + at.gv.egiz + BKULocal + 1.0.6-SNAPSHOT + war + + + at.gv.egiz + BKUCertificates + 1.0-SNAPSHOT + + + utils + at.gv.egiz + 1.2.1-SNAPSHOT + + + iaik_ecc_signed + iaik + + + + + commons-logging + commons-logging + + + + + org.mortbay.jetty + jetty + 6.1.19 + + + + org.mortbay.jetty + jsp-2.1-jetty + 6.1.19 + + + org.slf4j + slf4j-api + 1.5.8 + + + org.slf4j + slf4j-log4j12 + 1.5.8 + + + + + jre + javaws + 6.0 + jar + system + ${java.home}/lib/javaws.jar + + + diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java deleted file mode 100644 index abc0b8ee..00000000 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java +++ /dev/null @@ -1,418 +0,0 @@ -package at.gv.egiz.bku.webstart; - -import iaik.asn1.CodingException; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.MalformedURLException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.util.Enumeration; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -//import org.apache.commons.cli.CommandLine; -//import org.apache.commons.cli.CommandLineParser; -//import org.apache.commons.cli.HelpFormatter; -//import org.apache.commons.cli.Options; -//import org.apache.commons.cli.ParseException; -//import org.apache.commons.cli.PosixParser; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.bku.webstart.ui.BKUControllerInterface; -import at.gv.egiz.bku.webstart.ui.TrayIconDialog; -import at.gv.egiz.bku.utils.StreamUtil; -import java.awt.Desktop; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.FileInputStream; -import java.io.FileReader; -import java.io.FileWriter; -import java.net.BindException; -import java.net.URI; -import java.net.URL; -import java.security.GeneralSecurityException; -import java.util.UUID; -import java.util.jar.Attributes; -import java.util.jar.Manifest; -import java.util.zip.ZipOutputStream; -import org.mortbay.util.MultiException; - -public class BKULauncher implements BKUControllerInterface { - - /** configurations with less than this (major) version will be backuped and updated */ - public static final String MIN_CONFIG_VERSION = "1.0.3"; - public static final String CONFIG_DIR = ".mocca/conf/"; - public static final String CONF_TEMPLATE_FILE = "configuration.zip"; - public static final String CONF_TEMPLATE_RESOURCE = "at/gv/egiz/bku/webstart/conf/configuration.zip"; - public static final String WEBAPP_RESOURCE = "BKULocal.war"; - public static final String WEBAPP_FILE = "BKULocal.war"; - public static final String KEYSTORE_FILE = "keystore.ks"; - public static final String MESSAGES_RESOURCE = "at/gv/egiz/bku/webstart/ui/UIMessages"; - public static final String PASSWD_FILE = ".secret"; - /** resource bundle messages */ - public static final String GREETING_CAPTION = "Greetings.Caption"; - public static final String GREETING_MESSAGE = "Greetings.Message"; - public static final String STARTUP_CAPTION = "Startup.Caption"; - public static final String ERROR_CAPTION = "Error.Caption"; - public static final String STARTUP_MESSAGE = "Startup.Message"; - public static final String ERROR_STARTUP_MESSAGE = "Error.Startup.Message"; - public static final String ERROR_CONF_MESSAGE = "Error.Conf.Message"; - public static final String ERROR_BIND_MESSAGE = "Error.Bind.Message"; - public static final String VERSION_FILE = ".version"; - private static Log log = LogFactory.getLog(BKULauncher.class); - private ResourceBundle resourceBundle = null; - private Container server; - - private void createConfig(File configDir, File versionFile, String version) throws IOException, CertificateException, GeneralSecurityException, KeyStoreException, FileNotFoundException, NoSuchAlgorithmException { - log.debug("creating config directory: " + configDir); - configDir.mkdirs(); - InputStream is = getClass().getClassLoader().getResourceAsStream(CONF_TEMPLATE_RESOURCE); - OutputStream os = new FileOutputStream(new File(configDir, CONF_TEMPLATE_FILE)); - StreamUtil.copyStream(is, os); - os.close(); - File confTemplateFile = new File(configDir, CONF_TEMPLATE_FILE); - unzip(confTemplateFile); - confTemplateFile.delete(); - writeVersionFile(versionFile, version); - } - - private void createCertificates(File configDir) throws IOException, GeneralSecurityException, CodingException { - char[] password = UUID.randomUUID().toString().toCharArray(); - File passwdFile = new File(configDir, PASSWD_FILE); - FileWriter passwdWriter = new FileWriter(passwdFile); - passwdWriter.write(password); - passwdWriter.close(); - if (!passwdFile.setReadable(true, true)) { - passwdFile.delete(); - throw new IOException("failed to make " + passwdFile + " owner readable only, deleting file"); - } - TLSServerCA ca = new TLSServerCA(); - KeyStore ks = ca.generateKeyStore(password); - FileOutputStream fos = new FileOutputStream(new File(configDir, KEYSTORE_FILE)); - ks.store(fos, password); - fos.close(); - } - - private String getFileVersion(File versionFile) throws FileNotFoundException, IOException { - //TODO no file? - if (versionFile.exists() && versionFile.canRead()) { - BufferedReader versionReader = new BufferedReader(new FileReader(versionFile)); - String versionString = null; - while ((versionString = versionReader.readLine().trim()) != null) { - if (versionString.length() > 0 && !versionString.startsWith("#")) { - log.debug("found existing configuration version " + versionString); - break; - } - } - return versionString; - } - return null; - } - - private String getManifestVersion() throws MalformedURLException, IOException { - String bkuWebStartJar = BKULauncher.class.getProtectionDomain().getCodeSource().getLocation().toString(); - URL manifestURL = new URL("jar:" + bkuWebStartJar + "!/META-INF/MANIFEST.MF"); - String version = null; - if (manifestURL != null) { - Manifest manifest = new Manifest(manifestURL.openStream()); - if (log.isTraceEnabled()) { - log.trace("read version information from " + manifestURL); - } - Attributes atts = manifest.getMainAttributes(); - if (atts != null) { - version = atts.getValue("Implementation-Build"); - } - } - if (version == null) { - version = "UNKNOWN"; - } - log.debug("config version: " + version); - return version; - } - - /** - * change the - * @param oldVersion - * @param newVersion - * @return - */ - private boolean updateRequired(String oldVersion, String newVersion) { - if (oldVersion != null) { - log.debug("comparing " + oldVersion + " to " + MIN_CONFIG_VERSION); - - int majorEnd = oldVersion.indexOf('-'); - String oldMajor = (majorEnd < 0) ? oldVersion : oldVersion.substring(0, majorEnd); - - int compare = oldMajor.compareTo(MIN_CONFIG_VERSION); - if (compare < 0 || - // SNAPSHOT versions are pre-releases (update if release required) - (compare == 0 && oldVersion.startsWith("-SNAPSHOT", majorEnd))) { - return true; - } else { - return false; - } - } - log.debug("no old version, update required"); - return true; - } - - private boolean updateRequiredStrict(String oldVersion, String newVersion) { - String[] oldV = oldVersion.split("-"); - String[] newV = newVersion.split("-"); - log.debug("comparing " + oldV[0] + " to " + newV[0]); - if (oldV[0].compareTo(newV[0]) < 0) { - log.debug("update required"); - return true; - } else { - log.debug("comparing " + oldV[oldV.length - 1] + " to " + newV[newV.length - 1]); - if (oldV[oldV.length - 1].compareTo(newV[newV.length - 1]) < 0) { - log.debug("update required"); - return true; - } else { - log.debug("no update required"); - return false; - } - } - } - - private void writeVersionFile(File versionFile, String version) throws IOException { - BufferedWriter versionWriter = new BufferedWriter(new FileWriter(versionFile)); - versionWriter.write("# MOCCA Web Start configuration version\n"); - versionWriter.write("# DO NOT MODIFY THIS FILE\n\n"); - versionWriter.write(version); - versionWriter.close(); - } - -// private SplashScreen splash = SplashScreen.getSplashScreen(); - private void startUpServer() throws Exception { - log.info("init servlet container and MOCCA webapp"); - server = new Container(); - // XmlConfiguration xcfg = new XmlConfiguration(getClass().getClassLoader() - // .getResourceAsStream("at/gv/egiz/bku/local/app/jetty.xml")); - // xcfg.configure(server); - server.init(); - server.start(); - } - - private void initTrayIcon() { - log.debug("init MOCCA tray icon"); - Locale loc = Locale.getDefault(); - try { - resourceBundle = ResourceBundle.getBundle( - MESSAGES_RESOURCE, loc); - } catch (MissingResourceException mx) { - resourceBundle = ResourceBundle.getBundle( - MESSAGES_RESOURCE, Locale.ENGLISH); - } - TrayIconDialog.getInstance().init(resourceBundle); - TrayIconDialog.getInstance().setShutdownHook(this); -// TrayIconDialog.getInstance().displayInfo(GREETING_CAPTION, GREETING_MESSAGE); - } - - private void initStart() { - } - - private void initFinished(boolean installCert) { - try { -// if (splash != null) { -// try { -// splash.close(); -// } catch (IllegalStateException ex) { -// log.warn("Failed to close splash screen: " + ex.getMessage()); -// } -// } - - if (installCert) { - log.debug("trying install MOCCA certificate on system browser"); - if (Desktop.isDesktopSupported()) { - Desktop desktop = Desktop.getDesktop(); - if (desktop.isSupported(Desktop.Action.BROWSE)) { - try { - desktop.browse(new URI("https://localhost:" + - Integer.getInteger(Container.HTTPS_PORT_PROPERTY, 3496).intValue())); - } catch (Exception ex) { - log.error("failed to open system browser, install MOCCA certificate manually", ex); - } - } else { - log.error("failed to open system browser, install MOCCA certificate manually"); - } - } else { - log.error("failed to open system browser, install MOCCA certificate manually"); - } - } - - log.info("init completed, joining server"); - server.join(); - } catch (InterruptedException e) { - log.warn("failed to join MOCCA server: " + e.getMessage(), e); - } - } - - private void unzip(File zipfile) throws IOException { - File dir = zipfile.getParentFile(); - ZipFile zipFile = new ZipFile(zipfile); - Enumeration entries = zipFile.entries(); - while (entries.hasMoreElements()) { - ZipEntry entry = entries.nextElement(); - File eF = new File(dir, entry.getName()); - if (entry.isDirectory()) { - eF.mkdirs(); - continue; - } - File f = new File(eF.getParent()); - f.mkdirs(); - StreamUtil.copyStream(zipFile.getInputStream(entry), - new FileOutputStream(eF)); - } - zipFile.close(); - } - - /** - * @param args - */ - public static void main(String[] args) throws InterruptedException { - - if (log.isDebugEnabled()) { - //System.setProperty("DEBUG", "true"); - System.setProperty("VERBOSE", "true"); - System.setProperty("javax.net.debug", "ssl,handshake"); - } - -// log.warn("***** DISABLING SECURITY MANAGER *******"); - System.setSecurityManager(null); - - BKULauncher launcher = new BKULauncher(); - launcher.initStart(); - - boolean installCert = false; - - launcher.initTrayIcon(); - TrayIconDialog.getInstance().displayInfo(STARTUP_CAPTION, STARTUP_MESSAGE); - - try { - File configDir = new File(System.getProperty("user.home") + '/' + CONFIG_DIR); - installCert = launcher.ensureConfig(configDir); - } catch (Exception ex) { - log.fatal("Failed to init MOCCA configuration, exiting", ex); - TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_CONF_MESSAGE); - Thread.sleep(5000); - System.exit(-1000); - } - - try { - launcher.startUpServer(); - TrayIconDialog.getInstance().displayInfo(GREETING_CAPTION, GREETING_MESSAGE); - launcher.initFinished(installCert); - } catch (BindException ex) { - log.fatal("Failed to launch MOCCA, " + ex.getMessage(), ex); - TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_BIND_MESSAGE); - Thread.sleep(5000); - System.exit(-1000); - } catch (MultiException ex) { - log.fatal("Failed to launch MOCCA, " + ex.getMessage(), ex); - if (ex.getThrowable(0) instanceof BindException) { - TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_BIND_MESSAGE); - } else { - TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_STARTUP_MESSAGE); - } - Thread.sleep(5000); - System.exit(-1000); - } catch (Exception e) { - log.fatal("Failed to launch MOCCA, " + e.getMessage(), e); - TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_STARTUP_MESSAGE); - Thread.sleep(5000); - System.exit(-1000); - } - - } - - private void backupAndDelete(File dir, URI relativeTo, ZipOutputStream zip) throws IOException { - if (dir.isDirectory()) { - File[] subDirs = dir.listFiles(); - for (File subDir : subDirs) { - backupAndDelete(subDir, relativeTo, zip); - subDir.delete(); - } - } else { - URI relativePath = relativeTo.relativize(dir.toURI()); - ZipEntry entry = new ZipEntry(relativePath.toString()); - zip.putNextEntry(entry); - BufferedInputStream entryIS = new BufferedInputStream(new FileInputStream(dir)); - StreamUtil.copyStream(entryIS, zip); - entryIS.close(); - zip.closeEntry(); - dir.delete(); - } - } - - /** - * Checks whether the config directory already exists and creates it otherwise. - * @param configDir the config directory to be created - * @return true if a new MOCCA cert was created (and needs to be installed in the browser) - */ - private boolean ensureConfig(File configDir) throws IOException, GeneralSecurityException, CodingException { - log.debug("config directory: " + configDir); - String manifestVersion = getManifestVersion(); - File versionFile = new File(configDir, VERSION_FILE); - - if (configDir.exists()) { - if (configDir.isFile()) { - log.error("invalid config directory: " + configDir); - throw new IOException("invalid config directory: " + configDir); - } else { - String fileVersion = getFileVersion(versionFile); - if (updateRequired(fileVersion, manifestVersion)) { - if (fileVersion == null) { - fileVersion = "unknown"; - } - log.info("updating configuration from " + fileVersion + " to " + manifestVersion); - File moccaDir = configDir.getParentFile(); - File zipFile = new File(moccaDir, "conf-" + fileVersion + ".zip"); - ZipOutputStream zipOS = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile))); - backupAndDelete(configDir, moccaDir.toURI(), zipOS); - zipOS.close(); - createConfig(configDir, versionFile, manifestVersion); - createCertificates(configDir); - return true; - } - } - } else { - createConfig(configDir, versionFile, manifestVersion); - createCertificates(configDir); - return true; - } - return false; - } - - public void shutDown() { - log.info("Shutting down server"); - if ((server != null) && (server.isRunning())) { - try { - if (server.isRunning()) { - server.stop(); - } - } catch (Exception e) { - log.debug(e.toString()); - } finally { - if (server.isRunning()) { - server.destroy(); - } - } - } - System.exit(0); - } -} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java new file mode 100644 index 00000000..ab1746ed --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java @@ -0,0 +1,418 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.webstart; + +import at.gv.egiz.bku.utils.StreamUtil; +import iaik.asn1.CodingException; +import iaik.xml.crypto.utils.Utils; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.jar.Attributes; +import java.util.jar.Manifest; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipOutputStream; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.eclipse.jdt.core.dom.ThisExpression; + +/** + * + * @author Clemens Orthacker + */ +public class Configurator { + + /** + * MOCCA configuration + * configurations with less than this (major) version will be backuped and updated + * allowed: MAJOR[.MINOR[.X[-SNAPSHOT]]] + */ + public static final String MIN_CONFIG_VERSION = "1.0.9-SNAPSHOT"; + public static final String CONFIG_DIR = ".mocca/conf/"; + public static final String CERTS_DIR = ".mocca/certs/"; + public static final String VERSION_FILE = ".version"; + public static final String UNKOWN_VERSION = "unknown"; + public static final String CONF_TEMPLATE_FILE = "conf-tmp.zip"; + public static final String CONF_TEMPLATE_RESOURCE = "at/gv/egiz/bku/webstart/conf/conf.zip"; + public static final String CERTIFICATES_PKG = "at/gv/egiz/bku/certs"; + + /** + * MOCCA TLS certificate + */ + public static final String KEYSTORE_FILE = "keystore.ks"; + public static final String PASSWD_FILE = ".secret"; + + private static final Log log = LogFactory.getLog(Configurator.class); + + /** currently installed configuration version */ + private String version; + private String certsVersion; + /** whether a new MOCCA TLS cert was created during initialization */ + private boolean certRenewed = false; + + /** + * Checks whether the config directory already exists and creates it otherwise. + * @param configDir the config directory to be created + * @throws IOException config/certificate creation failed + * @throws GeneralSecurityException if MOCCA TLS certificate could not be created + * @throws CodingException if MOCCA TLS certificate could not be created + */ + public void ensureConfiguration() throws IOException, CodingException, GeneralSecurityException { + File configDir = new File(System.getProperty("user.home") + '/' + CONFIG_DIR); + if (configDir.exists()) { + if (configDir.isFile()) { + log.error("invalid config directory: " + configDir); + throw new IOException("invalid config directory: " + configDir); + } else { + version = readVersion(new File(configDir, VERSION_FILE)); + if (log.isDebugEnabled()) { + log.debug("config directory " + configDir + ", version " + version); + } + if (updateRequired(version)) { + File moccaDir = configDir.getParentFile(); + File zipFile = new File(moccaDir, "conf-" + version + ".zip"); + ZipOutputStream zipOS = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile))); + log.info("backup configuration to " + zipFile); + backupAndDelete(configDir, moccaDir.toURI(), zipOS); + zipOS.close(); + initConfig(configDir); + } + } + } else { + initConfig(configDir); + } + } + + /** + * To be replaced by TSLs in IAIK-PKI + * @throws IOException + */ + public void ensureCertificates() throws IOException { + File certsDir = new File(System.getProperty("user.home") + '/' + CERTS_DIR); + if (certsDir.exists()) { + if (certsDir.isFile()) { + log.error("invalid certificate store directory: " + certsDir); + throw new IOException("invalid config directory: " + certsDir); + } else { + certsVersion = readVersion(new File(certsDir, VERSION_FILE)); + if (log.isDebugEnabled()) { + log.debug("certificate-store directory " + certsDir + ", version " + certsVersion); + } + String newCertsVersion = getCertificatesVersion(); + if (updateRequiredStrict(certsVersion, newCertsVersion)) { + File moccaDir = certsDir.getParentFile(); + File zipFile = new File(moccaDir, "certs-" + certsVersion + ".zip"); + ZipOutputStream zipOS = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile))); + log.info("backup certificates to " + zipFile); + backupAndDelete(certsDir, moccaDir.toURI(), zipOS); + zipOS.close(); + + createCerts(certsDir, newCertsVersion); + certsVersion = newCertsVersion; + } + } + } else { + String newCertsVersion = getCertificatesVersion(); + createCerts(certsDir, newCertsVersion); + certsVersion = newCertsVersion; + } + } + + /** + * + * @return whether a new MOCCA TLS certificate has been created during initialization + */ + public boolean isCertRenewed() { + return certRenewed; + } + + /** + * @return The first valid (not empty, no comment) line of the version file or + * "unknown" if version file cannot be read or does not contain such a line. + */ + protected static String readVersion(File versionFile) { + if (versionFile.exists() && versionFile.canRead()) { + BufferedReader versionReader = null; + try { + versionReader = new BufferedReader(new FileReader(versionFile)); + String version; + while ((version = versionReader.readLine().trim()) != null) { + if (version.length() > 0 && !version.startsWith("#")) { + log.debug("configuration version from " + versionFile + ": " + version); + return version; + } + } + } catch (IOException ex) { + log.error("failed to read configuration version from " + versionFile, ex); + } finally { + try { + versionReader.close(); + } catch (IOException ex) { + } + } + } + log.debug("unknown configuration version"); + return UNKOWN_VERSION; + } + + /** + * Temporary workaround, replace with TSLs in IAIK-PKI. + * Retrieves version from BKUCertificates.jar Manifest file. + * The (remote) resource URL will be handled by the JNLP loader, + * and the resource retrieved from the cache. + * + * @return + * @throws IOException + */ + private static String getCertificatesVersion() throws IOException { + String certsResourceVersion = null; + URL certsURL = Configurator.class.getClassLoader().getResource(CERTIFICATES_PKG); + if (certsURL != null) { + StringBuilder url = new StringBuilder(certsURL.toExternalForm()); + url = url.replace(url.length() - CERTIFICATES_PKG.length(), url.length(), "META-INF/MANIFEST.MF"); + log.trace("retrieve certificates resource version from " + url); + certsURL = new URL(url.toString()); + Manifest certsManifest = new Manifest(certsURL.openStream()); + Attributes atts = certsManifest.getMainAttributes(); + if (atts != null) { + certsResourceVersion = atts.getValue("Implementation-Version"); + log.debug("certs resource version: " + certsResourceVersion); + } + } else { + log.error("Failed to retrieve certificates resource " + CERTIFICATES_PKG); + throw new IOException("Failed to retrieve certificates resource " + CERTIFICATES_PKG); + } + return certsResourceVersion; + } + + protected static boolean updateRequired(String oldVersion) { + log.debug("comparing " + oldVersion + " to " + MIN_CONFIG_VERSION); + if (oldVersion != null && !UNKOWN_VERSION.equals(oldVersion)) { + + int majorEnd = oldVersion.indexOf('-'); + String oldMajor = (majorEnd < 0) ? oldVersion : oldVersion.substring(0, majorEnd); + + String minMajor = MIN_CONFIG_VERSION; + boolean releaseRequired = true; + if (MIN_CONFIG_VERSION.endsWith("-SNAPSHOT")) { + releaseRequired = false; + minMajor = minMajor.substring(0, minMajor.length() - 9); + } + + int compare = oldMajor.compareTo(minMajor); + if (compare < 0 || + // SNAPSHOT versions are pre-releases (update if release required) + (compare == 0 && releaseRequired && oldVersion.startsWith("-SNAPSHOT", majorEnd))) { + log.debug("configuration update required"); + return true; + } else { + log.debug("configuration up to date"); + return false; + } + } + log.debug("no old version, configuration update required"); + return true; + } + + /** + * if unknown old, update in any case + * if known old and unknown new, don't update + * @param oldVersion + * @param newVersion + * @return + */ + private boolean updateRequiredStrict(String oldVersion, String newVersion) { + log.debug("comparing " + oldVersion + " to " + newVersion); + if (oldVersion != null && !UNKOWN_VERSION.equals(oldVersion)) { + if (newVersion != null && !UNKOWN_VERSION.equals(newVersion)) { + String[] oldV = oldVersion.split("-"); + String[] newV = newVersion.split("-"); + log.trace("comparing " + oldV[0] + " to " + newV[0]); + if (oldV[0].compareTo(newV[0]) < 0) { + log.debug("update required"); + return true; + } else { + log.trace("comparing " + oldV[oldV.length - 1] + " to " + newV[newV.length - 1]); + if (oldV[oldV.length - 1].compareTo(newV[newV.length - 1]) < 0) { + log.debug("update required"); + return true; + } else { + log.debug("no update required"); + return false; + } + } + } + log.debug("unknown new version, do not update"); + return true; + } + log.debug("unknown old version, update required"); + return true; + } + + protected static void backupAndDelete(File dir, URI relativeTo, ZipOutputStream zip) throws IOException { + if (dir.isDirectory()) { + File[] subDirs = dir.listFiles(); + for (File subDir : subDirs) { + backupAndDelete(subDir, relativeTo, zip); + subDir.delete(); + } + } else { + URI relativePath = relativeTo.relativize(dir.toURI()); + ZipEntry entry = new ZipEntry(relativePath.toString()); + zip.putNextEntry(entry); + BufferedInputStream entryIS = new BufferedInputStream(new FileInputStream(dir)); + StreamUtil.copyStream(entryIS, zip); + entryIS.close(); + zip.closeEntry(); + dir.delete(); + } + } + + /** + * set up a new MOCCA local configuration + * (not to be called directly, call ensureConfiguration()) + * @throws IOException config/certificate creation failed + * @throws GeneralSecurityException if MOCCA TLS certificate could not be created + * @throws CodingException if MOCCA TLS certificate could not be created + */ + protected void initConfig(File configDir) throws IOException, GeneralSecurityException, CodingException { + createConfig(configDir, Launcher.version); + version = Launcher.version; + createKeyStore(configDir); + certRenewed = true; + } + + private static void createConfig(File configDir, String version) throws IOException { + if (log.isDebugEnabled()) { + log.debug("creating configuration version " + Launcher.version + " in " + configDir ); + } + configDir.mkdirs(); + File confTemplateFile = new File(configDir, CONF_TEMPLATE_FILE); + InputStream is = Configurator.class.getClassLoader().getResourceAsStream(CONF_TEMPLATE_RESOURCE); + OutputStream os = new BufferedOutputStream(new FileOutputStream(confTemplateFile)); + StreamUtil.copyStream(is, os); + os.close(); + unzip(confTemplateFile, configDir); + confTemplateFile.delete(); + writeVersionFile(new File(configDir, VERSION_FILE), version); + } + + /** + * set up a new MOCCA local certStore + * @throws IOException config/certificate creation failed + * @throws GeneralSecurityException if MOCCA TLS certificate could not be created + * @throws CodingException if MOCCA TLS certificate could not be created + */ + private static void createCerts(File certsDir, String certsVersion) throws IOException { + if (log.isDebugEnabled()) { + log.debug("creating certificate-store " + certsDir + ", version " + certsVersion); + } + URL certsURL = Configurator.class.getClassLoader().getResource(CERTIFICATES_PKG); + if (certsURL != null) { + StringBuilder url = new StringBuilder(certsURL.toExternalForm()); + url = url.replace(url.length() - CERTIFICATES_PKG.length(), url.length(), "META-INF/MANIFEST.MF"); + log.debug("retrieve certificate resource names from " + url); + certsURL = new URL(url.toString()); + Manifest certsManifest = new Manifest(certsURL.openStream()); + certsDir.mkdirs(); + Iterator entries = certsManifest.getEntries().keySet().iterator(); + while (entries.hasNext()) { + String entry = entries.next(); + if (entry.startsWith(CERTIFICATES_PKG)) { + String f = entry.substring(CERTIFICATES_PKG.length()); // "/trustStore/..." + new File(certsDir, f.substring(0, f.lastIndexOf('/'))).mkdirs(); + BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(certsDir, f))); + log.debug(f); + StreamUtil.copyStream(Configurator.class.getClassLoader().getResourceAsStream(entry), bos); + bos.close(); + } else { + log.trace("ignore " + entry); + } + } + writeVersionFile(new File(certsDir, VERSION_FILE), certsVersion); + } else { + log.error("Failed to retrieve certificates resource " + CERTIFICATES_PKG); + throw new IOException("Failed to retrieve certificates resource " + CERTIFICATES_PKG); + } + } + + private static void unzip(File zipfile, File toDir) throws IOException { + ZipFile zipFile = new ZipFile(zipfile); + Enumeration entries = zipFile.entries(); + while (entries.hasMoreElements()) { + ZipEntry entry = entries.nextElement(); + File eF = new File(toDir, entry.getName()); + if (entry.isDirectory()) { + eF.mkdirs(); + continue; + } + File f = new File(eF.getParent()); + f.mkdirs(); + StreamUtil.copyStream(zipFile.getInputStream(entry), + new FileOutputStream(eF)); + } + zipFile.close(); + } + + private static void writeVersionFile(File versionFile, String version) throws IOException { + BufferedWriter versionWriter = new BufferedWriter(new FileWriter(versionFile)); + versionWriter.write("# MOCCA Web Start configuration version\n"); + versionWriter.write("# DO NOT MODIFY THIS FILE\n\n"); + versionWriter.write(version); + versionWriter.close(); + } + + private static void createKeyStore(File configDir) throws IOException, GeneralSecurityException, CodingException { + char[] password = UUID.randomUUID().toString().toCharArray(); + File passwdFile = new File(configDir, PASSWD_FILE); + FileWriter passwdWriter = new FileWriter(passwdFile); + passwdWriter.write(password); + passwdWriter.close(); + if (!passwdFile.setReadable(false, false) || !passwdFile.setReadable(true, true)) { + passwdFile.delete(); + throw new IOException("failed to make " + passwdFile + " owner readable only, deleting file"); + } + TLSServerCA ca = new TLSServerCA(); + KeyStore ks = ca.generateKeyStore(password); + File ksFile = new File(configDir, KEYSTORE_FILE); + FileOutputStream fos = new FileOutputStream(ksFile); + ks.store(fos, password); + fos.close(); + } +} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java index 89044486..4df90ab2 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java @@ -1,22 +1,28 @@ package at.gv.egiz.bku.webstart; import at.gv.egiz.bku.utils.StreamUtil; +import java.awt.AWTPermission; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; +import java.io.FilePermission; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.lang.reflect.ReflectPermission; +import java.net.NetPermission; +import java.net.SocketPermission; +import java.security.Permissions; +import java.security.SecurityPermission; +import java.util.PropertyPermission; +import javax.smartcardio.CardPermission; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.mortbay.jetty.Connector; -import org.mortbay.jetty.Handler; import org.mortbay.jetty.Server; -import org.mortbay.jetty.handler.DefaultHandler; -import org.mortbay.jetty.handler.HandlerCollection; import org.mortbay.jetty.nio.SelectChannelConnector; import org.mortbay.jetty.security.SslSocketConnector; import org.mortbay.jetty.webapp.WebAppContext; @@ -28,12 +34,18 @@ public class Container { public static final String HTTPS_PORT_PROPERTY = "mocca.http.port"; private static Log log = LogFactory.getLog(Container.class); + static { + if (log.isDebugEnabled()) { + //Jetty log INFO and WARN, include ignored exceptions + //jetty logging may be further restricted by setting level in log4j.properties + System.setProperty("VERBOSE", "true"); + //do not set Jetty DEBUG logging, produces loads of output + //System.setProperty("DEBUG", "true"); + } + } private Server server; - public Container() { - } - public void init() throws IOException { // System.setProperty("DEBUG", "true"); server = new Server(); @@ -55,15 +67,15 @@ public class Container { sslConnector.setPort(Integer.getInteger(HTTPS_PORT_PROPERTY, 3496).intValue()); sslConnector.setAcceptors(1); sslConnector.setHost("127.0.0.1"); - File configDir = new File(System.getProperty("user.home") + "/" + BKULauncher.CONFIG_DIR); - File keystoreFile = new File(configDir, BKULauncher.KEYSTORE_FILE); + File configDir = new File(System.getProperty("user.home") + "/" + Configurator.CONFIG_DIR); + File keystoreFile = new File(configDir, Configurator.KEYSTORE_FILE); if (!keystoreFile.canRead()) { log.error("MOCCA keystore file not readable: " + keystoreFile.getAbsolutePath()); throw new FileNotFoundException("MOCCA keystore file not readable: " + keystoreFile.getAbsolutePath()); } log.debug("loading MOCCA keystore from " + keystoreFile.getAbsolutePath()); sslConnector.setKeystore(keystoreFile.getAbsolutePath()); - File passwdFile = new File(configDir, BKULauncher.PASSWD_FILE); + File passwdFile = new File(configDir, Configurator.PASSWD_FILE); BufferedReader reader = new BufferedReader(new FileReader(passwdFile)); String pwd; while ((pwd = reader.readLine()) != null) { @@ -107,7 +119,6 @@ public class Container { sslConnector.setExcludeCipherSuites(RFC4492CipherSuites); - server.setConnectors(new Connector[] { connector, sslConnector }); WebAppContext webapp = new WebAppContext(); @@ -116,13 +127,13 @@ public class Container { webapp.setExtractWAR(true); webapp.setParentLoaderPriority(false); - webapp.setWar(copyWebapp(webapp.getTempDirectory())); //getClass().getClassLoader().getResource("BKULocalWar/").toString()); - + webapp.setWar(copyWebapp(webapp.getTempDirectory())); + webapp.setPermissions(getPermissions(webapp.getTempDirectory())); + server.setHandler(webapp); server.setGracefulShutdown(1000*3); } - private String copyWebapp(File webappDir) throws IOException { File webapp = new File(webappDir, "BKULocal.war"); log.debug("copying BKULocal classpath resource to " + webapp); @@ -133,6 +144,44 @@ public class Container { return webapp.getPath(); } + private Permissions getPermissions(File webappDir) { + Permissions perms = new Permissions(); + + // jetty-webstart (spring?) + perms.add(new RuntimePermission("getClassLoader")); + + // standard permissions + perms.add(new PropertyPermission("*", "read")); + perms.add(new RuntimePermission("accessDeclaredMembers")); + perms.add(new RuntimePermission("accessClassInPackage.*")); + perms.add(new RuntimePermission("defineClassInPackage.*")); + perms.add(new RuntimePermission("setFactory")); + perms.add(new RuntimePermission("getProtectionDomain")); + perms.add(new RuntimePermission("modifyThread")); + perms.add(new RuntimePermission("modifyThreadGroup")); + perms.add(new RuntimePermission("setFactory")); + perms.add(new ReflectPermission("suppressAccessChecks")); + + // MOCCA specific + perms.add(new SocketPermission("*", "connect,resolve")); + perms.add(new NetPermission("specifyStreamHandler")); + perms.add(new SecurityPermission("insertProvider.*")); + perms.add(new SecurityPermission("putProviderProperty.*")); + perms.add(new SecurityPermission("removeProvider.*")); + perms.add(new CardPermission("*", "*")); + perms.add(new AWTPermission("*")); + + perms.add(new FilePermission(webappDir.getAbsolutePath() + "/-", "read")); + perms.add(new FilePermission(new File(System.getProperty("java.home") + "/lib/xalan.properties").getAbsolutePath(), "read")); + perms.add(new FilePermission(new File(System.getProperty("java.home") + "/lib/xerces.properties").getAbsolutePath(), "read")); + perms.add(new FilePermission(new File(System.getProperty("user.home")).getAbsolutePath(), "read, write")); + perms.add(new FilePermission(new File(System.getProperty("user.home") + "/-").getAbsolutePath(), "read, write")); + perms.add(new FilePermission(new File(System.getProperty("user.home") + "/.mocca/logs/*").getAbsolutePath(), "read, write,delete")); + + + return perms; + } + public void start() throws Exception { server.start(); } 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 new file mode 100644 index 00000000..f7be7b65 --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java @@ -0,0 +1,230 @@ +package at.gv.egiz.bku.webstart; + +import iaik.asn1.CodingException; +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +import javax.jnlp.UnavailableServiceException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.webstart.ui.BKUControllerInterface; +import at.gv.egiz.bku.webstart.ui.TrayIconDialog; +import com.sun.javaws.security.JavaWebStartSecurity; +import java.awt.Desktop; +import java.awt.SplashScreen; +import java.net.BindException; +import java.net.URI; +import java.net.URL; +import java.security.GeneralSecurityException; +import java.util.jar.Attributes; +import java.util.jar.Manifest; +import javax.jnlp.BasicService; +import javax.jnlp.ServiceManager; +import org.mortbay.util.MultiException; + +public class Launcher implements BKUControllerInterface { + + public static final String WEBAPP_RESOURCE = "BKULocal.war"; + public static final String CERTIFICATES_RESOURCE = "BKUCertificates.jar"; + public static final String WEBAPP_FILE = "BKULocal.war"; + public static final String MESSAGES_RESOURCE = "at/gv/egiz/bku/webstart/ui/UIMessages"; + /** resource bundle messages */ + public static final String GREETING_CAPTION = "Greetings.Caption"; + public static final String GREETING_MESSAGE = "Greetings.Message"; + public static final String CONFIG_CAPTION = "Config.Caption"; + public static final String CONFIG_MESSAGE = "Config.Message"; + public static final String STARTUP_CAPTION = "Startup.Caption"; + public static final String STARTUP_MESSAGE = "Startup.Message"; + public static final String ERROR_CAPTION = "Error.Caption"; + public static final String ERROR_STARTUP_MESSAGE = "Error.Startup.Message"; + public static final String ERROR_CONF_MESSAGE = "Error.Conf.Message"; + public static final String ERROR_BIND_MESSAGE = "Error.Bind.Message"; + public static final URI HTTPS_SECURITY_LAYER_URI; + private static Log log = LogFactory.getLog(Launcher.class); + + static { + URI tmp = null; + try { + tmp = new URI("https://localhost:" + Integer.getInteger(Container.HTTPS_PORT_PROPERTY, 3496).intValue()); + } catch (URISyntaxException ex) { + log.error(ex); + } finally { + HTTPS_SECURITY_LAYER_URI = tmp; + } + } + + public static final String version; + static { + String tmp = Configurator.UNKOWN_VERSION; + try { + String bkuWebStartJar = Launcher.class.getProtectionDomain().getCodeSource().getLocation().toString(); + URL manifestURL = new URL("jar:" + bkuWebStartJar + "!/META-INF/MANIFEST.MF"); + if (log.isTraceEnabled()) { + log.trace("read version information from " + manifestURL); + } + Manifest manifest = new Manifest(manifestURL.openStream()); + Attributes atts = manifest.getMainAttributes(); + if (atts != null) { + tmp = atts.getValue("Implementation-Build"); + } + } catch (IOException ex) { + log.error("failed to read version", ex); + } finally { + version = tmp; + log.info("BKU Web Start " + version); + } + } + + private Configurator config; + private Container server; + private BasicService basicService; + + private void initStart() { + try { + basicService = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService"); + if (basicService.isOffline()) { + log.info("launching MOCCA Web Start offline"); + } else { + log.info("launching MOCCA Web Start online"); + } + } catch (UnavailableServiceException ex) { + log.info("Failed to obtain JNLP service: " + ex.getMessage()); + } + } + + private void initTrayIcon() { + log.debug("init MOCCA tray icon"); + Locale loc = Locale.getDefault(); + ResourceBundle resourceBundle; + try { + resourceBundle = ResourceBundle.getBundle( + MESSAGES_RESOURCE, loc); + } catch (MissingResourceException mx) { + resourceBundle = ResourceBundle.getBundle( + MESSAGES_RESOURCE, Locale.ENGLISH); + } + TrayIconDialog.getInstance().init(resourceBundle); + TrayIconDialog.getInstance().setShutdownHook(this); +// TrayIconDialog.getInstance().displayInfo(GREETING_CAPTION, GREETING_MESSAGE); + } + + private void initConfig() throws IOException, CodingException, GeneralSecurityException { + config = new Configurator(); + config.ensureConfiguration(); + config.ensureCertificates(); + } + + private void startServer() throws Exception { + log.info("init servlet container and MOCCA webapp"); + server = new Container(); + server.init(); + server.start(); + } + + private void initFinished() { + try { + // standalone (non-webstart) version has splashscreen + if (SplashScreen.getSplashScreen() != null) { + try { + SplashScreen.getSplashScreen().close(); + } catch (IllegalStateException ex) { + log.warn("Failed to close splash screen: " + ex.getMessage()); + } + } + if (config.isCertRenewed()) { + // don't use basicService.showDocument(), which causes a java ssl warning dialog + if (Desktop.isDesktopSupported()) { + Desktop desktop = Desktop.getDesktop(); + if (desktop.isSupported(Desktop.Action.BROWSE)) { + try { + desktop.browse(HTTPS_SECURITY_LAYER_URI); + } catch (Exception ex) { + log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URI, ex); + } + } else { + log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URI); + } + } else { + log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URI); + } + } + log.info("BKU successfully started"); + server.join(); + } catch (InterruptedException e) { + log.warn("failed to join server: " + e.getMessage(), e); + } + } + + @Override + public void shutDown() { + log.info("Shutting down server"); + if ((server != null) && (server.isRunning())) { + try { + if (server.isRunning()) { + server.stop(); + } + } catch (Exception e) { + log.debug(e.toString()); + } finally { + if (server.isRunning()) { + server.destroy(); + } + } + } + System.exit(0); + } + + public static void main(String[] args) throws InterruptedException, IOException { + + if (log.isTraceEnabled()) { + SecurityManager sm = System.getSecurityManager(); + if (sm instanceof JavaWebStartSecurity) { + System.setSecurityManager(new LogSecurityManager((JavaWebStartSecurity) sm)); + } + } + + Launcher launcher = new Launcher(); + launcher.initStart(); + launcher.initTrayIcon(); //keep reference? BKULauncher not garbage collected after main() + + try { + TrayIconDialog.getInstance().displayInfo(CONFIG_CAPTION, CONFIG_MESSAGE); + launcher.initConfig(); + } catch (Exception ex) { + log.fatal("Failed to initialize configuration", ex); + TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_CONF_MESSAGE); + Thread.sleep(5000); + System.exit(-1000); + } + + try { + TrayIconDialog.getInstance().displayInfo(STARTUP_CAPTION, STARTUP_MESSAGE); + launcher.startServer(); + TrayIconDialog.getInstance().displayInfo(GREETING_CAPTION, GREETING_MESSAGE); + launcher.initFinished(); + } catch (BindException ex) { + log.fatal("Failed to launch server, " + ex.getMessage(), ex); + TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_BIND_MESSAGE); + Thread.sleep(5000); + System.exit(-1000); + } catch (MultiException ex) { + log.fatal("Failed to launch server, " + ex.getMessage(), ex); + if (ex.getThrowable(0) instanceof BindException) { + TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_BIND_MESSAGE); + } else { + TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_STARTUP_MESSAGE); + } + Thread.sleep(5000); + System.exit(-1000); + } catch (Exception e) { + log.fatal("Failed to launch server, " + e.getMessage(), e); + TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_STARTUP_MESSAGE); + Thread.sleep(5000); + System.exit(-1000); + } + } +} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/LogSecurityManager.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/LogSecurityManager.java new file mode 100644 index 00000000..99fd403b --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/LogSecurityManager.java @@ -0,0 +1,440 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.webstart; + +import com.sun.javaws.security.JavaWebStartSecurity; +import java.io.FileDescriptor; +import java.net.InetAddress; +import java.security.Permission; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * JVM argument -Djava.security.debug=access,failure + * (passed as attribute to java element in jnlp) is ignored. + * + * @author Clemens Orthacker + */ +public class LogSecurityManager extends SecurityManager { + + protected static final Log log = LogFactory.getLog(LogSecurityManager.class); + JavaWebStartSecurity sm; + + public LogSecurityManager(JavaWebStartSecurity sm) { + this.sm = sm; +// AppPolicy policy = AppPolicy.getInstance(); +// SecurityManager sm = System.getSecurityManager(); + } + + @Override + public void checkAccept(String host, int port) { + try { + sm.checkAccept(host, port); + } catch (SecurityException ex) { + log.warn("checkAccept(" + host + ", " + port + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkAccess(Thread g) { + try { + sm.checkAccess(g); + } catch (SecurityException ex) { + log.warn("checkAccess(" + g + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkAccess(ThreadGroup g) { + try { + sm.checkAccess(g); + } catch (SecurityException ex) { + log.warn("checkAccess(" + g + "): " + ex.getMessage(), ex); + throw ex; + } + + } + + @Override + public void checkAwtEventQueueAccess() { + try { + sm.checkAwtEventQueueAccess(); + } catch (SecurityException ex) { + log.warn("checkAwtEventQAccess():" + ex.getMessage(), ex); + throw ex; + } + + } + + @Override + public void checkConnect(String host, int port) { + try { + sm.checkConnect(host, port); + } catch (SecurityException ex) { + log.warn("checkConnect(" + host + ", " + port + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkConnect(String host, int port, Object context) { + try { + sm.checkConnect(host, port, context); + } catch (SecurityException ex) { + log.warn("checkConnect(" + host + ", " + port + ", " + context + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkCreateClassLoader() { + try { + sm.checkCreateClassLoader(); + } catch (SecurityException ex) { + log.warn("checkCreateClassLoader(): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkDelete(String file) { + try { + sm.checkDelete(file); + } catch (SecurityException ex) { + log.warn("checkDelete(" + file + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkExec(String cmd) { + try { + sm.checkExec(cmd); + } catch (SecurityException ex) { + log.warn("checkExec(" + cmd + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkExit(int status) { + try { + sm.checkExit(status); + } catch (SecurityException ex) { + log.warn("checkExit(" + status + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkLink(String lib) { + try { + sm.checkLink(lib); + } catch (SecurityException ex) { + log.warn("checkLink(" + lib + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkListen(int port) { + try { + sm.checkListen(port); + } catch (SecurityException ex) { + log.warn("checkListen(" + port + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkMemberAccess(Class clazz, int which) { + try { + sm.checkMemberAccess(clazz, which); + } catch (SecurityException ex) { + log.warn("checkMemberAccess(" + clazz + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkMulticast(InetAddress maddr) { + try { + sm.checkMulticast(maddr); + } catch (SecurityException ex) { + log.warn("checkMulticast(" + maddr + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkMulticast(InetAddress maddr, byte ttl) { + try { + sm.checkMulticast(maddr,ttl); + } catch (SecurityException ex) { + log.warn("checkMulticast(" + maddr + "," + ttl + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkPackageAccess(String pkg) { + try { + sm.checkPackageAccess(pkg); + } catch (SecurityException ex) { + log.warn("checkPackageAccess(" + pkg + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkPackageDefinition(String pkg) { + try { + sm.checkPackageDefinition(pkg); + } catch (SecurityException ex) { + log.warn("checkPackageDefinition(" + pkg + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkPermission(Permission perm) { + try { + sm.checkPermission(perm); + } catch (SecurityException ex) { + log.warn("checkPermission(" + perm.toString() + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkPermission(Permission perm, Object context) { + try { + sm.checkPermission(perm, context); + } catch (SecurityException ex) { + log.warn("checkPermission(" + perm.toString() + ", ctx): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkPrintJobAccess() { + try { + sm.checkPrintJobAccess(); + } catch (SecurityException ex) { + log.info("checkPrintJobAccess(): " + ex.getMessage(), ex); + throw ex; + } + } + + /** + * allowed + */ + @Override + public void checkPropertiesAccess() { + try { + sm.checkPropertiesAccess(); + } catch (SecurityException ex) { + log.info("checkPropertiesAccess(): " + ex.getMessage(), ex); + throw ex; + } + } + + /** + * access to all properties allowed + * @param key + */ + @Override + public void checkPropertyAccess(String key) { + try { + sm.checkPropertyAccess(key); + } catch (SecurityException ex) { + log.info("checkPropertyAccess(" + key + "): " + ex.getMessage()); + throw ex; + } + } + + @Override + public void checkRead(FileDescriptor fd) { + try { + sm.checkRead(fd); + } catch (SecurityException ex) { + log.warn("checkRead(" + fd + ") " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkRead(String file) { + try { + sm.checkRead(file); + } catch (SecurityException ex) { + log.warn("checkRead(" + file + ") " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkRead(String file, Object context) { + try { + sm.checkRead(file, context); + } catch (SecurityException ex) { + log.warn("checkRead(" + file + ") " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkSecurityAccess(String target) { + try { + sm.checkSecurityAccess(target); + } catch (SecurityException ex) { + log.info("checkSecurityAccess(" + target + "): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public void checkSetFactory() { + log.info("checkSetFactory() "); + try { + sm.checkSetFactory(); + } catch (SecurityException ex) { + log.warn("checkSetFactroy(): " + ex.getMessage(), ex); + throw ex; + } + + } + + @Override + public void checkSystemClipboardAccess() { + try { + sm.checkSystemClipboardAccess(); + } catch (SecurityException ex) { + log.info("checkSystemClipboardAccess(): " + ex.getMessage(), ex); + throw ex; + } + } + + @Override + public boolean checkTopLevelWindow(Object window) { + log.info("checkTopLevelWindow(Object window)"); + try { + return sm.checkTopLevelWindow(window); + } catch (SecurityException ex) { + log.warn("checkTopLevelWindow(" + window + "): " + ex.getMessage(), ex); + throw ex; + } + + } + + @Override + public void checkWrite(FileDescriptor fd) { + try { + sm.checkWrite(fd); + } catch (SecurityException ex) { + log.info("checkWrite(" + fd + "): " + ex.getMessage(), ex); + } + } + + @Override + public void checkWrite(String file) { + try { + sm.checkWrite(file); + } catch (SecurityException ex) { + log.info("checkWrite(" + file + "): " + ex.getMessage(), ex); + } + } + +// @Override +// protected int classDepth(String name) { +// log.info("classDepth(String name)"); return this.classDepth(name); +// } +// +// @Override +// protected int classLoaderDepth() { +// log.info("classLoaderDepth"); return sm.classLoaderDepth(); +// } +// +// @Override +// protected Object clone() throws CloneNotSupportedException { +// log.info("clone"); return sm.clone(); +// } +// +// @Override +// protected ClassLoader currentClassLoader() { +// log.info("currentClassLoader"); return sm.currentClassLoader(); +// } +// +// @Override +// protected Class currentLoadedClass() { +// log.info("currentLoadedClass"); return sm.currentLoadedClass(); +// } + @Override + public boolean equals(Object obj) { + log.info("equals"); + return sm.equals(obj); + } + +// @Override +// protected void finalize() throws Throwable { +// log.info("finalize"); sm.finalize(); +// } +// @Override +// protected Class[] getClassContext() { +// log.info("getClassContext"); return sm.getClassContext(); +// } + @Override + public boolean getInCheck() { + log.info("getInCheck"); + return sm.getInCheck(); + } + + @Override + public Object getSecurityContext() { + log.info("getSecurityContext"); + return sm.getSecurityContext(); + } + + @Override + public ThreadGroup getThreadGroup() { + log.info("getThreadGroup"); + return sm.getThreadGroup(); + } + + @Override + public int hashCode() { + log.info("hashCode"); + return sm.hashCode(); + } + +// @Override +// protected boolean inClass(String name) { +// log.info("inClass"); return sm.inClass(name); +// } +// +// @Override +// protected boolean inClassLoader() { +// log.info(""); return sm.inClassLoader(); +// } + @Override + public String toString() { + log.info("toString"); + return sm.toString(); + } +} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java index 9990b2a0..fb7c40dd 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java @@ -36,7 +36,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class TrayIconDialog implements TrayIconDialogInterface { - public static final String TRAYICON_RESOURCE = "at/gv/egiz/bku/webstart/ui/trayicon.png"; + public static final String TRAYICON_RESOURCE = "at/gv/egiz/bku/webstart/ui/trayicon_32.png"; public static final String TRAYMENU_SHUTDOWN = "TrayMenu.Shutdown"; public static final String TRAYMENU_TOOLTIP = "TrayMenu.Tooltip"; diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo.png b/BKUWebStart/src/main/jnlp/resources/img/logo.png deleted file mode 100644 index 2c622d88..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/logo.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_16.ico b/BKUWebStart/src/main/jnlp/resources/img/logo_16.ico new file mode 100644 index 00000000..eaedb0ad Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/logo_16.ico differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_16.png b/BKUWebStart/src/main/jnlp/resources/img/logo_16.png new file mode 100644 index 00000000..f84f108d Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/logo_16.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_16.xpm b/BKUWebStart/src/main/jnlp/resources/img/logo_16.xpm new file mode 100644 index 00000000..de557170 --- /dev/null +++ b/BKUWebStart/src/main/jnlp/resources/img/logo_16.xpm @@ -0,0 +1,274 @@ +/* XPM */ +static char * logo_16x16_xpm[] = { +"16 16 255 2", +" c #EDF2FA", +". c #555249", +"+ c #F3F6FC", +"@ c #ED1C24", +"# c #939698", +"$ c #FFE699", +"% c #BBAA76", +"& c #464749", +"* c #CCCCCC", +"= c #EE262D", +"- c #FCDADC", +"; c #6B6E72", +"> c #FDE4E5", +", c #D0D6DE", +"' c #968C78", +") c #848182", +"! c #535458", +"~ c #76797E", +"{ c #EE2C33", +"] c #444444", +"^ c #80848A", +"/ c #5A636E", +"( c #738974", +"_ c #ACAEB1", +": c #929F98", +"< c #47443F", +"[ c #363436", +"} c #E4ECF7", +"| c #5D5E61", +"1 c #F14C53", +"2 c #A2A3A5", +"3 c #EF333A", +"4 c #515052", +"5 c #5C685E", +"6 c #FDEAEB", +"7 c #7A7B7D", +"8 c #9FA1A4", +"9 c #FBFCFE", +"0 c #4B514D", +"a c #888A8C", +"b c #777777", +"c c #525355", +"d c #E7EEF8", +"e c #A4A9AF", +"f c #F04148", +"g c #FFF4D7", +"h c #616365", +"i c #231F20", +"j c #D4DDE9", +"k c #918F8F", +"l c #8A8E95", +"m c #F1CA3F", +"n c #B5BBC5", +"o c #F1F1F1", +"p c #9FA5AD", +"q c #363432", +"r c #888888", +"s c #FFFFFF", +"t c #7D745A", +"u c #94875D", +"v c #999999", +"w c #5F6165", +"x c #635E51", +"y c #C8C7C7", +"z c #CAD1DD", +"A c #5A5758", +"B c #C0C7D1", +"C c #9399A1", +"D c #E4C14B", +"E c #AE9B5E", +"F c #BAB9B9", +"G c #C9AE59", +"H c #767374", +"I c #D6D5D5", +"J c #DDDDDD", +"K c #666666", +"L c #E3E3E3", +"M c #ACABAB", +"N c #222222", +"O c #9E9D9D", +"P c #333333", +"Q c #EEEEEE", +"R c #BBA55C", +"S c #BBBBBB", +"T c #706A56", +"U c #3F3B3C", +"V c #A1915E", +"W c #686566", +"X c #AAB0B9", +"Y c #111111", +"Z c #444344", +"` c #897E5C", +" . c #4C494A", +".. c #669DCD", +"+. c #C6C8CA", +"@. c #555556", +"#. c #312D2E", +"$. c #5F6A78", +"%. c #6C95BC", +"&. c #D6B853", +"*. c #525962", +"=. c #636467", +"-. c #6C8AAA", +";. c #E1E2E3", +">. c #DE9E56", +",. c #70B76A", +"'. c #6C90B3", +"). c #AB875E", +"!. c #F2575D", +"~. c #B9BBBD", +"{. c #FFF1CC", +"]. c #424347", +"^. c #4A4E55", +"/. c #637183", +"(. c #ED2028", +"_. c #65778C", +":. c #688268", +"<. c #7C7F81", +"[. c #706355", +"}. c #B88E5F", +"|. c #C5945D", +"1. c #565E58", +"2. c #D9ECD4", +"3. c #72A26F", +"4. c #72AA6E", +"5. c #FBB161", +"6. c #AAAAAA", +"7. c #937A5D", +"8. c #6B84A0", +"9. c #FFEDB5", +"0. c #F1CE5D", +"a. c #FFDBB4", +"b. c #697E96", +"c. c #EAA151", +"d. c #92CD8B", +"e. c #77C371", +"f. c #7C6C59", +"g. c #719B6E", +"h. c #FCBB75", +"i. c #FFD742", +"j. c #606162", +"k. c #6C6C6E", +"l. c #E2E3E4", +"m. c #6999C5", +"n. c #D4D5D7", +"o. c #F7F9FD", +"p. c #635950", +"q. c #F0F0F1", +"r. c #FDE3E4", +"s. c #706F6D", +"t. c #FFDD6F", +"u. c #787E88", +"v. c #D6BC69", +"w. c #EEEFF0", +"x. c #63615A", +"y. c #89C982", +"z. c #AEA58E", +"A. c #F3F9F1", +"B. c #4D5056", +"C. c #6E926C", +"D. c #6C8A6A", +"E. c #E4C564", +"F. c #77A0C8", +"G. c #898169", +"H. c #FFF7EE", +"I. c #333336", +"J. c #727878", +"K. c #AE9D66", +"L. c #607160", +"M. c #6B756F", +"N. c #71B16C", +"O. c #948A6C", +"P. c #7DC479", +"Q. c #D6BA5E", +"R. c #E1F0DE", +"S. c #ADD8A4", +"T. c #6E737C", +"U. c #9E8262", +"V. c #535D54", +"W. c #7D7766", +"X. c #A1A6AD", +"Y. c #D3D4D7", +"Z. c #ADAAA6", +"`. c #B7B9BC", +" + c #C39765", +".+ c #F25E64", +"++ c #F36268", +"@+ c #769C74", +"#+ c #B69166", +"$+ c #F9FBFD", +"%+ c #FFFBFB", +"&+ c #FFE07C", +"*+ c #646B68", +"=+ c #6D6965", +"-+ c #738498", +";+ c #C8BEA3", +">+ c #C1C4C9", +",+ c #A19984", +"'+ c #E4C979", +")+ c #F1D375", +"!+ c #80C679", +"~+ c #B3B6BC", +"{+ c #8D9096", +"]+ c #9FA8A1", +"^+ c #CFD9CE", +"/+ c #FED5A9", +"(+ c #D5D9E0", +"_+ c #8D877F", +":+ c #697B6A", +"<+ c #FFFBF0", +"[+ c #E3D4AC", +"}+ c #F1CC4F", +"|+ c #FFD954", +"1+ c #C8E4C0", +"2+ c #BEE0B7", +"3+ c #D6BE73", +"4+ c #857869", +"5+ c #E5E1DC", +"6+ c #85A7CB", +"7+ c #C9B26C", +"8+ c #D4C6B5", +"9+ c #C9B67E", +"0+ c #FFE5CA", +"a+ c #FCB66B", +"b+ c #E4E4E5", +"c+ c #E3E4E5", +"d+ c #E8EBEF", +"e+ c #EBEDF0", +"f+ c #87898C", +"g+ c #B19E7E", +"h+ c #B5C2BF", +"i+ c #FDC180", +"j+ c #EE2930", +"k+ c #E4E8EE", +"l+ c #565552", +"m+ c #E4CE8D", +"n+ c #636C79", +"o+ c #A3D49B", +"p+ c #858B94", +"q+ c #84868C", +"r+ c #F1D069", +"s+ c #D2995A", +"t+ c #B8BEC6", +"u+ c #EF3B42", +"v+ c #474444", +"w+ c #E1E5EC", +"x+ c #FDFEFE", +"y+ c #FFF7E3", +"z+ c #62A1D7", +"A+ c #6DC067", +"B+ c #FAA74A", +"C+ c #FFD531", +"D+ c #E0EAF7", +"E+ c #000000", +"F+ c #FFFFFF", +" 9 _ & < K.i.u i T R C+G x C+C+", +"+.& < E C+R . q q u C+C+T G C+C+", +"i t m m T q u m m x . m . C+C+C+", +"t D t q ` m C+C+C+C+t . < G E t ", +"x . E m C+C+C+C+C+C+C+. T u E m ", +"i m C+C+C+C+C+C+C+C+m T t C+C+C+", +"< V C+C+C+C+C+m D ` q x &.C+C+C+", +"G < C+C+C+E < . i x G C+C+C+C+C+", +"C+x V E < x E &.i G C+C+C+C+C+C+", +"}+` i ` D C+C+C+x x C+C+C+C+C+C+", +". R t E C+C+C+C+G i G C+C+C+C+C+", +"l+i.m x C+C+C+C+C+< x C+C+C+C+C+", +"i 7+C+u G C+C+E < q i G C+C+C+C+", +"i x.C+C+t E < x R C+< t C+C+C+C+", +"& i '+G x x D C+C+C+E i D C+C+C+", +"_ i [ V m u C+C+C+C+D i T m u < "}; diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_32.png b/BKUWebStart/src/main/jnlp/resources/img/logo_32.png new file mode 100644 index 00000000..337b144b Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/logo_32.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_64.gif b/BKUWebStart/src/main/jnlp/resources/img/logo_64.gif new file mode 100644 index 00000000..6081d1a1 Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/logo_64.gif differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_64.jpeg b/BKUWebStart/src/main/jnlp/resources/img/logo_64.jpeg new file mode 100644 index 00000000..720157a5 Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/logo_64.jpeg differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_64.png b/BKUWebStart/src/main/jnlp/resources/img/logo_64.png new file mode 100644 index 00000000..9e9b377c Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/logo_64.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_64x64.png b/BKUWebStart/src/main/jnlp/resources/img/logo_64x64.png deleted file mode 100644 index fa6d7f96..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/logo_64x64.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_90x90.png b/BKUWebStart/src/main/jnlp/resources/img/logo_90x90.png deleted file mode 100644 index d7f8bbd0..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/logo_90x90.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/version.xml b/BKUWebStart/src/main/jnlp/resources/img/version.xml index 715b6722..31f43441 100644 --- a/BKUWebStart/src/main/jnlp/resources/img/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/img/version.xml @@ -2,10 +2,38 @@ - logo.png + logo_16.xpm 1.0-SNAPSHOT - logo.png + logo_16.xpm + + + + logo_16.ico + 1.0-SNAPSHOT + + logo_16.ico + + + + logo_16.png + 1.0-SNAPSHOT + + logo_16.png + + + + logo_32.png + 1.0-SNAPSHOT + + logo_32.png + + + + logo_64.png + 1.0-SNAPSHOT + + logo_64.png diff --git a/BKUWebStart/src/main/jnlp/resources/version.xml b/BKUWebStart/src/main/jnlp/resources/version.xml index 763552fc..47c17088 100644 --- a/BKUWebStart/src/main/jnlp/resources/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/version.xml @@ -2,12 +2,11 @@ - BKUWebStart-1.0.5-SNAPSHOT.jar - 1.0.5-SNAPSHOT + BKUWebStart-1.0.9-SNAPSHOT.jar + 1.0.9-SNAPSHOT - BKUWebStart-1.0.5-SNAPSHOT.jar + BKUWebStart-1.0.9-SNAPSHOT.jar - utils-1.2.1-SNAPSHOT.jar @@ -15,13 +14,20 @@ utils-1.2.1-SNAPSHOT.jar + + + BKUCertificates-1.0-SNAPSHOT.jar + 1.0-SNAPSHOT + + BKUCertificates-1.0-SNAPSHOT.jar + - commons-logging-1.0.4.jar - 1.0.4 + commons-logging-1.1.1.jar + 1.1.1 - commons-logging-1.0.4.jar + commons-logging-1.1.1.jar @@ -64,17 +70,17 @@ - jetty-6.1.15.jar - 6.1.15 + jetty-6.1.19.jar + 6.1.19 - jetty-6.1.15.jar + jetty-6.1.19.jar - jetty-util-6.1.15.jar - 6.1.15 + jetty-util-6.1.19.jar + 6.1.19 - jetty-util-6.1.15.jar + jetty-util-6.1.19.jar @@ -83,6 +89,55 @@ servlet-api-2.5-20081211.jar + + + jsp-2.1-jetty-6.1.19.jar + 6.1.19 + + jsp-2.1-jetty-6.1.19.jar + + + + jsp-2.1-glassfish-9.1.1.B60.25.p0.jar + 9.1.1.B60.25.p0 + + jsp-2.1-glassfish-9.1.1.B60.25.p0.jar + + + + jsp-api-2.1-glassfish-9.1.1.B60.25.p0.jar + 9.1.1.B60.25.p0 + + jsp-api-2.1-glassfish-9.1.1.B60.25.p0.jar + + + + ant-1.6.5.jar + 1.6.5 + + ant-1.6.5.jar + + + + core-3.1.1.jar + 3.1.1 + + core-3.1.1.jar + + + + slf4j-api-1.5.8.jar + 1.5.8 + + slf4j-api-1.5.8.jar + + + + slf4j-log4j12-1.5.8.jar + 1.5.8 + + slf4j-log4j12-1.5.8.jar + diff --git a/BKUWebStart/src/main/jnlp/template-local.xml b/BKUWebStart/src/main/jnlp/template-local.xml new file mode 100644 index 00000000..9135ba1b --- /dev/null +++ b/BKUWebStart/src/main/jnlp/template-local.xml @@ -0,0 +1,42 @@ + + + + + + $project.Description + + E-Government Innovationszentrum (EGIZ) + + $project.Description (BKU) MOCCA Web Start + $project.Description + + + + + + + + + + +#if($offlineAllowed) + +#end + + + +#if($allPermissions) + + + +#end + + + + + + $dependencies + + + + \ No newline at end of file diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml index a6f6d96e..0176376a 100644 --- a/BKUWebStart/src/main/jnlp/template.xml +++ b/BKUWebStart/src/main/jnlp/template.xml @@ -4,12 +4,16 @@ $project.Description - $project.Organization.Name + + E-Government Innovationszentrum (EGIZ) - $project.Description + $project.Description (BKU) MOCCA Web Start $project.Description - - + + + + + @@ -20,23 +24,23 @@ #end - - + #if($allPermissions) #end + + - + $dependencies - - + $dependencies diff --git a/BKUWebStart/src/main/jnlp/template_dev.xml b/BKUWebStart/src/main/jnlp/template_dev.xml deleted file mode 100644 index 2d8e8133..00000000 --- a/BKUWebStart/src/main/jnlp/template_dev.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - $project.Name - $project.Organization.Name - - $project.Description - $project.Description - - - - - - - -#if($offlineAllowed) - -#end - - - - -#if($allPermissions) - - - -#end - - - - - - - $dependencies - - - - \ No newline at end of file diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/conf.zip b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/conf.zip new file mode 100644 index 00000000..1df56e5c Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/conf.zip differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/configuration.zip b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/configuration.zip deleted file mode 100644 index 74465445..00000000 Binary files a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/configuration.zip and /dev/null differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties index eb2b74c0..bf4e5b8a 100644 --- a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties +++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties @@ -1,11 +1,13 @@ #-------- tray icon messages ------- -TrayMenu.Tooltip=B\u00FCrgerkartenumgebung (MOCCA Web Start) +TrayMenu.Tooltip=B\u00FCrgerkartenumgebung TrayMenu.Shutdown=B\u00FCrgerkartenumgebung beenden +Config.Message=Zertifikate werden geladen +Config.Caption=B\u00FCrgerkartenumgebung Startup.Message=B\u00FCrgerkartenumgebung wird gestartet... -Startup.Caption=B\u00FCrgerkartenumgebung (MOCCA Web Start) +Startup.Caption=B\u00FCrgerkartenumgebung Greetings.Message=B\u00FCrgerkartenumgebung erfolgreich gestartet -Greetings.Caption=B\u00FCrgerkartenumgebung (MOCCA Web Start) +Greetings.Caption=B\u00FCrgerkartenumgebung Error.Caption=Fehler Error.Startup.Message=B\u00FCrgerkartenumgebung konnte nicht gestartet werden Error.Conf.Message=Konfiguration konnte nicht initialisiert werden, B\u00FCrberkartenumgebung wird nicht gestartet diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon.png deleted file mode 100644 index 2c622d88..00000000 Binary files a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon.png and /dev/null differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_16.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_16.png new file mode 100644 index 00000000..f84f108d Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_16.png differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_32.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_32.png new file mode 100644 index 00000000..2c622d88 Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_32.png differ diff --git a/BKUWebStart/src/main/resources/log4j.properties b/BKUWebStart/src/main/resources/log4j.properties index 4df33ab5..76de3576 100644 --- a/BKUWebStart/src/main/resources/log4j.properties +++ b/BKUWebStart/src/main/resources/log4j.properties @@ -1,5 +1,24 @@ +# Copyright 2008 Federal Chancellery Austria and +# Graz University of Technology +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # loglever DEBUG, appender STDOUT -log4j.rootLogger=TRACE, STDOUT, file +log4j.rootLogger=DEBUG, file +log4j.logger.org.mortbay.log=INFO +log4j.logger.pki=INFO + +log4j.additivity.pki=false # STDOUT appender log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender @@ -13,4 +32,4 @@ log4j.appender.file=org.apache.log4j.DailyRollingFileAppender log4j.appender.file.datePattern='.'yyyy-MM-dd log4j.appender.file.File=${user.home}/.mocca/logs/webstart.log log4j.appender.file.layout=org.apache.log4j.PatternLayout -log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n \ No newline at end of file +log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %-5p %c{1}:%L - %m%n \ No newline at end of file -- cgit v1.2.3 From fe103510aabea195b66bf222d87fd5dfd7a64041 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 13 Aug 2009 09:23:32 +0000 Subject: [#433] update BKU Web Start CertStore WebStart configuration refactored git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@424 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUWebStart/pom.xml | 2 +- BKUWebStart/src/main/jnlp/resources/version.xml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'BKUWebStart/src') diff --git a/BKUWebStart/pom.xml b/BKUWebStart/pom.xml index a8e33a58..79f4925f 100644 --- a/BKUWebStart/pom.xml +++ b/BKUWebStart/pom.xml @@ -14,7 +14,7 @@ | IMPORTANT: update jnlp/resources/version.xml (BKUWebStart and utils) and | include-webstart profile in BKUOnline if version changes |--> - 1.0.9-SNAPSHOT + 1.0.10-SNAPSHOT http://mocca.egovlabs.gv.at/ Bürgerkartenumgebung diff --git a/BKUWebStart/src/main/jnlp/resources/version.xml b/BKUWebStart/src/main/jnlp/resources/version.xml index 47c17088..67b319ca 100644 --- a/BKUWebStart/src/main/jnlp/resources/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/version.xml @@ -2,10 +2,10 @@ - BKUWebStart-1.0.9-SNAPSHOT.jar - 1.0.9-SNAPSHOT + BKUWebStart-1.0.10-SNAPSHOT.jar + 1.0.10-SNAPSHOT - BKUWebStart-1.0.9-SNAPSHOT.jar + BKUWebStart-1.0.10-SNAPSHOT.jar -- cgit v1.2.3 From a8e021a5b4450e117b76d9f6cc69bd24cd1dd5d3 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 14 Aug 2009 10:55:59 +0000 Subject: fixed updateRequired function git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@434 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../java/at/gv/egiz/bku/webstart/Configurator.java | 159 ++++++++++++------- .../java/at/gv/egiz/bku/webstart/Container.java | 4 + .../at/gv/egiz/bku/webstart/conf/conf.zip | Bin 2944 -> 3005 bytes BKUWebStart/src/main/resources/log4j.properties | 2 +- .../at/gv/egiz/bku/webstart/ConfiguratorTest.java | 175 +++++++++++++++++++++ .../src/test/resources/commons-logging.properties | 1 + BKUWebStart/src/test/resources/log4j.properties | 35 +++++ 7 files changed, 320 insertions(+), 56 deletions(-) create mode 100644 BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java create mode 100644 BKUWebStart/src/test/resources/commons-logging.properties create mode 100644 BKUWebStart/src/test/resources/log4j.properties (limited to 'BKUWebStart/src') diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java index ab1746ed..f1349637 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java @@ -79,7 +79,7 @@ public class Configurator { public static final String PASSWD_FILE = ".secret"; private static final Log log = LogFactory.getLog(Configurator.class); - + /** currently installed configuration version */ private String version; private String certsVersion; @@ -104,7 +104,7 @@ public class Configurator { if (log.isDebugEnabled()) { log.debug("config directory " + configDir + ", version " + version); } - if (updateRequired(version)) { + if (updateRequired(version, MIN_CONFIG_VERSION)) { File moccaDir = configDir.getParentFile(); File zipFile = new File(moccaDir, "conf-" + version + ".zip"); ZipOutputStream zipOS = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile))); @@ -135,7 +135,7 @@ public class Configurator { log.debug("certificate-store directory " + certsDir + ", version " + certsVersion); } String newCertsVersion = getCertificatesVersion(); - if (updateRequiredStrict(certsVersion, newCertsVersion)) { + if (updateRequired(certsVersion, newCertsVersion)) { File moccaDir = certsDir.getParentFile(); File zipFile = new File(moccaDir, "certs-" + certsVersion + ".zip"); ZipOutputStream zipOS = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile))); @@ -174,7 +174,7 @@ public class Configurator { String version; while ((version = versionReader.readLine().trim()) != null) { if (version.length() > 0 && !version.startsWith("#")) { - log.debug("configuration version from " + versionFile + ": " + version); + log.trace("configuration version from " + versionFile + ": " + version); return version; } } @@ -221,70 +221,119 @@ public class Configurator { return certsResourceVersion; } - protected static boolean updateRequired(String oldVersion) { - log.debug("comparing " + oldVersion + " to " + MIN_CONFIG_VERSION); - if (oldVersion != null && !UNKOWN_VERSION.equals(oldVersion)) { - - int majorEnd = oldVersion.indexOf('-'); - String oldMajor = (majorEnd < 0) ? oldVersion : oldVersion.substring(0, majorEnd); - - String minMajor = MIN_CONFIG_VERSION; - boolean releaseRequired = true; - if (MIN_CONFIG_VERSION.endsWith("-SNAPSHOT")) { - releaseRequired = false; - minMajor = minMajor.substring(0, minMajor.length() - 9); - } - - int compare = oldMajor.compareTo(minMajor); - if (compare < 0 || - // SNAPSHOT versions are pre-releases (update if release required) - (compare == 0 && releaseRequired && oldVersion.startsWith("-SNAPSHOT", majorEnd))) { - log.debug("configuration update required"); - return true; - } else { - log.debug("configuration up to date"); - return false; - } - } - log.debug("no old version, configuration update required"); - return true; - } - /** * if unknown old, update in any case - * if known old and unknown new, don't update + * if known old and unknown min, don't update * @param oldVersion - * @param newVersion + * @param minVersion * @return */ - private boolean updateRequiredStrict(String oldVersion, String newVersion) { - log.debug("comparing " + oldVersion + " to " + newVersion); + protected static boolean updateRequired(String oldVersion, String minVersion) { + log.debug("comparing " + oldVersion + " to " + minVersion); if (oldVersion != null && !UNKOWN_VERSION.equals(oldVersion)) { - if (newVersion != null && !UNKOWN_VERSION.equals(newVersion)) { - String[] oldV = oldVersion.split("-"); - String[] newV = newVersion.split("-"); - log.trace("comparing " + oldV[0] + " to " + newV[0]); - if (oldV[0].compareTo(newV[0]) < 0) { - log.debug("update required"); - return true; - } else { - log.trace("comparing " + oldV[oldV.length - 1] + " to " + newV[newV.length - 1]); - if (oldV[oldV.length - 1].compareTo(newV[newV.length - 1]) < 0) { + if (minVersion != null && !UNKOWN_VERSION.equals(minVersion)) { + int fromInd = 0; + int nextIndOld, nextIndMin; + int xOld, xMin; + + // assume dots '.' appear in major version only (not after "-SNAPSHOT") + while ((nextIndOld = oldVersion.indexOf('.', fromInd)) > 0) { + nextIndMin = minVersion.indexOf('.', fromInd); + if (nextIndMin < 0) { + log.debug("installed version newer than minimum required (newer minor version)"); + } + xOld = Integer.valueOf(oldVersion.substring(fromInd, nextIndOld)); + xMin = Integer.valueOf(minVersion.substring(fromInd, nextIndMin)); + if (xMin > xOld) { log.debug("update required"); return true; - } else { - log.debug("no update required"); + } else if (xMin < xOld) { + log.debug("installed version newer than minimum required"); return false; } + fromInd = nextIndOld + 1; + } + + // compare last digit of major + boolean preRelease = true; + int majorEndOld = oldVersion.indexOf("-SNAPSHOT"); + if (majorEndOld < 0) { + preRelease = false; + majorEndOld = oldVersion.length(); + } + + boolean releaseRequired = false; + int majorEndMin = minVersion.indexOf("-SNAPSHOT"); + if (majorEndMin < 0) { + releaseRequired = true; + majorEndMin = minVersion.length(); + } + + xOld = Integer.valueOf(oldVersion.substring(fromInd, majorEndOld)); + boolean hasMoreDigitsMin = true; + nextIndMin = minVersion.indexOf('.', fromInd); + if (nextIndMin < 0) { + hasMoreDigitsMin = false; + nextIndMin = majorEndMin; + } + xMin = Integer.valueOf(minVersion.substring(fromInd, nextIndMin)); + if (xMin > xOld) { + log.debug("update required"); + return true; + } else if (xMin < xOld) { + log.debug("installed version newer than minimum required"); + return false; + } else if (hasMoreDigitsMin) { // xMin == xOld + log.debug("update required (newer minor version required)"); + return true; + } else if (preRelease && releaseRequired) { + log.debug("pre-release installed but release required"); + return true; + } else { + log.debug("exact match, no updated required"); + return false; } } - log.debug("unknown new version, do not update"); - return true; + log.debug("unknown minimum version, do not update"); + return false; } - log.debug("unknown old version, update required"); + log.debug("no old version, update required"); return true; } - + + /** + + * @param oldVersion + * @param newVersion + * @return + */ +// private boolean updateRequiredStrict(String oldVersion, String newVersion) { +// log.debug("comparing " + oldVersion + " to " + newVersion); +// if (oldVersion != null && !UNKOWN_VERSION.equals(oldVersion)) { +// if (newVersion != null && !UNKOWN_VERSION.equals(newVersion)) { +// String[] oldV = oldVersion.split("-"); +// String[] newV = newVersion.split("-"); +// log.trace("comparing " + oldV[0] + " to " + newV[0]); +// if (oldV[0].compareTo(newV[0]) < 0) { +// log.debug("update required"); +// return true; +// } else { +// log.trace("comparing " + oldV[oldV.length - 1] + " to " + newV[newV.length - 1]); +// if (oldV[oldV.length - 1].compareTo(newV[newV.length - 1]) < 0) { +// log.debug("update required"); +// return true; +// } else { +// log.debug("no update required"); +// return false; +// } +// } +// } +// log.debug("unknown new version, do not update"); +// return true; +// } +// log.debug("unknown old version, update required"); +// return true; +// } protected static void backupAndDelete(File dir, URI relativeTo, ZipOutputStream zip) throws IOException { if (dir.isDirectory()) { File[] subDirs = dir.listFiles(); @@ -320,7 +369,7 @@ public class Configurator { private static void createConfig(File configDir, String version) throws IOException { if (log.isDebugEnabled()) { - log.debug("creating configuration version " + Launcher.version + " in " + configDir ); + log.debug("creating configuration version " + Launcher.version + " in " + configDir); } configDir.mkdirs(); File confTemplateFile = new File(configDir, CONF_TEMPLATE_FILE); @@ -347,7 +396,7 @@ public class Configurator { if (certsURL != null) { StringBuilder url = new StringBuilder(certsURL.toExternalForm()); url = url.replace(url.length() - CERTIFICATES_PKG.length(), url.length(), "META-INF/MANIFEST.MF"); - log.debug("retrieve certificate resource names from " + url); + log.trace("retrieve certificate resource names from " + url); certsURL = new URL(url.toString()); Manifest certsManifest = new Manifest(certsURL.openStream()); certsDir.mkdirs(); diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java index 4df90ab2..a2947833 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java @@ -177,7 +177,11 @@ public class Container { perms.add(new FilePermission(new File(System.getProperty("user.home")).getAbsolutePath(), "read, write")); perms.add(new FilePermission(new File(System.getProperty("user.home") + "/-").getAbsolutePath(), "read, write")); perms.add(new FilePermission(new File(System.getProperty("user.home") + "/.mocca/logs/*").getAbsolutePath(), "read, write,delete")); + perms.add(new FilePermission(new File(System.getProperty("user.home") + "/.mocca/certs/-").getAbsolutePath(), "read, write,delete")); + //TODO + log.trace("granting file read/write permission to MOCCA local"); + perms.add(new FilePermission("<>", "read, write")); return perms; } diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/conf.zip b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/conf.zip index 1df56e5c..7ed90b7b 100644 Binary files a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/conf.zip and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/conf.zip differ diff --git a/BKUWebStart/src/main/resources/log4j.properties b/BKUWebStart/src/main/resources/log4j.properties index 76de3576..76562ccf 100644 --- a/BKUWebStart/src/main/resources/log4j.properties +++ b/BKUWebStart/src/main/resources/log4j.properties @@ -18,7 +18,7 @@ log4j.rootLogger=DEBUG, file log4j.logger.org.mortbay.log=INFO log4j.logger.pki=INFO -log4j.additivity.pki=false +#log4j.additivity.pki=false # STDOUT appender log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender diff --git a/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java b/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java new file mode 100644 index 00000000..0c08a276 --- /dev/null +++ b/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java @@ -0,0 +1,175 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.bku.webstart; + +import java.io.File; +import java.net.URI; +import java.util.zip.ZipOutputStream; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author clemens + */ +public class ConfiguratorTest { + + + public ConfiguratorTest() { + } + + @BeforeClass + public static void setUpClass() throws Exception { + } + + @AfterClass + public static void tearDownClass() throws Exception { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + /** + * Test of ensureConfiguration method, of class Configurator. + */ + @Ignore + @Test + public void testEnsureConfiguration() throws Exception { + System.out.println("ensureConfiguration"); + Configurator instance = new Configurator(); + instance.ensureConfiguration(); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of ensureCertificates method, of class Configurator. + */ + @Ignore + @Test + public void testEnsureCertificates() throws Exception { + System.out.println("ensureCertificates"); + Configurator instance = new Configurator(); + instance.ensureCertificates(); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of isCertRenewed method, of class Configurator. + */ + @Ignore + @Test + public void testIsCertRenewed() { + System.out.println("isCertRenewed"); + Configurator instance = new Configurator(); + boolean expResult = false; + boolean result = instance.isCertRenewed(); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of readVersion method, of class Configurator. + */ + @Ignore + @Test + public void testReadVersion() { + System.out.println("readVersion"); + File versionFile = null; + String expResult = ""; + String result = Configurator.readVersion(versionFile); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of updateRequired method, of class Configurator. + */ + @Test + public void testUpdateRequired() { + System.out.println("updateRequired"); + String oldVersion = "1.0.9-SNAPSHOT-r123"; + String minVersion = "1.0.9-SNAPSHOT"; + boolean expResult = false; + boolean result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + + oldVersion = "1.0.9-SNAPSHOT-r123"; + minVersion = "1.0.9"; + expResult = true; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + + oldVersion = "1.0.9-SNAPSHOT-r123"; + minVersion = "1.0.10-SNAPSHOT"; + expResult = true; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + + oldVersion = "1.0.9"; + minVersion = "1.0.9.1-SNAPSHOT"; + expResult = true; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + + oldVersion = "1.0.9"; + minVersion = "1.0.8.99-SNAPSHOT"; + expResult = false; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + + oldVersion = "1"; + minVersion = "2"; + expResult = true; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + } + + /** + * Test of backupAndDelete method, of class Configurator. + */ + @Ignore + @Test + public void testBackupAndDelete() throws Exception { + System.out.println("backupAndDelete"); + File dir = null; + URI relativeTo = null; + ZipOutputStream zip = null; + Configurator.backupAndDelete(dir, relativeTo, zip); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of initConfig method, of class Configurator. + */ + @Ignore + @Test + public void testInitConfig() throws Exception { + System.out.println("initConfig"); + File configDir = null; + Configurator instance = new Configurator(); + instance.initConfig(configDir); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + +} \ No newline at end of file diff --git a/BKUWebStart/src/test/resources/commons-logging.properties b/BKUWebStart/src/test/resources/commons-logging.properties new file mode 100644 index 00000000..29292562 --- /dev/null +++ b/BKUWebStart/src/test/resources/commons-logging.properties @@ -0,0 +1 @@ +org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger diff --git a/BKUWebStart/src/test/resources/log4j.properties b/BKUWebStart/src/test/resources/log4j.properties new file mode 100644 index 00000000..ea08c51d --- /dev/null +++ b/BKUWebStart/src/test/resources/log4j.properties @@ -0,0 +1,35 @@ +# Copyright 2008 Federal Chancellery Austria and +# Graz University of Technology +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# loglever DEBUG, appender STDOUT +log4j.rootLogger=TRACE, STDOUT +log4j.logger.org.mortbay.log=INFO +log4j.logger.pki=INFO + +#log4j.additivity.pki=false + +# STDOUT appender +log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender +log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout +#log4j.appender.STDOUT.layout.ConversionPattern=%5p | %d{dd HH:mm:ss,SSS} | %20c | %10t | %m%n +#log4j.appender.STDOUT.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n +log4j.appender.STDOUT.layout.ConversionPattern=%-5p |%d | %t | %c %x- %m%n + +### FILE appender +log4j.appender.file=org.apache.log4j.DailyRollingFileAppender +log4j.appender.file.datePattern='.'yyyy-MM-dd +log4j.appender.file.File=${user.home}/.mocca/logs/webstart.log +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %-5p %c{1}:%L - %m%n \ No newline at end of file -- cgit v1.2.3 From df55caa03b0111d81b44762936462ca29d229c7e Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 14 Aug 2009 10:59:28 +0000 Subject: <> git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@435 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'BKUWebStart/src') diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java index a2947833..4ae3b060 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java @@ -181,7 +181,7 @@ public class Container { //TODO log.trace("granting file read/write permission to MOCCA local"); - perms.add(new FilePermission("<>", "read, write")); + perms.add(new FilePermission("<>", "read, write")); return perms; } -- cgit v1.2.3 From 3125332260699b8ffd28188c9038cc106c4751d6 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 14 Aug 2009 11:34:30 +0000 Subject: RELEASE VERSIONs (not updated by maven release plugin) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@437 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUWebStart/src/main/jnlp/resources/version.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'BKUWebStart/src') diff --git a/BKUWebStart/src/main/jnlp/resources/version.xml b/BKUWebStart/src/main/jnlp/resources/version.xml index 67b319ca..013194a4 100644 --- a/BKUWebStart/src/main/jnlp/resources/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/version.xml @@ -2,24 +2,24 @@ - BKUWebStart-1.0.10-SNAPSHOT.jar - 1.0.10-SNAPSHOT + BKUWebStart-1.0.10.jar + 1.0.10 - BKUWebStart-1.0.10-SNAPSHOT.jar + BKUWebStart-1.0.10.jar - utils-1.2.1-SNAPSHOT.jar - 1.2.1-SNAPSHOT + utils-1.2.1.jar + 1.2.1 - utils-1.2.1-SNAPSHOT.jar + utils-1.2.1.jar - BKUCertificates-1.0-SNAPSHOT.jar - 1.0-SNAPSHOT + BKUCertificates-1.0.jar + 1.0 - BKUCertificates-1.0-SNAPSHOT.jar + BKUCertificates-1.0.jar -- cgit v1.2.3 From e72c9994054446f38c5bc53d7da573e366f57963 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 19 Aug 2009 13:43:02 +0000 Subject: make "include-webstart" profile default (added "local-webstart" for development) updateRequired (versioning) bug fixed AboutDialog Branding (removed MOCCA/Bean) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@444 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUWebStart/pom.xml | 36 ++-- .../java/at/gv/egiz/bku/webstart/Configurator.java | 55 +----- .../java/at/gv/egiz/bku/webstart/Container.java | 2 +- .../java/at/gv/egiz/bku/webstart/Launcher.java | 208 +++++++++++++-------- .../at/gv/egiz/bku/webstart/gui/AboutDialog.form | 139 ++++++++++++++ .../at/gv/egiz/bku/webstart/gui/AboutDialog.java | 162 ++++++++++++++++ .../bku/webstart/gui/BKUControllerInterface.java | 23 +++ .../gv/egiz/bku/webstart/gui/TrayMenuListener.java | 75 ++++++++ .../bku/webstart/ui/BKUControllerInterface.java | 23 --- .../at/gv/egiz/bku/webstart/ui/TrayIconDialog.java | 205 -------------------- .../bku/webstart/ui/TrayIconDialogInterface.java | 33 ---- .../src/main/jnlp/resources/img/logo_24.png | Bin 0 -> 1982 bytes BKUWebStart/src/main/jnlp/resources/img/splash.png | Bin 54978 -> 41455 bytes .../src/main/jnlp/resources/img/version.xml | 32 +--- BKUWebStart/src/main/jnlp/template-local.xml | 2 + BKUWebStart/src/main/jnlp/template.xml | 8 +- .../resources/at/gv/egiz/bku/webstart/logo_24.png | Bin 0 -> 1982 bytes .../resources/at/gv/egiz/bku/webstart/logo_32.png | Bin 0 -> 3228 bytes .../at/gv/egiz/bku/webstart/logo_notext.png | Bin 0 -> 3291 bytes .../at/gv/egiz/bku/webstart/messages.properties | 35 ++++ .../resources/at/gv/egiz/bku/webstart/splash.png | Bin 0 -> 41455 bytes .../gv/egiz/bku/webstart/ui/UIMessages.properties | 20 -- .../at/gv/egiz/bku/webstart/ui/favicon.png | Bin 2149 -> 0 bytes .../at/gv/egiz/bku/webstart/ui/trayicon_16.png | Bin 1084 -> 0 bytes .../at/gv/egiz/bku/webstart/ui/trayicon_32.png | Bin 2609 -> 0 bytes BKUWebStart/src/main/resources/logo_32x32.png | Bin 1522 -> 0 bytes BKUWebStart/src/main/resources/logo_90x90.png | Bin 3294 -> 0 bytes BKUWebStart/src/main/resources/logo_RGB22x22.png | Bin 1751 -> 0 bytes BKUWebStart/src/main/resources/logo_RGB32x32.png | Bin 2609 -> 0 bytes .../src/main/resources/splash_standalone.png | Bin 54978 -> 0 bytes .../at/gv/egiz/bku/webstart/ConfiguratorTest.java | 24 +++ 31 files changed, 630 insertions(+), 452 deletions(-) create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.form create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.java create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/TrayMenuListener.java delete mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/BKUControllerInterface.java delete mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java delete mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialogInterface.java create mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_24.png create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_24.png create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_32.png create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_notext.png create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/splash.png delete mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties delete mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/favicon.png delete mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_16.png delete mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_32.png delete mode 100644 BKUWebStart/src/main/resources/logo_32x32.png delete mode 100644 BKUWebStart/src/main/resources/logo_90x90.png delete mode 100644 BKUWebStart/src/main/resources/logo_RGB22x22.png delete mode 100644 BKUWebStart/src/main/resources/logo_RGB32x32.png delete mode 100644 BKUWebStart/src/main/resources/splash_standalone.png (limited to 'BKUWebStart/src') diff --git a/BKUWebStart/pom.xml b/BKUWebStart/pom.xml index 2de61fdc..03f5f5f3 100644 --- a/BKUWebStart/pom.xml +++ b/BKUWebStart/pom.xml @@ -43,18 +43,6 @@ false ${project.build.directory}/classes - true @@ -89,8 +77,8 @@ lib ${project.basedir}/src/main/jnlp - template-local.xml - mocca-local.jnlp + template.xml + mocca.jnlp at.gv.egiz.bku.webstart.Launcher 1.6+ true @@ -111,7 +99,7 @@ false - false + true true true @@ -165,18 +153,19 @@ true - at.gv.egiz.bku.webstart.BKULauncher + at.gv.egiz.bku.webstart.Launcher development ${pom.url} - splash_standalone.png + at/gv/egiz/bku/webstart/splash.png + @@ -211,7 +200,8 @@ - include-webstart + + local-webstart @@ -219,12 +209,10 @@ org.codehaus.mojo.webstart - template.xml - mocca.jnlp + template-local.xml + mocca-local.jnlp - false - - true + false @@ -298,4 +286,4 @@ ${java.home}/lib/javaws.jar - \ No newline at end of file + diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java index f1349637..bef2246b 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java @@ -18,7 +18,6 @@ package at.gv.egiz.bku.webstart; import at.gv.egiz.bku.utils.StreamUtil; import iaik.asn1.CodingException; -import iaik.xml.crypto.utils.Utils; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; @@ -32,25 +31,19 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.URI; -import java.net.URISyntaxException; import java.net.URL; import java.security.GeneralSecurityException; import java.security.KeyStore; import java.util.Enumeration; import java.util.Iterator; -import java.util.Map; -import java.util.Set; import java.util.UUID; import java.util.jar.Attributes; import java.util.jar.Manifest; -import java.util.logging.Level; -import java.util.logging.Logger; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.eclipse.jdt.core.dom.ThisExpression; /** * @@ -63,7 +56,7 @@ public class Configurator { * configurations with less than this (major) version will be backuped and updated * allowed: MAJOR[.MINOR[.X[-SNAPSHOT]]] */ - public static final String MIN_CONFIG_VERSION = "1.0.9-SNAPSHOT"; + public static final String MIN_CONFIG_VERSION = "1.0.9"; public static final String CONFIG_DIR = ".mocca/conf/"; public static final String CERTS_DIR = ".mocca/certs/"; public static final String VERSION_FILE = ".version"; @@ -259,14 +252,20 @@ public class Configurator { int majorEndOld = oldVersion.indexOf("-SNAPSHOT"); if (majorEndOld < 0) { preRelease = false; - majorEndOld = oldVersion.length(); + majorEndOld = oldVersion.indexOf('-'); // 1.0.10-r439 + if (majorEndOld < 0) { + majorEndOld = oldVersion.length(); + } } boolean releaseRequired = false; int majorEndMin = minVersion.indexOf("-SNAPSHOT"); if (majorEndMin < 0) { releaseRequired = true; - majorEndMin = minVersion.length(); + majorEndMin = minVersion.indexOf('-'); + if (majorEndMin < 0) { + majorEndMin = minVersion.length(); + } } xOld = Integer.valueOf(oldVersion.substring(fromInd, majorEndOld)); @@ -301,39 +300,6 @@ public class Configurator { return true; } - /** - - * @param oldVersion - * @param newVersion - * @return - */ -// private boolean updateRequiredStrict(String oldVersion, String newVersion) { -// log.debug("comparing " + oldVersion + " to " + newVersion); -// if (oldVersion != null && !UNKOWN_VERSION.equals(oldVersion)) { -// if (newVersion != null && !UNKOWN_VERSION.equals(newVersion)) { -// String[] oldV = oldVersion.split("-"); -// String[] newV = newVersion.split("-"); -// log.trace("comparing " + oldV[0] + " to " + newV[0]); -// if (oldV[0].compareTo(newV[0]) < 0) { -// log.debug("update required"); -// return true; -// } else { -// log.trace("comparing " + oldV[oldV.length - 1] + " to " + newV[newV.length - 1]); -// if (oldV[oldV.length - 1].compareTo(newV[newV.length - 1]) < 0) { -// log.debug("update required"); -// return true; -// } else { -// log.debug("no update required"); -// return false; -// } -// } -// } -// log.debug("unknown new version, do not update"); -// return true; -// } -// log.debug("unknown old version, update required"); -// return true; -// } protected static void backupAndDelete(File dir, URI relativeTo, ZipOutputStream zip) throws IOException { if (dir.isDirectory()) { File[] subDirs = dir.listFiles(); @@ -454,8 +420,7 @@ public class Configurator { passwdWriter.write(password); passwdWriter.close(); if (!passwdFile.setReadable(false, false) || !passwdFile.setReadable(true, true)) { - passwdFile.delete(); - throw new IOException("failed to make " + passwdFile + " owner readable only, deleting file"); + log.error("failed to make " + passwdFile + " owner readable only (certain file-systems do not support owner's permissions)"); } TLSServerCA ca = new TLSServerCA(); KeyStore ks = ca.generateKeyStore(password); diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java index 4ae3b060..08a0808a 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java @@ -151,7 +151,7 @@ public class Container { perms.add(new RuntimePermission("getClassLoader")); // standard permissions - perms.add(new PropertyPermission("*", "read")); + perms.add(new PropertyPermission("*", "read,write")); perms.add(new RuntimePermission("accessDeclaredMembers")); perms.add(new RuntimePermission("accessClassInPackage.*")); perms.add(new RuntimePermission("defineClassInPackage.*")); 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 f7be7b65..23d832a2 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 @@ -1,27 +1,33 @@ package at.gv.egiz.bku.webstart; +import at.gv.egiz.bku.webstart.gui.BKUControllerInterface; +import at.gv.egiz.bku.webstart.gui.TrayMenuListener; import iaik.asn1.CodingException; import java.io.IOException; import java.net.URISyntaxException; import java.util.Locale; -import java.util.MissingResourceException; import java.util.ResourceBundle; import javax.jnlp.UnavailableServiceException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import at.gv.egiz.bku.webstart.ui.BKUControllerInterface; -import at.gv.egiz.bku.webstart.ui.TrayIconDialog; import com.sun.javaws.security.JavaWebStartSecurity; +import java.awt.AWTException; import java.awt.Desktop; +import java.awt.Image; +import java.awt.MenuItem; +import java.awt.PopupMenu; import java.awt.SplashScreen; +import java.awt.SystemTray; +import java.awt.TrayIcon; import java.net.BindException; import java.net.URI; import java.net.URL; import java.security.GeneralSecurityException; import java.util.jar.Attributes; import java.util.jar.Manifest; +import javax.imageio.ImageIO; import javax.jnlp.BasicService; import javax.jnlp.ServiceManager; import org.mortbay.util.MultiException; @@ -31,18 +37,26 @@ public class Launcher implements BKUControllerInterface { public static final String WEBAPP_RESOURCE = "BKULocal.war"; public static final String CERTIFICATES_RESOURCE = "BKUCertificates.jar"; public static final String WEBAPP_FILE = "BKULocal.war"; - public static final String MESSAGES_RESOURCE = "at/gv/egiz/bku/webstart/ui/UIMessages"; + public static final String MESSAGES_RESOURCE = "at/gv/egiz/bku/webstart/messages"; + public static final String TRAYICON_RESOURCE = "at/gv/egiz/bku/webstart/logo_"; /** resource bundle messages */ - public static final String GREETING_CAPTION = "Greetings.Caption"; - public static final String GREETING_MESSAGE = "Greetings.Message"; - public static final String CONFIG_CAPTION = "Config.Caption"; - public static final String CONFIG_MESSAGE = "Config.Message"; - public static final String STARTUP_CAPTION = "Startup.Caption"; - public static final String STARTUP_MESSAGE = "Startup.Message"; - public static final String ERROR_CAPTION = "Error.Caption"; - public static final String ERROR_STARTUP_MESSAGE = "Error.Startup.Message"; - public static final String ERROR_CONF_MESSAGE = "Error.Conf.Message"; - public static final String ERROR_BIND_MESSAGE = "Error.Bind.Message"; + public static final String CAPTION_DEFAULT = "tray.caption.default"; + public static final String CAPTION_ERROR = "tray.caption.error"; + public static final String MESSAGE_START = "tray.message.start"; + public static final String MESSAGE_START_OFFLINE = "tray.message.start.offline"; + public static final String MESSAGE_CONFIG = "tray.message.config"; + public static final String MESSAGE_CERTS = "tray.message.certs"; + public static final String MESSAGE_FINISHED = "tray.message.finished"; + public static final String MESSAGE_SHUTDOWN = "tray.message.shutdown"; + public static final String ERROR_START = "tray.error.start"; + public static final String ERROR_CONFIG = "tray.error.config"; + public static final String ERROR_BIND = "tray.error.bind"; + public static final String LABEL_SHUTDOWN = "tray.label.shutdown"; + public static final String LABEL_PIN = "tray.label.pin"; + public static final String LABEL_ABOUT = "tray.label.about"; + public static final String TOOLTIP_DEFAULT = "tray.tooltip.default"; + + /** local bku uri */ public static final URI HTTPS_SECURITY_LAYER_URI; private static Log log = LogFactory.getLog(Launcher.class); @@ -56,7 +70,6 @@ public class Launcher implements BKUControllerInterface { HTTPS_SECURITY_LAYER_URI = tmp; } } - public static final String version; static { String tmp = Configurator.UNKOWN_VERSION; @@ -78,16 +91,107 @@ public class Launcher implements BKUControllerInterface { log.info("BKU Web Start " + version); } } - private Configurator config; private Container server; private BasicService basicService; + private TrayIcon trayIcon; + private ResourceBundle messages; + + public Launcher() { + if (log.isTraceEnabled()) { + SecurityManager sm = System.getSecurityManager(); + if (sm instanceof JavaWebStartSecurity) { + System.setSecurityManager(new LogSecurityManager((JavaWebStartSecurity) sm)); + } + } + messages = ResourceBundle.getBundle(MESSAGES_RESOURCE, Locale.getDefault()); + trayIcon = initTrayIcon(); + } + + public void launch() throws Exception { + initStart(); + try { + initConfig(); + } catch (Exception ex) { + log.fatal("Failed to initialize configuration", ex); + trayIcon.displayMessage(messages.getString(CAPTION_ERROR), + messages.getString(ERROR_CONFIG), TrayIcon.MessageType.ERROR); + throw ex; + } + try { + startServer(); + initFinished(); + } catch (BindException ex) { + log.fatal("Failed to launch server, " + ex.getMessage(), ex); + trayIcon.displayMessage(messages.getString(CAPTION_ERROR), + messages.getString(ERROR_BIND), TrayIcon.MessageType.ERROR); + throw ex; + } catch (MultiException ex) { + log.fatal("Failed to launch server, " + ex.getMessage(), ex); + if (ex.getThrowable(0) instanceof BindException) { + trayIcon.displayMessage(messages.getString(CAPTION_ERROR), + messages.getString(ERROR_BIND), TrayIcon.MessageType.ERROR); + } else { + trayIcon.displayMessage(messages.getString(CAPTION_ERROR), + messages.getString(ERROR_START), TrayIcon.MessageType.ERROR); + } + throw ex; + } catch (Exception ex) { + log.fatal("Failed to launch server, " + ex.getMessage(), ex); + trayIcon.displayMessage(messages.getString(CAPTION_ERROR), + messages.getString(ERROR_START), TrayIcon.MessageType.ERROR); + throw ex; + } + } + + private TrayIcon initTrayIcon() { //ResourceBundle messages, BKUControllerInterface bkuHook) { + if (SystemTray.isSupported()) { + try { + // get the SystemTray instance + SystemTray tray = SystemTray.getSystemTray(); + log.debug("TrayIcon size: " + tray.getTrayIconSize()); + String iconResource = (tray.getTrayIconSize().height < 25) + ? TRAYICON_RESOURCE + "24.png" + : TRAYICON_RESOURCE + "32.png"; + Image image = ImageIO.read(Launcher.class.getClassLoader().getResourceAsStream(iconResource)); + + TrayMenuListener listener = new TrayMenuListener(this, messages, version); + PopupMenu popup = new PopupMenu(); + + MenuItem shutdownItem = new MenuItem(messages.getString(LABEL_SHUTDOWN)); + shutdownItem.addActionListener(listener); + shutdownItem.setActionCommand(TrayMenuListener.SHUTDOWN_COMMAND); + popup.add(shutdownItem); + + MenuItem aboutItem = new MenuItem(messages.getString(LABEL_ABOUT)); + aboutItem.setActionCommand(TrayMenuListener.ABOUT_COMMAND); + aboutItem.addActionListener(listener); + popup.add(aboutItem); + + TrayIcon ti = new TrayIcon(image, messages.getString(TOOLTIP_DEFAULT), popup); + ti.addActionListener(listener); + tray.add(ti); + return ti; + } catch (AWTException ex) { + log.error("Failed to init tray icon", ex); + } catch (IOException ex) { + log.error("Failed to load tray icon image", ex); + } + } else { + log.error("No system tray support"); + } + return null; + } private void initStart() { try { + trayIcon.displayMessage(messages.getString(CAPTION_DEFAULT), + messages.getString(MESSAGE_START), TrayIcon.MessageType.INFO); basicService = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService"); if (basicService.isOffline()) { log.info("launching MOCCA Web Start offline"); + trayIcon.displayMessage(messages.getString(CAPTION_DEFAULT), + messages.getString(MESSAGE_START_OFFLINE), TrayIcon.MessageType.INFO); } else { log.info("launching MOCCA Web Start online"); } @@ -96,30 +200,20 @@ public class Launcher implements BKUControllerInterface { } } - private void initTrayIcon() { - log.debug("init MOCCA tray icon"); - Locale loc = Locale.getDefault(); - ResourceBundle resourceBundle; - try { - resourceBundle = ResourceBundle.getBundle( - MESSAGES_RESOURCE, loc); - } catch (MissingResourceException mx) { - resourceBundle = ResourceBundle.getBundle( - MESSAGES_RESOURCE, Locale.ENGLISH); - } - TrayIconDialog.getInstance().init(resourceBundle); - TrayIconDialog.getInstance().setShutdownHook(this); -// TrayIconDialog.getInstance().displayInfo(GREETING_CAPTION, GREETING_MESSAGE); - } - private void initConfig() throws IOException, CodingException, GeneralSecurityException { + trayIcon.displayMessage(messages.getString(CAPTION_DEFAULT), + messages.getString(MESSAGE_CONFIG), TrayIcon.MessageType.INFO); config = new Configurator(); config.ensureConfiguration(); + trayIcon.displayMessage(messages.getString(CAPTION_DEFAULT), + messages.getString(MESSAGE_CERTS), TrayIcon.MessageType.INFO); config.ensureCertificates(); } private void startServer() throws Exception { log.info("init servlet container and MOCCA webapp"); +// trayIcon.displayMessage(messages.getString(CAPTION_DEFAULT), +// messages.getString(MESSAGE_START), TrayIcon.MessageType.INFO); server = new Container(); server.init(); server.start(); @@ -127,6 +221,8 @@ public class Launcher implements BKUControllerInterface { private void initFinished() { try { + trayIcon.displayMessage(messages.getString(CAPTION_DEFAULT), + messages.getString(MESSAGE_FINISHED), TrayIcon.MessageType.INFO); // standalone (non-webstart) version has splashscreen if (SplashScreen.getSplashScreen() != null) { try { @@ -162,6 +258,8 @@ public class Launcher implements BKUControllerInterface { @Override public void shutDown() { log.info("Shutting down server"); + trayIcon.displayMessage(messages.getString(CAPTION_DEFAULT), + messages.getString(MESSAGE_SHUTDOWN), TrayIcon.MessageType.INFO); if ((server != null) && (server.isRunning())) { try { if (server.isRunning()) { @@ -179,51 +277,13 @@ public class Launcher implements BKUControllerInterface { } public static void main(String[] args) throws InterruptedException, IOException { - - if (log.isTraceEnabled()) { - SecurityManager sm = System.getSecurityManager(); - if (sm instanceof JavaWebStartSecurity) { - System.setSecurityManager(new LogSecurityManager((JavaWebStartSecurity) sm)); - } - } - - Launcher launcher = new Launcher(); - launcher.initStart(); - launcher.initTrayIcon(); //keep reference? BKULauncher not garbage collected after main() - try { - TrayIconDialog.getInstance().displayInfo(CONFIG_CAPTION, CONFIG_MESSAGE); - launcher.initConfig(); + Launcher launcher = new Launcher(); + launcher.launch(); } catch (Exception ex) { - log.fatal("Failed to initialize configuration", ex); - TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_CONF_MESSAGE); - Thread.sleep(5000); - System.exit(-1000); - } - - try { - TrayIconDialog.getInstance().displayInfo(STARTUP_CAPTION, STARTUP_MESSAGE); - launcher.startServer(); - TrayIconDialog.getInstance().displayInfo(GREETING_CAPTION, GREETING_MESSAGE); - launcher.initFinished(); - } catch (BindException ex) { - log.fatal("Failed to launch server, " + ex.getMessage(), ex); - TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_BIND_MESSAGE); - Thread.sleep(5000); - System.exit(-1000); - } catch (MultiException ex) { - log.fatal("Failed to launch server, " + ex.getMessage(), ex); - if (ex.getThrowable(0) instanceof BindException) { - TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_BIND_MESSAGE); - } else { - TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_STARTUP_MESSAGE); - } - Thread.sleep(5000); - System.exit(-1000); - } catch (Exception e) { - log.fatal("Failed to launch server, " + e.getMessage(), e); - TrayIconDialog.getInstance().displayError(ERROR_CAPTION, ERROR_STARTUP_MESSAGE); + log.info("waiting to shutdown..."); Thread.sleep(5000); + log.info("exit"); System.exit(-1000); } } diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.form b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.form new file mode 100644 index 00000000..c1cfdab7 --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.form @@ -0,0 +1,139 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.java new file mode 100644 index 00000000..efa80bd6 --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.java @@ -0,0 +1,162 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * AboutDialog.java + * + * Created on 18.08.2009, 11:54:44 + */ + +package at.gv.egiz.bku.webstart.gui; + +import java.text.Format; +import java.text.MessageFormat; +import java.util.ResourceBundle; + +/** + * + * @author clemens + */ +public class AboutDialog extends javax.swing.JDialog { + + /** Creates new form AboutDialog */ + public AboutDialog(java.awt.Frame parent, boolean modal, String version) { + super(parent, modal); + this.version = version; + initComponents(); + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jPanel3 = new javax.swing.JPanel(); + jButton1 = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("at/gv/egiz/bku/webstart/messages"); // NOI18N + setTitle(bundle.getString("about.frame.title")); // NOI18N + + jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/at/gv/egiz/bku/webstart/logo_notext.png"))); // NOI18N + + jLabel2.setText(getVersionText(bundle)); + + jLabel3.setText(bundle.getString("about.title")); // NOI18N + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(jLabel2)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel2)) + ); + + jButton1.setText(bundle.getString("button.close")); // NOI18N + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addContainerGap(157, Short.MAX_VALUE) + .addComponent(jButton1) + .addContainerGap()) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jButton1) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE) + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + pack(); + }// //GEN-END:initComponents + + private String getVersionText(ResourceBundle bundle) { + return MessageFormat.format(bundle.getString("about.version"), version); + } + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + setVisible(false); + }//GEN-LAST:event_jButton1ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + AboutDialog dialog = new AboutDialog(new javax.swing.JFrame(), true, "1.2.3"); + dialog.addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent e) { + System.exit(0); + } + }); + dialog.setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel3; + // End of variables declaration//GEN-END:variables + + private String version; +} 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 new file mode 100644 index 00000000..886b55f7 --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java @@ -0,0 +1,23 @@ +/* +* Copyright 2008 Federal Chancellery Austria and +* Graz University of Technology +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package at.gv.egiz.bku.webstart.gui; + +public interface BKUControllerInterface { + + public void shutDown(); + +} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/TrayMenuListener.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/TrayMenuListener.java new file mode 100644 index 00000000..1e5efe8e --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/TrayMenuListener.java @@ -0,0 +1,75 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.webstart.gui; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.util.ResourceBundle; +import javax.swing.JFrame; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker + */ +public class TrayMenuListener implements ActionListener { + + /** action commands for tray menu */ + public static final String SHUTDOWN_COMMAND = "shutdown"; + public static final String PIN_COMMAND = "pin"; + public static final String ABOUT_COMMAND = "about"; + + private static final Log log = LogFactory.getLog(TrayMenuListener.class); + + protected BKUControllerInterface bku; + protected ResourceBundle messages; + protected String version; + protected AboutDialog aboutDialog; + + public TrayMenuListener(BKUControllerInterface bkuHook, ResourceBundle messages, String version) { + this.messages = messages; + this.version = version; + this.bku = bkuHook; + } + + @Override + public void actionPerformed(ActionEvent e) { + if (SHUTDOWN_COMMAND.equals(e.getActionCommand())) { + log.debug("shutdown requested via tray menu"); + bku.shutDown(); + } else if (ABOUT_COMMAND.equals(e.getActionCommand())) { + log.debug("about dialog requested via tray menu"); + if (aboutDialog == null) { + aboutDialog = new AboutDialog(new JFrame(), true, version); + aboutDialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + aboutDialog.setVisible(false); + } + }); + } + aboutDialog.setLocationByPlatform(true); + aboutDialog.setVisible(true); + } else if (PIN_COMMAND.equals(e.getActionCommand())) { + log.error("not implemented yet."); + } else { + log.error("unknown tray menu command: " + e.getActionCommand()); + } + } +} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/BKUControllerInterface.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/BKUControllerInterface.java deleted file mode 100644 index fd9838f9..00000000 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/BKUControllerInterface.java +++ /dev/null @@ -1,23 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.bku.webstart.ui; - -public interface BKUControllerInterface { - - public void shutDown(); - -} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java deleted file mode 100644 index fb7c40dd..00000000 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialog.java +++ /dev/null @@ -1,205 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.bku.webstart.ui; - -import java.awt.AWTException; -import java.awt.Image; -import java.awt.MenuItem; -import java.awt.PopupMenu; -import java.awt.SystemTray; -import java.awt.TrayIcon; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.IOException; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.ResourceBundle; - -import javax.imageio.ImageIO; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class TrayIconDialog implements TrayIconDialogInterface { - public static final String TRAYICON_RESOURCE = "at/gv/egiz/bku/webstart/ui/trayicon_32.png"; - public static final String TRAYMENU_SHUTDOWN = "TrayMenu.Shutdown"; - public static final String TRAYMENU_TOOLTIP = "TrayMenu.Tooltip"; - - private static Log log = LogFactory.getLog(TrayIconDialog.class); - private static TrayIconDialogInterface instance; - private boolean isSupported; - private BKUControllerInterface shutDown; - private TrayIcon trayIcon = null; - private ResourceBundle resourceBundle = null; - - private TrayIconDialog() { - } - - private void displayTrayMsg(String captionID, String messageID, - TrayIcon.MessageType type) { - if ((isSupported) && (resourceBundle != null)) { - try { - trayIcon.displayMessage(resourceBundle.getString(captionID), - resourceBundle.getString(messageID), type); - } catch (Exception ex) { - log.error(ex); - } - } - } - - /* - * (non-Javadoc) - * - * @see - * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#displayInfo(java.lang.String - * , java.lang.String) - */ - public void displayInfo(String captionID, String messageID) { - displayTrayMsg(captionID, messageID, TrayIcon.MessageType.INFO); - } - - /* - * (non-Javadoc) - * - * @see - * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#displayWarning(java.lang - * .String, java.lang.String) - */ - public void displayWarning(String captionID, String messageID) { - displayTrayMsg(captionID, messageID, TrayIcon.MessageType.WARNING); - } - - /* - * (non-Javadoc) - * - * @see - * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#displayError(java.lang. - * String, java.lang.String) - */ - public void displayError(String captionID, String messageID) { - displayTrayMsg(captionID, messageID, TrayIcon.MessageType.ERROR); - } - - /* - * (non-Javadoc) - * - * @see - * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#init(java.util.ResourceBundle - * ) - */ - public void init(ResourceBundle resourceBundel) { - this.resourceBundle = resourceBundel; - isSupported = SystemTray.isSupported(); - log.info("Trayicon supported: " + isSupported); - try { - if (isSupported) { - SystemTray tray = SystemTray.getSystemTray(); - Image image = ImageIO.read(getClass().getClassLoader() - .getResourceAsStream(TRAYICON_RESOURCE)); - PopupMenu popup = new PopupMenu(); - MenuItem exitItem = new MenuItem(resourceBundel - .getString(TRAYMENU_SHUTDOWN)); - popup.add(exitItem); - exitItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - log.info("Calling Shutdown"); - if (shutDown != null) { - shutDown.shutDown(); - } - } - }); - - trayIcon = new TrayIcon(image, "BKULogo", popup); - trayIcon.setImageAutoSize(true); - trayIcon.setToolTip(resourceBundel.getString(TRAYMENU_TOOLTIP)); - try { - tray.add(trayIcon); - } catch (AWTException e) { - log.error("TrayIcon could not be added.", e); - isSupported = false; - } - } - } catch (IOException e) { - log.error(e); - } - } - - /* - * (non-Javadoc) - * - * @see - * at.gv.egiz.bku.local.ui.TrayIconDialogInterface#setShutdownHook(at.gv.egiz - * .bku.local.ui.BKUControllerInterface) - */ - public void setShutdownHook(BKUControllerInterface shutDown) { - this.shutDown = shutDown; - } - - @SuppressWarnings("unchecked") - public synchronized static TrayIconDialogInterface getInstance() { - ClassLoader cl = TrayIconDialog.class.getClassLoader(); - if (instance == null) { - if (cl.toString().equals(cl.getParent().toString())) { - instance = new TrayIconDialog(); - return instance; - } - ClassLoader parent = cl; - while (!parent.toString().equals(cl.getParent().toString())) { - parent = parent.getParent(); - } - try { - Class otherClassInstance = (Class) parent - .loadClass(TrayIconDialog.class.getName()); - Method getInstanceMethod = otherClassInstance.getDeclaredMethod( - "getInstance", new Class[] {}); - Object otherSingleton = getInstanceMethod.invoke(null, new Object[] {}); - instance = (TrayIconDialogInterface) Proxy.newProxyInstance(cl, - new Class[] { TrayIconDialogInterface.class }, - new PassThroughProxyHandler(otherSingleton)); - } catch (ClassNotFoundException ce) { - instance = new TrayIconDialog(); - } catch (Exception e) { - log.error(e); - instance = new TrayIconDialog(); - } - return instance; - } - return instance; - } - - /** - * - * Only works for public methods - * - */ - static class PassThroughProxyHandler implements InvocationHandler { - private final Object delegate; - - public PassThroughProxyHandler(Object delegate) { - this.delegate = delegate; - } - - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable { - Method delegateMethod = delegate.getClass().getMethod(method.getName(), - method.getParameterTypes()); - return delegateMethod.invoke(delegate, args); - } - } - -} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialogInterface.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialogInterface.java deleted file mode 100644 index 078844cb..00000000 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/ui/TrayIconDialogInterface.java +++ /dev/null @@ -1,33 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.bku.webstart.ui; - -import java.util.ResourceBundle; - -public interface TrayIconDialogInterface { - - public abstract void displayInfo(String captionID, String messageID); - - public abstract void displayWarning(String captionID, String messageID); - - public abstract void displayError(String captionID, String messageID); - - public abstract void init(ResourceBundle resourceBundel); - - public abstract void setShutdownHook(BKUControllerInterface shutDown); - -} \ No newline at end of file diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_24.png b/BKUWebStart/src/main/jnlp/resources/img/logo_24.png new file mode 100644 index 00000000..a9074f01 Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/logo_24.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/splash.png b/BKUWebStart/src/main/jnlp/resources/img/splash.png index 72c1d868..597fbc60 100644 Binary files a/BKUWebStart/src/main/jnlp/resources/img/splash.png and b/BKUWebStart/src/main/jnlp/resources/img/splash.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/version.xml b/BKUWebStart/src/main/jnlp/resources/img/version.xml index 31f43441..1ba3ecda 100644 --- a/BKUWebStart/src/main/jnlp/resources/img/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/img/version.xml @@ -2,43 +2,29 @@ - logo_16.xpm - 1.0-SNAPSHOT + logo_24 + 1.0 - logo_16.xpm + logo_24.png - logo_16.ico - 1.0-SNAPSHOT - - logo_16.ico - - - - logo_16.png - 1.0-SNAPSHOT - - logo_16.png - - - - logo_32.png - 1.0-SNAPSHOT + logo_32 + 1.0 logo_32.png - logo_64.png - 1.0-SNAPSHOT + logo_64 + 1.0 logo_64.png - splash.png - 1.0-SNAPSHOT + splash + 2.0 splash.png diff --git a/BKUWebStart/src/main/jnlp/template-local.xml b/BKUWebStart/src/main/jnlp/template-local.xml index 9135ba1b..80447c89 100644 --- a/BKUWebStart/src/main/jnlp/template-local.xml +++ b/BKUWebStart/src/main/jnlp/template-local.xml @@ -10,7 +10,9 @@ $project.Description (BKU) MOCCA Web Start $project.Description + + diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml index 0176376a..bbc4c466 100644 --- a/BKUWebStart/src/main/jnlp/template.xml +++ b/BKUWebStart/src/main/jnlp/template.xml @@ -10,10 +10,10 @@ $project.Description (BKU) MOCCA Web Start $project.Description - - - - + + + + diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_24.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_24.png new file mode 100644 index 00000000..a9074f01 Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_24.png differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_32.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_32.png new file mode 100644 index 00000000..3c77d179 Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_32.png differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_notext.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_notext.png new file mode 100644 index 00000000..407f3b3e Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_notext.png differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties new file mode 100644 index 00000000..d965f970 --- /dev/null +++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties @@ -0,0 +1,35 @@ +# Copyright 2008 Federal Chancellery Austria and +# Graz University of Technology +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +tray.caption.default=B\u00FCrgerkarte +tray.caption.error=Fehler +tray.message.start=B\u00FCrgerkartenumgebung wird gestartet... +tray.message.start.offline=B\u00FCrgerkartenumgebung wird offline gestartet... +tray.message.config=Konfiguration wird geladen +tray.message.certs=Zertifikate werden geladen +tray.message.finished=B\u00FCrgerkartenumgebung erfolgreich gestartet +tray.message.shutdown=B\u00FCrgerkartenumgebung wird beendet +tray.error.start=B\u00FCrgerkartenumgebung konnte nicht gestartet werden +tray.error.config=Konfiguration konnte nicht initialisiert werden, B\u00FCrberkartenumgebung wird nicht gestartet +tray.error.bind=Die f\u00FCr die B\u00FCrgerkartenumgebung reservierte Adresse wird bereits von einem anderen Dienst verwendet +tray.label.shutdown=Beenden +tray.label.pin=PIN Verwaltung +tray.label.about=\u00DCber... +tray.tooltip.default=B\u00FCrgerkartenumgebung +about.frame.title=B\u00FCrgerkarte +about.title=B\u00FCrgerkartenumgebung +about.version=Version: {0} +button.ok=Best\u00E4tigen +button.close=Schlie\u00DFen diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/splash.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/splash.png new file mode 100644 index 00000000..597fbc60 Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/splash.png differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties deleted file mode 100644 index bf4e5b8a..00000000 --- a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/UIMessages.properties +++ /dev/null @@ -1,20 +0,0 @@ -#-------- tray icon messages ------- -TrayMenu.Tooltip=B\u00FCrgerkartenumgebung -TrayMenu.Shutdown=B\u00FCrgerkartenumgebung beenden - -Config.Message=Zertifikate werden geladen -Config.Caption=B\u00FCrgerkartenumgebung -Startup.Message=B\u00FCrgerkartenumgebung wird gestartet... -Startup.Caption=B\u00FCrgerkartenumgebung -Greetings.Message=B\u00FCrgerkartenumgebung erfolgreich gestartet -Greetings.Caption=B\u00FCrgerkartenumgebung -Error.Caption=Fehler -Error.Startup.Message=B\u00FCrgerkartenumgebung konnte nicht gestartet werden -Error.Conf.Message=Konfiguration konnte nicht initialisiert werden, B\u00FCrberkartenumgebung wird nicht gestartet -Error.Bind.Message=Die f\u00FCr die B\u00FCrgerkartenumgebung reservierte Adresse wird bereits von einem anderen Dienst verwendet -Message.RequestCaption=New Request -Message.InfoboxReadRequest=Reading Infobox -Message.SecureSignatureKeypair=Reading secure signature certificate -Message.CertifiedKeypair=Reading certified certificate -Message.IdentityLink=Reading Identitylink -Message.SignRequest=Creating Signature \ No newline at end of file diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/favicon.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/favicon.png deleted file mode 100644 index 2d0276de..00000000 Binary files a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/favicon.png and /dev/null differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_16.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_16.png deleted file mode 100644 index f84f108d..00000000 Binary files a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_16.png and /dev/null differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_32.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_32.png deleted file mode 100644 index 2c622d88..00000000 Binary files a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/ui/trayicon_32.png and /dev/null differ diff --git a/BKUWebStart/src/main/resources/logo_32x32.png b/BKUWebStart/src/main/resources/logo_32x32.png deleted file mode 100644 index 337b144b..00000000 Binary files a/BKUWebStart/src/main/resources/logo_32x32.png and /dev/null differ diff --git a/BKUWebStart/src/main/resources/logo_90x90.png b/BKUWebStart/src/main/resources/logo_90x90.png deleted file mode 100644 index d7f8bbd0..00000000 Binary files a/BKUWebStart/src/main/resources/logo_90x90.png and /dev/null differ diff --git a/BKUWebStart/src/main/resources/logo_RGB22x22.png b/BKUWebStart/src/main/resources/logo_RGB22x22.png deleted file mode 100644 index 598ab00b..00000000 Binary files a/BKUWebStart/src/main/resources/logo_RGB22x22.png and /dev/null differ diff --git a/BKUWebStart/src/main/resources/logo_RGB32x32.png b/BKUWebStart/src/main/resources/logo_RGB32x32.png deleted file mode 100644 index 2c622d88..00000000 Binary files a/BKUWebStart/src/main/resources/logo_RGB32x32.png and /dev/null differ diff --git a/BKUWebStart/src/main/resources/splash_standalone.png b/BKUWebStart/src/main/resources/splash_standalone.png deleted file mode 100644 index 72c1d868..00000000 Binary files a/BKUWebStart/src/main/resources/splash_standalone.png and /dev/null differ diff --git a/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java b/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java index 0c08a276..0ea126cb 100644 --- a/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java +++ b/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java @@ -118,6 +118,30 @@ public class ConfiguratorTest { result = Configurator.updateRequired(oldVersion, minVersion); assertEquals(expResult, result); + oldVersion = "1.0.9-SNAPSHOT-r123"; + minVersion = "1.0.10-r432"; + expResult = true; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + + oldVersion = "1.0.9-r123"; + minVersion = "1.0.10-SNAPSHOT"; + expResult = true; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + + oldVersion = "1.0.9-r123"; + minVersion = "1.0.9-SNAPSHOT"; + expResult = false; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + + oldVersion = "1.0.9-SNAPSHOT"; + minVersion = "1.0.9-r349"; + expResult = true; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + oldVersion = "1.0.9-SNAPSHOT-r123"; minVersion = "1.0.10-SNAPSHOT"; expResult = true; -- cgit v1.2.3 From 22001c93bca360d1b15c252cb22d2a4147ff350d Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 20 Aug 2009 16:24:55 +0000 Subject: [#430] Activation/PIN-management in MOCCA Web Start - new Modules: smccSTALExt, BKUGuiExt in order not to depend on BKUAppletExt in BKULocal - provide stal-request handler de-registration in abstractSMCCSTAL git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@448 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/src/main/java/META-INF/MANIFEST.MF | 3 - BKUAppletExt/pom.xml | 10 + .../java/at/gv/egiz/bku/gui/ActivationGUI.java | 249 -------- .../at/gv/egiz/bku/gui/ActivationGUIFacade.java | 33 - .../main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java | 70 --- .../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 669 -------------------- .../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 117 ---- .../java/at/gv/egiz/bku/gui/PINSpecRenderer.java | 39 -- .../java/at/gv/egiz/bku/gui/PINStatusRenderer.java | 61 -- .../at/gv/egiz/bku/gui/PINStatusTableModel.java | 58 -- .../egiz/bku/online/applet/ActivationApplet.java | 2 +- .../bku/online/applet/PINManagementBKUWorker.java | 16 +- .../bku/smccstal/ext/CardMgmtRequestHandler.java | 177 ------ .../bku/smccstal/ext/GetPINStatusException.java | 41 -- .../smccstal/ext/ManagementPINProviderFactory.java | 262 -------- .../smccstal/ext/PINManagementRequestHandler.java | 244 -------- .../gv/egiz/bku/gui/ActivationMessages.properties | 69 --- .../egiz/bku/gui/ActivationMessages_en.properties | 68 --- .../java/at/gv/egiz/bku/gui/ActivationGuiTest.java | 62 -- .../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 202 ------- BKUCommonGUI/pom.xml | 2 +- .../main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 2 +- BKUGuiExt/pom.xml | 27 + .../java/at/gv/egiz/bku/gui/ActivationGUI.java | 250 ++++++++ .../at/gv/egiz/bku/gui/ActivationGUIFacade.java | 34 ++ .../main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java | 71 +++ .../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 670 +++++++++++++++++++++ .../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 118 ++++ .../java/at/gv/egiz/bku/gui/PINSpecRenderer.java | 39 ++ .../java/at/gv/egiz/bku/gui/PINStatusRenderer.java | 61 ++ .../at/gv/egiz/bku/gui/PINStatusTableModel.java | 58 ++ .../gv/egiz/bku/gui/ActivationMessages.properties | 69 +++ .../egiz/bku/gui/ActivationMessages_en.properties | 68 +++ .../java/at/gv/egiz/bku/gui/ActivationGuiTest.java | 63 ++ .../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 203 +++++++ BKULocal/pom.xml | 25 +- .../java/at/gv/egiz/bku/local/gui/GUIProxy.java | 55 ++ .../at/gv/egiz/bku/local/stal/BKUGuiProxy.java | 156 ----- .../at/gv/egiz/bku/local/stal/LocalBKUWorker.java | 6 +- .../gv/egiz/bku/local/stal/LocalSTALFactory.java | 18 +- .../bku/local/webapp/PINManagementServlet.java | 167 +++++ BKULocal/src/main/webapp/WEB-INF/web.xml | 10 +- BKULocal/src/main/webapp/index.html | 7 +- .../java/at/gv/egiz/bku/webstart/Launcher.java | 104 +++- .../bku/webstart/gui/PINManagementInvoker.java | 71 +++ .../gv/egiz/bku/webstart/gui/TrayMenuListener.java | 75 --- BKUWebStart/src/main/jnlp/resources/version.xml | 12 +- .../at/gv/egiz/bku/webstart/messages.properties | 1 + pom.xml | 2 + .../at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java | 5 + smccSTALExt/pom.xml | 27 + .../egiz/bku/smccstal/CardMgmtRequestHandler.java | 177 ++++++ .../egiz/bku/smccstal/GetPINStatusException.java | 41 ++ .../bku/smccstal/ManagementPINProviderFactory.java | 262 ++++++++ .../bku/smccstal/PINManagementRequestHandler.java | 245 ++++++++ 55 files changed, 2947 insertions(+), 2706 deletions(-) delete mode 100644 BKUApplet/src/main/java/META-INF/MANIFEST.MF delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java delete mode 100644 BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties delete mode 100644 BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties delete mode 100644 BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java delete mode 100644 BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java create mode 100644 BKUGuiExt/pom.xml create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java create mode 100644 BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties create mode 100644 BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties create mode 100644 BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java create mode 100644 BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java create mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/gui/GUIProxy.java delete mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java create mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/PINManagementServlet.java create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/PINManagementInvoker.java delete mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/TrayMenuListener.java create mode 100644 smccSTALExt/pom.xml create mode 100644 smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java create mode 100644 smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GetPINStatusException.java create mode 100644 smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/ManagementPINProviderFactory.java create mode 100644 smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java (limited to 'BKUWebStart/src') diff --git a/BKUApplet/src/main/java/META-INF/MANIFEST.MF b/BKUApplet/src/main/java/META-INF/MANIFEST.MF deleted file mode 100644 index 5e949512..00000000 --- a/BKUApplet/src/main/java/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 79fc5600..98502ab2 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -31,6 +31,16 @@ BKUApplet 1.2.2-SNAPSHOT + + at.gv.egiz + BKUGuiExt + 1.2.2-SNAPSHOT + + + at.gv.egiz + smccSTALExt + 1.2.2-SNAPSHOT + diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java deleted file mode 100644 index 8134ac5f..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package at.gv.egiz.bku.gui; - -import java.awt.Container; -import java.awt.Cursor; -import java.awt.event.ActionListener; -import java.net.URL; -import java.text.MessageFormat; -import java.util.Locale; -import java.util.ResourceBundle; -import javax.swing.GroupLayout; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JProgressBar; -import javax.swing.LayoutStyle; -import javax.swing.SwingUtilities; - -/** - * - * @author Clemens Orthacker - */ -public class ActivationGUI extends CardMgmtGUI implements ActivationGUIFacade { - - public static final String TITLE_ACTIVATION = "title.activation"; - public static final String LABEL_ACTIVATION = "label.activation"; - public static final String LABEL_ACTIVATION_STEP = "label.activation.step"; - public static final String LABEL_ACTIVATION_IDLE = "label.activation.idle"; - - public static final String HELP_ACTIVATION = "help.activation"; - - protected JProgressBar progressBar; - - public ActivationGUI(Container contentPane, - Locale locale, - Style guiStyle, - URL backgroundImgURL, - AbstractHelpListener helpListener) { - super(contentPane, locale, guiStyle, backgroundImgURL, helpListener); - - progressBar = new JProgressBar(); - } - - @Override - public void showActivationProgressDialog(final int currentStep, final int maxProgress, final ActionListener cancelListener, final String cancelCommand) { - - log.debug("scheduling activation progress dialog (step " + currentStep + ")"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - log.debug("show activation progress dialog (step " + currentStep + ")"); - - mainPanel.removeAll(); - buttonPanel.removeAll(); - - mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - - - JLabel infoLabel = new JLabel(); - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - - if (renderHeaderPanel) { - titleLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); - infoLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION)); - } else { - infoLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); - } - - helpListener.setHelpTopic(HELP_ACTIVATION); - - progressBar.setIndeterminate(false); - progressBar.setStringPainted(true); - progressBar.setString(null); //reset to percentage - progressBar.setMinimum(0); - progressBar.setMaximum(maxProgress); - - JLabel stepLabel = new JLabel(); - stepLabel.setFont(stepLabel.getFont().deriveFont(stepLabel.getFont().getStyle() & ~java.awt.Font.BOLD, stepLabel.getFont().getSize()-2)); - String stepPattern = cardmgmtMessages.getString(LABEL_ACTIVATION_STEP); - stepLabel.setText(MessageFormat.format(stepPattern, new Object[]{ currentStep })); - - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); - - GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup().addComponent(infoLabel); - GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(infoLabel); - - if (!renderHeaderPanel) { - infoHorizontal.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel); - infoVertical.addComponent(helpLabel); - } - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(infoHorizontal) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(stepLabel) - .addComponent(progressBar))); - - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(infoVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(stepLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(progressBar))); - - JButton cancelButton = new JButton(); - cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - cancelButton.setText(messages.getString(BUTTON_CANCEL)); - cancelButton.addActionListener(cancelListener); - cancelButton.setActionCommand(cancelCommand); - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - buttonPanelLayout.setHorizontalGroup( - buttonPanelLayout.createSequentialGroup() - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); - buttonPanelLayout.setVerticalGroup( - buttonPanelLayout.createSequentialGroup() - .addComponent(cancelButton)); - - contentPanel.validate(); - - } - }); - - } - - @Override - public void incrementProgress() { - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - progressBar.setValue(progressBar.getValue() + 1); - } - }); - - } - - @Override - public void showIdleDialog(final ActionListener cancelListener, final String cancelCommand) { - log.debug("scheduling idle dialog"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - log.debug("show idle dialog"); - - mainPanel.removeAll(); - buttonPanel.removeAll(); - - mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - - - JLabel infoLabel = new JLabel(); - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - - if (renderHeaderPanel) { - titleLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); - infoLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION)); - } else { - infoLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); - } - - helpListener.setHelpTopic(HELP_ACTIVATION); - - progressBar.setIndeterminate(true); - progressBar.setStringPainted(true); - progressBar.setString(""); //not string painted progressbar is smaller - - JLabel stepLabel = new JLabel(); - stepLabel.setFont(stepLabel.getFont().deriveFont(stepLabel.getFont().getStyle() & ~java.awt.Font.BOLD, stepLabel.getFont().getSize()-2)); - stepLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION_IDLE)); - - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); - - GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup().addComponent(infoLabel); - GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(infoLabel); - - if (!renderHeaderPanel) { - infoHorizontal.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel); - infoVertical.addComponent(helpLabel); - } - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(infoHorizontal) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(stepLabel) - .addComponent(progressBar))); - - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(infoVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(stepLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(progressBar))); - - JButton cancelButton = new JButton(); - cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - cancelButton.setText(messages.getString(BUTTON_CANCEL)); - cancelButton.addActionListener(cancelListener); - cancelButton.setActionCommand(cancelCommand); - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - buttonPanelLayout.setHorizontalGroup( - buttonPanelLayout.createSequentialGroup() - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); - buttonPanelLayout.setVerticalGroup( - buttonPanelLayout.createSequentialGroup() - .addComponent(cancelButton)); - - contentPanel.validate(); - - } - }); - - } -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java deleted file mode 100644 index 860a1097..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package at.gv.egiz.bku.gui; - -import java.awt.event.ActionListener; - -/** - * - * @author Clemens Orthacker - */ -public interface ActivationGUIFacade extends BKUGUIFacade { - - public void showActivationProgressDialog(int currentStep, int maxProgress, ActionListener cancelListener, String cancelCommand); - - public void incrementProgress(); - - public void showIdleDialog(ActionListener cancelListener, String cancelCommand); - -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java deleted file mode 100644 index ac9ab78b..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package at.gv.egiz.bku.gui; - -import java.awt.Container; -import java.net.URL; -import java.util.Locale; -import java.util.ResourceBundle; - -/** - * Common superclass for Activation and PinManagement GUIs - * - * @author Clemens Orthacker - */ -public class CardMgmtGUI extends BKUGUIImpl { - - public static final String CARDMGMT_MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/ActivationMessages"; - - protected ResourceBundle cardmgmtMessages; - - public CardMgmtGUI(Container contentPane, - Locale locale, - Style guiStyle, - URL backgroundImgURL, - AbstractHelpListener helpListener) { - super(contentPane, locale, guiStyle, backgroundImgURL, helpListener); - - } - - @Override - protected void loadMessageBundle(Locale locale) { - super.loadMessageBundle(locale); - - if (locale != null) { - Locale lang = new Locale(locale.getLanguage().substring(0,2)); - log.debug("loading applet resources for language: " + lang.toString()); - cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE, lang); - } else { - cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE); - } - } - - @Override - protected String getMessage(String key) { - if (super.hasMessage(key)) { - return super.getMessage(key); - } - return cardmgmtMessages.getString(key); - } - - @Override - protected boolean hasMessage(String key) { - return (cardmgmtMessages.containsKey(key) || super.hasMessage(key)); - } -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java deleted file mode 100644 index 3b77daa5..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java +++ /dev/null @@ -1,669 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package at.gv.egiz.bku.gui; - -import at.gv.egiz.smcc.PINSpec; -import java.awt.Container; -import java.awt.Cursor; -import java.awt.Font; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseMotionAdapter; -import java.net.URL; -import java.text.MessageFormat; -import java.util.Locale; -import java.util.Map; -import javax.swing.GroupLayout; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPasswordField; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.LayoutStyle; -import javax.swing.ListSelectionModel; -import javax.swing.SwingUtilities; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * TODO pull out ResourceBundle to common superclass for activationGUI and pinMgmtGUI - * @author Clemens Orthacker - */ -public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFacade { - - protected static final Log log = LogFactory.getLog(PINManagementGUI.class); - - /** remember the pinfield to return to worker */ - protected JPasswordField oldPinField; - /** remember the pinSpec to return to worker */ - protected PINSpec pinSpec; - - public PINManagementGUI(Container contentPane, - Locale locale, - Style guiStyle, - URL backgroundImgURL, - AbstractHelpListener helpListener) { - super(contentPane, locale, guiStyle, backgroundImgURL, helpListener); - } - - @Override - public char[] getOldPin() { - if (oldPinField != null) { - char[] pin = oldPinField.getPassword(); - oldPinField = null; - return pin; - } - return null; - } - - @Override - public PINSpec getSelectedPINSpec() { - return pinSpec; - } - - @Override - public void showPINManagementDialog(final Map pins, - final ActionListener activateListener, - final String activateCmd, - final String changeCmd, - final String unblockCmd, - final String verifyCmd, - final ActionListener cancelListener, - final String cancelCmd) { - - log.debug("scheduling PIN managment dialog"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - log.debug("show PIN management dialog"); - - mainPanel.removeAll(); - buttonPanel.removeAll(); - - helpListener.setHelpTopic(HELP_PINMGMT); - - JLabel mgmtLabel = new JLabel(); - mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - - if (renderHeaderPanel) { - titleLabel.setText(getMessage(TITLE_PINMGMT)); - String infoPattern = getMessage(MESSAGE_PINMGMT); - mgmtLabel.setText(MessageFormat.format(infoPattern, pins.size())); - } else { - mgmtLabel.setText(getMessage(TITLE_PINMGMT)); - } - - final PINStatusTableModel tableModel = new PINStatusTableModel(pins); - final JTable pinStatusTable = new JTable(tableModel); - pinStatusTable.setDefaultRenderer(PINSpec.class, new PINSpecRenderer()); - pinStatusTable.setDefaultRenderer(STATUS.class, new PINStatusRenderer(cardmgmtMessages)); - pinStatusTable.setTableHeader(null); - pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); -// pinStatusTable.addMouseMotionListener(new MouseMotionAdapter() { -// -// @Override -// public void mouseMoved(MouseEvent e) { -// if (pinStatusTable.columnAtPoint(e.getPoint()) == 0) { -// pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); -// } else { -// pinStatusTable.setCursor(Cursor.getDefaultCursor()); -// } -// } -// }); - - final JButton activateButton = new JButton(); - activateButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - activateButton.addActionListener(activateListener); - - pinStatusTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - pinStatusTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { - - @Override - public void valueChanged(final ListSelectionEvent e) { - //invoke later to allow thread to paint selection background - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - ListSelectionModel lsm = (ListSelectionModel) e.getSource(); - int selectionIdx = lsm.getMinSelectionIndex(); - if (selectionIdx >= 0) { - pinSpec = (PINSpec) tableModel.getValueAt(selectionIdx, 0); - STATUS status = (STATUS) tableModel.getValueAt(selectionIdx, 1); - - if (status == STATUS.NOT_ACTIV) { - activateButton.setText(getMessage(BUTTON_ACTIVATE)); - activateButton.setEnabled(true); - activateButton.setActionCommand(activateCmd); - } else if (status == STATUS.BLOCKED) { - activateButton.setText(getMessage(BUTTON_UNBLOCK)); - activateButton.setEnabled(true); - activateButton.setActionCommand(unblockCmd); - } else if (status == STATUS.ACTIV) { - activateButton.setText(getMessage(BUTTON_CHANGE)); - activateButton.setEnabled(true); - activateButton.setActionCommand(changeCmd); - } else if (status == STATUS.UNKNOWN) { - activateButton.setText(getMessage(BUTTON_VERIFY)); - activateButton.setEnabled(true); - activateButton.setActionCommand(verifyCmd); - } - } - } - }); - } - }); - - //select first entry - pinStatusTable.getSelectionModel().setSelectionInterval(0, 0); - - 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(helpLabel); - messageVertical - .addComponent(helpLabel); - } - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(messageHorizontal) - .addComponent(pinStatusScrollPane, 0, 0, Short.MAX_VALUE)); - - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(messageVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinStatusScrollPane, 0, 0, pinStatusTable.getPreferredSize().height+3)); - - JButton cancelButton = new JButton(); - cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - cancelButton.setText(getMessage(BUTTON_CLOSE)); - cancelButton.setActionCommand(cancelCmd); - cancelButton.addActionListener(cancelListener); - - 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) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); - - GroupLayout.Group buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(activateButton) - .addComponent(cancelButton); - - buttonPanelLayout.setHorizontalGroup(buttonHorizontal); - buttonPanelLayout.setVerticalGroup(buttonVertical); - - contentPanel.validate(); - } - }); - } - - @Override - public void showPINDialog(DIALOG type, PINSpec pinSpec, - ActionListener okListener, String okCommand, - ActionListener cancelListener, String cancelCommand) { - showPINDialog(type, pinSpec, -1, false, - okListener, okCommand, cancelListener, cancelCommand); - } - - @Override - public void showPINDialog(DIALOG type, PINSpec pinSpec, int retries, - ActionListener okListener, String okCommand, - ActionListener cancelListener, String cancelCommand) { - showPINDialog(type, pinSpec, retries, false, - okListener, okCommand, cancelListener, cancelCommand); - } - - @Override - public void showPinpadPINDialog(DIALOG type, PINSpec pinSpec, int retries) { - String title, msg; - Object[] params; - if (retries < 0) { - params = new Object[2]; - if (shortText) { - params[0] = "PIN"; - } else { - params[0] = pinSpec.getLocalizedName(); - } - params[1] = pinSpec.getLocalizedLength(); - if (type == DIALOG.CHANGE) { - log.debug("show change pin dialog"); - title = TITLE_CHANGE_PIN; - msg = MESSAGE_CHANGEPIN_PINPAD; - } else if (type == DIALOG.ACTIVATE) { - log.debug("show activate pin dialog"); - title = TITLE_ACTIVATE_PIN; - msg = MESSAGE_ENTERPIN_PINPAD; - } else if (type == DIALOG.VERIFY) { - log.debug("show verify pin dialog"); - title = TITLE_VERIFY_PIN; - msg = MESSAGE_ENTERPIN_PINPAD; - } else { - log.debug("show unblock pin dialog"); - title = TITLE_UNBLOCK_PIN; - msg = MESSAGE_ENTERPIN_PINPAD; - } - - } else { - log.debug("show retry pin dialog"); - title = TITLE_RETRY; - msg = (retries < 2) ? - MESSAGE_LAST_RETRY : MESSAGE_RETRIES; - params = new Object[] {String.valueOf(retries)}; - } - showMessageDialog(title, msg, params); - } - - private void showPINDialog(final DIALOG type, final PINSpec pinSpec, - final int retries, final boolean pinpad, - final ActionListener okListener, final String okCommand, - final ActionListener cancelListener, final String cancelCommand) { - - log.debug("scheduling pin dialog"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - String HELP_TOPIC, TITLE, MESSAGE_MGMT, MESSAGE_MGMT_PARAM, PINSIZE; - HELP_TOPIC = HELP_PINMGMT; - - PINSIZE = (pinSpec.getMaxLength() > pinSpec.getMinLength()) ? - pinSpec.getMinLength() + "-" + pinSpec.getMaxLength() : - String.valueOf(pinSpec.getMinLength()); - - if (retries < 0) { - if (type == DIALOG.CHANGE) { - log.debug("show change pin dialog"); - TITLE = TITLE_CHANGE_PIN; - MESSAGE_MGMT = MESSAGE_CHANGE_PIN; - } else if (type == DIALOG.ACTIVATE) { - log.debug("show activate pin dialog"); - TITLE = TITLE_ACTIVATE_PIN; - MESSAGE_MGMT = MESSAGE_ACTIVATE_PIN; - oldPinField = null; - PINSIZE = pinSpec.getLocalizedLength(); - } else if (type == DIALOG.VERIFY) { - log.debug("show verify pin dialog"); - TITLE = TITLE_VERIFY_PIN; - MESSAGE_MGMT = MESSAGE_VERIFY_PIN; - } else { - log.debug("show unblock pin dialog"); - TITLE = TITLE_UNBLOCK_PIN; - MESSAGE_MGMT = MESSAGE_UNBLOCK_PIN; - } - if (shortText) { - MESSAGE_MGMT_PARAM = "PIN"; - } else { - MESSAGE_MGMT_PARAM = pinSpec.getLocalizedName(); - } - } else { - log.debug("show retry pin dialog"); - TITLE = TITLE_RETRY; - MESSAGE_MGMT = (retries < 2) ? - MESSAGE_LAST_RETRY : MESSAGE_RETRIES; - MESSAGE_MGMT_PARAM = String.valueOf(retries); - } - - mainPanel.removeAll(); - buttonPanel.removeAll(); - - helpListener.setHelpTopic(HELP_TOPIC); - - JLabel mgmtLabel = new JLabel(); - if (retries < 0) { - mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD)); - } else { - mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() | Font.BOLD)); - mgmtLabel.setForeground(ERROR_COLOR); - helpListener.setHelpTopic(HELP_RETRY); - } - - if (renderHeaderPanel) { - titleLabel.setText(getMessage(TITLE)); - String mgmtPattern = getMessage(MESSAGE_MGMT); - mgmtLabel.setText(MessageFormat.format(mgmtPattern, MESSAGE_MGMT_PARAM)); - } else { - mgmtLabel.setText(getMessage(TITLE)); - } - - //////////////////////////////////////////////////////////////// - // COMMON LAYOUT SECTION - //////////////////////////////////////////////////////////////// - - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); - - GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup() - .addComponent(mgmtLabel); - GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(mgmtLabel); - - if (!renderHeaderPanel) { - infoHorizontal - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel); - infoVertical - .addComponent(helpLabel); - } - - GroupLayout.ParallelGroup pinHorizontal; - GroupLayout.SequentialGroup pinVertical; - - if (pinpad) { - JLabel pinpadLabel = new JLabel(); - pinpadLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD)); - String pinpadPattern = getMessage(MESSAGE_VERIFYPIN_PINPAD); - pinpadLabel.setText(MessageFormat.format(pinpadPattern, - new Object[] { pinSpec.getLocalizedName(), PINSIZE })); - - pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(pinpadLabel); - pinVertical = mainPanelLayout.createSequentialGroup() - .addComponent(pinpadLabel); - } else { - - JButton okButton = new JButton(); - okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~Font.BOLD)); - okButton.setText(getMessage(BUTTON_OK)); - okButton.setEnabled(pinSpec.getMinLength() <= 0); - okButton.setActionCommand(okCommand); - okButton.addActionListener(okListener); - - JLabel oldPinLabel = null; - JLabel repeatPinLabel = null; - JLabel pinLabel = new JLabel(); - pinLabel.setFont(pinLabel.getFont().deriveFont(pinLabel.getFont().getStyle() & ~Font.BOLD)); - String pinLabelPattern = (type == DIALOG.CHANGE) ? getMessage(LABEL_NEW_PIN) : getMessage(LABEL_PIN); - pinLabel.setText(MessageFormat.format(pinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); - - final JPasswordField repeatPinField = new JPasswordField(); - pinField = new JPasswordField(); - pinField.setText(""); - pinField.setActionCommand(okCommand); - pinField.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if (pinField.getPassword().length >= pinSpec.getMinLength()) { - if (type == DIALOG.VERIFY) { - okListener.actionPerformed(e); - } else { - repeatPinField.requestFocusInWindow(); - } - } - } - }); - - if (type != DIALOG.VERIFY) { - pinField.setDocument(new PINDocument(pinSpec, null)); - repeatPinLabel = new JLabel(); - repeatPinLabel.setFont(pinLabel.getFont()); - String repeatPinLabelPattern = getMessage(LABEL_REPEAT_PIN); - repeatPinLabel.setText(MessageFormat.format(repeatPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); - - repeatPinField.setText(""); -// repeatPinField.setDocument(new PINDocument(pinSpec, okButton, pinField.getDocument())); - repeatPinField.setActionCommand(okCommand); - repeatPinField.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if (pinField.getPassword().length >= pinSpec.getMinLength()) { - okListener.actionPerformed(e); - } - } - }); - - if (type == DIALOG.CHANGE) { - oldPinLabel = new JLabel(); - oldPinLabel.setFont(oldPinLabel.getFont().deriveFont(oldPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - String oldPinLabelPattern = getMessage(LABEL_OLD_PIN); - oldPinLabel.setText(MessageFormat.format(oldPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); - - oldPinField = new JPasswordField(); - oldPinField.setText(""); - oldPinField.setDocument(new PINDocument(pinSpec, null)); - oldPinField.setActionCommand(okCommand); - oldPinField.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if (oldPinField.getPassword().length >= pinSpec.getMinLength()) { - pinField.requestFocusInWindow(); - } - } - }); - - repeatPinField.setDocument(new PINDocument( - pinSpec, okButton, - pinField.getDocument(), oldPinField.getDocument())); - } else { - // else -> ACTIVATE (not verify, not change) - repeatPinField.setDocument(new PINDocument( - pinSpec, okButton, pinField.getDocument())); - } - } else { - pinField.setDocument(new PINDocument(pinSpec, okButton)); - } - - JLabel pinsizeLabel = new JLabel(); - pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~Font.BOLD, pinsizeLabel.getFont().getSize()-2)); - String pinsizePattern = getMessage(LABEL_PINSIZE); - pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{PINSIZE})); - - //////////////////////////////////////////////////////////////// - // NON-PINPAD SPECIFIC LAYOUT SECTION - //////////////////////////////////////////////////////////////// - - pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); - pinVertical = mainPanelLayout.createSequentialGroup(); - -// if (pinLabelPos == PinLabelPosition.ABOVE) { -// if (changePin) { -// pinHorizontal -// .addComponent(oldPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) -// .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE); -// pinVertical -// .addComponent(oldPinLabel) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); -// } -// pinHorizontal -// .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) -// .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) -// .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) -// .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) -// .addGroup(mainPanelLayout.createSequentialGroup() -// .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) -// .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); -// pinVertical -// .addComponent(pinLabel) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(repeatPinLabel) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(pinsizeLabel); -// } else { - - - if (type == DIALOG.CHANGE) { - pinHorizontal - .addGroup(mainPanelLayout.createSequentialGroup() - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(oldPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); - - pinVertical - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(oldPinLabel) - .addComponent(oldPinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(pinLabel) - .addComponent(pinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(repeatPinLabel) - .addComponent(repeatPinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); - } else if (type == DIALOG.ACTIVATE) { - pinHorizontal - .addGroup(mainPanelLayout.createSequentialGroup() - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); - - pinVertical - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(pinLabel) - .addComponent(pinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(repeatPinLabel) - .addComponent(repeatPinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); - } else { // VERIFY - pinHorizontal - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); - - pinVertical - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(pinLabel) - .addComponent(pinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); - } - pinHorizontal - .addGroup(mainPanelLayout.createSequentialGroup() - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); - pinVertical - .addComponent(pinsizeLabel); - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup() - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); - GroupLayout.Group buttonVertical; - - JButton cancelButton = new JButton(); - cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - cancelButton.setText(getMessage(BUTTON_CANCEL)); - cancelButton.setActionCommand(cancelCommand); - cancelButton.addActionListener(cancelListener); - - buttonHorizontal - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); - buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(okButton) - .addComponent(cancelButton); - - buttonPanelLayout.setHorizontalGroup(buttonHorizontal); - buttonPanelLayout.setVerticalGroup(buttonVertical); - - if (oldPinField != null) { - oldPinField.requestFocusInWindow(); - } else { - pinField.requestFocusInWindow(); - } - - } // END NON-PINPAD SECTION - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(infoHorizontal) - .addGroup(pinHorizontal)); - - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(infoVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pinVertical)); - - contentPanel.validate(); - - } - }); - } - - @Override - protected int initButtonSize() { - int bs = super.initButtonSize(); - - JButton b = new JButton(); - b.setText(getMessage(BUTTON_ACTIVATE)); - if (b.getPreferredSize().width > bs) { - bs = b.getPreferredSize().width; - } - b.setText(getMessage(BUTTON_CHANGE)); - if (b.getPreferredSize().width > bs) { - bs = b.getPreferredSize().width; - } - b.setText(getMessage(BUTTON_UNBLOCK)); - if (b.getPreferredSize().width > bs) { - bs = b.getPreferredSize().width; - } - b.setText(getMessage(BUTTON_CANCEL)); - if (b.getPreferredSize().width > bs) { - bs = b.getPreferredSize().width; - } - - return bs; - } - -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java deleted file mode 100644 index f99bcfd1..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package at.gv.egiz.bku.gui; - -import at.gv.egiz.smcc.PINSpec; -import java.awt.event.ActionListener; -import java.util.Map; - -/** - * - * @author Clemens Orthacker - */ -public interface PINManagementGUIFacade extends BKUGUIFacade { - - public static final String HELP_PINMGMT = "help.pin.mgmt"; -// public static final String HELP_VERIFY_PIN = "help.pin.verify"; - public static final String TITLE_PINMGMT = "title.pin.mgmt"; - public static final String TITLE_ACTIVATE_PIN = "title.activate.pin"; - public static final String TITLE_CHANGE_PIN = "title.change.pin"; - public static final String TITLE_VERIFY_PIN = "title.verify.pin"; - public static final String TITLE_UNBLOCK_PIN = "title.unblock.pin"; - public static final String TITLE_ACTIVATE_SUCCESS = "title.activate.success"; - public static final String TITLE_CHANGE_SUCCESS = "title.change.success"; - - // removed message.* prefix to reuse keys as help keys - public static final String MESSAGE_ACTIVATE_SUCCESS = "activate.success"; - public static final String MESSAGE_CHANGE_SUCCESS = "change.success"; - public static final String MESSAGE_PINMGMT = "pin.mgmt"; -// public static final String MESSAGE_PINPAD = "pinpad"; - public static final String MESSAGE_ACTIVATE_PIN = "activate.pin"; - public static final String MESSAGE_CHANGE_PIN = "change.pin"; - public static final String MESSAGE_VERIFY_PIN = "verify.pin"; - public static final String MESSAGE_UNBLOCK_PIN = "unblock.pin"; - public static final String MESSAGE_ACTIVATEPIN_PINPAD = "activate.pinpad"; - public static final String MESSAGE_CHANGEPIN_PINPAD = "change.pinpad"; - public static final String MESSAGE_VERIFYPIN_PINPAD = "verify.pinpad"; - public static final String MESSAGE_UNBLOCKPIN_PINPAD = "unblock.pinpad"; - - public static final String LABEL_OLD_PIN = "label.old.pin"; - public static final String LABEL_NEW_PIN = "label.new.pin"; - public static final String LABEL_REPEAT_PIN = "label.repeat.pin"; - - public static final String ERR_STATUS = "err.status"; - public static final String ERR_ACTIVATE = "err.activate"; - public static final String ERR_CHANGE = "err.change"; - public static final String ERR_UNBLOCK = "err.unblock"; - public static final String ERR_VERIFY = "err.verify"; - public static final String ERR_RETRIES = "err.retries"; - public static final String ERR_LOCKED = "err.locked"; - public static final String ERR_NOT_ACTIVE = "err.not.active"; - public static final String ERR_PIN_FORMAT = "err.pin.format"; - public static final String ERR_PIN_CONFIRMATION = "err.pin.confirmation"; - public static final String ERR_PIN_OPERATION_ABORTED = "err.pin.operation.aborted"; - public static final String ERR_UNSUPPORTED_CARD = "err.unsupported.card"; - - public static final String BUTTON_ACTIVATE = "button.activate"; - public static final String BUTTON_UNBLOCK = "button.unblock"; - public static final String BUTTON_CHANGE = "button.change"; - public static final String BUTTON_VERIFY = "button.verify"; - - public static final String STATUS_ACTIVE = "status.active"; - public static final String STATUS_BLOCKED = "status.blocked"; - public static final String STATUS_NOT_ACTIVE = "status.not.active"; - public static final String STATUS_UNKNOWN = "status.unknown"; - - public enum STATUS { ACTIV, NOT_ACTIV, BLOCKED, UNKNOWN }; - public enum DIALOG { VERIFY, ACTIVATE, CHANGE, UNBLOCK }; - - public void showPINManagementDialog(Map pins, - ActionListener activateListener, String activateCmd, String changeCmd, String unblockCmd, String verifyCmd, - ActionListener cancelListener, String cancelCmd); - - public void showPINDialog(DIALOG type, PINSpec pin, - ActionListener okListener, String okCmd, - ActionListener cancelListener, String cancelCmd); - - public void showPINDialog(DIALOG type, PINSpec pin, int retries, - ActionListener okListener, String okCmd, - ActionListener cancelListener, String cancelCmd); - - public void showPinpadPINDialog(DIALOG type, PINSpec pin, int retries); - -// public void showActivatePINDialog(PINSpec pin, -// ActionListener okListener, String okCmd, -// ActionListener cancelListener, String cancelCmd); -// -// public void showChangePINDialog(PINSpec pin, -// ActionListener okListener, String okCmd, -// ActionListener cancelListener, String cancelCmd); -// -// public void showUnblockPINDialog(PINSpec pin, -// ActionListener okListener, String okCmd, -// ActionListener cancelListener, String cancelCmd); -// -// public void showVerifyPINDialog(PINSpec pin, -// ActionListener okListener, String okCmd, -// ActionListener cancelListener, String cancelCmd); - - public char[] getOldPin(); - - public PINSpec getSelectedPINSpec(); -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java deleted file mode 100644 index e3d73e1f..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package at.gv.egiz.bku.gui; - -import at.gv.egiz.smcc.PINSpec; -import javax.swing.table.DefaultTableCellRenderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * - * @author Clemens Orthacker - */ -public class PINSpecRenderer extends DefaultTableCellRenderer { - - private static final Log log = LogFactory.getLog(PINSpecRenderer.class); - - @Override - protected void setValue(Object value) { - PINSpec pinSpec = (PINSpec) value; - super.setText(pinSpec.getLocalizedName()); - } - -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java deleted file mode 100644 index 83ff74f2..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package at.gv.egiz.bku.gui; - -import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; -import java.awt.Color; -import java.awt.Font; -import java.util.ResourceBundle; -import javax.swing.table.DefaultTableCellRenderer; - -/** - * - * @author Clemens Orthacker - */ -public class PINStatusRenderer extends DefaultTableCellRenderer { - -// private static final Log log = LogFactory.getLog(PINStatusRenderer.class); - - public static final Color RED = new Color(0.9f, 0.0f, 0.0f); - public static final Color GREEN = new Color(0.0f, 0.8f, 0.0f); - protected ResourceBundle messages; - - public PINStatusRenderer(ResourceBundle messages) { - this.messages = messages; - } - - @Override - protected void setValue(Object value) { - STATUS pinStatus = (STATUS) value; - super.setFont(super.getFont().deriveFont(super.getFont().getStyle() | Font.BOLD)); - - if (pinStatus == STATUS.NOT_ACTIV) { - super.setForeground(RED); - super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_NOT_ACTIVE) + ""); - } else if (pinStatus == STATUS.ACTIV) { - super.setForeground(GREEN); - super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_ACTIVE) + ""); - } else if (pinStatus == STATUS.BLOCKED) { - super.setForeground(RED); - super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_BLOCKED) + ""); - } else { - super.setForeground(Color.BLACK); - super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_UNKNOWN) + ""); - } - } -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java deleted file mode 100644 index 052c13b2..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package at.gv.egiz.bku.gui; - -import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; -import at.gv.egiz.smcc.PINSpec; -import java.util.Map; -import javax.swing.table.DefaultTableModel; - -/** - * - * @author Clemens Orthacker - */ -public class PINStatusTableModel extends DefaultTableModel { - -// protected static final Log log = LogFactory.getLog(PINStatusTableModel.class); - protected Class[] types; - - public PINStatusTableModel(Map pinStatuses) { - super(0, 2); - if (pinStatuses == null) { - throw new RuntimeException("pinStatuses must not be null"); - } -// log.trace(pinStatuses.size() + " PINs"); - types = new Class[] { PINSpec.class, STATUS.class }; - for (PINSpec pinSpec : pinStatuses.keySet()) { - addRow(new Object[] { pinSpec, pinStatuses.get(pinSpec) }); - } -// PINSpec activePIN = new PINSpec(0, 1, null, "active-PIN", (byte) 0x01); -// PINSpec blockedPIN = new PINSpec(0, 1, null, "blocked-PIN", (byte) 0x01); -// addRow(new Object[] { activePIN, PINStatusProvider.STATUS.ACTIV }); -// addRow(new Object[] { blockedPIN, PINStatusProvider.STATUS.BLOCKED }); - } - - @Override - public Class getColumnClass(int columnIndex) { - return types[columnIndex]; - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - return false; - } -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java index 68f0cb72..cfd1e200 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java @@ -22,7 +22,7 @@ import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIFacade.Style; import at.gv.egiz.bku.online.applet.BKUApplet; import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; -import at.gv.egiz.bku.smccstal.ext.CardMgmtRequestHandler; +import at.gv.egiz.bku.smccstal.CardMgmtRequestHandler; import at.gv.egiz.stal.ext.APDUScriptRequest; import at.gv.egiz.stal.service.STALPortType; import at.gv.egiz.stal.service.translator.STALTranslator; diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java index 81b635f8..d06c2865 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java @@ -18,11 +18,16 @@ package at.gv.egiz.bku.online.applet; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.PINManagementGUIFacade; -import at.gv.egiz.bku.smccstal.ext.PINManagementRequestHandler; +import at.gv.egiz.bku.smccstal.PINManagementRequestHandler; import at.gv.egiz.stal.ErrorResponse; +import at.gv.egiz.stal.InfoboxReadRequest; +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.PINManagementRequest; import at.gv.egiz.stal.ext.PINManagementResponse; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -36,7 +41,8 @@ public class PINManagementBKUWorker extends AppletBKUWorker { public PINManagementBKUWorker(BKUApplet applet, PINManagementGUIFacade gui) { super(applet, gui); - handlerMap.clear(); + removeRequestHandler(InfoboxReadRequest.class); + removeRequestHandler(SignRequest.class); addRequestHandler(PINManagementRequest.class, new PINManagementRequestHandler()); } @@ -46,7 +52,11 @@ public class PINManagementBKUWorker extends AppletBKUWorker { BKUGUIFacade.MESSAGE_WELCOME); try { - List responses = handleRequest(Collections.singletonList(new PINManagementRequest())); + + ArrayList reqs = new ArrayList(); + reqs.add(new PINManagementRequest()); + reqs.add(new QuitRequest()); + List responses = handleRequest(reqs); if (responses.size() == 1) { STALResponse response = responses.get(0); diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java deleted file mode 100644 index 769342e7..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java +++ /dev/null @@ -1,177 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -/** - * - */ -package at.gv.egiz.bku.smccstal.ext; - -import at.gv.egiz.bku.gui.ActivationGUIFacade; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.smartcardio.Card; -import javax.smartcardio.CardChannel; -import javax.smartcardio.CardException; -import javax.smartcardio.CommandAPDU; -import javax.smartcardio.ResponseAPDU; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.bku.smccstal.AbstractRequestHandler; -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.APDUScriptRequest; -import at.gv.egiz.stal.ext.APDUScriptResponse; -import at.gv.egiz.stal.ext.APDUScriptRequest.Command; -import at.gv.egiz.stal.ext.APDUScriptRequest.RequestScriptElement; -import at.gv.egiz.stal.ext.APDUScriptRequest.Reset; -import at.gv.egiz.stal.ext.APDUScriptResponse.Response; -import at.gv.egiz.stal.ext.APDUScriptResponse.ATR; -import at.gv.egiz.stal.ext.APDUScriptResponse.ResponseScriptElement; -import java.awt.event.ActionListener; - -/** - * @author mcentner - * - */ -public class CardMgmtRequestHandler extends AbstractRequestHandler implements ActionListener { - - /** - * Logging facility. - */ - private static Log log = LogFactory.getLog(CardMgmtRequestHandler.class); - - /** - * The sequence counter. - */ - private int sequenceNum = 0; - - /** - * display script num - */ - private int currentActivationScript = 0; - - @Override - public STALResponse handleRequest(STALRequest request) - throws InterruptedException { - - // APDU Script Request - if (request instanceof APDUScriptRequest) { - - currentActivationScript++; - log.debug("handling APDU script " + currentActivationScript); - - Card icc = card.getCard(); - - if (icc == null) { - log.error("SignatureCard instance '" + card.getClass().getName() + "' does not support card management requests."); - return new ErrorResponse(1000); - } - - List script = ((APDUScriptRequest) request).getScript(); - ArrayList responses = new ArrayList(script.size()); - - ((ActivationGUIFacade) gui).showActivationProgressDialog(currentActivationScript, script.size(), this, "cancel"); - - try { - log.trace("begin exclusive"); - icc.beginExclusive(); - - for (RequestScriptElement scriptElement : script) { - ((ActivationGUIFacade) gui).incrementProgress(); - - if (scriptElement instanceof Command) { - log.trace("handling APDU script element COMMAND"); - Command command = (Command) scriptElement; - CommandAPDU commandAPDU = new CommandAPDU(command.getCommandAPDU()); - - log.trace("get basicchannel"); - CardChannel channel = icc.getBasicChannel(); - - sequenceNum = command.getSequence(); - log.debug("Transmit APDU (sequence=" + sequenceNum + ")"); - log.trace(commandAPDU.toString()); - ResponseAPDU responseAPDU = channel.transmit(commandAPDU); - log.trace(responseAPDU.toString()); - - byte[] sw = new byte[] { - (byte) (0xFF & responseAPDU.getSW1()), - (byte) (0xFF & responseAPDU.getSW2()) }; - - responses.add(new Response(sequenceNum, responseAPDU.getData(), sw, 0)); - - if (command.getExpectedSW() != null && - !Arrays.equals(sw, command.getExpectedSW())) { - // unexpected SW - log.warn("Got unexpected SW. APDU-script execution stopped."); - break; - } - - } else if (scriptElement instanceof Reset) { - - log.trace("handling APDU script element RESET"); - sequenceNum = 0; - card.reset(); - javax.smartcardio.ATR atr = icc.getATR(); - log.trace("got ATR: " + atr.toString()); - responses.add(new ATR(atr.getBytes())); - - log.trace("regain exclusive access to card"); - icc = card.getCard(); - icc.beginExclusive(); - } - - } - - } catch (CardException e) { - log.info("Failed to execute APDU script.", e); - responses.add(new Response(sequenceNum, null, null, Response.RC_UNSPECIFIED)); - } catch (SignatureCardException e) { - log.info("Failed to reset smart card.", e); - responses.add(new Response(sequenceNum, null, null, Response.RC_UNSPECIFIED)); - } catch (RuntimeException e) { - log.error(e); - throw e; - } finally { - try { - icc.endExclusive(); - } catch (CardException e) { - log.info(e); - } - } - - log.trace("done handling APDU script " + currentActivationScript + ", return response containing " + responses.size() + " elements"); - ((ActivationGUIFacade) gui).showIdleDialog(this, "cancel"); - return new APDUScriptResponse(responses); - - } else { - log.error("Got unexpected STAL request: " + request); - return new ErrorResponse(1000); - } - - } - - @Override - public boolean requireCard() { - return true; - } - -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java deleted file mode 100644 index abbe66a1..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package at.gv.egiz.bku.smccstal.ext; - -import at.gv.egiz.smcc.SignatureCardException; - -/** - * - * @author Clemens Orthacker - */ -public class GetPINStatusException extends SignatureCardException { - - /** - * Creates a new instance of GetStatusException without detail message. - */ - public GetPINStatusException() { - } - - - /** - * Constructs an instance of GetStatusException with the specified detail message. - * @param msg the detail message. - */ - public GetPINStatusException(String msg) { - super(msg); - } -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java deleted file mode 100644 index f54f89d4..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package at.gv.egiz.bku.smccstal.ext; - -import at.gv.egiz.bku.gui.BKUGUIFacade; -import at.gv.egiz.smcc.ChangePINProvider; -import at.gv.egiz.bku.gui.PINManagementGUIFacade; -import at.gv.egiz.bku.smccstal.AbstractPINProvider; -import at.gv.egiz.bku.smccstal.PINProviderFactory; -import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.ccid.CCID; -import at.gv.egiz.smcc.PINProvider; -import at.gv.egiz.smcc.PINSpec; -import at.gv.egiz.smcc.SignatureCard; - -/** - * - * @author Clemens Orthacker - */ -public class ManagementPINProviderFactory extends PINProviderFactory { - - public ManagementPINProviderFactory(CCID reader, PINManagementGUIFacade gui) { - super(reader, gui); - } - -// public static ManagementPINProviderFactory getInstance(SignatureCard forCard, -// PINManagementGUIFacade gui) { -// if (forCard.getReader().hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) { -// return new PinpadPINProviderFactory(gui); -// -// } else { -// return new SoftwarePINProviderFactory(gui); -// } -// } - - public PINProvider getVerifyPINProvider() { - if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_START)) { - return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.VERIFY); - } else if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) { - return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.VERIFY); - } else { - return new SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG.VERIFY); - } - } - - public PINProvider getActivatePINProvider() { - if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_START)) { - return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.ACTIVATE); - } else if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_DIRECT)) { - return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.ACTIVATE); - } else { - return new SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG.ACTIVATE); - } - } - - public ChangePINProvider getChangePINProvider() { - if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_START)) { - return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.CHANGE); - } else if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_DIRECT)) { - return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.CHANGE); - } else { - return new ChangePinProvider(); - } - } - - public PINProvider getUnblockPINProvider() { - if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_START)) { - return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.UNBLOCK); - } else if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) { - return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.UNBLOCK); - } else { - return new SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG.UNBLOCK); - } - } - - class PinpadGenericPinProvider extends AbstractPINProvider - implements ChangePINProvider { - - protected PINManagementGUIFacade.DIALOG type; - - private PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG type) { - this.type = type; - } - - @Override - public char[] providePIN(PINSpec spec, int retries) - throws CancelledException, InterruptedException { - - showPinpadPINDialog(retries, spec); - retry = true; - return null; - } - - /** - * do not call this method without calling providePIN() - * (no message is displayed) - * @param spec - * @param retries - * @return - */ - @Override - public char[] provideOldPIN(PINSpec spec, int retries) { - return null; - } - - private void showPinpadPINDialog(int retries, PINSpec pinSpec) { - String title, message; - Object[] params; - if (retry) { - if (retries == 1) { - message = BKUGUIFacade.MESSAGE_LAST_RETRY_PINPAD; - } else { - message = BKUGUIFacade.MESSAGE_RETRIES_PINPAD; - } - title = BKUGUIFacade.TITLE_RETRY; - params = new Object[]{String.valueOf(retries)}; - } else if (type == PINManagementGUIFacade.DIALOG.VERIFY) { - title = PINManagementGUIFacade.TITLE_VERIFY_PIN; - message = BKUGUIFacade.MESSAGE_ENTERPIN_PINPAD; - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } - params = new Object[]{pinSpec.getLocalizedName(), pinSize}; - } else if (type == PINManagementGUIFacade.DIALOG.ACTIVATE) { - title = PINManagementGUIFacade.TITLE_ACTIVATE_PIN; - message = PINManagementGUIFacade.MESSAGE_ACTIVATEPIN_PINPAD; - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } - params = new Object[]{pinSpec.getLocalizedName(), pinSize}; - } else if (type == PINManagementGUIFacade.DIALOG.CHANGE) { - title = PINManagementGUIFacade.TITLE_CHANGE_PIN; - message = PINManagementGUIFacade.MESSAGE_CHANGEPIN_PINPAD; - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } - params = new Object[]{pinSpec.getLocalizedName(), pinSize}; - } else { //if (type == DIALOG.UNBLOCK) { - title = PINManagementGUIFacade.TITLE_UNBLOCK_PIN; - message = PINManagementGUIFacade.MESSAGE_UNBLOCKPIN_PINPAD; - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } - params = new Object[]{pinSpec.getLocalizedName(), pinSize}; - } - gui.showMessageDialog(title, message, params); - } - } - - - class SoftwareGenericPinProvider extends AbstractPINProvider { - -// protected PINManagementGUIFacade gui; - protected PINManagementGUIFacade.DIALOG type; - - private SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG type) { - this.type = type; - } - - @Override - public char[] providePIN(PINSpec spec, int retries) - throws CancelledException, InterruptedException { - - ((PINManagementGUIFacade) gui).showPINDialog(type, spec, - (retry) ? retries : -1, - this, "exec", - this, "back"); - - waitForAction(); - - if ("exec".equals(action)) { - gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT, - BKUGUIFacade.MESSAGE_WAIT); - retry = true; - return gui.getPin(); - } else if ("back".equals(action)) { - throw new CancelledException(); - } else { - log.error("unsupported command " + action); - throw new CancelledException(); - } - } - } - - class ChangePinProvider extends AbstractPINProvider - implements ChangePINProvider { - -// protected PINManagementGUIFacade gui; - - private char[] oldPin; - private char[] newPin; - - private ChangePinProvider() { - } - - @Override - public char[] providePIN(PINSpec spec, int retries) - throws CancelledException, InterruptedException { - if (newPin == null) { - getPINs(spec, retries); - } - char[] pin = newPin; - newPin = null; - return pin; - } - - @Override - public char[] provideOldPIN(PINSpec spec, int retries) - throws CancelledException, InterruptedException { - if (oldPin == null) { - getPINs(spec, retries); - } - char[] pin = oldPin; - oldPin = null; - return pin; - } - - private void getPINs(PINSpec spec, int retries) - throws InterruptedException, CancelledException { - - ((PINManagementGUIFacade) gui).showPINDialog( - PINManagementGUIFacade.DIALOG.CHANGE, spec, - (retry) ? retries : -1, - this, "exec", - this, "back"); - - waitForAction(); - - if ("exec".equals(action)) { - gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT, - BKUGUIFacade.MESSAGE_WAIT); - retry = true; - oldPin = ((PINManagementGUIFacade) gui).getOldPin(); - newPin = gui.getPin(); - } else if ("back".equals(action)) { - throw new CancelledException(); - } else { - log.error("unsupported command " + action); - throw new CancelledException(); - } - } - } -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java deleted file mode 100644 index e0b09d63..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package at.gv.egiz.bku.smccstal.ext; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.bku.gui.BKUGUIFacade; -import at.gv.egiz.bku.gui.PINManagementGUIFacade; -import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; -import at.gv.egiz.bku.smccstal.AbstractRequestHandler; -import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.LockedException; -import at.gv.egiz.smcc.NotActivatedException; -import at.gv.egiz.smcc.PINConfirmationException; -import at.gv.egiz.smcc.PINFormatException; -import at.gv.egiz.smcc.PINMgmtSignatureCard; -import at.gv.egiz.smcc.PINOperationAbortedException; -import at.gv.egiz.smcc.PINSpec; -import at.gv.egiz.smcc.SignatureCardException; -import at.gv.egiz.smcc.TimeoutException; -import at.gv.egiz.smcc.PINMgmtSignatureCard.PIN_STATE; -import at.gv.egiz.stal.ErrorResponse; -import at.gv.egiz.stal.STALRequest; -import at.gv.egiz.stal.STALResponse; -import at.gv.egiz.stal.ext.PINManagementRequest; -import at.gv.egiz.stal.ext.PINManagementResponse; - -/** - * - * @author Clemens Orthacker - */ -public class PINManagementRequestHandler extends AbstractRequestHandler { - - protected static final Log log = LogFactory.getLog(PINManagementRequestHandler.class); - - protected Map pinStates = new HashMap(); - - @Override - public STALResponse handleRequest(STALRequest request) throws InterruptedException { - if (request instanceof PINManagementRequest) { - - PINManagementGUIFacade gui = (PINManagementGUIFacade) this.gui; - - PINSpec selectedPIN = null; - - try { - - if (card instanceof PINMgmtSignatureCard) { - - // update all PIN states - for (PINSpec pinSpec : ((PINMgmtSignatureCard) card).getPINSpecs()) { - updatePINState(pinSpec, STATUS.UNKNOWN); - } - - gui.showPINManagementDialog(pinStates, this, "activate_enterpin", - "change_enterpin", "unblock_enterpuk", "verify_enterpin", this, - "cancel"); - - } else { - - // card does not support PIN management - gui.showErrorDialog(PINManagementGUIFacade.ERR_UNSUPPORTED_CARD, - null, this, "cancel"); - - } - - while (true) { - - waitForAction(); - - if ("cancel".equals(actionCommand)) { - return new PINManagementResponse(); - } else { - selectedPIN = gui.getSelectedPINSpec(); - - if (selectedPIN == null) { - throw new NullPointerException("no PIN selected for activation/change"); - } - - ManagementPINProviderFactory ppfac = - new ManagementPINProviderFactory(card.getReader(), gui); - - try { - if ("activate_enterpin".equals(actionCommand)) { - log.info("activate " + selectedPIN.getLocalizedName()); - ((PINMgmtSignatureCard) card).activatePIN(selectedPIN, - ppfac.getActivatePINProvider()); - updatePINState(selectedPIN, STATUS.ACTIV); - gui.showMessageDialog(PINManagementGUIFacade.TITLE_ACTIVATE_SUCCESS, - PINManagementGUIFacade.MESSAGE_ACTIVATE_SUCCESS, - new Object[] {selectedPIN.getLocalizedName()}, - BKUGUIFacade.BUTTON_OK, this, "ok"); - waitForAction(); - } else if ("change_enterpin".equals(actionCommand)) { - log.info("change " + selectedPIN.getLocalizedName()); - ((PINMgmtSignatureCard) card).changePIN(selectedPIN, - ppfac.getChangePINProvider()); - updatePINState(selectedPIN, STATUS.ACTIV); - gui.showMessageDialog(PINManagementGUIFacade.TITLE_CHANGE_SUCCESS, - PINManagementGUIFacade.MESSAGE_CHANGE_SUCCESS, - new Object[] {selectedPIN.getLocalizedName()}, - BKUGUIFacade.BUTTON_OK, this, "ok"); - waitForAction(); - - } else if ("unblock_enterpuk".equals(actionCommand)) { - log.info("unblock " + selectedPIN.getLocalizedName()); - ((PINMgmtSignatureCard) card).unblockPIN(selectedPIN, - ppfac.getUnblockPINProvider()); - } else if ("verify_enterpin".equals(actionCommand)) { - log.info("verify " + selectedPIN.getLocalizedName()); - ((PINMgmtSignatureCard) card).verifyPIN(selectedPIN, - ppfac.getVerifyPINProvider()); - updatePINState(selectedPIN, STATUS.ACTIV); - } - } catch (CancelledException ex) { - log.trace("cancelled"); - } catch (TimeoutException ex) { - log.error("Timeout during pin entry"); - gui.showMessageDialog(BKUGUIFacade.TITLE_ENTRY_TIMEOUT, - BKUGUIFacade.ERR_PIN_TIMEOUT, - new Object[] {selectedPIN.getLocalizedName()}, - BKUGUIFacade.BUTTON_OK, this, null); - waitForAction(); - } catch (LockedException ex) { - log.error(selectedPIN.getLocalizedName() + " locked"); - updatePINState(selectedPIN, STATUS.BLOCKED); - gui.showErrorDialog(PINManagementGUIFacade.ERR_LOCKED, - new Object[] {selectedPIN.getLocalizedName()}, - this, null); - waitForAction(); - } catch (NotActivatedException ex) { - log.error(selectedPIN.getLocalizedName() + " not active"); - updatePINState(selectedPIN, STATUS.NOT_ACTIV); - gui.showErrorDialog(PINManagementGUIFacade.ERR_NOT_ACTIVE, - new Object[] {selectedPIN.getLocalizedName()}, - this, null); - waitForAction(); - } catch (PINConfirmationException ex) { - log.error("confirmation pin does not match new " + selectedPIN.getLocalizedName()); - gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_CONFIRMATION, - new Object[] {selectedPIN.getLocalizedName()}, - this, null); - waitForAction(); - } catch (PINOperationAbortedException ex) { - log.error("pin operation aborted without further details"); - gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_OPERATION_ABORTED, - new Object[] {selectedPIN.getLocalizedName()}, - this, null); - waitForAction(); - } catch (PINFormatException ex) { - log.error("wrong format of new " + selectedPIN.getLocalizedName()); -// updatePINStatus(selectedPIN, STATUS.NOT_ACTIV); - String pinSize = String.valueOf(selectedPIN.getMinLength()); - if (selectedPIN.getMinLength() != selectedPIN.getMaxLength()) { - pinSize += "-" + selectedPIN.getMaxLength(); - } - gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_FORMAT, - new Object[] {selectedPIN.getLocalizedName(), pinSize}, - this, null); - waitForAction(); - } - } // end if - - selectedPIN = null; - gui.showPINManagementDialog(pinStates, - this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", - this, "cancel"); - } // end while - - } catch (GetPINStatusException ex) { - String pin = (selectedPIN != null) ? selectedPIN.getLocalizedName() : "pin"; - log.error("failed to get " + pin + " status: " + ex.getMessage()); - gui.showErrorDialog(PINManagementGUIFacade.ERR_STATUS, null, - this, "ok"); - waitForAction(); - return new ErrorResponse(1000); - } catch (SignatureCardException ex) { - log.error(ex.getMessage(), ex); - gui.showErrorDialog(PINManagementGUIFacade.ERR_UNKNOWN, null, - this, "ok"); - waitForAction(); - return new ErrorResponse(1000); - } - } else { - log.error("Got unexpected STAL request: " + request); - return new ErrorResponse(1000); - } - } - - @Override - public boolean requireCard() { - return true; - } - - /** - * query status for STARCOS card, - * assume provided status for ACOS card - * @param pinSpec - * @param status - * @throws at.gv.egiz.smcc.SignatureCardException if query status fails - */ - private void updatePINState(PINSpec pinSpec, STATUS status) - throws GetPINStatusException { - - PINMgmtSignatureCard pmCard = ((PINMgmtSignatureCard) card); - PIN_STATE pinState; - try { - pinState = pmCard.getPINState(pinSpec); - } catch (SignatureCardException e) { - String msg = "Failed to get PIN status for pin '" - + pinSpec.getLocalizedName() + "'."; - log.info(msg, e); - throw new GetPINStatusException(msg); - } - if (pinState == PIN_STATE.ACTIV) { - pinStates.put(pinSpec, STATUS.ACTIV); - } else if (pinState == PIN_STATE.NOT_ACTIV) { - pinStates.put(pinSpec, STATUS.NOT_ACTIV); - } else if (pinState == PIN_STATE.BLOCKED) { - pinStates.put(pinSpec, STATUS.BLOCKED); - } else { - pinStates.put(pinSpec, status); - } - } - -} diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties deleted file mode 100644 index 977d6e3a..00000000 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2008 Federal Chancellery Austria and -# Graz University of Technology -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -title.activation=Aktivierung -title.pin.mgmt=PIN Verwaltung -title.activate.pin=PIN Aktivieren -title.change.pin=PIN \u00C4ndern -title.unblock.pin=PIN Entsperren -title.verify.pin=PIN Eingeben -title.activate.success=Erfolg -title.change.success=Erfolg - -# removed message.* prefix to reuse keys as help keys -pin.mgmt=Die Karte verf\u00FCgt \u00FCber {0} PINs -activate.pin={0} eingeben und best\u00E4tigen -change.pin={0} eingeben und best\u00E4tigen -unblock.pin=PUK zu {0} eingeben -verify.pin={0} eingeben -verify.pinpad={0} ({1} stellig) am Kartenleser eingeben (und best\u00E4tigen). -activate.pinpad={0} ({1} stellig) am Kartenleser eingeben und wiederholen (jeweils best\u00E4tigen). -change.pinpad=Alte {0} ({1} stellig) am Kartenleser eingeben, danach neue {0} eingeben und wiederholen (jeweils best\u00E4tigen). -unblock.pinpad={0} ({1} stellig) am Kartenleser eingeben (und best\u00E4tigen). -activate.success={0} wurde erfolgreich aktiviert. -change.success={0} wurde erfolgreich ge\u00E4ndert. - -label.activation=e-card Aktivierungsprozess -label.activation.step=Schritt {0} -label.activation.idle=Warte auf Server... -label.old.pin=Alte {0}: -label.new.pin=Neue {0}: -label.repeat.pin=Best\u00E4tigung: - -button.activate=Aktivieren -button.change=\u00C4ndern -button.unblock=Entsperren -button.verify=Abfragen - -help.activation=help.activation -help.pin.mgmt=help.pin.mgmt - -err.status=Der Status der PINs konnte nicht \u00FCberpr\u00FCft werden. -err.activate=Beim Aktivieren der {0} trat ein Fehler auf. -err.change=Beim \u00C4ndern der {0} trat ein Fehler auf. -err.unblock=Das Entsperren der {0} wird nicht unterst\u00FCtzt. -err.verify=VERIFY ERROR (TODO) -err.retries=Falsche {0}, noch {1} Versuche -err.locked={0} gesperrt. -err.not.active={0} nicht aktiviert. -err.pin.format=Ung\u00FCltige {0} L\u00E4nge, verlangt sind {1} Stellen. -err.pin.confirmation={0} und Best\u00E4tigung stimmen nicht \u00FCberein. -err.pin.operation.aborted=Der Vorgang f\u00FCr {0} wurde abgebrochen. -err.unsupported.card=Die Karte wird nicht unterst\u00FCtzt - -status.not.active=NICHT AKTIV -status.active=AKTIV -status.blocked=GESPERRT -status.unknown=UNBEKANNT diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties deleted file mode 100644 index 7f01971b..00000000 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright 2008 Federal Chancellery Austria and -# Graz University of Technology -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -title.activation=Activation -title.pin.mgmt=PIN Management -title.activate.pin=Activate PIN -title.verify.pin=Enter PIN -title.change.pin=Change PIN -title.unblock.pin=Unblock PIN -title.activate.success=Success -title.change.success=Success - -# removed message.* prefix to reuse keys as help keys -pin.mgmt=The smartcard has {0} PINs -activate.pin=Enter and confirm {0} -change.pin=Enter and confirm {0} -unblock.pin=Enter PUK for {0} -verify.pin=Enter {0} -verify.pinpad=Enter {0} ({1} digits) on cardreader (and confirm). -activate.pinpad=Enter {0} ({1} digits) on cardreader and repeat (confirm in each case). -change.pinpad=Enter old {0} ({1} digits) on cardreader, then enter new {0} and repeat (confirm in each case). -unblock.pinpad=Enter {0} ({1} digits) on cardreader (and confirm). -activate.success={0} successfully activated -change.success={0} successfully changed - -label.activation=e-card activation process -label.activation.step=Step {0} -label.activation.idle=Wait for server... -label.old.pin=Old {0}: -label.new.pin=New {0}: -label.repeat.pin=Confirmation: - -button.activate=Activate -button.change=Change -button.unblock=Unblock -button.verify=Query - -help.activation=help.activation -help.pin.mgmt=help.pin.mgmt - -err.status=PIN statuses could not be read. -err.activate=An error occured during the activation of {0}. -err.change=An error occured during the changing of {0}. -err.unblock=Unblocking of {0} is not supported. -err.retries=Wrong {0}, {1} tries remaining -err.locked={0} locked -err.not.active={0} not activated. -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 - -status.not.active=NOT ACTIVE -status.active=ACTIVE -status.blocked=BLOCKED -status.unknown=UNKNOWN diff --git a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java deleted file mode 100644 index 95c5c678..00000000 --- a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -package at.gv.egiz.bku.gui; - -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.JFrame; -import org.junit.Ignore; -import org.junit.Test; - - -/** - * - * @author clemens - */ -@Ignore -public class ActivationGuiTest { - - @Test - public void testBKUGUI() { - JFrame testFrame = new JFrame("BKUGUITest"); - Container contentPane = testFrame.getContentPane(); - contentPane.setPreferredSize(new Dimension(152, 145)); -// contentPane.setPreferredSize(new Dimension(300, 190)); - ActivationGUIFacade gui = new ActivationGUI(contentPane, null, BKUGUIFacade.Style.tiny, null, null); - BKUGUIWorker worker = new BKUGUIWorker(); - worker.init(gui); - testFrame.pack(); - testFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - testFrame.setVisible(true); - new Thread(worker).start(); - - while(true) ; - } - - @Test - public void dummyTest() { - } - -// public static void main(String[] args) { -// new BKUGUITest().testBKUGUI(); -// } -} diff --git a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java deleted file mode 100644 index b01abe72..00000000 --- a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package at.gv.egiz.bku.gui; - -import at.gv.egiz.smcc.PINSpec; -import at.gv.egiz.stal.HashDataInput; -import at.gv.egiz.stal.impl.ByteArrayHashDataInput; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; - -/** - * - * @author clemens - */ -public class BKUGUIWorker implements Runnable { - - ActivationGUIFacade gui; - - public void init(ActivationGUIFacade gui) { - this.gui = gui; - } - - @Override - public void run() { - try { - - final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN", (byte)0x00, null); - - - final ActionListener cancelListener = new ActionListener() { - - public void actionPerformed(ActionEvent e) { - System.out.println("CANCEL EVENT OCCURED: " + e); - } - }; - ActionListener okListener = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - System.out.println("OK EVENT OCCURED: " + e); - } - }; - final ActionListener signListener = new ActionListener() { - - public void actionPerformed(ActionEvent e) { - System.out.println("SIGN EVENT OCCURED: " + e); - } - }; - ActionListener hashdataListener = new ActionListener() { - - public void actionPerformed(ActionEvent e) { - System.out.println("HASHDATA EVENT OCCURED: " + e); - ActionListener returnListener = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - gui.showSignaturePINDialog(signPinSpec, -1, signListener, "sign", cancelListener, "cancel", null, "hashdata"); - } - }; - HashDataInput signedRef1 = new ByteArrayHashDataInput( - "Ich bin ein einfacher Text mit Umlauten: öäüßéç@€\n123\n456\n\tHello, world!\n\nlkjsd\nnksdjf".getBytes(), - "ref-id-0000000000000000000000001", - "text/plain", - "UTF-8"); - - HashDataInput signedRef2 = new ByteArrayHashDataInput( - "HashDataInput_002".getBytes(), - "ref-id-000000002", - "application/xhtml+xml", - "UTF-8"); - - HashDataInput signedRef3 = new ByteArrayHashDataInput( - "HashDataInput_003".getBytes(), - "ref-id-000000003", - "application/xhtml+xml", - "UTF-8"); - - HashDataInput signedRef4 = new ByteArrayHashDataInput( - "HashDataInput_004".getBytes(), - "ref-id-000000004", - "text/xml", - "UTF-8"); - - // - List signedRefs = new ArrayList(); - signedRefs.add(signedRef1); - signedRefs.add(signedRef2); - signedRefs.add(signedRef3); - signedRefs.add(signedRef4); -// signedRefs.add(signedRef4); -// signedRefs.add(signedRef4); -// signedRefs.add(signedRef4); -// signedRefs.add(signedRef4); -// signedRefs = Collections.singletonList(signedRef1); - gui.showSecureViewer(signedRefs, returnListener, "return"); - } - }; - - - -// gui.showWelcomeDialog(); -// -// Thread.sleep(2000); -// -// gui.showWaitDialog(null); -// -// Thread.sleep(1000); -// -// gui.showWaitDialog("test"); -// -// Thread.sleep(1000); -// -// -// gui.showInsertCardDialog(cancelListener, "cancel"); -// -// Thread.sleep(2000); -// -// gui.showCardNotSupportedDialog(cancelListener, "cancel"); -// -// Thread.sleep(2000); -// -// PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN"); -// -// gui.showCardPINDialog(cardPinSpec, okListener, "ok", cancelListener, "cancel"); -// -// Thread.sleep(2000); -// -// gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); -// -// Thread.sleep(4000); -// - -// gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, null, null); - -// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); -// -// Thread.sleep(2000); -// -// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}, null, null); -// -// Thread.sleep(2000); -// -// gui.showErrorDialog("error.test", new Object[] {"Testfehler", "noch ein TestFehler"}); -// -// Thread.sleep(2000); -// -// gui.showErrorDialog("error.no.hashdata", null); -// -// Thread.sleep(2000); -// -// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}); -// -// Thread.sleep(2000); -// -// gui.showErrorDialog("error.unknown", null); - - gui.showActivationProgressDialog(1, 3, null, null); - - gui.incrementProgress(); - - Thread.sleep(1000); - - gui.incrementProgress(); - - Thread.sleep(1000); - - gui.incrementProgress(); - - - Thread.sleep(1000); - - gui.showIdleDialog(null, null); - -// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save"); -// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save"); -// Thread.sleep(2000); - - } catch (InterruptedException ex) { - ex.printStackTrace(); - } - } -} diff --git a/BKUCommonGUI/pom.xml b/BKUCommonGUI/pom.xml index 393a5756..ef6e6692 100644 --- a/BKUCommonGUI/pom.xml +++ b/BKUCommonGUI/pom.xml @@ -7,7 +7,7 @@ 4.0.0 at.gv.egiz BKUCommonGUI - BKU Common GUI + BKU GUI 1.2.2-SNAPSHOT diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java index de9a91b9..2663e8bf 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java @@ -132,7 +132,7 @@ public class BKUGUIImpl implements BKUGUIFacade { log.debug("scheduling gui initialization"); - SwingUtilities.invokeAndWait(new Runnable() { + SwingUtilities.invokeLater(new Runnable() { @Override public void run() { diff --git a/BKUGuiExt/pom.xml b/BKUGuiExt/pom.xml new file mode 100644 index 00000000..87520232 --- /dev/null +++ b/BKUGuiExt/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + bku + at.gv.egiz + 1.2.2-SNAPSHOT + + at.gv.egiz + BKUGuiExt + 1.2.2-SNAPSHOT + BKU GUI Extension + + + at.gv.egiz + STALXService + 1.2.2-SNAPSHOT + + + at.gv.egiz + smccSTAL + 1.2.2-SNAPSHOT + + + + diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java new file mode 100644 index 00000000..c8927e1e --- /dev/null +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java @@ -0,0 +1,250 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.gui; + +import at.gv.egiz.bku.gui.*; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.event.ActionListener; +import java.net.URL; +import java.text.MessageFormat; +import java.util.Locale; +import java.util.ResourceBundle; +import javax.swing.GroupLayout; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JProgressBar; +import javax.swing.LayoutStyle; +import javax.swing.SwingUtilities; + +/** + * + * @author Clemens Orthacker + */ +public class ActivationGUI extends CardMgmtGUI implements ActivationGUIFacade { + + public static final String TITLE_ACTIVATION = "title.activation"; + public static final String LABEL_ACTIVATION = "label.activation"; + public static final String LABEL_ACTIVATION_STEP = "label.activation.step"; + public static final String LABEL_ACTIVATION_IDLE = "label.activation.idle"; + + public static final String HELP_ACTIVATION = "help.activation"; + + protected JProgressBar progressBar; + + public ActivationGUI(Container contentPane, + Locale locale, + Style guiStyle, + URL backgroundImgURL, + AbstractHelpListener helpListener) { + super(contentPane, locale, guiStyle, backgroundImgURL, helpListener); + + progressBar = new JProgressBar(); + } + + @Override + public void showActivationProgressDialog(final int currentStep, final int maxProgress, final ActionListener cancelListener, final String cancelCommand) { + + log.debug("scheduling activation progress dialog (step " + currentStep + ")"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show activation progress dialog (step " + currentStep + ")"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + + + JLabel infoLabel = new JLabel(); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + + if (renderHeaderPanel) { + titleLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); + infoLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION)); + } else { + infoLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); + } + + helpListener.setHelpTopic(HELP_ACTIVATION); + + progressBar.setIndeterminate(false); + progressBar.setStringPainted(true); + progressBar.setString(null); //reset to percentage + progressBar.setMinimum(0); + progressBar.setMaximum(maxProgress); + + JLabel stepLabel = new JLabel(); + stepLabel.setFont(stepLabel.getFont().deriveFont(stepLabel.getFont().getStyle() & ~java.awt.Font.BOLD, stepLabel.getFont().getSize()-2)); + String stepPattern = cardmgmtMessages.getString(LABEL_ACTIVATION_STEP); + stepLabel.setText(MessageFormat.format(stepPattern, new Object[]{ currentStep })); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup().addComponent(infoLabel); + GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(infoLabel); + + if (!renderHeaderPanel) { + infoHorizontal.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel); + infoVertical.addComponent(helpLabel); + } + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(infoHorizontal) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(stepLabel) + .addComponent(progressBar))); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addGroup(infoVertical) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(stepLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(progressBar))); + + JButton cancelButton = new JButton(); + cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.addActionListener(cancelListener); + cancelButton.setActionCommand(cancelCommand); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createSequentialGroup() + .addComponent(cancelButton)); + + contentPanel.validate(); + + } + }); + + } + + @Override + public void incrementProgress() { + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + progressBar.setValue(progressBar.getValue() + 1); + } + }); + + } + + @Override + public void showIdleDialog(final ActionListener cancelListener, final String cancelCommand) { + log.debug("scheduling idle dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show idle dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + + + JLabel infoLabel = new JLabel(); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + + if (renderHeaderPanel) { + titleLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); + infoLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION)); + } else { + infoLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); + } + + helpListener.setHelpTopic(HELP_ACTIVATION); + + progressBar.setIndeterminate(true); + progressBar.setStringPainted(true); + progressBar.setString(""); //not string painted progressbar is smaller + + JLabel stepLabel = new JLabel(); + stepLabel.setFont(stepLabel.getFont().deriveFont(stepLabel.getFont().getStyle() & ~java.awt.Font.BOLD, stepLabel.getFont().getSize()-2)); + stepLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION_IDLE)); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup().addComponent(infoLabel); + GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(infoLabel); + + if (!renderHeaderPanel) { + infoHorizontal.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel); + infoVertical.addComponent(helpLabel); + } + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(infoHorizontal) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(stepLabel) + .addComponent(progressBar))); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addGroup(infoVertical) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(stepLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(progressBar))); + + JButton cancelButton = new JButton(); + cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.addActionListener(cancelListener); + cancelButton.setActionCommand(cancelCommand); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createSequentialGroup() + .addComponent(cancelButton)); + + contentPanel.validate(); + + } + }); + + } +} diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java new file mode 100644 index 00000000..3fc14d04 --- /dev/null +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java @@ -0,0 +1,34 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.gui; + +import at.gv.egiz.bku.gui.*; +import java.awt.event.ActionListener; + +/** + * + * @author Clemens Orthacker + */ +public interface ActivationGUIFacade extends BKUGUIFacade { + + public void showActivationProgressDialog(int currentStep, int maxProgress, ActionListener cancelListener, String cancelCommand); + + public void incrementProgress(); + + public void showIdleDialog(ActionListener cancelListener, String cancelCommand); + +} diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java new file mode 100644 index 00000000..c8e1826c --- /dev/null +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java @@ -0,0 +1,71 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.gui; + +import at.gv.egiz.bku.gui.*; +import java.awt.Container; +import java.net.URL; +import java.util.Locale; +import java.util.ResourceBundle; + +/** + * Common superclass for Activation and PinManagement GUIs + * + * @author Clemens Orthacker + */ +public class CardMgmtGUI extends BKUGUIImpl { + + public static final String CARDMGMT_MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/ActivationMessages"; + + protected ResourceBundle cardmgmtMessages; + + public CardMgmtGUI(Container contentPane, + Locale locale, + Style guiStyle, + URL backgroundImgURL, + AbstractHelpListener helpListener) { + super(contentPane, locale, guiStyle, backgroundImgURL, helpListener); + + } + + @Override + protected void loadMessageBundle(Locale locale) { + super.loadMessageBundle(locale); + + if (locale != null) { + Locale lang = new Locale(locale.getLanguage().substring(0,2)); + log.debug("loading applet resources for language: " + lang.toString()); + cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE, lang); + } else { + cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE); + } + } + + @Override + protected String getMessage(String key) { + if (super.hasMessage(key)) { + return super.getMessage(key); + } + return cardmgmtMessages.getString(key); + } + + @Override + protected boolean hasMessage(String key) { + return (cardmgmtMessages.containsKey(key) || super.hasMessage(key)); + } +} diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java new file mode 100644 index 00000000..3d503510 --- /dev/null +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java @@ -0,0 +1,670 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.gui; + +import at.gv.egiz.bku.gui.*; +import at.gv.egiz.smcc.PINSpec; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; +import java.net.URL; +import java.text.MessageFormat; +import java.util.Locale; +import java.util.Map; +import javax.swing.GroupLayout; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPasswordField; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.LayoutStyle; +import javax.swing.ListSelectionModel; +import javax.swing.SwingUtilities; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * TODO pull out ResourceBundle to common superclass for activationGUI and pinMgmtGUI + * @author Clemens Orthacker + */ +public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFacade { + + protected static final Log log = LogFactory.getLog(PINManagementGUI.class); + + /** remember the pinfield to return to worker */ + protected JPasswordField oldPinField; + /** remember the pinSpec to return to worker */ + protected PINSpec pinSpec; + + public PINManagementGUI(Container contentPane, + Locale locale, + Style guiStyle, + URL backgroundImgURL, + AbstractHelpListener helpListener) { + super(contentPane, locale, guiStyle, backgroundImgURL, helpListener); + } + + @Override + public char[] getOldPin() { + if (oldPinField != null) { + char[] pin = oldPinField.getPassword(); + oldPinField = null; + return pin; + } + return null; + } + + @Override + public PINSpec getSelectedPINSpec() { + return pinSpec; + } + + @Override + public void showPINManagementDialog(final Map pins, + final ActionListener activateListener, + final String activateCmd, + final String changeCmd, + final String unblockCmd, + final String verifyCmd, + final ActionListener cancelListener, + final String cancelCmd) { + + log.debug("scheduling PIN managment dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + log.debug("show PIN management dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + helpListener.setHelpTopic(HELP_PINMGMT); + + JLabel mgmtLabel = new JLabel(); + mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + + if (renderHeaderPanel) { + titleLabel.setText(getMessage(TITLE_PINMGMT)); + String infoPattern = getMessage(MESSAGE_PINMGMT); + mgmtLabel.setText(MessageFormat.format(infoPattern, pins.size())); + } else { + mgmtLabel.setText(getMessage(TITLE_PINMGMT)); + } + + final PINStatusTableModel tableModel = new PINStatusTableModel(pins); + final JTable pinStatusTable = new JTable(tableModel); + pinStatusTable.setDefaultRenderer(PINSpec.class, new PINSpecRenderer()); + pinStatusTable.setDefaultRenderer(STATUS.class, new PINStatusRenderer(cardmgmtMessages)); + pinStatusTable.setTableHeader(null); + pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); +// pinStatusTable.addMouseMotionListener(new MouseMotionAdapter() { +// +// @Override +// public void mouseMoved(MouseEvent e) { +// if (pinStatusTable.columnAtPoint(e.getPoint()) == 0) { +// pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); +// } else { +// pinStatusTable.setCursor(Cursor.getDefaultCursor()); +// } +// } +// }); + + final JButton activateButton = new JButton(); + activateButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + activateButton.addActionListener(activateListener); + + pinStatusTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + pinStatusTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + + @Override + public void valueChanged(final ListSelectionEvent e) { + //invoke later to allow thread to paint selection background + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + ListSelectionModel lsm = (ListSelectionModel) e.getSource(); + int selectionIdx = lsm.getMinSelectionIndex(); + if (selectionIdx >= 0) { + pinSpec = (PINSpec) tableModel.getValueAt(selectionIdx, 0); + STATUS status = (STATUS) tableModel.getValueAt(selectionIdx, 1); + + if (status == STATUS.NOT_ACTIV) { + activateButton.setText(getMessage(BUTTON_ACTIVATE)); + activateButton.setEnabled(true); + activateButton.setActionCommand(activateCmd); + } else if (status == STATUS.BLOCKED) { + activateButton.setText(getMessage(BUTTON_UNBLOCK)); + activateButton.setEnabled(true); + activateButton.setActionCommand(unblockCmd); + } else if (status == STATUS.ACTIV) { + activateButton.setText(getMessage(BUTTON_CHANGE)); + activateButton.setEnabled(true); + activateButton.setActionCommand(changeCmd); + } else if (status == STATUS.UNKNOWN) { + activateButton.setText(getMessage(BUTTON_VERIFY)); + activateButton.setEnabled(true); + activateButton.setActionCommand(verifyCmd); + } + } + } + }); + } + }); + + //select first entry + pinStatusTable.getSelectionModel().setSelectionInterval(0, 0); + + 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(helpLabel); + messageVertical + .addComponent(helpLabel); + } + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(messageHorizontal) + .addComponent(pinStatusScrollPane, 0, 0, Short.MAX_VALUE)); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addGroup(messageVertical) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinStatusScrollPane, 0, 0, pinStatusTable.getPreferredSize().height+3)); + + JButton cancelButton = new JButton(); + cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + cancelButton.setText(getMessage(BUTTON_CLOSE)); + cancelButton.setActionCommand(cancelCmd); + cancelButton.addActionListener(cancelListener); + + 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) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + + GroupLayout.Group buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(activateButton) + .addComponent(cancelButton); + + buttonPanelLayout.setHorizontalGroup(buttonHorizontal); + buttonPanelLayout.setVerticalGroup(buttonVertical); + + contentPanel.validate(); + } + }); + } + + @Override + public void showPINDialog(DIALOG type, PINSpec pinSpec, + ActionListener okListener, String okCommand, + ActionListener cancelListener, String cancelCommand) { + showPINDialog(type, pinSpec, -1, false, + okListener, okCommand, cancelListener, cancelCommand); + } + + @Override + public void showPINDialog(DIALOG type, PINSpec pinSpec, int retries, + ActionListener okListener, String okCommand, + ActionListener cancelListener, String cancelCommand) { + showPINDialog(type, pinSpec, retries, false, + okListener, okCommand, cancelListener, cancelCommand); + } + + @Override + public void showPinpadPINDialog(DIALOG type, PINSpec pinSpec, int retries) { + String title, msg; + Object[] params; + if (retries < 0) { + params = new Object[2]; + if (shortText) { + params[0] = "PIN"; + } else { + params[0] = pinSpec.getLocalizedName(); + } + params[1] = pinSpec.getLocalizedLength(); + if (type == DIALOG.CHANGE) { + log.debug("show change pin dialog"); + title = TITLE_CHANGE_PIN; + msg = MESSAGE_CHANGEPIN_PINPAD; + } else if (type == DIALOG.ACTIVATE) { + log.debug("show activate pin dialog"); + title = TITLE_ACTIVATE_PIN; + msg = MESSAGE_ENTERPIN_PINPAD; + } else if (type == DIALOG.VERIFY) { + log.debug("show verify pin dialog"); + title = TITLE_VERIFY_PIN; + msg = MESSAGE_ENTERPIN_PINPAD; + } else { + log.debug("show unblock pin dialog"); + title = TITLE_UNBLOCK_PIN; + msg = MESSAGE_ENTERPIN_PINPAD; + } + + } else { + log.debug("show retry pin dialog"); + title = TITLE_RETRY; + msg = (retries < 2) ? + MESSAGE_LAST_RETRY : MESSAGE_RETRIES; + params = new Object[] {String.valueOf(retries)}; + } + showMessageDialog(title, msg, params); + } + + private void showPINDialog(final DIALOG type, final PINSpec pinSpec, + final int retries, final boolean pinpad, + final ActionListener okListener, final String okCommand, + final ActionListener cancelListener, final String cancelCommand) { + + log.debug("scheduling pin dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + String HELP_TOPIC, TITLE, MESSAGE_MGMT, MESSAGE_MGMT_PARAM, PINSIZE; + HELP_TOPIC = HELP_PINMGMT; + + PINSIZE = (pinSpec.getMaxLength() > pinSpec.getMinLength()) ? + pinSpec.getMinLength() + "-" + pinSpec.getMaxLength() : + String.valueOf(pinSpec.getMinLength()); + + if (retries < 0) { + if (type == DIALOG.CHANGE) { + log.debug("show change pin dialog"); + TITLE = TITLE_CHANGE_PIN; + MESSAGE_MGMT = MESSAGE_CHANGE_PIN; + } else if (type == DIALOG.ACTIVATE) { + log.debug("show activate pin dialog"); + TITLE = TITLE_ACTIVATE_PIN; + MESSAGE_MGMT = MESSAGE_ACTIVATE_PIN; + oldPinField = null; + PINSIZE = pinSpec.getLocalizedLength(); + } else if (type == DIALOG.VERIFY) { + log.debug("show verify pin dialog"); + TITLE = TITLE_VERIFY_PIN; + MESSAGE_MGMT = MESSAGE_VERIFY_PIN; + } else { + log.debug("show unblock pin dialog"); + TITLE = TITLE_UNBLOCK_PIN; + MESSAGE_MGMT = MESSAGE_UNBLOCK_PIN; + } + if (shortText) { + MESSAGE_MGMT_PARAM = "PIN"; + } else { + MESSAGE_MGMT_PARAM = pinSpec.getLocalizedName(); + } + } else { + log.debug("show retry pin dialog"); + TITLE = TITLE_RETRY; + MESSAGE_MGMT = (retries < 2) ? + MESSAGE_LAST_RETRY : MESSAGE_RETRIES; + MESSAGE_MGMT_PARAM = String.valueOf(retries); + } + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + helpListener.setHelpTopic(HELP_TOPIC); + + JLabel mgmtLabel = new JLabel(); + if (retries < 0) { + mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD)); + } else { + mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() | Font.BOLD)); + mgmtLabel.setForeground(ERROR_COLOR); + helpListener.setHelpTopic(HELP_RETRY); + } + + if (renderHeaderPanel) { + titleLabel.setText(getMessage(TITLE)); + String mgmtPattern = getMessage(MESSAGE_MGMT); + mgmtLabel.setText(MessageFormat.format(mgmtPattern, MESSAGE_MGMT_PARAM)); + } else { + mgmtLabel.setText(getMessage(TITLE)); + } + + //////////////////////////////////////////////////////////////// + // COMMON LAYOUT SECTION + //////////////////////////////////////////////////////////////// + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup() + .addComponent(mgmtLabel); + GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(mgmtLabel); + + if (!renderHeaderPanel) { + infoHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel); + infoVertical + .addComponent(helpLabel); + } + + GroupLayout.ParallelGroup pinHorizontal; + GroupLayout.SequentialGroup pinVertical; + + if (pinpad) { + JLabel pinpadLabel = new JLabel(); + pinpadLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD)); + String pinpadPattern = getMessage(MESSAGE_VERIFYPIN_PINPAD); + pinpadLabel.setText(MessageFormat.format(pinpadPattern, + new Object[] { pinSpec.getLocalizedName(), PINSIZE })); + + pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(pinpadLabel); + pinVertical = mainPanelLayout.createSequentialGroup() + .addComponent(pinpadLabel); + } else { + + JButton okButton = new JButton(); + okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~Font.BOLD)); + okButton.setText(getMessage(BUTTON_OK)); + okButton.setEnabled(pinSpec.getMinLength() <= 0); + okButton.setActionCommand(okCommand); + okButton.addActionListener(okListener); + + JLabel oldPinLabel = null; + JLabel repeatPinLabel = null; + JLabel pinLabel = new JLabel(); + pinLabel.setFont(pinLabel.getFont().deriveFont(pinLabel.getFont().getStyle() & ~Font.BOLD)); + String pinLabelPattern = (type == DIALOG.CHANGE) ? getMessage(LABEL_NEW_PIN) : getMessage(LABEL_PIN); + pinLabel.setText(MessageFormat.format(pinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); + + final JPasswordField repeatPinField = new JPasswordField(); + pinField = new JPasswordField(); + pinField.setText(""); + pinField.setActionCommand(okCommand); + pinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (pinField.getPassword().length >= pinSpec.getMinLength()) { + if (type == DIALOG.VERIFY) { + okListener.actionPerformed(e); + } else { + repeatPinField.requestFocusInWindow(); + } + } + } + }); + + if (type != DIALOG.VERIFY) { + pinField.setDocument(new PINDocument(pinSpec, null)); + repeatPinLabel = new JLabel(); + repeatPinLabel.setFont(pinLabel.getFont()); + String repeatPinLabelPattern = getMessage(LABEL_REPEAT_PIN); + repeatPinLabel.setText(MessageFormat.format(repeatPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); + + repeatPinField.setText(""); +// repeatPinField.setDocument(new PINDocument(pinSpec, okButton, pinField.getDocument())); + repeatPinField.setActionCommand(okCommand); + repeatPinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (pinField.getPassword().length >= pinSpec.getMinLength()) { + okListener.actionPerformed(e); + } + } + }); + + if (type == DIALOG.CHANGE) { + oldPinLabel = new JLabel(); + oldPinLabel.setFont(oldPinLabel.getFont().deriveFont(oldPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + String oldPinLabelPattern = getMessage(LABEL_OLD_PIN); + oldPinLabel.setText(MessageFormat.format(oldPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); + + oldPinField = new JPasswordField(); + oldPinField.setText(""); + oldPinField.setDocument(new PINDocument(pinSpec, null)); + oldPinField.setActionCommand(okCommand); + oldPinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (oldPinField.getPassword().length >= pinSpec.getMinLength()) { + pinField.requestFocusInWindow(); + } + } + }); + + repeatPinField.setDocument(new PINDocument( + pinSpec, okButton, + pinField.getDocument(), oldPinField.getDocument())); + } else { + // else -> ACTIVATE (not verify, not change) + repeatPinField.setDocument(new PINDocument( + pinSpec, okButton, pinField.getDocument())); + } + } else { + pinField.setDocument(new PINDocument(pinSpec, okButton)); + } + + JLabel pinsizeLabel = new JLabel(); + pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~Font.BOLD, pinsizeLabel.getFont().getSize()-2)); + String pinsizePattern = getMessage(LABEL_PINSIZE); + pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{PINSIZE})); + + //////////////////////////////////////////////////////////////// + // NON-PINPAD SPECIFIC LAYOUT SECTION + //////////////////////////////////////////////////////////////// + + pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); + pinVertical = mainPanelLayout.createSequentialGroup(); + +// if (pinLabelPos == PinLabelPosition.ABOVE) { +// if (changePin) { +// pinHorizontal +// .addComponent(oldPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) +// .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE); +// pinVertical +// .addComponent(oldPinLabel) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); +// } +// pinHorizontal +// .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) +// .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) +// .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) +// .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) +// .addGroup(mainPanelLayout.createSequentialGroup() +// .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) +// .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); +// pinVertical +// .addComponent(pinLabel) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(repeatPinLabel) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(pinsizeLabel); +// } else { + + + if (type == DIALOG.CHANGE) { + pinHorizontal + .addGroup(mainPanelLayout.createSequentialGroup() + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(oldPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + + pinVertical + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(oldPinLabel) + .addComponent(oldPinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(pinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(repeatPinLabel) + .addComponent(repeatPinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); + } else if (type == DIALOG.ACTIVATE) { + pinHorizontal + .addGroup(mainPanelLayout.createSequentialGroup() + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + + pinVertical + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(pinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(repeatPinLabel) + .addComponent(repeatPinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); + } else { // VERIFY + pinHorizontal + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); + + pinVertical + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(pinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); + } + pinHorizontal + .addGroup(mainPanelLayout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); + pinVertical + .addComponent(pinsizeLabel); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + GroupLayout.Group buttonVertical; + + JButton cancelButton = new JButton(); + cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + cancelButton.setText(getMessage(BUTTON_CANCEL)); + cancelButton.setActionCommand(cancelCommand); + cancelButton.addActionListener(cancelListener); + + buttonHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(okButton) + .addComponent(cancelButton); + + buttonPanelLayout.setHorizontalGroup(buttonHorizontal); + buttonPanelLayout.setVerticalGroup(buttonVertical); + + if (oldPinField != null) { + oldPinField.requestFocusInWindow(); + } else { + pinField.requestFocusInWindow(); + } + + } // END NON-PINPAD SECTION + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(infoHorizontal) + .addGroup(pinHorizontal)); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addGroup(infoVertical) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(pinVertical)); + + contentPanel.validate(); + + } + }); + } + + @Override + protected int initButtonSize() { + int bs = super.initButtonSize(); + + JButton b = new JButton(); + b.setText(getMessage(BUTTON_ACTIVATE)); + if (b.getPreferredSize().width > bs) { + bs = b.getPreferredSize().width; + } + b.setText(getMessage(BUTTON_CHANGE)); + if (b.getPreferredSize().width > bs) { + bs = b.getPreferredSize().width; + } + b.setText(getMessage(BUTTON_UNBLOCK)); + if (b.getPreferredSize().width > bs) { + bs = b.getPreferredSize().width; + } + b.setText(getMessage(BUTTON_CANCEL)); + if (b.getPreferredSize().width > bs) { + bs = b.getPreferredSize().width; + } + + return bs; + } + +} diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java new file mode 100644 index 00000000..297173d9 --- /dev/null +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java @@ -0,0 +1,118 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.gui; + +import at.gv.egiz.bku.gui.*; +import at.gv.egiz.smcc.PINSpec; +import java.awt.event.ActionListener; +import java.util.Map; + +/** + * + * @author Clemens Orthacker + */ +public interface PINManagementGUIFacade extends BKUGUIFacade { + + public static final String HELP_PINMGMT = "help.pin.mgmt"; +// public static final String HELP_VERIFY_PIN = "help.pin.verify"; + public static final String TITLE_PINMGMT = "title.pin.mgmt"; + public static final String TITLE_ACTIVATE_PIN = "title.activate.pin"; + public static final String TITLE_CHANGE_PIN = "title.change.pin"; + public static final String TITLE_VERIFY_PIN = "title.verify.pin"; + public static final String TITLE_UNBLOCK_PIN = "title.unblock.pin"; + public static final String TITLE_ACTIVATE_SUCCESS = "title.activate.success"; + public static final String TITLE_CHANGE_SUCCESS = "title.change.success"; + + // removed message.* prefix to reuse keys as help keys + public static final String MESSAGE_ACTIVATE_SUCCESS = "activate.success"; + public static final String MESSAGE_CHANGE_SUCCESS = "change.success"; + public static final String MESSAGE_PINMGMT = "pin.mgmt"; +// public static final String MESSAGE_PINPAD = "pinpad"; + public static final String MESSAGE_ACTIVATE_PIN = "activate.pin"; + public static final String MESSAGE_CHANGE_PIN = "change.pin"; + public static final String MESSAGE_VERIFY_PIN = "verify.pin"; + public static final String MESSAGE_UNBLOCK_PIN = "unblock.pin"; + public static final String MESSAGE_ACTIVATEPIN_PINPAD = "activate.pinpad"; + public static final String MESSAGE_CHANGEPIN_PINPAD = "change.pinpad"; + public static final String MESSAGE_VERIFYPIN_PINPAD = "verify.pinpad"; + public static final String MESSAGE_UNBLOCKPIN_PINPAD = "unblock.pinpad"; + + public static final String LABEL_OLD_PIN = "label.old.pin"; + public static final String LABEL_NEW_PIN = "label.new.pin"; + public static final String LABEL_REPEAT_PIN = "label.repeat.pin"; + + public static final String ERR_STATUS = "err.status"; + public static final String ERR_ACTIVATE = "err.activate"; + public static final String ERR_CHANGE = "err.change"; + public static final String ERR_UNBLOCK = "err.unblock"; + public static final String ERR_VERIFY = "err.verify"; + public static final String ERR_RETRIES = "err.retries"; + public static final String ERR_LOCKED = "err.locked"; + public static final String ERR_NOT_ACTIVE = "err.not.active"; + public static final String ERR_PIN_FORMAT = "err.pin.format"; + public static final String ERR_PIN_CONFIRMATION = "err.pin.confirmation"; + public static final String ERR_PIN_OPERATION_ABORTED = "err.pin.operation.aborted"; + public static final String ERR_UNSUPPORTED_CARD = "err.unsupported.card"; + + public static final String BUTTON_ACTIVATE = "button.activate"; + public static final String BUTTON_UNBLOCK = "button.unblock"; + public static final String BUTTON_CHANGE = "button.change"; + public static final String BUTTON_VERIFY = "button.verify"; + + public static final String STATUS_ACTIVE = "status.active"; + public static final String STATUS_BLOCKED = "status.blocked"; + public static final String STATUS_NOT_ACTIVE = "status.not.active"; + public static final String STATUS_UNKNOWN = "status.unknown"; + + public enum STATUS { ACTIV, NOT_ACTIV, BLOCKED, UNKNOWN }; + public enum DIALOG { VERIFY, ACTIVATE, CHANGE, UNBLOCK }; + + public void showPINManagementDialog(Map pins, + ActionListener activateListener, String activateCmd, String changeCmd, String unblockCmd, String verifyCmd, + ActionListener cancelListener, String cancelCmd); + + public void showPINDialog(DIALOG type, PINSpec pin, + ActionListener okListener, String okCmd, + ActionListener cancelListener, String cancelCmd); + + public void showPINDialog(DIALOG type, PINSpec pin, int retries, + ActionListener okListener, String okCmd, + ActionListener cancelListener, String cancelCmd); + + public void showPinpadPINDialog(DIALOG type, PINSpec pin, int retries); + +// public void showActivatePINDialog(PINSpec pin, +// ActionListener okListener, String okCmd, +// ActionListener cancelListener, String cancelCmd); +// +// public void showChangePINDialog(PINSpec pin, +// ActionListener okListener, String okCmd, +// ActionListener cancelListener, String cancelCmd); +// +// public void showUnblockPINDialog(PINSpec pin, +// ActionListener okListener, String okCmd, +// ActionListener cancelListener, String cancelCmd); +// +// public void showVerifyPINDialog(PINSpec pin, +// ActionListener okListener, String okCmd, +// ActionListener cancelListener, String cancelCmd); + + public char[] getOldPin(); + + public PINSpec getSelectedPINSpec(); +} diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java new file mode 100644 index 00000000..e3d73e1f --- /dev/null +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java @@ -0,0 +1,39 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.gui; + +import at.gv.egiz.smcc.PINSpec; +import javax.swing.table.DefaultTableCellRenderer; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker + */ +public class PINSpecRenderer extends DefaultTableCellRenderer { + + private static final Log log = LogFactory.getLog(PINSpecRenderer.class); + + @Override + protected void setValue(Object value) { + PINSpec pinSpec = (PINSpec) value; + super.setText(pinSpec.getLocalizedName()); + } + +} diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java new file mode 100644 index 00000000..83ff74f2 --- /dev/null +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java @@ -0,0 +1,61 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.gui; + +import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; +import java.awt.Color; +import java.awt.Font; +import java.util.ResourceBundle; +import javax.swing.table.DefaultTableCellRenderer; + +/** + * + * @author Clemens Orthacker + */ +public class PINStatusRenderer extends DefaultTableCellRenderer { + +// private static final Log log = LogFactory.getLog(PINStatusRenderer.class); + + public static final Color RED = new Color(0.9f, 0.0f, 0.0f); + public static final Color GREEN = new Color(0.0f, 0.8f, 0.0f); + protected ResourceBundle messages; + + public PINStatusRenderer(ResourceBundle messages) { + this.messages = messages; + } + + @Override + protected void setValue(Object value) { + STATUS pinStatus = (STATUS) value; + super.setFont(super.getFont().deriveFont(super.getFont().getStyle() | Font.BOLD)); + + if (pinStatus == STATUS.NOT_ACTIV) { + super.setForeground(RED); + super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_NOT_ACTIVE) + ""); + } else if (pinStatus == STATUS.ACTIV) { + super.setForeground(GREEN); + super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_ACTIVE) + ""); + } else if (pinStatus == STATUS.BLOCKED) { + super.setForeground(RED); + super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_BLOCKED) + ""); + } else { + super.setForeground(Color.BLACK); + super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_UNKNOWN) + ""); + } + } +} diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java new file mode 100644 index 00000000..052c13b2 --- /dev/null +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java @@ -0,0 +1,58 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.gui; + +import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; +import at.gv.egiz.smcc.PINSpec; +import java.util.Map; +import javax.swing.table.DefaultTableModel; + +/** + * + * @author Clemens Orthacker + */ +public class PINStatusTableModel extends DefaultTableModel { + +// protected static final Log log = LogFactory.getLog(PINStatusTableModel.class); + protected Class[] types; + + public PINStatusTableModel(Map pinStatuses) { + super(0, 2); + if (pinStatuses == null) { + throw new RuntimeException("pinStatuses must not be null"); + } +// log.trace(pinStatuses.size() + " PINs"); + types = new Class[] { PINSpec.class, STATUS.class }; + for (PINSpec pinSpec : pinStatuses.keySet()) { + addRow(new Object[] { pinSpec, pinStatuses.get(pinSpec) }); + } +// PINSpec activePIN = new PINSpec(0, 1, null, "active-PIN", (byte) 0x01); +// PINSpec blockedPIN = new PINSpec(0, 1, null, "blocked-PIN", (byte) 0x01); +// addRow(new Object[] { activePIN, PINStatusProvider.STATUS.ACTIV }); +// addRow(new Object[] { blockedPIN, PINStatusProvider.STATUS.BLOCKED }); + } + + @Override + public Class getColumnClass(int columnIndex) { + return types[columnIndex]; + } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + return false; + } +} 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 new file mode 100644 index 00000000..977d6e3a --- /dev/null +++ b/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties @@ -0,0 +1,69 @@ +# Copyright 2008 Federal Chancellery Austria and +# Graz University of Technology +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +title.activation=Aktivierung +title.pin.mgmt=PIN Verwaltung +title.activate.pin=PIN Aktivieren +title.change.pin=PIN \u00C4ndern +title.unblock.pin=PIN Entsperren +title.verify.pin=PIN Eingeben +title.activate.success=Erfolg +title.change.success=Erfolg + +# removed message.* prefix to reuse keys as help keys +pin.mgmt=Die Karte verf\u00FCgt \u00FCber {0} PINs +activate.pin={0} eingeben und best\u00E4tigen +change.pin={0} eingeben und best\u00E4tigen +unblock.pin=PUK zu {0} eingeben +verify.pin={0} eingeben +verify.pinpad={0} ({1} stellig) am Kartenleser eingeben (und best\u00E4tigen). +activate.pinpad={0} ({1} stellig) am Kartenleser eingeben und wiederholen (jeweils best\u00E4tigen). +change.pinpad=Alte {0} ({1} stellig) am Kartenleser eingeben, danach neue {0} eingeben und wiederholen (jeweils best\u00E4tigen). +unblock.pinpad={0} ({1} stellig) am Kartenleser eingeben (und best\u00E4tigen). +activate.success={0} wurde erfolgreich aktiviert. +change.success={0} wurde erfolgreich ge\u00E4ndert. + +label.activation=e-card Aktivierungsprozess +label.activation.step=Schritt {0} +label.activation.idle=Warte auf Server... +label.old.pin=Alte {0}: +label.new.pin=Neue {0}: +label.repeat.pin=Best\u00E4tigung: + +button.activate=Aktivieren +button.change=\u00C4ndern +button.unblock=Entsperren +button.verify=Abfragen + +help.activation=help.activation +help.pin.mgmt=help.pin.mgmt + +err.status=Der Status der PINs konnte nicht \u00FCberpr\u00FCft werden. +err.activate=Beim Aktivieren der {0} trat ein Fehler auf. +err.change=Beim \u00C4ndern der {0} trat ein Fehler auf. +err.unblock=Das Entsperren der {0} wird nicht unterst\u00FCtzt. +err.verify=VERIFY ERROR (TODO) +err.retries=Falsche {0}, noch {1} Versuche +err.locked={0} gesperrt. +err.not.active={0} nicht aktiviert. +err.pin.format=Ung\u00FCltige {0} L\u00E4nge, verlangt sind {1} Stellen. +err.pin.confirmation={0} und Best\u00E4tigung stimmen nicht \u00FCberein. +err.pin.operation.aborted=Der Vorgang f\u00FCr {0} wurde abgebrochen. +err.unsupported.card=Die Karte wird nicht unterst\u00FCtzt + +status.not.active=NICHT AKTIV +status.active=AKTIV +status.blocked=GESPERRT +status.unknown=UNBEKANNT diff --git a/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties new file mode 100644 index 00000000..7f01971b --- /dev/null +++ b/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties @@ -0,0 +1,68 @@ +# Copyright 2008 Federal Chancellery Austria and +# Graz University of Technology +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +title.activation=Activation +title.pin.mgmt=PIN Management +title.activate.pin=Activate PIN +title.verify.pin=Enter PIN +title.change.pin=Change PIN +title.unblock.pin=Unblock PIN +title.activate.success=Success +title.change.success=Success + +# removed message.* prefix to reuse keys as help keys +pin.mgmt=The smartcard has {0} PINs +activate.pin=Enter and confirm {0} +change.pin=Enter and confirm {0} +unblock.pin=Enter PUK for {0} +verify.pin=Enter {0} +verify.pinpad=Enter {0} ({1} digits) on cardreader (and confirm). +activate.pinpad=Enter {0} ({1} digits) on cardreader and repeat (confirm in each case). +change.pinpad=Enter old {0} ({1} digits) on cardreader, then enter new {0} and repeat (confirm in each case). +unblock.pinpad=Enter {0} ({1} digits) on cardreader (and confirm). +activate.success={0} successfully activated +change.success={0} successfully changed + +label.activation=e-card activation process +label.activation.step=Step {0} +label.activation.idle=Wait for server... +label.old.pin=Old {0}: +label.new.pin=New {0}: +label.repeat.pin=Confirmation: + +button.activate=Activate +button.change=Change +button.unblock=Unblock +button.verify=Query + +help.activation=help.activation +help.pin.mgmt=help.pin.mgmt + +err.status=PIN statuses could not be read. +err.activate=An error occured during the activation of {0}. +err.change=An error occured during the changing of {0}. +err.unblock=Unblocking of {0} is not supported. +err.retries=Wrong {0}, {1} tries remaining +err.locked={0} locked +err.not.active={0} not activated. +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 + +status.not.active=NOT ACTIVE +status.active=ACTIVE +status.blocked=BLOCKED +status.unknown=UNKNOWN diff --git a/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java new file mode 100644 index 00000000..49ae577b --- /dev/null +++ b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java @@ -0,0 +1,63 @@ +/* +* Copyright 2008 Federal Chancellery Austria and +* Graz University of Technology +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.bku.gui; + +import at.gv.egiz.bku.gui.*; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.JFrame; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * + * @author clemens + */ +@Ignore +public class ActivationGuiTest { + + @Test + public void testBKUGUI() { + JFrame testFrame = new JFrame("BKUGUITest"); + Container contentPane = testFrame.getContentPane(); + contentPane.setPreferredSize(new Dimension(152, 145)); +// contentPane.setPreferredSize(new Dimension(300, 190)); + ActivationGUIFacade gui = new ActivationGUI(contentPane, null, BKUGUIFacade.Style.tiny, null, null); + BKUGUIWorker worker = new BKUGUIWorker(); + worker.init(gui); + testFrame.pack(); + testFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + testFrame.setVisible(true); + new Thread(worker).start(); + + while(true) ; + } + + @Test + public void dummyTest() { + } + +// public static void main(String[] args) { +// new BKUGUITest().testBKUGUI(); +// } +} diff --git a/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java new file mode 100644 index 00000000..74ea8952 --- /dev/null +++ b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java @@ -0,0 +1,203 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package at.gv.egiz.bku.gui; + +import at.gv.egiz.bku.gui.*; +import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.stal.HashDataInput; +import at.gv.egiz.stal.impl.ByteArrayHashDataInput; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author clemens + */ +public class BKUGUIWorker implements Runnable { + + ActivationGUIFacade gui; + + public void init(ActivationGUIFacade gui) { + this.gui = gui; + } + + @Override + public void run() { + try { + + final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN", (byte)0x00, null); + + + final ActionListener cancelListener = new ActionListener() { + + public void actionPerformed(ActionEvent e) { + System.out.println("CANCEL EVENT OCCURED: " + e); + } + }; + ActionListener okListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + System.out.println("OK EVENT OCCURED: " + e); + } + }; + final ActionListener signListener = new ActionListener() { + + public void actionPerformed(ActionEvent e) { + System.out.println("SIGN EVENT OCCURED: " + e); + } + }; + ActionListener hashdataListener = new ActionListener() { + + public void actionPerformed(ActionEvent e) { + System.out.println("HASHDATA EVENT OCCURED: " + e); + ActionListener returnListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + gui.showSignaturePINDialog(signPinSpec, -1, signListener, "sign", cancelListener, "cancel", null, "hashdata"); + } + }; + HashDataInput signedRef1 = new ByteArrayHashDataInput( + "Ich bin ein einfacher Text mit Umlauten: öäüßéç@€\n123\n456\n\tHello, world!\n\nlkjsd\nnksdjf".getBytes(), + "ref-id-0000000000000000000000001", + "text/plain", + "UTF-8"); + + HashDataInput signedRef2 = new ByteArrayHashDataInput( + "HashDataInput_002".getBytes(), + "ref-id-000000002", + "application/xhtml+xml", + "UTF-8"); + + HashDataInput signedRef3 = new ByteArrayHashDataInput( + "HashDataInput_003".getBytes(), + "ref-id-000000003", + "application/xhtml+xml", + "UTF-8"); + + HashDataInput signedRef4 = new ByteArrayHashDataInput( + "HashDataInput_004".getBytes(), + "ref-id-000000004", + "text/xml", + "UTF-8"); + + // + List signedRefs = new ArrayList(); + signedRefs.add(signedRef1); + signedRefs.add(signedRef2); + signedRefs.add(signedRef3); + signedRefs.add(signedRef4); +// signedRefs.add(signedRef4); +// signedRefs.add(signedRef4); +// signedRefs.add(signedRef4); +// signedRefs.add(signedRef4); +// signedRefs = Collections.singletonList(signedRef1); + gui.showSecureViewer(signedRefs, returnListener, "return"); + } + }; + + + +// gui.showWelcomeDialog(); +// +// Thread.sleep(2000); +// +// gui.showWaitDialog(null); +// +// Thread.sleep(1000); +// +// gui.showWaitDialog("test"); +// +// Thread.sleep(1000); +// +// +// gui.showInsertCardDialog(cancelListener, "cancel"); +// +// Thread.sleep(2000); +// +// gui.showCardNotSupportedDialog(cancelListener, "cancel"); +// +// Thread.sleep(2000); +// +// PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN"); +// +// gui.showCardPINDialog(cardPinSpec, okListener, "ok", cancelListener, "cancel"); +// +// Thread.sleep(2000); +// +// gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); +// +// Thread.sleep(4000); +// + +// gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, null, null); + +// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}, null, null); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog("error.test", new Object[] {"Testfehler", "noch ein TestFehler"}); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog("error.no.hashdata", null); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog("error.unknown", null); + + gui.showActivationProgressDialog(1, 3, null, null); + + gui.incrementProgress(); + + Thread.sleep(1000); + + gui.incrementProgress(); + + Thread.sleep(1000); + + gui.incrementProgress(); + + + Thread.sleep(1000); + + gui.showIdleDialog(null, null); + +// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save"); +// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save"); +// Thread.sleep(2000); + + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + } +} diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index 9704b7db..81cb3df8 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -93,6 +93,21 @@ smccSTAL 1.2.2-SNAPSHOT + + at.gv.egiz + BKUGuiExt + 1.2.2-SNAPSHOT + + + at.gv.egiz + smccSTALExt + 1.2.2-SNAPSHOT + + + at.gv.egiz + BKUViewer + 1.2.2-SNAPSHOT + BKUHelp at.gv.egiz @@ -117,16 +132,6 @@ commons-logging commons-logging - - at.gv.egiz - BKUApplet - 1.2.2-SNAPSHOT - - - at.gv.egiz - BKUViewer - 1.2.2-SNAPSHOT - diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/GUIProxy.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/GUIProxy.java new file mode 100644 index 00000000..38dd04d9 --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/GUIProxy.java @@ -0,0 +1,55 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.local.gui; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import javax.swing.JFrame; + +/** + * + * @author Clemens Orthacker + */ +public class GUIProxy implements InvocationHandler { + + JFrame frame; + BKUGUIFacade delegate; + + static public Object newInstance(BKUGUIFacade gui, JFrame frame, Class[] interfaces) { + return java.lang.reflect.Proxy.newProxyInstance(gui.getClass().getClassLoader(), + interfaces, + new GUIProxy(gui, frame)); + } + + private GUIProxy(BKUGUIFacade delegate, JFrame frame) { + this.frame = frame; + this.delegate = delegate; + } + + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + + if (method.getName().startsWith("show")) { + frame.setVisible(true); + frame.toFront(); + return method.invoke(delegate, args); + } else { //if (method.getName().startsWith("get")) { + return method.invoke(delegate, args); + } + } +} diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java deleted file mode 100644 index c724c071..00000000 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java +++ /dev/null @@ -1,156 +0,0 @@ -package at.gv.egiz.bku.local.stal; - -import java.awt.event.ActionListener; -import java.util.List; - -import java.util.Locale; -import javax.swing.JDialog; - -import at.gv.egiz.bku.gui.BKUGUIFacade; -import at.gv.egiz.smcc.PINSpec; -import at.gv.egiz.stal.HashDataInput; -import javax.swing.JFrame; - -public class BKUGuiProxy implements BKUGUIFacade { - - private BKUGUIFacade delegate; - private JFrame dialog; - - public BKUGuiProxy(JFrame dialog, BKUGUIFacade delegate) { - this.delegate = delegate; - this.dialog = dialog; - } - - private void showDialog() { - dialog.setVisible(true); - dialog.setAlwaysOnTop(true); - } - - @Override - public char[] getPin() { - return delegate.getPin(); - } - -// @Override -// public void init(Container contentPane, Locale locale, URL bgImage, ActionListener helpListener) { -// delegate.init(contentPane, locale, bgImage, helpListener); -// } - - @Override - public Locale getLocale() { - return delegate.getLocale(); - } - -// @Override -// public void showCardNotSupportedDialog(ActionListener cancelListener, -// String actionCommand) { -// showDialog(); -// delegate.showCardNotSupportedDialog(cancelListener, actionCommand); -// } -// -// @Override -// public void showCardPINDialog(PINSpec pinSpec, ActionListener okListener, -// String okCommand, ActionListener cancelListener, String cancelCommand) { -// showDialog(); -// delegate.showCardPINDialog(pinSpec, okListener, okCommand, cancelListener, -// cancelCommand); -// } -// - @Override - public void showCardPINDialog(PINSpec pinSpec, int numRetries, - ActionListener okListener, String okCommand, - ActionListener cancelListener, String cancelCommand) { - showDialog(); - delegate.showCardPINDialog(pinSpec, numRetries, okListener, okCommand, - cancelListener, cancelCommand); - } - - @Override - public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams, ActionListener okListener, - String actionCommand) { - showDialog(); - delegate.showErrorDialog(errorMsgKey, errorMsgParams, okListener, actionCommand); - } - - @Override - public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams) { - showDialog(); - delegate.showErrorDialog(errorMsgKey, errorMsgParams); - } - -// @Override -// public void showInsertCardDialog(ActionListener cancelListener, -// String actionCommand) { -// showDialog(); -// delegate.showInsertCardDialog(cancelListener, actionCommand); -// } -// -// @Override -// public void showSignaturePINDialog(PINSpec pinSpec, -// ActionListener signListener, String signCommand, -// ActionListener cancelListener, String cancelCommand, -// ActionListener hashdataListener, String hashdataCommand) { -// showDialog(); -// delegate.showSignaturePINDialog(pinSpec, signListener, signCommand, -// cancelListener, cancelCommand, hashdataListener, hashdataCommand); -// } -// - @Override - public void showSignaturePINDialog(PINSpec pinSpec, int numRetries, - ActionListener okListener, String okCommand, - ActionListener cancelListener, String cancelCommand, - ActionListener hashdataListener, String hashdataCommand) { - showDialog(); - delegate.showSignaturePINDialog(pinSpec, numRetries, okListener, - okCommand, cancelListener, cancelCommand, hashdataListener, - hashdataCommand); - } -// -// @Override -// public void showWaitDialog(String waitMessage) { -// showDialog(); -// delegate.showWaitDialog(waitMessage); -// } -// -// @Override -// public void showWelcomeDialog() { -// showDialog(); -// delegate.showWelcomeDialog(); -// } - - @Override - public void showSecureViewer(List signedReferences, - ActionListener okListener, - String okCommand) { - showDialog(); - delegate.showSecureViewer(signedReferences, okListener, okCommand); - } - - @Override - public void showMessageDialog(String titleKey, - String msgKey, Object[] msgParams, - String buttonKey, ActionListener okListener, String okCommand) { - showDialog(); - delegate.showMessageDialog(titleKey, msgKey, msgParams, buttonKey, okListener, okCommand); - } - - @Override - public void showMessageDialog(String titleKey, String msgKey, Object[] msgParams) { - showDialog(); - delegate.showMessageDialog(titleKey, msgKey, msgParams); - } - - @Override - public void showMessageDialog(String titleKey, String msgKey) { - showDialog(); - delegate.showMessageDialog(titleKey, msgKey); - } - - @Override - public void showPinpadSignaturePINDialog(PINSpec pinSpec, int numRetries, - ActionListener viewerListener, String viewerCommand) { - showDialog(); - delegate.showPinpadSignaturePINDialog(pinSpec, numRetries, - viewerListener, viewerCommand); - } -} 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 ca4d35d1..75f71be6 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 @@ -18,11 +18,13 @@ package at.gv.egiz.bku.local.stal; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.smccstal.AbstractBKUWorker; +import at.gv.egiz.bku.smccstal.PINManagementRequestHandler; 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.PINManagementRequest; import java.util.List; import javax.swing.JFrame; @@ -39,16 +41,18 @@ public class LocalBKUWorker extends AbstractBKUWorker { this.container = container; addRequestHandler(SignRequest.class, new LocalSignRequestHandler(new LocalSecureViewer(gui))); + addRequestHandler(PINManagementRequest.class, new PINManagementRequestHandler()); } + /** does not change container's visibility (use quit request to close) */ @Override public List handleRequest(List requestList) { signatureCard = null; List responses = super.handleRequest(requestList); - // container.setVisible(false); return responses; } + /** overrides handle quit from abstract bku worker, make container invisible */ @Override public STALResponse handleRequest(STALRequest request) { if (request instanceof QuitRequest) { diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java index 4c9554e2..712fb969 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java @@ -24,6 +24,9 @@ import java.util.Locale; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIImpl; +import at.gv.egiz.bku.gui.PINManagementGUI; +import at.gv.egiz.bku.gui.PINManagementGUIFacade; +import at.gv.egiz.bku.local.gui.GUIProxy; import at.gv.egiz.bku.local.gui.LocalHelpListener; import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.STALFactory; @@ -33,10 +36,16 @@ import javax.swing.JRootPane; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +/** + * Creates a PINManagementGUI and a LocalBKUWorker, which in turn registers + * PINManagementRequestHandler from smccSTALExt. + * The RequestHandler expects PINManagementGUIFacade, therefore BKUGUIProxy has to implement the extended GUI. + * @author clemens + */ public class LocalSTALFactory implements STALFactory { protected static final Log log = LogFactory.getLog(LocalSTALFactory.class); - protected static final Dimension PREFERRED_SIZE = new Dimension(300, 189); + protected static final Dimension PREFERRED_SIZE = new Dimension(318, 200); protected String helpURL; protected Locale locale; @@ -47,7 +56,7 @@ public class LocalSTALFactory implements STALFactory { //http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html // use undecorated JFrame instead of JWindow, // which creates an invisible owning frame and therefore cannot getFocusInWindow() - JFrame dialog = new JFrame(); + JFrame dialog = new JFrame("Bürgerkarte"); dialog.setUndecorated(true); dialog.getRootPane().setWindowDecorationStyle(JRootPane.NONE); @@ -64,12 +73,13 @@ public class LocalSTALFactory implements STALFactory { } catch (MalformedURLException ex) { log.error("failed to configure help listener: " + ex.getMessage(), ex); } - BKUGUIFacade gui = new BKUGUIImpl(dialog.getContentPane(), + PINManagementGUIFacade gui = new PINManagementGUI(dialog.getContentPane(), dialog.getLocale(), BKUGUIFacade.Style.advanced, null, helpListener); - stal = new LocalBKUWorker(new BKUGuiProxy(dialog, gui), dialog); + BKUGUIFacade proxy = (BKUGUIFacade) GUIProxy.newInstance(gui, dialog, new Class[] { PINManagementGUIFacade.class} ); + stal = new LocalBKUWorker(proxy, dialog); dialog.setPreferredSize(PREFERRED_SIZE); dialog.pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/PINManagementServlet.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/PINManagementServlet.java new file mode 100644 index 00000000..89e526ac --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/PINManagementServlet.java @@ -0,0 +1,167 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.local.webapp; + +import at.gv.egiz.bku.local.stal.LocalSTALFactory; +import at.gv.egiz.marshal.MarshallerFactory; +import at.gv.egiz.stal.QuitRequest; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.ext.PINManagementRequest; +import at.gv.egiz.stal.ext.PINManagementResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import org.apache.regexp.REUtil; + +/** + * PINManagementBKUWorker for non-applet version + * @author Clemens Orthacker + */ +public class PINManagementServlet extends HttpServlet { + +// static JAXBContext stalCtx; + + /** + * Processes requests for both HTTP GET and POST methods. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + LocalSTALFactory sf = new LocalSTALFactory(); + + ArrayList stalReqs = new ArrayList(); + stalReqs.add(new PINManagementRequest()); + stalReqs.add(new QuitRequest()); + + List stalResps = sf.createSTAL().handleRequest(stalReqs); + + String redirect = request.getParameter("redirect"); + if (redirect != null) { + String referer = request.getHeader("Referer"); + if (referer != null) { + redirect = new URL(new URL(referer), redirect).toExternalForm(); + } + response.sendRedirect(redirect); + } else { + response.setStatus(HttpServletResponse.SC_OK); +// if (stalResps.get(0) != null) { +// PrintWriter out = response.getWriter(); +// try { +// response.setContentType("text/xml;charset=UTF-8"); +// // cannot directly marshal STALResponse, no ObjectFactory in at.gv.egiz.stal +// if (stalCtx == null) { +// stalCtx = JAXBContext.newInstance("at.gv.egiz.stal:at.gv.egiz.stal.ext"); +// } +// Marshaller m = MarshallerFactory.createMarshaller(stalCtx); +// m.marshal(stalResps.get(0), out); +// out.close(); +// } catch (JAXBException ex) { +// throw new ServletException("Failed to marshal STAL response", ex); +// } finally { +// out.close(); +// } +// } else { +// throw new ServletException("internal error"); +// } + } + + +// try { +// out.println(""); +// out.println(""); +// out.println("Servlet PINManagementServlet"); +// out.println(""); +// out.println(""); +// out.println("

Servlet PINManagementServlet at " + request.getContextPath() + "

"); +// out.println("

" + stalResps.size() + " responses:

    "); +// for (STALResponse resp : stalResps) { +// out.println("
  • " + resp.getClass()); +// } +// Enumeration headers = request.getHeaderNames(); +// out.println("

headers:

    "); +// while (headers.hasMoreElements()) { +// String header = headers.nextElement(); +// out.println("
  • " + header + ": " + request.getHeader(header)); +// } +// Enumeration params = request.getParameterNames(); +// out.println("

params:

    "); +// while (params.hasMoreElements()) { +// String param = params.nextElement(); +// out.println("
  • " + param + ": " + request.getParameter(param)); +// } +// out.println("

"); +// out.println(""); +// } finally { +// out.close(); +// } + } + + // + /** + * Handles the HTTP GET method. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP POST method. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// +} diff --git a/BKULocal/src/main/webapp/WEB-INF/web.xml b/BKULocal/src/main/webapp/WEB-INF/web.xml index 8e696570..83f33d9e 100644 --- a/BKULocal/src/main/webapp/WEB-INF/web.xml +++ b/BKULocal/src/main/webapp/WEB-INF/web.xml @@ -40,6 +40,10 @@ help /help.jsp + + PINManagementServlet + at.gv.egiz.bku.local.webapp.PINManagementServlet + BKUServlet /http-security-layer-request @@ -53,7 +57,11 @@ /help/* - + + + PINManagementServlet + /PINManagement + index.html index.htm diff --git a/BKULocal/src/main/webapp/index.html b/BKULocal/src/main/webapp/index.html index 215eec80..537c154a 100644 --- a/BKULocal/src/main/webapp/index.html +++ b/BKULocal/src/main/webapp/index.html @@ -23,7 +23,12 @@

BKU Web Start - Willkommen

-

Diese Seite installiert das MOCCA Zertifikat in ihrem Browser. +

+

Diese Seite installiert das MOCCA Zertifikat in ihrem Browser. In jedem weiteren Browser können sie dieses durch Aufruf dieser Seite ebenso installieren.

+
+ 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 23d832a2..ca40ddc0 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 @@ -1,10 +1,10 @@ package at.gv.egiz.bku.webstart; +import at.gv.egiz.bku.webstart.gui.AboutDialog; import at.gv.egiz.bku.webstart.gui.BKUControllerInterface; -import at.gv.egiz.bku.webstart.gui.TrayMenuListener; +import at.gv.egiz.bku.webstart.gui.PINManagementInvoker; import iaik.asn1.CodingException; import java.io.IOException; -import java.net.URISyntaxException; import java.util.Locale; import java.util.ResourceBundle; @@ -21,8 +21,12 @@ import java.awt.PopupMenu; import java.awt.SplashScreen; import java.awt.SystemTray; import java.awt.TrayIcon; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; import java.net.BindException; -import java.net.URI; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; import java.net.URL; import java.security.GeneralSecurityException; import java.util.jar.Attributes; @@ -30,9 +34,10 @@ import java.util.jar.Manifest; import javax.imageio.ImageIO; import javax.jnlp.BasicService; import javax.jnlp.ServiceManager; +import javax.swing.JFrame; import org.mortbay.util.MultiException; -public class Launcher implements BKUControllerInterface { +public class Launcher implements BKUControllerInterface, ActionListener { public static final String WEBAPP_RESOURCE = "BKULocal.war"; public static final String CERTIFICATES_RESOURCE = "BKUCertificates.jar"; @@ -51,23 +56,37 @@ public class Launcher implements BKUControllerInterface { public static final String ERROR_START = "tray.error.start"; public static final String ERROR_CONFIG = "tray.error.config"; public static final String ERROR_BIND = "tray.error.bind"; + public static final String ERROR_PIN = "tray.error.pin.connect"; public static final String LABEL_SHUTDOWN = "tray.label.shutdown"; public static final String LABEL_PIN = "tray.label.pin"; public static final String LABEL_ABOUT = "tray.label.about"; public static final String TOOLTIP_DEFAULT = "tray.tooltip.default"; - - /** local bku uri */ - public static final URI HTTPS_SECURITY_LAYER_URI; + + /** action commands for tray menu */ + public static final String SHUTDOWN_COMMAND = "shutdown"; + public static final String PIN_COMMAND = "pin"; + public static final String ABOUT_COMMAND = "about"; + private static Log log = LogFactory.getLog(Launcher.class); + /** local bku uri */ + public static final URL HTTP_SECURITY_LAYER_URL; + public static final URL HTTPS_SECURITY_LAYER_URL; + public static final URL PIN_MANAGEMENT_URL; static { - URI tmp = null; + URL http = null; + URL https = null; + URL pin = null; try { - tmp = new URI("https://localhost:" + Integer.getInteger(Container.HTTPS_PORT_PROPERTY, 3496).intValue()); - } catch (URISyntaxException ex) { + http = new URL("http://localhost:" + Integer.getInteger(Container.HTTPS_PORT_PROPERTY, 3495).intValue()); + https = new URL("https://localhost:" + Integer.getInteger(Container.HTTPS_PORT_PROPERTY, 3496).intValue()); + pin = new URL(http, "/PINManagement"); + } catch (MalformedURLException ex) { log.error(ex); } finally { - HTTPS_SECURITY_LAYER_URI = tmp; + HTTP_SECURITY_LAYER_URL = http; + HTTPS_SECURITY_LAYER_URL = https; + PIN_MANAGEMENT_URL = pin; } } public static final String version; @@ -96,6 +115,8 @@ public class Launcher implements BKUControllerInterface { private BasicService basicService; private TrayIcon trayIcon; private ResourceBundle messages; + private AboutDialog aboutDialog; + public Launcher() { if (log.isTraceEnabled()) { @@ -144,7 +165,7 @@ public class Launcher implements BKUControllerInterface { } } - private TrayIcon initTrayIcon() { //ResourceBundle messages, BKUControllerInterface bkuHook) { + private TrayIcon initTrayIcon() { if (SystemTray.isSupported()) { try { // get the SystemTray instance @@ -155,21 +176,27 @@ public class Launcher implements BKUControllerInterface { : TRAYICON_RESOURCE + "32.png"; Image image = ImageIO.read(Launcher.class.getClassLoader().getResourceAsStream(iconResource)); - TrayMenuListener listener = new TrayMenuListener(this, messages, version); PopupMenu popup = new PopupMenu(); + MenuItem pinItem = new MenuItem(messages.getString(LABEL_PIN)); + pinItem.addActionListener(this); + pinItem.setActionCommand(PIN_COMMAND); + popup.add(pinItem); + MenuItem shutdownItem = new MenuItem(messages.getString(LABEL_SHUTDOWN)); - shutdownItem.addActionListener(listener); - shutdownItem.setActionCommand(TrayMenuListener.SHUTDOWN_COMMAND); + shutdownItem.addActionListener(this); + shutdownItem.setActionCommand(SHUTDOWN_COMMAND); popup.add(shutdownItem); + popup.addSeparator(); + MenuItem aboutItem = new MenuItem(messages.getString(LABEL_ABOUT)); - aboutItem.setActionCommand(TrayMenuListener.ABOUT_COMMAND); - aboutItem.addActionListener(listener); + aboutItem.setActionCommand(ABOUT_COMMAND); + aboutItem.addActionListener(this); popup.add(aboutItem); TrayIcon ti = new TrayIcon(image, messages.getString(TOOLTIP_DEFAULT), popup); - ti.addActionListener(listener); + ti.addActionListener(this); tray.add(ti); return ti; } catch (AWTException ex) { @@ -237,15 +264,15 @@ public class Launcher implements BKUControllerInterface { Desktop desktop = Desktop.getDesktop(); if (desktop.isSupported(Desktop.Action.BROWSE)) { try { - desktop.browse(HTTPS_SECURITY_LAYER_URI); + desktop.browse(HTTPS_SECURITY_LAYER_URL.toURI()); } catch (Exception ex) { - log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URI, ex); + log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URL, ex); } } else { - log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URI); + log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URL); } } else { - log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URI); + log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URL); } } log.info("BKU successfully started"); @@ -276,6 +303,39 @@ public class Launcher implements BKUControllerInterface { System.exit(0); } + /** + * Listen for TrayMenu actions (display error messages on trayIcon) + * @param e + */ + @Override + public void actionPerformed(ActionEvent e) { + if (SHUTDOWN_COMMAND.equals(e.getActionCommand())) { + log.debug("shutdown requested via tray menu"); + this.shutDown(); + } else if (ABOUT_COMMAND.equals(e.getActionCommand())) { + log.debug("about dialog requested via tray menu"); + if (aboutDialog == null) { + aboutDialog = new AboutDialog(new JFrame(), true, version); + aboutDialog.addWindowListener(new WindowAdapter() { + + @Override + public void windowClosing(java.awt.event.WindowEvent e) { + aboutDialog.setVisible(false); + } + }); + } + aboutDialog.setLocationByPlatform(true); + aboutDialog.setVisible(true); + } else if (PIN_COMMAND.equals(e.getActionCommand())) { + log.debug("pin management dialog requested via tray menu"); + + new Thread(new PINManagementInvoker(trayIcon, messages)).start(); + + } else { + log.error("unknown tray menu command: " + e.getActionCommand()); + } + } + public static void main(String[] args) throws InterruptedException, IOException { try { Launcher launcher = new Launcher(); diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/PINManagementInvoker.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/PINManagementInvoker.java new file mode 100644 index 00000000..55e26313 --- /dev/null +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/PINManagementInvoker.java @@ -0,0 +1,71 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.webstart.gui; + +import at.gv.egiz.bku.webstart.Launcher; +import java.awt.TrayIcon; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.util.ResourceBundle; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * GUI is painted using SwingUtilities.invokeLater, but TrayIcon ActionListener Thread (== webstart thread) joined Jetty Thread + * + * @author Clemens Orthacker + */ +public class PINManagementInvoker implements Runnable { + + private static final Log log = LogFactory.getLog(PINManagementInvoker.class); + + TrayIcon trayIcon; + ResourceBundle messages; + + public PINManagementInvoker(TrayIcon trayIcon, ResourceBundle messages) { + this.trayIcon = trayIcon; + this.messages = messages; + } + + @Override + public void run() { + HttpURLConnection connection = null; + try { + log.debug("Connecting to: " + Launcher.PIN_MANAGEMENT_URL); + + connection = (HttpURLConnection) Launcher.PIN_MANAGEMENT_URL.openConnection(); + + connection.setRequestMethod("GET"); + connection.setReadTimeout(0); + connection.connect(); + + if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) { + log.debug("pin management dialog returned"); + } else { + log.error("unexpected response from pin management: " + connection.getResponseMessage()); + } + } catch (IOException ex) { + log.error("Failed to connect to PIN Management", ex); + trayIcon.displayMessage(messages.getString(Launcher.CAPTION_ERROR), + messages.getString(Launcher.ERROR_PIN), TrayIcon.MessageType.ERROR); + } finally { + if (connection != null) { + connection.disconnect(); + } + } + } +} diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/TrayMenuListener.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/TrayMenuListener.java deleted file mode 100644 index 1e5efe8e..00000000 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/TrayMenuListener.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package at.gv.egiz.bku.webstart.gui; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.util.ResourceBundle; -import javax.swing.JFrame; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * - * @author Clemens Orthacker - */ -public class TrayMenuListener implements ActionListener { - - /** action commands for tray menu */ - public static final String SHUTDOWN_COMMAND = "shutdown"; - public static final String PIN_COMMAND = "pin"; - public static final String ABOUT_COMMAND = "about"; - - private static final Log log = LogFactory.getLog(TrayMenuListener.class); - - protected BKUControllerInterface bku; - protected ResourceBundle messages; - protected String version; - protected AboutDialog aboutDialog; - - public TrayMenuListener(BKUControllerInterface bkuHook, ResourceBundle messages, String version) { - this.messages = messages; - this.version = version; - this.bku = bkuHook; - } - - @Override - public void actionPerformed(ActionEvent e) { - if (SHUTDOWN_COMMAND.equals(e.getActionCommand())) { - log.debug("shutdown requested via tray menu"); - bku.shutDown(); - } else if (ABOUT_COMMAND.equals(e.getActionCommand())) { - log.debug("about dialog requested via tray menu"); - if (aboutDialog == null) { - aboutDialog = new AboutDialog(new JFrame(), true, version); - aboutDialog.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(java.awt.event.WindowEvent e) { - aboutDialog.setVisible(false); - } - }); - } - aboutDialog.setLocationByPlatform(true); - aboutDialog.setVisible(true); - } else if (PIN_COMMAND.equals(e.getActionCommand())) { - log.error("not implemented yet."); - } else { - log.error("unknown tray menu command: " + e.getActionCommand()); - } - } -} diff --git a/BKUWebStart/src/main/jnlp/resources/version.xml b/BKUWebStart/src/main/jnlp/resources/version.xml index 013194a4..64a3963e 100644 --- a/BKUWebStart/src/main/jnlp/resources/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/version.xml @@ -2,17 +2,17 @@ - BKUWebStart-1.0.10.jar - 1.0.10 + BKUWebStart-1.0.11-SNAPSHOT.jar + 1.0.11-SNAPSHOT - BKUWebStart-1.0.10.jar + BKUWebStart-1.0.11-SNAPSHOT.jar - utils-1.2.1.jar - 1.2.1 + utils-1.2.2-SNAPSHOT.jar + 1.2.2-SNAPSHOT - utils-1.2.1.jar + utils-1.2.2-SNAPSHOT.jar diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties index d965f970..b6d9238e 100644 --- a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties +++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties @@ -24,6 +24,7 @@ tray.message.shutdown=B\u00FCrgerkartenumgebung wird beendet tray.error.start=B\u00FCrgerkartenumgebung konnte nicht gestartet werden tray.error.config=Konfiguration konnte nicht initialisiert werden, B\u00FCrberkartenumgebung wird nicht gestartet tray.error.bind=Die f\u00FCr die B\u00FCrgerkartenumgebung reservierte Adresse wird bereits von einem anderen Dienst verwendet +tray.error.pin.connect=Verbindung zur PIN Verwaltung konnte nicht hergestellt werden tray.label.shutdown=Beenden tray.label.pin=PIN Verwaltung tray.label.about=\u00DCber... diff --git a/pom.xml b/pom.xml index 912d29d0..7f98c2ec 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,8 @@ BKUWebStart BKUCertificates BKUHelp + BKUGuiExt + smccSTALExt diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java index 71f35181..d0762da9 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java @@ -160,6 +160,11 @@ public abstract class AbstractSMCCSTAL implements STAL { handlerMap.put(id.getSimpleName(), handler); } + public void removeRequestHandler(Class id) { + log.debug("De-registering STAL request handler: " + id.getSimpleName()); + handlerMap.remove(id.getSimpleName()); + } + public SMCCSTALRequestHandler getRequestHandler( Class request) { return handlerMap.get(request.getSimpleName()); diff --git a/smccSTALExt/pom.xml b/smccSTALExt/pom.xml new file mode 100644 index 00000000..481993e1 --- /dev/null +++ b/smccSTALExt/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + bku + at.gv.egiz + 1.2.2-SNAPSHOT + + at.gv.egiz + smccSTALExt + ${project.parent.version} + smcc STAL Extension + + + at.gv.egiz + smccSTAL + ${project.parent.version} + + + at.gv.egiz + BKUGuiExt + ${project.parent.version} + + + + diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java new file mode 100644 index 00000000..533206b3 --- /dev/null +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java @@ -0,0 +1,177 @@ +/* +* Copyright 2008 Federal Chancellery Austria and +* Graz University of Technology +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * + */ +package at.gv.egiz.bku.smccstal; + +import at.gv.egiz.bku.gui.ActivationGUIFacade; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.smartcardio.Card; +import javax.smartcardio.CardChannel; +import javax.smartcardio.CardException; +import javax.smartcardio.CommandAPDU; +import javax.smartcardio.ResponseAPDU; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.smccstal.AbstractRequestHandler; +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.APDUScriptRequest; +import at.gv.egiz.stal.ext.APDUScriptResponse; +import at.gv.egiz.stal.ext.APDUScriptRequest.Command; +import at.gv.egiz.stal.ext.APDUScriptRequest.RequestScriptElement; +import at.gv.egiz.stal.ext.APDUScriptRequest.Reset; +import at.gv.egiz.stal.ext.APDUScriptResponse.Response; +import at.gv.egiz.stal.ext.APDUScriptResponse.ATR; +import at.gv.egiz.stal.ext.APDUScriptResponse.ResponseScriptElement; +import java.awt.event.ActionListener; + +/** + * @author mcentner + * + */ +public class CardMgmtRequestHandler extends AbstractRequestHandler implements ActionListener { + + /** + * Logging facility. + */ + private static Log log = LogFactory.getLog(CardMgmtRequestHandler.class); + + /** + * The sequence counter. + */ + private int sequenceNum = 0; + + /** + * display script num + */ + private int currentActivationScript = 0; + + @Override + public STALResponse handleRequest(STALRequest request) + throws InterruptedException { + + // APDU Script Request + if (request instanceof APDUScriptRequest) { + + currentActivationScript++; + log.debug("handling APDU script " + currentActivationScript); + + Card icc = card.getCard(); + + if (icc == null) { + log.error("SignatureCard instance '" + card.getClass().getName() + "' does not support card management requests."); + return new ErrorResponse(1000); + } + + List script = ((APDUScriptRequest) request).getScript(); + ArrayList responses = new ArrayList(script.size()); + + ((ActivationGUIFacade) gui).showActivationProgressDialog(currentActivationScript, script.size(), this, "cancel"); + + try { + log.trace("begin exclusive"); + icc.beginExclusive(); + + for (RequestScriptElement scriptElement : script) { + ((ActivationGUIFacade) gui).incrementProgress(); + + if (scriptElement instanceof Command) { + log.trace("handling APDU script element COMMAND"); + Command command = (Command) scriptElement; + CommandAPDU commandAPDU = new CommandAPDU(command.getCommandAPDU()); + + log.trace("get basicchannel"); + CardChannel channel = icc.getBasicChannel(); + + sequenceNum = command.getSequence(); + log.debug("Transmit APDU (sequence=" + sequenceNum + ")"); + log.trace(commandAPDU.toString()); + ResponseAPDU responseAPDU = channel.transmit(commandAPDU); + log.trace(responseAPDU.toString()); + + byte[] sw = new byte[] { + (byte) (0xFF & responseAPDU.getSW1()), + (byte) (0xFF & responseAPDU.getSW2()) }; + + responses.add(new Response(sequenceNum, responseAPDU.getData(), sw, 0)); + + if (command.getExpectedSW() != null && + !Arrays.equals(sw, command.getExpectedSW())) { + // unexpected SW + log.warn("Got unexpected SW. APDU-script execution stopped."); + break; + } + + } else if (scriptElement instanceof Reset) { + + log.trace("handling APDU script element RESET"); + sequenceNum = 0; + card.reset(); + javax.smartcardio.ATR atr = icc.getATR(); + log.trace("got ATR: " + atr.toString()); + responses.add(new ATR(atr.getBytes())); + + log.trace("regain exclusive access to card"); + icc = card.getCard(); + icc.beginExclusive(); + } + + } + + } catch (CardException e) { + log.info("Failed to execute APDU script.", e); + responses.add(new Response(sequenceNum, null, null, Response.RC_UNSPECIFIED)); + } catch (SignatureCardException e) { + log.info("Failed to reset smart card.", e); + responses.add(new Response(sequenceNum, null, null, Response.RC_UNSPECIFIED)); + } catch (RuntimeException e) { + log.error(e); + throw e; + } finally { + try { + icc.endExclusive(); + } catch (CardException e) { + log.info(e); + } + } + + log.trace("done handling APDU script " + currentActivationScript + ", return response containing " + responses.size() + " elements"); + ((ActivationGUIFacade) gui).showIdleDialog(this, "cancel"); + return new APDUScriptResponse(responses); + + } else { + log.error("Got unexpected STAL request: " + request); + return new ErrorResponse(1000); + } + + } + + @Override + public boolean requireCard() { + return true; + } + +} diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GetPINStatusException.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GetPINStatusException.java new file mode 100644 index 00000000..66b15887 --- /dev/null +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GetPINStatusException.java @@ -0,0 +1,41 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.smccstal; + +import at.gv.egiz.smcc.SignatureCardException; + +/** + * + * @author Clemens Orthacker + */ +public class GetPINStatusException extends SignatureCardException { + + /** + * Creates a new instance of GetStatusException without detail message. + */ + public GetPINStatusException() { + } + + + /** + * Constructs an instance of GetStatusException with the specified detail message. + * @param msg the detail message. + */ + public GetPINStatusException(String msg) { + super(msg); + } +} diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/ManagementPINProviderFactory.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/ManagementPINProviderFactory.java new file mode 100644 index 00000000..34bcbf5c --- /dev/null +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/ManagementPINProviderFactory.java @@ -0,0 +1,262 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.smccstal; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.smcc.ChangePINProvider; +import at.gv.egiz.bku.gui.PINManagementGUIFacade; +import at.gv.egiz.bku.smccstal.AbstractPINProvider; +import at.gv.egiz.bku.smccstal.PINProviderFactory; +import at.gv.egiz.smcc.CancelledException; +import at.gv.egiz.smcc.ccid.CCID; +import at.gv.egiz.smcc.PINProvider; +import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.SignatureCard; + +/** + * + * @author Clemens Orthacker + */ +public class ManagementPINProviderFactory extends PINProviderFactory { + + public ManagementPINProviderFactory(CCID reader, PINManagementGUIFacade gui) { + super(reader, gui); + } + +// public static ManagementPINProviderFactory getInstance(SignatureCard forCard, +// PINManagementGUIFacade gui) { +// if (forCard.getReader().hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) { +// return new PinpadPINProviderFactory(gui); +// +// } else { +// return new SoftwarePINProviderFactory(gui); +// } +// } + + public PINProvider getVerifyPINProvider() { + if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_START)) { + return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.VERIFY); + } else if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) { + return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.VERIFY); + } else { + return new SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG.VERIFY); + } + } + + public PINProvider getActivatePINProvider() { + if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_START)) { + return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.ACTIVATE); + } else if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_DIRECT)) { + return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.ACTIVATE); + } else { + return new SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG.ACTIVATE); + } + } + + public ChangePINProvider getChangePINProvider() { + if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_START)) { + return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.CHANGE); + } else if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_DIRECT)) { + return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.CHANGE); + } else { + return new ChangePinProvider(); + } + } + + public PINProvider getUnblockPINProvider() { + if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_START)) { + return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.UNBLOCK); + } else if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) { + return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.UNBLOCK); + } else { + return new SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG.UNBLOCK); + } + } + + class PinpadGenericPinProvider extends AbstractPINProvider + implements ChangePINProvider { + + protected PINManagementGUIFacade.DIALOG type; + + private PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG type) { + this.type = type; + } + + @Override + public char[] providePIN(PINSpec spec, int retries) + throws CancelledException, InterruptedException { + + showPinpadPINDialog(retries, spec); + retry = true; + return null; + } + + /** + * do not call this method without calling providePIN() + * (no message is displayed) + * @param spec + * @param retries + * @return + */ + @Override + public char[] provideOldPIN(PINSpec spec, int retries) { + return null; + } + + private void showPinpadPINDialog(int retries, PINSpec pinSpec) { + String title, message; + Object[] params; + if (retry) { + if (retries == 1) { + message = BKUGUIFacade.MESSAGE_LAST_RETRY_PINPAD; + } else { + message = BKUGUIFacade.MESSAGE_RETRIES_PINPAD; + } + title = BKUGUIFacade.TITLE_RETRY; + params = new Object[]{String.valueOf(retries)}; + } else if (type == PINManagementGUIFacade.DIALOG.VERIFY) { + title = PINManagementGUIFacade.TITLE_VERIFY_PIN; + message = BKUGUIFacade.MESSAGE_ENTERPIN_PINPAD; + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); + } + params = new Object[]{pinSpec.getLocalizedName(), pinSize}; + } else if (type == PINManagementGUIFacade.DIALOG.ACTIVATE) { + title = PINManagementGUIFacade.TITLE_ACTIVATE_PIN; + message = PINManagementGUIFacade.MESSAGE_ACTIVATEPIN_PINPAD; + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); + } + params = new Object[]{pinSpec.getLocalizedName(), pinSize}; + } else if (type == PINManagementGUIFacade.DIALOG.CHANGE) { + title = PINManagementGUIFacade.TITLE_CHANGE_PIN; + message = PINManagementGUIFacade.MESSAGE_CHANGEPIN_PINPAD; + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); + } + params = new Object[]{pinSpec.getLocalizedName(), pinSize}; + } else { //if (type == DIALOG.UNBLOCK) { + title = PINManagementGUIFacade.TITLE_UNBLOCK_PIN; + message = PINManagementGUIFacade.MESSAGE_UNBLOCKPIN_PINPAD; + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); + } + params = new Object[]{pinSpec.getLocalizedName(), pinSize}; + } + gui.showMessageDialog(title, message, params); + } + } + + + class SoftwareGenericPinProvider extends AbstractPINProvider { + +// protected PINManagementGUIFacade gui; + protected PINManagementGUIFacade.DIALOG type; + + private SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG type) { + this.type = type; + } + + @Override + public char[] providePIN(PINSpec spec, int retries) + throws CancelledException, InterruptedException { + + ((PINManagementGUIFacade) gui).showPINDialog(type, spec, + (retry) ? retries : -1, + this, "exec", + this, "back"); + + waitForAction(); + + if ("exec".equals(action)) { + gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT, + BKUGUIFacade.MESSAGE_WAIT); + retry = true; + return gui.getPin(); + } else if ("back".equals(action)) { + throw new CancelledException(); + } else { + log.error("unsupported command " + action); + throw new CancelledException(); + } + } + } + + class ChangePinProvider extends AbstractPINProvider + implements ChangePINProvider { + +// protected PINManagementGUIFacade gui; + + private char[] oldPin; + private char[] newPin; + + private ChangePinProvider() { + } + + @Override + public char[] providePIN(PINSpec spec, int retries) + throws CancelledException, InterruptedException { + if (newPin == null) { + getPINs(spec, retries); + } + char[] pin = newPin; + newPin = null; + return pin; + } + + @Override + public char[] provideOldPIN(PINSpec spec, int retries) + throws CancelledException, InterruptedException { + if (oldPin == null) { + getPINs(spec, retries); + } + char[] pin = oldPin; + oldPin = null; + return pin; + } + + private void getPINs(PINSpec spec, int retries) + throws InterruptedException, CancelledException { + + ((PINManagementGUIFacade) gui).showPINDialog( + PINManagementGUIFacade.DIALOG.CHANGE, spec, + (retry) ? retries : -1, + this, "exec", + this, "back"); + + waitForAction(); + + if ("exec".equals(action)) { + gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT, + BKUGUIFacade.MESSAGE_WAIT); + retry = true; + oldPin = ((PINManagementGUIFacade) gui).getOldPin(); + newPin = gui.getPin(); + } else if ("back".equals(action)) { + throw new CancelledException(); + } else { + log.error("unsupported command " + action); + throw new CancelledException(); + } + } + } +} diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java new file mode 100644 index 00000000..bfeb90b0 --- /dev/null +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java @@ -0,0 +1,245 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.smccstal; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.bku.gui.PINManagementGUIFacade; +import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; +import at.gv.egiz.bku.smccstal.AbstractRequestHandler; +import at.gv.egiz.smcc.CancelledException; +import at.gv.egiz.smcc.LockedException; +import at.gv.egiz.smcc.NotActivatedException; +import at.gv.egiz.smcc.PINConfirmationException; +import at.gv.egiz.smcc.PINFormatException; +import at.gv.egiz.smcc.PINMgmtSignatureCard; +import at.gv.egiz.smcc.PINOperationAbortedException; +import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.TimeoutException; +import at.gv.egiz.smcc.PINMgmtSignatureCard.PIN_STATE; +import at.gv.egiz.stal.ErrorResponse; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.ext.PINManagementRequest; +import at.gv.egiz.stal.ext.PINManagementResponse; + +/** + * + * @author Clemens Orthacker + */ +public class PINManagementRequestHandler extends AbstractRequestHandler { + + protected static final Log log = LogFactory.getLog(PINManagementRequestHandler.class); + + protected Map pinStates = new HashMap(); + + @Override + public STALResponse handleRequest(STALRequest request) throws InterruptedException { + if (request instanceof PINManagementRequest) { + + PINManagementGUIFacade gui = (PINManagementGUIFacade) this.gui; + + PINSpec selectedPIN = null; + + try { + + if (card instanceof PINMgmtSignatureCard) { + + // update all PIN states + for (PINSpec pinSpec : ((PINMgmtSignatureCard) card).getPINSpecs()) { + updatePINState(pinSpec, STATUS.UNKNOWN); + } + + gui.showPINManagementDialog(pinStates, this, "activate_enterpin", + "change_enterpin", "unblock_enterpuk", "verify_enterpin", this, + "cancel"); + + } else { + + // card does not support PIN management + gui.showErrorDialog(PINManagementGUIFacade.ERR_UNSUPPORTED_CARD, + null, this, "cancel"); + + } + + while (true) { + + waitForAction(); + + if ("cancel".equals(actionCommand)) { + log.debug("pin management cancel"); + return new PINManagementResponse(); + } else { + selectedPIN = gui.getSelectedPINSpec(); + + if (selectedPIN == null) { + throw new NullPointerException("no PIN selected for activation/change"); + } + + ManagementPINProviderFactory ppfac = + new ManagementPINProviderFactory(card.getReader(), gui); + + try { + if ("activate_enterpin".equals(actionCommand)) { + log.info("activate " + selectedPIN.getLocalizedName()); + ((PINMgmtSignatureCard) card).activatePIN(selectedPIN, + ppfac.getActivatePINProvider()); + updatePINState(selectedPIN, STATUS.ACTIV); + gui.showMessageDialog(PINManagementGUIFacade.TITLE_ACTIVATE_SUCCESS, + PINManagementGUIFacade.MESSAGE_ACTIVATE_SUCCESS, + new Object[] {selectedPIN.getLocalizedName()}, + BKUGUIFacade.BUTTON_OK, this, "ok"); + waitForAction(); + } else if ("change_enterpin".equals(actionCommand)) { + log.info("change " + selectedPIN.getLocalizedName()); + ((PINMgmtSignatureCard) card).changePIN(selectedPIN, + ppfac.getChangePINProvider()); + updatePINState(selectedPIN, STATUS.ACTIV); + gui.showMessageDialog(PINManagementGUIFacade.TITLE_CHANGE_SUCCESS, + PINManagementGUIFacade.MESSAGE_CHANGE_SUCCESS, + new Object[] {selectedPIN.getLocalizedName()}, + BKUGUIFacade.BUTTON_OK, this, "ok"); + waitForAction(); + + } else if ("unblock_enterpuk".equals(actionCommand)) { + log.info("unblock " + selectedPIN.getLocalizedName()); + ((PINMgmtSignatureCard) card).unblockPIN(selectedPIN, + ppfac.getUnblockPINProvider()); + } else if ("verify_enterpin".equals(actionCommand)) { + log.info("verify " + selectedPIN.getLocalizedName()); + ((PINMgmtSignatureCard) card).verifyPIN(selectedPIN, + ppfac.getVerifyPINProvider()); + updatePINState(selectedPIN, STATUS.ACTIV); + } + } catch (CancelledException ex) { + log.trace("cancelled"); + } catch (TimeoutException ex) { + log.error("Timeout during pin entry"); + gui.showMessageDialog(BKUGUIFacade.TITLE_ENTRY_TIMEOUT, + BKUGUIFacade.ERR_PIN_TIMEOUT, + new Object[] {selectedPIN.getLocalizedName()}, + BKUGUIFacade.BUTTON_OK, this, null); + waitForAction(); + } catch (LockedException ex) { + log.error(selectedPIN.getLocalizedName() + " locked"); + updatePINState(selectedPIN, STATUS.BLOCKED); + gui.showErrorDialog(PINManagementGUIFacade.ERR_LOCKED, + new Object[] {selectedPIN.getLocalizedName()}, + this, null); + waitForAction(); + } catch (NotActivatedException ex) { + log.error(selectedPIN.getLocalizedName() + " not active"); + updatePINState(selectedPIN, STATUS.NOT_ACTIV); + gui.showErrorDialog(PINManagementGUIFacade.ERR_NOT_ACTIVE, + new Object[] {selectedPIN.getLocalizedName()}, + this, null); + waitForAction(); + } catch (PINConfirmationException ex) { + log.error("confirmation pin does not match new " + selectedPIN.getLocalizedName()); + gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_CONFIRMATION, + new Object[] {selectedPIN.getLocalizedName()}, + this, null); + waitForAction(); + } catch (PINOperationAbortedException ex) { + log.error("pin operation aborted without further details"); + gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_OPERATION_ABORTED, + new Object[] {selectedPIN.getLocalizedName()}, + this, null); + waitForAction(); + } catch (PINFormatException ex) { + log.error("wrong format of new " + selectedPIN.getLocalizedName()); +// updatePINStatus(selectedPIN, STATUS.NOT_ACTIV); + String pinSize = String.valueOf(selectedPIN.getMinLength()); + if (selectedPIN.getMinLength() != selectedPIN.getMaxLength()) { + pinSize += "-" + selectedPIN.getMaxLength(); + } + gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_FORMAT, + new Object[] {selectedPIN.getLocalizedName(), pinSize}, + this, null); + waitForAction(); + } + } // end if + + selectedPIN = null; + gui.showPINManagementDialog(pinStates, + this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", + this, "cancel"); + } // end while + + } catch (GetPINStatusException ex) { + String pin = (selectedPIN != null) ? selectedPIN.getLocalizedName() : "pin"; + log.error("failed to get " + pin + " status: " + ex.getMessage()); + gui.showErrorDialog(PINManagementGUIFacade.ERR_STATUS, null, + this, "ok"); + waitForAction(); + return new ErrorResponse(1000); + } catch (SignatureCardException ex) { + log.error(ex.getMessage(), ex); + gui.showErrorDialog(PINManagementGUIFacade.ERR_UNKNOWN, null, + this, "ok"); + waitForAction(); + return new ErrorResponse(1000); + } + } else { + log.error("Got unexpected STAL request: " + request); + return new ErrorResponse(1000); + } + } + + @Override + public boolean requireCard() { + return true; + } + + /** + * query status for STARCOS card, + * assume provided status for ACOS card + * @param pinSpec + * @param status + * @throws at.gv.egiz.smcc.SignatureCardException if query status fails + */ + private void updatePINState(PINSpec pinSpec, STATUS status) + throws GetPINStatusException { + + PINMgmtSignatureCard pmCard = ((PINMgmtSignatureCard) card); + PIN_STATE pinState; + try { + pinState = pmCard.getPINState(pinSpec); + } catch (SignatureCardException e) { + String msg = "Failed to get PIN status for pin '" + + pinSpec.getLocalizedName() + "'."; + log.info(msg, e); + throw new GetPINStatusException(msg); + } + if (pinState == PIN_STATE.ACTIV) { + pinStates.put(pinSpec, STATUS.ACTIV); + } else if (pinState == PIN_STATE.NOT_ACTIV) { + pinStates.put(pinSpec, STATUS.NOT_ACTIV); + } else if (pinState == PIN_STATE.BLOCKED) { + pinStates.put(pinSpec, STATUS.BLOCKED); + } else { + pinStates.put(pinSpec, status); + } + } + +} -- cgit v1.2.3 From 65f25f58df0df1d8a90625f3944155235a9d20be Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 20 Aug 2009 16:33:43 +0000 Subject: 24x24 icon for webstart 16x16 tray icon git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@449 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../src/main/java/at/gv/egiz/bku/webstart/Launcher.java | 12 +++++++++--- BKUWebStart/src/main/jnlp/template.xml | 2 ++ .../main/resources/at/gv/egiz/bku/webstart/logo_16.png | Bin 0 -> 1084 bytes 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_16.png (limited to 'BKUWebStart/src') 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 ca40ddc0..d216fdc4 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 @@ -171,9 +171,15 @@ public class Launcher implements BKUControllerInterface, ActionListener { // get the SystemTray instance SystemTray tray = SystemTray.getSystemTray(); log.debug("TrayIcon size: " + tray.getTrayIconSize()); - String iconResource = (tray.getTrayIconSize().height < 25) - ? TRAYICON_RESOURCE + "24.png" - : TRAYICON_RESOURCE + "32.png"; + + String iconResource; + if (tray.getTrayIconSize().height < 17) { + iconResource = TRAYICON_RESOURCE + "16.png"; + } else if (tray.getTrayIconSize().height < 25) { + iconResource = TRAYICON_RESOURCE + "24.png"; + } else { + iconResource = TRAYICON_RESOURCE + "32.png"; + } Image image = ImageIO.read(Launcher.class.getClassLoader().getResourceAsStream(iconResource)); PopupMenu popup = new PopupMenu(); diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml index bbc4c466..5d9db869 100644 --- a/BKUWebStart/src/main/jnlp/template.xml +++ b/BKUWebStart/src/main/jnlp/template.xml @@ -10,7 +10,9 @@ $project.Description (BKU) MOCCA Web Start $project.Description + + diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_16.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_16.png new file mode 100644 index 00000000..f84f108d Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_16.png differ -- cgit v1.2.3 From ddb7f48bec002481ee4ae2696ecfe89edaec226b Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 20 Aug 2009 17:00:13 +0000 Subject: include-webstart version set to bkuOnline version BKUWebStart version.xml updated for release 1.2.2 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@451 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUOnline/pom.xml | 1 + BKUWebStart/src/main/jnlp/resources/version.xml | 12 ++++++------ pom.xml | 8 -------- 3 files changed, 7 insertions(+), 14 deletions(-) (limited to 'BKUWebStart/src') diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index 3901a4ff..051c6011 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -315,6 +315,7 @@ at.gv.egiz BKUWebStart + ${project.version} provided zip diff --git a/BKUWebStart/src/main/jnlp/resources/version.xml b/BKUWebStart/src/main/jnlp/resources/version.xml index 64a3963e..c1546b44 100644 --- a/BKUWebStart/src/main/jnlp/resources/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/version.xml @@ -2,17 +2,17 @@ - BKUWebStart-1.0.11-SNAPSHOT.jar - 1.0.11-SNAPSHOT + BKUWebStart-1.2.2.jar + 1.2.2 - BKUWebStart-1.0.11-SNAPSHOT.jar + BKUWebStart-1.2.2 - utils-1.2.2-SNAPSHOT.jar - 1.2.2-SNAPSHOT + utils-1.2.2.jar + 1.2.2 - utils-1.2.2-SNAPSHOT.jar + utils-1.2.2.jar diff --git a/pom.xml b/pom.xml index 7f98c2ec..acd17bca 100644 --- a/pom.xml +++ b/pom.xml @@ -261,14 +261,6 @@ jaxb-impl 2.1.9 - - - at.gv.egiz - BKUWebStart - 1.0.11-SNAPSHOT - zip - \ No newline at end of file -- cgit v1.2.3 From 84eee5daccfebb3fad94eae986c46748c4cfc3f6 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 21 Aug 2009 16:03:40 +0000 Subject: icons 2.0 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@465 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../java/at/gv/egiz/bku/webstart/Launcher.java | 10 +- .../at/gv/egiz/bku/webstart/gui/AboutDialog.form | 6 +- .../at/gv/egiz/bku/webstart/gui/AboutDialog.java | 6 +- .../src/main/jnlp/resources/img/chip128.png | Bin 0 -> 7775 bytes BKUWebStart/src/main/jnlp/resources/img/chip16.png | Bin 0 -> 787 bytes BKUWebStart/src/main/jnlp/resources/img/chip24.png | Bin 0 -> 1227 bytes BKUWebStart/src/main/jnlp/resources/img/chip32.png | Bin 0 -> 1753 bytes BKUWebStart/src/main/jnlp/resources/img/chip48.png | Bin 0 -> 2771 bytes .../src/main/jnlp/resources/img/logo_16.ico | Bin 1406 -> 0 bytes .../src/main/jnlp/resources/img/logo_16.png | Bin 1084 -> 0 bytes .../src/main/jnlp/resources/img/logo_16.xpm | 274 --------------------- .../src/main/jnlp/resources/img/logo_24.png | Bin 1982 -> 0 bytes .../src/main/jnlp/resources/img/logo_32.png | Bin 1522 -> 0 bytes .../src/main/jnlp/resources/img/logo_64.gif | Bin 1690 -> 0 bytes .../src/main/jnlp/resources/img/logo_64.jpeg | Bin 1347 -> 0 bytes .../src/main/jnlp/resources/img/logo_64.png | Bin 1689 -> 0 bytes .../src/main/jnlp/resources/img/version.xml | 41 ++- BKUWebStart/src/main/jnlp/resources/version.xml | 12 +- BKUWebStart/src/main/jnlp/template-local.xml | 14 +- BKUWebStart/src/main/jnlp/template.xml | 14 +- .../resources/at/gv/egiz/bku/webstart/chip16.png | Bin 0 -> 787 bytes .../resources/at/gv/egiz/bku/webstart/chip24.png | Bin 0 -> 1227 bytes .../resources/at/gv/egiz/bku/webstart/chip32.png | Bin 0 -> 1753 bytes .../resources/at/gv/egiz/bku/webstart/chip48.png | Bin 0 -> 2771 bytes .../at/gv/egiz/bku/webstart/chiperling96.png | Bin 0 -> 7378 bytes .../resources/at/gv/egiz/bku/webstart/logo_16.png | Bin 1084 -> 0 bytes .../resources/at/gv/egiz/bku/webstart/logo_24.png | Bin 1982 -> 0 bytes .../resources/at/gv/egiz/bku/webstart/logo_32.png | Bin 3228 -> 0 bytes .../at/gv/egiz/bku/webstart/logo_notext.png | Bin 3291 -> 0 bytes 29 files changed, 66 insertions(+), 311 deletions(-) create mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip128.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip16.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip24.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip32.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip48.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_16.ico delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_16.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_16.xpm delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_24.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_32.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_64.gif delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_64.jpeg delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/logo_64.png create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip16.png create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip24.png create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip32.png create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip48.png create mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chiperling96.png delete mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_16.png delete mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_24.png delete mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_32.png delete mode 100644 BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_notext.png (limited to 'BKUWebStart/src') 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 d216fdc4..0cfc14e5 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 @@ -42,8 +42,9 @@ public class Launcher implements BKUControllerInterface, ActionListener { public static final String WEBAPP_RESOURCE = "BKULocal.war"; public static final String CERTIFICATES_RESOURCE = "BKUCertificates.jar"; public static final String WEBAPP_FILE = "BKULocal.war"; + /** no leading slash for messages, but for image */ public static final String MESSAGES_RESOURCE = "at/gv/egiz/bku/webstart/messages"; - public static final String TRAYICON_RESOURCE = "at/gv/egiz/bku/webstart/logo_"; + public static final String TRAYICON_RESOURCE = "/at/gv/egiz/bku/webstart/chip"; /** resource bundle messages */ public static final String CAPTION_DEFAULT = "tray.caption.default"; public static final String CAPTION_ERROR = "tray.caption.error"; @@ -177,10 +178,12 @@ public class Launcher implements BKUControllerInterface, ActionListener { iconResource = TRAYICON_RESOURCE + "16.png"; } else if (tray.getTrayIconSize().height < 25) { iconResource = TRAYICON_RESOURCE + "24.png"; - } else { + } else if (tray.getTrayIconSize().height < 33) { iconResource = TRAYICON_RESOURCE + "32.png"; + } else { + iconResource = TRAYICON_RESOURCE + "48.png"; } - Image image = ImageIO.read(Launcher.class.getClassLoader().getResourceAsStream(iconResource)); + Image image = ImageIO.read(getClass().getResourceAsStream(iconResource)); PopupMenu popup = new PopupMenu(); @@ -347,6 +350,7 @@ public class Launcher implements BKUControllerInterface, ActionListener { Launcher launcher = new Launcher(); launcher.launch(); } catch (Exception ex) { + log.debug(ex); log.info("waiting to shutdown..."); Thread.sleep(5000); log.info("exit"); diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.form b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.form index c1cfdab7..548893a7 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.form +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.form @@ -40,7 +40,7 @@ - + @@ -80,7 +80,7 @@ - + @@ -106,7 +106,7 @@ - + diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.java index efa80bd6..1e35af58 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/AboutDialog.java @@ -48,7 +48,7 @@ public class AboutDialog extends javax.swing.JDialog { java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("at/gv/egiz/bku/webstart/messages"); // NOI18N setTitle(bundle.getString("about.frame.title")); // NOI18N - jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/at/gv/egiz/bku/webstart/logo_notext.png"))); // NOI18N + jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/at/gv/egiz/bku/webstart/chiperling96.png"))); // NOI18N jLabel2.setText(getVersionText(bundle)); @@ -88,7 +88,7 @@ public class AboutDialog extends javax.swing.JDialog { jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() - .addContainerGap(157, Short.MAX_VALUE) + .addContainerGap(163, Short.MAX_VALUE) .addComponent(jButton1) .addContainerGap()) ); @@ -116,7 +116,7 @@ public class AboutDialog extends javax.swing.JDialog { .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); diff --git a/BKUWebStart/src/main/jnlp/resources/img/chip128.png b/BKUWebStart/src/main/jnlp/resources/img/chip128.png new file mode 100644 index 00000000..c36d8079 Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/chip128.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/chip16.png b/BKUWebStart/src/main/jnlp/resources/img/chip16.png new file mode 100644 index 00000000..96b580e9 Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/chip16.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/chip24.png b/BKUWebStart/src/main/jnlp/resources/img/chip24.png new file mode 100644 index 00000000..efd6dbeb Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/chip24.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/chip32.png b/BKUWebStart/src/main/jnlp/resources/img/chip32.png new file mode 100644 index 00000000..e7efb020 Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/chip32.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/chip48.png b/BKUWebStart/src/main/jnlp/resources/img/chip48.png new file mode 100644 index 00000000..491fbcac Binary files /dev/null and b/BKUWebStart/src/main/jnlp/resources/img/chip48.png differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_16.ico b/BKUWebStart/src/main/jnlp/resources/img/logo_16.ico deleted file mode 100644 index eaedb0ad..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/logo_16.ico and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_16.png b/BKUWebStart/src/main/jnlp/resources/img/logo_16.png deleted file mode 100644 index f84f108d..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/logo_16.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_16.xpm b/BKUWebStart/src/main/jnlp/resources/img/logo_16.xpm deleted file mode 100644 index de557170..00000000 --- a/BKUWebStart/src/main/jnlp/resources/img/logo_16.xpm +++ /dev/null @@ -1,274 +0,0 @@ -/* XPM */ -static char * logo_16x16_xpm[] = { -"16 16 255 2", -" c #EDF2FA", -". c #555249", -"+ c #F3F6FC", -"@ c #ED1C24", -"# c #939698", -"$ c #FFE699", -"% c #BBAA76", -"& c #464749", -"* c #CCCCCC", -"= c #EE262D", -"- c #FCDADC", -"; c #6B6E72", -"> c #FDE4E5", -", c #D0D6DE", -"' c #968C78", -") c #848182", -"! c #535458", -"~ c #76797E", -"{ c #EE2C33", -"] c #444444", -"^ c #80848A", -"/ c #5A636E", -"( c #738974", -"_ c #ACAEB1", -": c #929F98", -"< c #47443F", -"[ c #363436", -"} c #E4ECF7", -"| c #5D5E61", -"1 c #F14C53", -"2 c #A2A3A5", -"3 c #EF333A", -"4 c #515052", -"5 c #5C685E", -"6 c #FDEAEB", -"7 c #7A7B7D", -"8 c #9FA1A4", -"9 c #FBFCFE", -"0 c #4B514D", -"a c #888A8C", -"b c #777777", -"c c #525355", -"d c #E7EEF8", -"e c #A4A9AF", -"f c #F04148", -"g c #FFF4D7", -"h c #616365", -"i c #231F20", -"j c #D4DDE9", -"k c #918F8F", -"l c #8A8E95", -"m c #F1CA3F", -"n c #B5BBC5", -"o c #F1F1F1", -"p c #9FA5AD", -"q c #363432", -"r c #888888", -"s c #FFFFFF", -"t c #7D745A", -"u c #94875D", -"v c #999999", -"w c #5F6165", -"x c #635E51", -"y c #C8C7C7", -"z c #CAD1DD", -"A c #5A5758", -"B c #C0C7D1", -"C c #9399A1", -"D c #E4C14B", -"E c #AE9B5E", -"F c #BAB9B9", -"G c #C9AE59", -"H c #767374", -"I c #D6D5D5", -"J c #DDDDDD", -"K c #666666", -"L c #E3E3E3", -"M c #ACABAB", -"N c #222222", -"O c #9E9D9D", -"P c #333333", -"Q c #EEEEEE", -"R c #BBA55C", -"S c #BBBBBB", -"T c #706A56", -"U c #3F3B3C", -"V c #A1915E", -"W c #686566", -"X c #AAB0B9", -"Y c #111111", -"Z c #444344", -"` c #897E5C", -" . c #4C494A", -".. c #669DCD", -"+. c #C6C8CA", -"@. c #555556", -"#. c #312D2E", -"$. c #5F6A78", -"%. c #6C95BC", -"&. c #D6B853", -"*. c #525962", -"=. c #636467", -"-. c #6C8AAA", -";. c #E1E2E3", -">. c #DE9E56", -",. c #70B76A", -"'. c #6C90B3", -"). c #AB875E", -"!. c #F2575D", -"~. c #B9BBBD", -"{. c #FFF1CC", -"]. c #424347", -"^. c #4A4E55", -"/. c #637183", -"(. c #ED2028", -"_. c #65778C", -":. c #688268", -"<. c #7C7F81", -"[. c #706355", -"}. c #B88E5F", -"|. c #C5945D", -"1. c #565E58", -"2. c #D9ECD4", -"3. c #72A26F", -"4. c #72AA6E", -"5. c #FBB161", -"6. c #AAAAAA", -"7. c #937A5D", -"8. c #6B84A0", -"9. c #FFEDB5", -"0. c #F1CE5D", -"a. c #FFDBB4", -"b. c #697E96", -"c. c #EAA151", -"d. c #92CD8B", -"e. c #77C371", -"f. c #7C6C59", -"g. c #719B6E", -"h. c #FCBB75", -"i. c #FFD742", -"j. c #606162", -"k. c #6C6C6E", -"l. c #E2E3E4", -"m. c #6999C5", -"n. c #D4D5D7", -"o. c #F7F9FD", -"p. c #635950", -"q. c #F0F0F1", -"r. c #FDE3E4", -"s. c #706F6D", -"t. c #FFDD6F", -"u. c #787E88", -"v. c #D6BC69", -"w. c #EEEFF0", -"x. c #63615A", -"y. c #89C982", -"z. c #AEA58E", -"A. c #F3F9F1", -"B. c #4D5056", -"C. c #6E926C", -"D. c #6C8A6A", -"E. c #E4C564", -"F. c #77A0C8", -"G. c #898169", -"H. c #FFF7EE", -"I. c #333336", -"J. c #727878", -"K. c #AE9D66", -"L. c #607160", -"M. c #6B756F", -"N. c #71B16C", -"O. c #948A6C", -"P. c #7DC479", -"Q. c #D6BA5E", -"R. c #E1F0DE", -"S. c #ADD8A4", -"T. c #6E737C", -"U. c #9E8262", -"V. c #535D54", -"W. c #7D7766", -"X. c #A1A6AD", -"Y. c #D3D4D7", -"Z. c #ADAAA6", -"`. c #B7B9BC", -" + c #C39765", -".+ c #F25E64", -"++ c #F36268", -"@+ c #769C74", -"#+ c #B69166", -"$+ c #F9FBFD", -"%+ c #FFFBFB", -"&+ c #FFE07C", -"*+ c #646B68", -"=+ c #6D6965", -"-+ c #738498", -";+ c #C8BEA3", -">+ c #C1C4C9", -",+ c #A19984", -"'+ c #E4C979", -")+ c #F1D375", -"!+ c #80C679", -"~+ c #B3B6BC", -"{+ c #8D9096", -"]+ c #9FA8A1", -"^+ c #CFD9CE", -"/+ c #FED5A9", -"(+ c #D5D9E0", -"_+ c #8D877F", -":+ c #697B6A", -"<+ c #FFFBF0", -"[+ c #E3D4AC", -"}+ c #F1CC4F", -"|+ c #FFD954", -"1+ c #C8E4C0", -"2+ c #BEE0B7", -"3+ c #D6BE73", -"4+ c #857869", -"5+ c #E5E1DC", -"6+ c #85A7CB", -"7+ c #C9B26C", -"8+ c #D4C6B5", -"9+ c #C9B67E", -"0+ c #FFE5CA", -"a+ c #FCB66B", -"b+ c #E4E4E5", -"c+ c #E3E4E5", -"d+ c #E8EBEF", -"e+ c #EBEDF0", -"f+ c #87898C", -"g+ c #B19E7E", -"h+ c #B5C2BF", -"i+ c #FDC180", -"j+ c #EE2930", -"k+ c #E4E8EE", -"l+ c #565552", -"m+ c #E4CE8D", -"n+ c #636C79", -"o+ c #A3D49B", -"p+ c #858B94", -"q+ c #84868C", -"r+ c #F1D069", -"s+ c #D2995A", -"t+ c #B8BEC6", -"u+ c #EF3B42", -"v+ c #474444", -"w+ c #E1E5EC", -"x+ c #FDFEFE", -"y+ c #FFF7E3", -"z+ c #62A1D7", -"A+ c #6DC067", -"B+ c #FAA74A", -"C+ c #FFD531", -"D+ c #E0EAF7", -"E+ c #000000", -"F+ c #FFFFFF", -" 9 _ & < K.i.u i T R C+G x C+C+", -"+.& < E C+R . q q u C+C+T G C+C+", -"i t m m T q u m m x . m . C+C+C+", -"t D t q ` m C+C+C+C+t . < G E t ", -"x . E m C+C+C+C+C+C+C+. T u E m ", -"i m C+C+C+C+C+C+C+C+m T t C+C+C+", -"< V C+C+C+C+C+m D ` q x &.C+C+C+", -"G < C+C+C+E < . i x G C+C+C+C+C+", -"C+x V E < x E &.i G C+C+C+C+C+C+", -"}+` i ` D C+C+C+x x C+C+C+C+C+C+", -". R t E C+C+C+C+G i G C+C+C+C+C+", -"l+i.m x C+C+C+C+C+< x C+C+C+C+C+", -"i 7+C+u G C+C+E < q i G C+C+C+C+", -"i x.C+C+t E < x R C+< t C+C+C+C+", -"& i '+G x x D C+C+C+E i D C+C+C+", -"_ i [ V m u C+C+C+C+D i T m u < "}; diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_24.png b/BKUWebStart/src/main/jnlp/resources/img/logo_24.png deleted file mode 100644 index a9074f01..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/logo_24.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_32.png b/BKUWebStart/src/main/jnlp/resources/img/logo_32.png deleted file mode 100644 index 337b144b..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/logo_32.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_64.gif b/BKUWebStart/src/main/jnlp/resources/img/logo_64.gif deleted file mode 100644 index 6081d1a1..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/logo_64.gif and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_64.jpeg b/BKUWebStart/src/main/jnlp/resources/img/logo_64.jpeg deleted file mode 100644 index 720157a5..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/logo_64.jpeg and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/logo_64.png b/BKUWebStart/src/main/jnlp/resources/img/logo_64.png deleted file mode 100644 index 9e9b377c..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/logo_64.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/version.xml b/BKUWebStart/src/main/jnlp/resources/img/version.xml index 1ba3ecda..826b58f6 100644 --- a/BKUWebStart/src/main/jnlp/resources/img/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/img/version.xml @@ -2,28 +2,49 @@ - logo_24 - 1.0 + logo16.png + 2.0 + + logo16.png + + + + logo24.png + 2.0 + + logo24.png + + + + logo32.png + 2.0 - logo_24.png + logo32.png - logo_32 - 1.0 + logo48.png + 2.0 - logo_32.png + logo48.png - logo_64 - 1.0 + logo64.png + 2.0 + + logo64.png + + + + logo128.png + 2.0 - logo_64.png + logo128.png - splash + splash.png 2.0 splash.png diff --git a/BKUWebStart/src/main/jnlp/resources/version.xml b/BKUWebStart/src/main/jnlp/resources/version.xml index c1546b44..e5f1d71c 100644 --- a/BKUWebStart/src/main/jnlp/resources/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/version.xml @@ -2,17 +2,17 @@ - BKUWebStart-1.2.2.jar - 1.2.2 + BKUWebStart-1.2.3-SNAPSHOT.jar + 1.2.3-SNAPSHOT - BKUWebStart-1.2.2 + BKUWebStart-1.2.3-SNAPSHOT.jar - utils-1.2.2.jar - 1.2.2 + utils-1.2.3-SNAPSHOT.jar + 1.2.3-SNAPSHOT - utils-1.2.2.jar + utils-1.2.3-SNAPSHOT.jar diff --git a/BKUWebStart/src/main/jnlp/template-local.xml b/BKUWebStart/src/main/jnlp/template-local.xml index 80447c89..ab987cae 100644 --- a/BKUWebStart/src/main/jnlp/template-local.xml +++ b/BKUWebStart/src/main/jnlp/template-local.xml @@ -9,12 +9,14 @@ $project.Description (BKU) MOCCA Web Start $project.Description - - - - - - + + + + + + + + diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml index 5d9db869..23d9379a 100644 --- a/BKUWebStart/src/main/jnlp/template.xml +++ b/BKUWebStart/src/main/jnlp/template.xml @@ -9,12 +9,14 @@ $project.Description (BKU) MOCCA Web Start $project.Description - - - - - - + + + + + + + + diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip16.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip16.png new file mode 100644 index 00000000..96b580e9 Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip16.png differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip24.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip24.png new file mode 100644 index 00000000..efd6dbeb Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip24.png differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip32.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip32.png new file mode 100644 index 00000000..e7efb020 Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip32.png differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip48.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip48.png new file mode 100644 index 00000000..491fbcac Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chip48.png differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chiperling96.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chiperling96.png new file mode 100644 index 00000000..477d4fb5 Binary files /dev/null and b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/chiperling96.png differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_16.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_16.png deleted file mode 100644 index f84f108d..00000000 Binary files a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_16.png and /dev/null differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_24.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_24.png deleted file mode 100644 index a9074f01..00000000 Binary files a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_24.png and /dev/null differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_32.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_32.png deleted file mode 100644 index 3c77d179..00000000 Binary files a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_32.png and /dev/null differ diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_notext.png b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_notext.png deleted file mode 100644 index 407f3b3e..00000000 Binary files a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/logo_notext.png and /dev/null differ -- cgit v1.2.3 From 19d127f4c2d3b235db4ed060d9371f33674b7c86 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 21 Aug 2009 16:04:27 +0000 Subject: version.xml prepare for release 1.2.3 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@466 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUWebStart/src/main/jnlp/resources/version.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BKUWebStart/src') diff --git a/BKUWebStart/src/main/jnlp/resources/version.xml b/BKUWebStart/src/main/jnlp/resources/version.xml index e5f1d71c..451fe038 100644 --- a/BKUWebStart/src/main/jnlp/resources/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/version.xml @@ -2,17 +2,17 @@ - BKUWebStart-1.2.3-SNAPSHOT.jar - 1.2.3-SNAPSHOT + BKUWebStart-1.2.3.jar + 1.2.3 - BKUWebStart-1.2.3-SNAPSHOT.jar + BKUWebStart-1.2.3.jar - utils-1.2.3-SNAPSHOT.jar - 1.2.3-SNAPSHOT + utils-1.2.3.jar + 1.2.3 - utils-1.2.3-SNAPSHOT.jar + utils-1.2.3.jar -- cgit v1.2.3 From f1f9ab678eb71a861737d47ec666413d4ad043f7 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 21 Aug 2009 17:07:21 +0000 Subject: icons 2.0 (logo->chip) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@470 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../src/main/jnlp/resources/img/version.xml | 24 +++++++++++----------- BKUWebStart/src/main/jnlp/template-local.xml | 16 +++++++-------- BKUWebStart/src/main/jnlp/template.xml | 16 +++++++-------- 3 files changed, 28 insertions(+), 28 deletions(-) (limited to 'BKUWebStart/src') diff --git a/BKUWebStart/src/main/jnlp/resources/img/version.xml b/BKUWebStart/src/main/jnlp/resources/img/version.xml index 826b58f6..5e160beb 100644 --- a/BKUWebStart/src/main/jnlp/resources/img/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/img/version.xml @@ -2,45 +2,45 @@ - logo16.png + chip16.png 2.0 - logo16.png + chip16.png - logo24.png + chip24.png 2.0 - logo24.png + chip24.png - logo32.png + chip32.png 2.0 - logo32.png + chip32.png - logo48.png + chip48.png 2.0 - logo48.png + chip48.png - logo64.png + chip64.png 2.0 - logo64.png + chip64.png - logo128.png + chip128.png 2.0 - logo128.png + chip128.png diff --git a/BKUWebStart/src/main/jnlp/template-local.xml b/BKUWebStart/src/main/jnlp/template-local.xml index ab987cae..1b21c118 100644 --- a/BKUWebStart/src/main/jnlp/template-local.xml +++ b/BKUWebStart/src/main/jnlp/template-local.xml @@ -9,14 +9,14 @@ $project.Description (BKU) MOCCA Web Start $project.Description - - - - - - - - + + + + + + + + diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml index 23d9379a..a8ee0341 100644 --- a/BKUWebStart/src/main/jnlp/template.xml +++ b/BKUWebStart/src/main/jnlp/template.xml @@ -9,14 +9,14 @@ $project.Description (BKU) MOCCA Web Start $project.Description - - - - - - - - + + + + + + + + -- cgit v1.2.3 From 145003155c05e915b900989a27cef1271398164b Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 26 Aug 2009 17:31:32 +0000 Subject: MOCCA TLS Server CA cert installation servlet removed help.jsp (and jsp dependencies in jetty) moved html pages to src/main/webapp (encoding problem?) switch to BASIC download protocol in BKUWebStart (no jnlpDownloadServlet required, see template.xml) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@474 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/gui/AbstractHelpListener.java | 17 +- BKUHelp/pom.xml | 9 +- BKULocal/pom.xml | 2 +- .../local/webapp/InstallCertificateServlet.java | 149 +++++++++++++++ BKULocal/src/main/webapp/WEB-INF/web.xml | 19 +- BKULocal/src/main/webapp/img/chip16.ico | Bin 0 -> 1150 bytes BKULocal/src/main/webapp/img/chip48.png | Bin 0 -> 2771 bytes BKULocal/src/main/webapp/index.html | 56 ++++-- BKUOnline/pom.xml | 7 +- BKUWebStart/pom.xml | 28 +-- .../java/at/gv/egiz/bku/webstart/Configurator.java | 2 +- .../java/at/gv/egiz/bku/webstart/Container.java | 210 +++++++++++++-------- .../java/at/gv/egiz/bku/webstart/Launcher.java | 7 +- .../java/at/gv/egiz/bku/webstart/TLSServerCA.java | 3 +- BKUWebStart/src/main/jnlp/resources/version.xml | 35 ---- BKUWebStart/src/main/jnlp/template.xml | 22 +-- 16 files changed, 387 insertions(+), 179 deletions(-) create mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/InstallCertificateServlet.java create mode 100644 BKULocal/src/main/webapp/img/chip16.ico create mode 100644 BKULocal/src/main/webapp/img/chip48.png (limited to 'BKUWebStart/src') diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java index b871263e..6fd1ffea 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java @@ -38,6 +38,11 @@ import org.apache.commons.logging.LogFactory; */ public abstract class AbstractHelpListener implements ActionListener { + /** + * any locale not in the list will be mapped to 'de' + */ + public static final String[] SUPPORTED_LANGUAGES = new String[] { "de" }; + protected final static Log log = LogFactory.getLog(AbstractHelpListener.class); protected URL baseURL; protected Locale locale; @@ -71,12 +76,14 @@ public abstract class AbstractHelpListener implements ActionListener { URL helpURL = baseURL; log.trace("constructing help URL: " + helpURL); try { - if (locale != null) { - helpURL = new URL(helpURL, locale.toString() + "/"); - log.trace("constructing help URL: " + helpURL); - } + // not localized for now + //check if locale.getLanguage() supported and add default if not +// if (locale != null) { +// helpURL = new URL(helpURL, locale.toString() + "/"); +// log.trace("constructing help URL: " + helpURL); +// } if (helpTopic != null && !"".equals(helpTopic)) { - helpURL = new URL(helpURL, helpTopic + ".html"); + helpURL = new URL(helpURL, "de/" + helpTopic + ".html"); log.trace("constructing help URL: " + helpURL); } } catch (MalformedURLException ex) { diff --git a/BKUHelp/pom.xml b/BKUHelp/pom.xml index ec2ad47d..6dbfd55f 100644 --- a/BKUHelp/pom.xml +++ b/BKUHelp/pom.xml @@ -7,6 +7,13 @@ at.gv.egiz BKUHelp - 1.1 + 1.2-SNAPSHOT BKU Help + + + + src/main/webapp + + + \ No newline at end of file diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index 523357f2..b3487f68 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -111,7 +111,7 @@ BKUHelp at.gv.egiz - 1.1 + 1.2-SNAPSHOT org.springframework diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/InstallCertificateServlet.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/InstallCertificateServlet.java new file mode 100644 index 00000000..0a9d001b --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/InstallCertificateServlet.java @@ -0,0 +1,149 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.local.webapp; + +import iaik.pkcs.PKCS7CertList; +import iaik.utils.Util; +import java.io.IOException; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author Clemens Orthacker + */ +public class InstallCertificateServlet extends HttpServlet { + public static final String HTTPS_REDIRECT = "https://localhost:3496/"; + + public static final String SERVER_CA_CERTIFICATE_ATTRIBUTE = "mocca.tls.server.ca.certificate"; + protected PKCS7CertList p7c; + private static final Log log = LogFactory.getLog(InstallCertificateServlet.class); + + @Override + public void init() throws ServletException { + super.init(); + Certificate caCert = (Certificate) getServletContext().getAttribute(SERVER_CA_CERTIFICATE_ATTRIBUTE); + if (caCert != null) { + try { + p7c = new PKCS7CertList(); + p7c.setCertificateList(new iaik.x509.X509Certificate[] { Util.convertCertificate(caCert) }); + } catch (CertificateException ex) { + log.error("failed to import local ca certificate " + SERVER_CA_CERTIFICATE_ATTRIBUTE, ex); + } + } else { + log.error("failed to import local ca certificate " + SERVER_CA_CERTIFICATE_ATTRIBUTE); + } + } + + /** + * Processes requests for both HTTP GET and POST methods. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + +// try { +// SSLContext sslCtx1 = SSLContext.getDefault(); +// log.debug("Default SSLContext (" + sslCtx1.getProtocol() + "): " + sslCtx1.getClass().getName()); +// } catch (NoSuchAlgorithmException ex) { +// log.debug("no sslContext: " + ex.getMessage(), ex); +// } +// +// try { +// SSLContext sslCtx2 = SSLContext.getInstance("TLS"); +// log.debug("TLS SSLContext: " + sslCtx2.getClass().getName()); +// +// SSLServerSocketFactory serverSocketFactory = sslCtx2.getServerSocketFactory(); +// SSLSessionContext serverSessionContext = sslCtx2.getServerSessionContext(); +// +// if (serverSocketFactory != null) { +// log.debug("SSL ServerSocketFactory: " + serverSocketFactory.getClass().getName()); +// } +// if (serverSessionContext != null) { +// log.debug("SSL ServerSessionContext: " + serverSessionContext.getClass().getName()); +// } +// } catch (NoSuchAlgorithmException ex) { +// log.debug("no sslContext: " + ex.getMessage(), ex); +// } +// +// try { +// SSLContext sslCtx3 = SSLContext.getInstance("SSLv3"); +// log.debug("TLS SSLContext: " + sslCtx3.getClass().getName()); +// } catch (NoSuchAlgorithmException ex) { +// log.debug("no sslContext: " + ex.getMessage(), ex); +// } + + + + + + if (p7c != null) { + log.debug("returning local ca certificate"); + response.setContentType("application/x-x509-ca-cert"); + p7c.writeTo(response.getOutputStream()); + response.getOutputStream().flush(); + } else { + log.debug("no local ca certificate, redirecting to " + HTTPS_REDIRECT); + response.sendRedirect(HTTPS_REDIRECT); + } + + } + + // + /** + * Handles the HTTP GET method. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP POST method. + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// +} diff --git a/BKULocal/src/main/webapp/WEB-INF/web.xml b/BKULocal/src/main/webapp/WEB-INF/web.xml index 83f33d9e..8768dbd8 100644 --- a/BKULocal/src/main/webapp/WEB-INF/web.xml +++ b/BKULocal/src/main/webapp/WEB-INF/web.xml @@ -1,5 +1,4 @@ - - + http-security-layer-request @@ -35,15 +34,15 @@ BKUServlet at.gv.egiz.bku.local.webapp.BKURequestHandler - - - help - /help.jsp PINManagementServlet at.gv.egiz.bku.local.webapp.PINManagementServlet + + InstallCertificateServlet + at.gv.egiz.bku.local.webapp.InstallCertificateServlet + BKUServlet /http-security-layer-request @@ -52,16 +51,16 @@ BKUServlet /https-security-layer-request - - help - /help/* - PINManagementServlet /PINManagement + + InstallCertificateServlet + /installCertificate + index.html index.htm diff --git a/BKULocal/src/main/webapp/img/chip16.ico b/BKULocal/src/main/webapp/img/chip16.ico new file mode 100644 index 00000000..42175127 Binary files /dev/null and b/BKULocal/src/main/webapp/img/chip16.ico differ diff --git a/BKULocal/src/main/webapp/img/chip48.png b/BKULocal/src/main/webapp/img/chip48.png new file mode 100644 index 00000000..491fbcac Binary files /dev/null and b/BKULocal/src/main/webapp/img/chip48.png differ diff --git a/BKULocal/src/main/webapp/index.html b/BKULocal/src/main/webapp/index.html index 537c154a..6aefe43c 100644 --- a/BKULocal/src/main/webapp/index.html +++ b/BKULocal/src/main/webapp/index.html @@ -14,21 +14,45 @@ See the License for the specific language governing permissions and limitations under the License. --> - - - - BKU Web Start - Willkommen - - - - -

BKU Web Start - Willkommen

-
-

Diese Seite installiert das MOCCA Zertifikat in ihrem Browser. - In jedem weiteren Browser können sie dieses durch Aufruf dieser Seite ebenso installieren.

-
-
- PIN Verwaltung + + + + + Bürgerkarte - Willkommen + + + + + + +
+ +
+
+ Logo
- +

Um die Bürgerkartenumgebung zu verwenden installieren Sie bitte + zunächst das CA Zertifikat. +

+ +

Weiters können Sie

+ + +


+ +
+ +
+ + diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index f03bc792..9fc36d63 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -39,7 +39,7 @@ BKUHelp at.gv.egiz - 1.1 + 1.2-SNAPSHOT commons-logging @@ -302,12 +302,13 @@ - + webstart-maven-plugin @@ -98,8 +100,8 @@ false - - true + false + false true true @@ -190,9 +192,6 @@ false - true - - true @@ -212,7 +211,6 @@ template-local.xml mocca-local.jnlp - false @@ -221,6 +219,14 @@ + at.gv.egiz BKULocal @@ -259,12 +265,12 @@ + | org.mortbay.jetty jsp-2.1-jetty 6.1.19 - + org.slf4j slf4j-api diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java index bef2246b..923a70d9 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java @@ -56,7 +56,7 @@ public class Configurator { * configurations with less than this (major) version will be backuped and updated * allowed: MAJOR[.MINOR[.X[-SNAPSHOT]]] */ - public static final String MIN_CONFIG_VERSION = "1.0.9"; + public static final String MIN_CONFIG_VERSION = "1.2.4-SNAPSHOT"; public static final String CONFIG_DIR = ".mocca/conf/"; public static final String CERTS_DIR = ".mocca/certs/"; public static final String VERSION_FILE = ".version"; diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java index 08a0808a..3bf74d3c 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Container.java @@ -2,9 +2,11 @@ package at.gv.egiz.bku.webstart; import at.gv.egiz.bku.utils.StreamUtil; import java.awt.AWTPermission; +import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.File; +import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FilePermission; @@ -15,8 +17,12 @@ import java.io.OutputStream; import java.lang.reflect.ReflectPermission; import java.net.NetPermission; import java.net.SocketPermission; +import java.security.AllPermission; +import java.security.KeyStore; import java.security.Permissions; import java.security.SecurityPermission; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; import java.util.PropertyPermission; import javax.smartcardio.CardPermission; import org.apache.commons.logging.Log; @@ -32,8 +38,9 @@ public class Container { public static final String HTTP_PORT_PROPERTY = "mocca.http.port"; public static final String HTTPS_PORT_PROPERTY = "mocca.http.port"; - + public static final String SERVER_CA_CERTIFICATE_ATTRIBUTE = "mocca.tls.server.ca.certificate"; private static Log log = LogFactory.getLog(Container.class); + static { if (log.isDebugEnabled()) { //Jetty log INFO and WARN, include ignored exceptions @@ -43,7 +50,6 @@ public class Container { //System.setProperty("DEBUG", "true"); } } - private Server server; public void init() throws IOException { @@ -75,63 +81,98 @@ public class Container { } log.debug("loading MOCCA keystore from " + keystoreFile.getAbsolutePath()); sslConnector.setKeystore(keystoreFile.getAbsolutePath()); - File passwdFile = new File(configDir, Configurator.PASSWD_FILE); - BufferedReader reader = new BufferedReader(new FileReader(passwdFile)); - String pwd; - while ((pwd = reader.readLine()) != null) { - sslConnector.setPassword(pwd); - sslConnector.setKeyPassword(pwd); - } - reader.close(); - + String passwd = readPassword(new File(configDir, Configurator.PASSWD_FILE)); + sslConnector.setPassword(passwd); + sslConnector.setKeyPassword(passwd); + //avoid jetty's ClassCastException: iaik.security.ecc.ecdsa.ECPublicKey cannot be cast to java.security.interfaces.ECPublicKey - String[] RFC4492CipherSuites = new String[] { + String[] RFC4492CipherSuites = new String[]{ "TLS_ECDH_ECDSA_WITH_NULL_SHA", - "TLS_ECDH_ECDSA_WITH_RC4_128_SHA", - "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA", - "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA", - "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA", - - "TLS_ECDHE_ECDSA_WITH_NULL_SHA", - "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", - "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", - "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", - "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", - - "TLS_ECDH_RSA_WITH_NULL_SHA", - "TLS_ECDH_RSA_WITH_RC4_128_SHA", - "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA", - "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA", - "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA", - - "TLS_ECDHE_RSA_WITH_NULL_SHA", - "TLS_ECDHE_RSA_WITH_RC4_128_SHA", - "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", - "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", - "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", - - "TLS_ECDH_anon_WITH_NULL_SHA", - "TLS_ECDH_anon_WITH_RC4_128_SHA", - "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA", - "TLS_ECDH_anon_WITH_AES_128_CBC_SHA", - "TLS_ECDH_anon_WITH_AES_256_CBC_SHA" + "TLS_ECDH_ECDSA_WITH_RC4_128_SHA", + "TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA", + "TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA", + "TLS_ECDHE_ECDSA_WITH_NULL_SHA", + "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", + "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", + "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", + "TLS_ECDH_RSA_WITH_NULL_SHA", + "TLS_ECDH_RSA_WITH_RC4_128_SHA", + "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA", + "TLS_ECDH_RSA_WITH_AES_256_CBC_SHA", + "TLS_ECDHE_RSA_WITH_NULL_SHA", + "TLS_ECDHE_RSA_WITH_RC4_128_SHA", + "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", + "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", + "TLS_ECDH_anon_WITH_NULL_SHA", + "TLS_ECDH_anon_WITH_RC4_128_SHA", + "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA", + "TLS_ECDH_anon_WITH_AES_128_CBC_SHA", + "TLS_ECDH_anon_WITH_AES_256_CBC_SHA" }; sslConnector.setExcludeCipherSuites(RFC4492CipherSuites); - server.setConnectors(new Connector[] { connector, sslConnector }); - + server.setConnectors(new Connector[]{connector, sslConnector}); + WebAppContext webapp = new WebAppContext(); webapp.setLogUrlOnStart(true); webapp.setContextPath("/"); - webapp.setExtractWAR(true); + webapp.setExtractWAR(true); webapp.setParentLoaderPriority(false); + try { + // no way to get certificate from within the servlet (SSLEngine/Jetty SSLSocketConnector/SSLContext?) + if (log.isTraceEnabled()) { + log.trace("local ca certificate from " + keystoreFile + " in webapp context at " + SERVER_CA_CERTIFICATE_ATTRIBUTE); + } + BufferedInputStream bis = new BufferedInputStream(new FileInputStream(keystoreFile)); + KeyStore sslKeyStore = KeyStore.getInstance("JKS"); + sslKeyStore.load(bis, passwd.toCharArray()); + Certificate[] sslChain = sslKeyStore.getCertificateChain(TLSServerCA.MOCCA_TLS_SERVER_ALIAS); + webapp.setAttribute(SERVER_CA_CERTIFICATE_ATTRIBUTE, sslChain[sslChain.length - 1]); + bis.close(); + } catch (Exception ex) { + log.error("Failed to load local ca certificate", ex); + log.warn("automated web certificate installation will not be available"); + } + webapp.setWar(copyWebapp(webapp.getTempDirectory())); webapp.setPermissions(getPermissions(webapp.getTempDirectory())); - + server.setHandler(webapp); - server.setGracefulShutdown(1000*3); + server.setGracefulShutdown(1000 * 3); + } + + /** + * @return The first valid (not empty, no comment) line of the passwd file + * @throws IOException + */ + protected static String readPassword(File passwdFile) throws IOException { + if (passwdFile.exists() && passwdFile.canRead()) { + BufferedReader passwdReader = null; + try { + passwdReader = new BufferedReader(new FileReader(passwdFile)); + String passwd; + while ((passwd = passwdReader.readLine().trim()) != null) { + if (passwd.length() > 0 && !passwd.startsWith("#")) { + return passwd; + } + } + } catch (IOException ex) { + log.error("failed to read password from " + passwdFile, ex); + throw ex; + } finally { + try { + passwdReader.close(); + } catch (IOException ex) { + } + } + } + throw new IOException(passwdFile + " not readable"); } private String copyWebapp(File webappDir) throws IOException { @@ -146,43 +187,48 @@ public class Container { private Permissions getPermissions(File webappDir) { Permissions perms = new Permissions(); + perms.add(new AllPermission()); + + + if (false) { + + // jetty-webstart (spring?) + perms.add(new RuntimePermission("getClassLoader")); + + // standard permissions + perms.add(new PropertyPermission("*", "read,write")); + perms.add(new RuntimePermission("accessDeclaredMembers")); + perms.add(new RuntimePermission("accessClassInPackage.*")); + perms.add(new RuntimePermission("defineClassInPackage.*")); + perms.add(new RuntimePermission("setFactory")); + perms.add(new RuntimePermission("getProtectionDomain")); + perms.add(new RuntimePermission("modifyThread")); + perms.add(new RuntimePermission("modifyThreadGroup")); + perms.add(new RuntimePermission("setFactory")); + perms.add(new ReflectPermission("suppressAccessChecks")); + + // MOCCA specific + perms.add(new SocketPermission("*", "connect,resolve")); + perms.add(new NetPermission("specifyStreamHandler")); + perms.add(new SecurityPermission("insertProvider.*")); + perms.add(new SecurityPermission("putProviderProperty.*")); + perms.add(new SecurityPermission("removeProvider.*")); + perms.add(new CardPermission("*", "*")); + perms.add(new AWTPermission("*")); + + perms.add(new FilePermission(webappDir.getAbsolutePath() + "/-", "read")); + perms.add(new FilePermission(new File(System.getProperty("java.home") + "/lib/xalan.properties").getAbsolutePath(), "read")); + perms.add(new FilePermission(new File(System.getProperty("java.home") + "/lib/xerces.properties").getAbsolutePath(), "read")); + perms.add(new FilePermission(new File(System.getProperty("user.home")).getAbsolutePath(), "read, write")); + perms.add(new FilePermission(new File(System.getProperty("user.home") + "/-").getAbsolutePath(), "read, write")); + perms.add(new FilePermission(new File(System.getProperty("user.home") + "/.mocca/logs/*").getAbsolutePath(), "read, write,delete")); + perms.add(new FilePermission(new File(System.getProperty("user.home") + "/.mocca/certs/-").getAbsolutePath(), "read, write,delete")); + + //TODO +// log.trace("granting file read/write permission to MOCCA local"); +// perms.add(new FilePermission("<>", "read, write")); - // jetty-webstart (spring?) - perms.add(new RuntimePermission("getClassLoader")); - - // standard permissions - perms.add(new PropertyPermission("*", "read,write")); - perms.add(new RuntimePermission("accessDeclaredMembers")); - perms.add(new RuntimePermission("accessClassInPackage.*")); - perms.add(new RuntimePermission("defineClassInPackage.*")); - perms.add(new RuntimePermission("setFactory")); - perms.add(new RuntimePermission("getProtectionDomain")); - perms.add(new RuntimePermission("modifyThread")); - perms.add(new RuntimePermission("modifyThreadGroup")); - perms.add(new RuntimePermission("setFactory")); - perms.add(new ReflectPermission("suppressAccessChecks")); - - // MOCCA specific - perms.add(new SocketPermission("*", "connect,resolve")); - perms.add(new NetPermission("specifyStreamHandler")); - perms.add(new SecurityPermission("insertProvider.*")); - perms.add(new SecurityPermission("putProviderProperty.*")); - perms.add(new SecurityPermission("removeProvider.*")); - perms.add(new CardPermission("*", "*")); - perms.add(new AWTPermission("*")); - - perms.add(new FilePermission(webappDir.getAbsolutePath() + "/-", "read")); - perms.add(new FilePermission(new File(System.getProperty("java.home") + "/lib/xalan.properties").getAbsolutePath(), "read")); - perms.add(new FilePermission(new File(System.getProperty("java.home") + "/lib/xerces.properties").getAbsolutePath(), "read")); - perms.add(new FilePermission(new File(System.getProperty("user.home")).getAbsolutePath(), "read, write")); - perms.add(new FilePermission(new File(System.getProperty("user.home") + "/-").getAbsolutePath(), "read, write")); - perms.add(new FilePermission(new File(System.getProperty("user.home") + "/.mocca/logs/*").getAbsolutePath(), "read, write,delete")); - perms.add(new FilePermission(new File(System.getProperty("user.home") + "/.mocca/certs/-").getAbsolutePath(), "read, write,delete")); - - //TODO - log.trace("granting file read/write permission to MOCCA local"); - perms.add(new FilePermission("<>", "read, write")); - + } return perms; } @@ -205,4 +251,4 @@ public class Container { public void join() throws InterruptedException { server.join(); } -} \ No newline at end of file +} 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 0cfc14e5..0106de62 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 @@ -27,6 +27,7 @@ import java.awt.event.WindowAdapter; import java.net.BindException; import java.net.HttpURLConnection; import java.net.MalformedURLException; +import java.net.URI; import java.net.URL; import java.security.GeneralSecurityException; import java.util.jar.Attributes; @@ -73,21 +74,25 @@ public class Launcher implements BKUControllerInterface, ActionListener { /** local bku uri */ public static final URL HTTP_SECURITY_LAYER_URL; public static final URL HTTPS_SECURITY_LAYER_URL; + public static final URL INSTALL_CERT_URL; public static final URL PIN_MANAGEMENT_URL; static { URL http = null; URL https = null; URL pin = null; + URL cert = null; try { http = new URL("http://localhost:" + Integer.getInteger(Container.HTTPS_PORT_PROPERTY, 3495).intValue()); https = new URL("https://localhost:" + Integer.getInteger(Container.HTTPS_PORT_PROPERTY, 3496).intValue()); pin = new URL(http, "/PINManagement"); + cert = new URL(http, "/installCertificate"); } catch (MalformedURLException ex) { log.error(ex); } finally { HTTP_SECURITY_LAYER_URL = http; HTTPS_SECURITY_LAYER_URL = https; PIN_MANAGEMENT_URL = pin; + INSTALL_CERT_URL = cert; } } public static final String version; @@ -273,7 +278,7 @@ public class Launcher implements BKUControllerInterface, ActionListener { Desktop desktop = Desktop.getDesktop(); if (desktop.isSupported(Desktop.Action.BROWSE)) { try { - desktop.browse(HTTPS_SECURITY_LAYER_URL.toURI()); + desktop.browse(HTTP_SECURITY_LAYER_URL.toURI()); } catch (Exception ex) { log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URL, ex); } diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/TLSServerCA.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/TLSServerCA.java index 97ca716b..fd94958e 100644 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/TLSServerCA.java +++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/TLSServerCA.java @@ -32,6 +32,7 @@ import org.apache.commons.logging.LogFactory; public class TLSServerCA { public static final int CA_VALIDITY_Y = 3; + public static final String MOCCA_TLS_SERVER_ALIAS = "server"; public static final int SERVER_VALIDITY_Y = 3; private final static Log log = LogFactory.getLog(TLSServerCA.class); @@ -127,7 +128,7 @@ public class TLSServerCA { generateServerCert(); KeyStore ks = KeyStore.getInstance("JKS"); ks.load(null, null); - ks.setKeyEntry("server", serverKeyPair.getPrivate(), password, new X509Certificate[]{serverCert, caCert}); + ks.setKeyEntry(MOCCA_TLS_SERVER_ALIAS, serverKeyPair.getPrivate(), password, new X509Certificate[]{serverCert, caCert}); return ks; // } catch (Exception e) { // log.error("Cannot generate certificate", e); diff --git a/BKUWebStart/src/main/jnlp/resources/version.xml b/BKUWebStart/src/main/jnlp/resources/version.xml index 451fe038..5e504b68 100644 --- a/BKUWebStart/src/main/jnlp/resources/version.xml +++ b/BKUWebStart/src/main/jnlp/resources/version.xml @@ -89,41 +89,6 @@ servlet-api-2.5-20081211.jar - - - jsp-2.1-jetty-6.1.19.jar - 6.1.19 - - jsp-2.1-jetty-6.1.19.jar - - - - jsp-2.1-glassfish-9.1.1.B60.25.p0.jar - 9.1.1.B60.25.p0 - - jsp-2.1-glassfish-9.1.1.B60.25.p0.jar - - - - jsp-api-2.1-glassfish-9.1.1.B60.25.p0.jar - 9.1.1.B60.25.p0 - - jsp-api-2.1-glassfish-9.1.1.B60.25.p0.jar - - - - ant-1.6.5.jar - 1.6.5 - - ant-1.6.5.jar - - - - core-3.1.1.jar - 3.1.1 - - core-3.1.1.jar - slf4j-api-1.5.8.jar diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml index a8ee0341..8181bc31 100644 --- a/BKUWebStart/src/main/jnlp/template.xml +++ b/BKUWebStart/src/main/jnlp/template.xml @@ -1,5 +1,5 @@ - + @@ -9,15 +9,15 @@ $project.Description (BKU) MOCCA Web Start $project.Description - - - - - - - - - + + + + + + + + + @@ -39,13 +39,11 @@ - $dependencies - $dependencies -- cgit v1.2.3 From 234cc16c3ebee52e7b3b76219b94d6ee644d5775 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 27 Aug 2009 16:00:46 +0000 Subject: added HELP tray item added INSTALL CA CERT help page WebStart: shortcut online=true git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@476 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../main/webapp/help/de/help.install.cacert.html | 52 +++++++++++++++++++ .../main/webapp/help/de/help.install.cacert.png | Bin 0 -> 25299 bytes BKUHelp/src/main/webapp/help/index.html | 1 + BKULocal/src/main/webapp/index.html | 4 +- .../java/at/gv/egiz/bku/webstart/Launcher.java | 56 +++++++++++++++------ BKUWebStart/src/main/jnlp/template-local.xml | 2 +- BKUWebStart/src/main/jnlp/template.xml | 2 +- .../at/gv/egiz/bku/webstart/messages.properties | 2 + 8 files changed, 100 insertions(+), 19 deletions(-) create mode 100644 BKUHelp/src/main/webapp/help/de/help.install.cacert.html create mode 100644 BKUHelp/src/main/webapp/help/de/help.install.cacert.png (limited to 'BKUWebStart/src') diff --git a/BKUHelp/src/main/webapp/help/de/help.install.cacert.html b/BKUHelp/src/main/webapp/help/de/help.install.cacert.html new file mode 100644 index 00000000..a7573102 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/de/help.install.cacert.html @@ -0,0 +1,52 @@ + + + + +Bürgerkarte - Hilfe + + + + + + + +
+ +
+

Installation des CA Zertifikats

+

Die Bürgerkartenumgebung authentifiziert sich mittels eines TLS Zertifikats ausgestellt auf + CN=127.0.0.1, O=MOCCA, OU=MOCCA TLS Server. + Beim Aufruf der Bürgerkartenumgebung (zum Beispiel bei einem Anmeldevorgang mit Bürgerkarte) + wird dieses Zertifikat vom Web-Browser überprüft. + Um diese Überprüfung zu ermöglichen ist es notwendig das Ausstellerzertifikat, lautend auf + O=MOCCA, OU=MOCCA TLS Server CA, im Web-Browser zu installieren. +

+

+ Klicken Sie dazu auf die Verknüpfung CA Zertifikat installieren + und wählen Sie im angezeigten Dialog die Option 'Dieser CA vertrauen um Websites zu identifizieren'. + (Anmerkung: Der genaue Wortlaut hängt vom verwendeten Web-Browser ab). +

+

Bildschirmfoto des Zertifikatsinstallationsdialogs

+

Hinweis: Der tatsächliche Dialog kann vom oben dargestellten abweichen und hängt vom verwendeten Web-Browser ab.

+

Kopieren Sie diese Verknüpfung und rufen Sie sie in weiteren Web-Browsern ihrer Wahl auf um das Zertifikat auch dort zu installieren.

+

Das CA Zertifikat wird ausschließlich zur Identifikation der lokalen Bürgerkartenumgebung verwendet + und kann bei der Deinstallation der Bürgerkartenumgebung aus dem Web-Browser entfernt werden.

+


+
+ +
+ + diff --git a/BKUHelp/src/main/webapp/help/de/help.install.cacert.png b/BKUHelp/src/main/webapp/help/de/help.install.cacert.png new file mode 100644 index 00000000..0c1b2564 Binary files /dev/null and b/BKUHelp/src/main/webapp/help/de/help.install.cacert.png differ diff --git a/BKUHelp/src/main/webapp/help/index.html b/BKUHelp/src/main/webapp/help/index.html index 1c207572..3cb6354d 100644 --- a/BKUHelp/src/main/webapp/help/index.html +++ b/BKUHelp/src/main/webapp/help/index.html @@ -25,6 +25,7 @@

Häufige gestellte Fragen werden in den folgenden Hilfeseiten behandelt:

    +
  • Installation des CA Zertifikats
  • Fehler bei der PC/SC Installation
  • Unterstützte Signaturkarten
  • Auslesen der Daten auf der Bürgerkarte
  • diff --git a/BKULocal/src/main/webapp/index.html b/BKULocal/src/main/webapp/index.html index 6aefe43c..c5be17fe 100644 --- a/BKULocal/src/main/webapp/index.html +++ b/BKULocal/src/main/webapp/index.html @@ -37,11 +37,11 @@ zunächst das CA Zertifikat.

    -

    Weiters können Sie

    +

    Weiters können Sie


    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 0106de62..8cc9817f 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 @@ -5,9 +5,12 @@ import at.gv.egiz.bku.webstart.gui.BKUControllerInterface; import at.gv.egiz.bku.webstart.gui.PINManagementInvoker; import iaik.asn1.CodingException; import java.io.IOException; +import java.net.URISyntaxException; import java.util.Locale; import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.jnlp.UnavailableServiceException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -30,6 +33,7 @@ import java.net.MalformedURLException; import java.net.URI; import java.net.URL; import java.security.GeneralSecurityException; +import java.text.MessageFormat; import java.util.jar.Attributes; import java.util.jar.Manifest; import javax.imageio.ImageIO; @@ -39,6 +43,7 @@ import javax.swing.JFrame; import org.mortbay.util.MultiException; public class Launcher implements BKUControllerInterface, ActionListener { + public static final String HELP_COMMAND = "help"; public static final String WEBAPP_RESOURCE = "BKULocal.war"; public static final String CERTIFICATES_RESOURCE = "BKUCertificates.jar"; @@ -59,8 +64,10 @@ public class Launcher implements BKUControllerInterface, ActionListener { public static final String ERROR_CONFIG = "tray.error.config"; public static final String ERROR_BIND = "tray.error.bind"; public static final String ERROR_PIN = "tray.error.pin.connect"; + public static final String ERROR_OPEN_URL = "tray.error.open.url"; public static final String LABEL_SHUTDOWN = "tray.label.shutdown"; public static final String LABEL_PIN = "tray.label.pin"; + public static final String LABEL_HELP = "tray.label.help"; public static final String LABEL_ABOUT = "tray.label.about"; public static final String TOOLTIP_DEFAULT = "tray.tooltip.default"; @@ -76,16 +83,19 @@ public class Launcher implements BKUControllerInterface, ActionListener { public static final URL HTTPS_SECURITY_LAYER_URL; public static final URL INSTALL_CERT_URL; public static final URL PIN_MANAGEMENT_URL; + public static final URL HELP_URL; static { URL http = null; URL https = null; URL pin = null; URL cert = null; + URL help = null; try { http = new URL("http://localhost:" + Integer.getInteger(Container.HTTPS_PORT_PROPERTY, 3495).intValue()); https = new URL("https://localhost:" + Integer.getInteger(Container.HTTPS_PORT_PROPERTY, 3496).intValue()); pin = new URL(http, "/PINManagement"); cert = new URL(http, "/installCertificate"); + help = new URL(http, "/help"); } catch (MalformedURLException ex) { log.error(ex); } finally { @@ -93,6 +103,7 @@ public class Launcher implements BKUControllerInterface, ActionListener { HTTPS_SECURITY_LAYER_URL = https; PIN_MANAGEMENT_URL = pin; INSTALL_CERT_URL = cert; + HELP_URL = help; } } public static final String version; @@ -170,6 +181,18 @@ public class Launcher implements BKUControllerInterface, ActionListener { throw ex; } } + + private void browse(URL url) throws IOException, URISyntaxException { + // don't use basicService.showDocument(), which causes a java ssl warning dialog + if (Desktop.isDesktopSupported()) { + Desktop desktop = Desktop.getDesktop(); + if (desktop.isSupported(Desktop.Action.BROWSE)) { + desktop.browse(url.toURI()); + return; + } + } + throw new IOException("current platform does not support Java Desktop API"); + } private TrayIcon initTrayIcon() { if (SystemTray.isSupported()) { @@ -192,6 +215,11 @@ public class Launcher implements BKUControllerInterface, ActionListener { PopupMenu popup = new PopupMenu(); + MenuItem helpItem = new MenuItem(messages.getString(LABEL_HELP)); + helpItem.addActionListener(this); + helpItem.setActionCommand(HELP_COMMAND); + popup.add(helpItem); + MenuItem pinItem = new MenuItem(messages.getString(LABEL_PIN)); pinItem.addActionListener(this); pinItem.setActionCommand(PIN_COMMAND); @@ -273,20 +301,10 @@ public class Launcher implements BKUControllerInterface, ActionListener { } } if (config.isCertRenewed()) { - // don't use basicService.showDocument(), which causes a java ssl warning dialog - if (Desktop.isDesktopSupported()) { - Desktop desktop = Desktop.getDesktop(); - if (desktop.isSupported(Desktop.Action.BROWSE)) { - try { - desktop.browse(HTTP_SECURITY_LAYER_URL.toURI()); - } catch (Exception ex) { - log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URL, ex); - } - } else { - log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URL); - } - } else { - log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URL); + try { + browse(HTTP_SECURITY_LAYER_URL); + } catch (Exception ex) { + log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URL, ex); } } log.info("BKU successfully started"); @@ -344,7 +362,15 @@ public class Launcher implements BKUControllerInterface, ActionListener { log.debug("pin management dialog requested via tray menu"); new Thread(new PINManagementInvoker(trayIcon, messages)).start(); - + } else if (HELP_COMMAND.equals(e.getActionCommand())) { + log.debug("help page requested via tray menu"); + try { + browse(HELP_URL); + } catch (Exception ex) { + log.error("Failed to open " + HELP_URL, ex); + String msg = MessageFormat.format(messages.getString(ERROR_OPEN_URL), HELP_URL); + trayIcon.displayMessage(messages.getString(CAPTION_ERROR), msg, TrayIcon.MessageType.ERROR); + } } else { log.error("unknown tray menu command: " + e.getActionCommand()); } diff --git a/BKUWebStart/src/main/jnlp/template-local.xml b/BKUWebStart/src/main/jnlp/template-local.xml index 1b21c118..3193255a 100644 --- a/BKUWebStart/src/main/jnlp/template-local.xml +++ b/BKUWebStart/src/main/jnlp/template-local.xml @@ -18,7 +18,7 @@ - + diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml index 8181bc31..790e60e1 100644 --- a/BKUWebStart/src/main/jnlp/template.xml +++ b/BKUWebStart/src/main/jnlp/template.xml @@ -18,7 +18,7 @@ - + diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties index b6d9238e..9ba359be 100644 --- a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties +++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties @@ -25,8 +25,10 @@ tray.error.start=B\u00FCrgerkartenumgebung konnte nicht gestartet werden tray.error.config=Konfiguration konnte nicht initialisiert werden, B\u00FCrberkartenumgebung wird nicht gestartet tray.error.bind=Die f\u00FCr die B\u00FCrgerkartenumgebung reservierte Adresse wird bereits von einem anderen Dienst verwendet tray.error.pin.connect=Verbindung zur PIN Verwaltung konnte nicht hergestellt werden +tray.error.open.url=Verbindung zu {0} konnte nicht hergestellt werden tray.label.shutdown=Beenden tray.label.pin=PIN Verwaltung +tray.label.help=Hilfe tray.label.about=\u00DCber... tray.tooltip.default=B\u00FCrgerkartenumgebung about.frame.title=B\u00FCrgerkarte -- cgit v1.2.3 From 0acb5643e945daf024c0dec04f0ad86d6427b7b0 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 27 Aug 2009 20:02:15 +0000 Subject: seperate BKUWebStart main jar and BKUWebStart bundle use webstart-maven-plugin:jnlp-download-servlet goal to get versions right git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@477 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUOnline/src/main/jnlp/resources/logo.png | Bin 2609 -> 0 bytes BKUOnline/src/main/jnlp/resources/logo_64x64.png | Bin 2299 -> 0 bytes BKUOnline/src/main/jnlp/resources/logo_90x90.png | Bin 3294 -> 0 bytes BKUOnline/src/main/jnlp/resources/splash.png | Bin 54978 -> 0 bytes BKUOnline/src/main/jnlp/template.xml | 38 ------ .../src/main/jnlp/resources/img/chip128.png | Bin 7775 -> 0 bytes BKUWebStart/src/main/jnlp/resources/img/chip16.png | Bin 787 -> 0 bytes BKUWebStart/src/main/jnlp/resources/img/chip24.png | Bin 1227 -> 0 bytes BKUWebStart/src/main/jnlp/resources/img/chip32.png | Bin 1753 -> 0 bytes BKUWebStart/src/main/jnlp/resources/img/chip48.png | Bin 2771 -> 0 bytes BKUWebStart/src/main/jnlp/resources/img/splash.png | Bin 41455 -> 0 bytes .../src/main/jnlp/resources/img/version.xml | 52 --------- BKUWebStart/src/main/jnlp/resources/player.jnlp | 3 - BKUWebStart/src/main/jnlp/resources/version.xml | 129 --------------------- BKUWebStart/src/main/jnlp/template-local.xml | 46 -------- BKUWebStart/src/main/jnlp/template.xml | 51 -------- src/main/assemblies/assembly-test.xml | 36 ------ 17 files changed, 355 deletions(-) delete mode 100644 BKUOnline/src/main/jnlp/resources/logo.png delete mode 100644 BKUOnline/src/main/jnlp/resources/logo_64x64.png delete mode 100644 BKUOnline/src/main/jnlp/resources/logo_90x90.png delete mode 100644 BKUOnline/src/main/jnlp/resources/splash.png delete mode 100644 BKUOnline/src/main/jnlp/template.xml delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip128.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip16.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip24.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip32.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip48.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/splash.png delete mode 100644 BKUWebStart/src/main/jnlp/resources/img/version.xml delete mode 100644 BKUWebStart/src/main/jnlp/resources/player.jnlp delete mode 100644 BKUWebStart/src/main/jnlp/resources/version.xml delete mode 100644 BKUWebStart/src/main/jnlp/template-local.xml delete mode 100644 BKUWebStart/src/main/jnlp/template.xml delete mode 100644 src/main/assemblies/assembly-test.xml (limited to 'BKUWebStart/src') diff --git a/BKUOnline/src/main/jnlp/resources/logo.png b/BKUOnline/src/main/jnlp/resources/logo.png deleted file mode 100644 index 2c622d88..00000000 Binary files a/BKUOnline/src/main/jnlp/resources/logo.png and /dev/null differ diff --git a/BKUOnline/src/main/jnlp/resources/logo_64x64.png b/BKUOnline/src/main/jnlp/resources/logo_64x64.png deleted file mode 100644 index fa6d7f96..00000000 Binary files a/BKUOnline/src/main/jnlp/resources/logo_64x64.png and /dev/null differ diff --git a/BKUOnline/src/main/jnlp/resources/logo_90x90.png b/BKUOnline/src/main/jnlp/resources/logo_90x90.png deleted file mode 100644 index d7f8bbd0..00000000 Binary files a/BKUOnline/src/main/jnlp/resources/logo_90x90.png and /dev/null differ diff --git a/BKUOnline/src/main/jnlp/resources/splash.png b/BKUOnline/src/main/jnlp/resources/splash.png deleted file mode 100644 index 72c1d868..00000000 Binary files a/BKUOnline/src/main/jnlp/resources/splash.png and /dev/null differ diff --git a/BKUOnline/src/main/jnlp/template.xml b/BKUOnline/src/main/jnlp/template.xml deleted file mode 100644 index c8291f61..00000000 --- a/BKUOnline/src/main/jnlp/template.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - $project.Name - $project.Organization.Name - - $project.Description - $project.Description - - - - - - - -#if($offlineAllowed) - -#end - - - - -#if($allPermissions) - - - -#end - - - - - - - $dependencies - - - - \ No newline at end of file diff --git a/BKUWebStart/src/main/jnlp/resources/img/chip128.png b/BKUWebStart/src/main/jnlp/resources/img/chip128.png deleted file mode 100644 index c36d8079..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/chip128.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/chip16.png b/BKUWebStart/src/main/jnlp/resources/img/chip16.png deleted file mode 100644 index 96b580e9..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/chip16.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/chip24.png b/BKUWebStart/src/main/jnlp/resources/img/chip24.png deleted file mode 100644 index efd6dbeb..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/chip24.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/chip32.png b/BKUWebStart/src/main/jnlp/resources/img/chip32.png deleted file mode 100644 index e7efb020..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/chip32.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/chip48.png b/BKUWebStart/src/main/jnlp/resources/img/chip48.png deleted file mode 100644 index 491fbcac..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/chip48.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/splash.png b/BKUWebStart/src/main/jnlp/resources/img/splash.png deleted file mode 100644 index 597fbc60..00000000 Binary files a/BKUWebStart/src/main/jnlp/resources/img/splash.png and /dev/null differ diff --git a/BKUWebStart/src/main/jnlp/resources/img/version.xml b/BKUWebStart/src/main/jnlp/resources/img/version.xml deleted file mode 100644 index 5e160beb..00000000 --- a/BKUWebStart/src/main/jnlp/resources/img/version.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - chip16.png - 2.0 - - chip16.png - - - - chip24.png - 2.0 - - chip24.png - - - - chip32.png - 2.0 - - chip32.png - - - - chip48.png - 2.0 - - chip48.png - - - - chip64.png - 2.0 - - chip64.png - - - - chip128.png - 2.0 - - chip128.png - - - - splash.png - 2.0 - - splash.png - - diff --git a/BKUWebStart/src/main/jnlp/resources/player.jnlp b/BKUWebStart/src/main/jnlp/resources/player.jnlp deleted file mode 100644 index da08ebc2..00000000 --- a/BKUWebStart/src/main/jnlp/resources/player.jnlp +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/BKUWebStart/src/main/jnlp/resources/version.xml b/BKUWebStart/src/main/jnlp/resources/version.xml deleted file mode 100644 index 5e504b68..00000000 --- a/BKUWebStart/src/main/jnlp/resources/version.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - BKUWebStart-1.2.3.jar - 1.2.3 - - BKUWebStart-1.2.3.jar - - - - utils-1.2.3.jar - 1.2.3 - - utils-1.2.3.jar - - - - BKUCertificates-1.0.jar - 1.0 - - BKUCertificates-1.0.jar - - - - - commons-logging-1.1.1.jar - 1.1.1 - - commons-logging-1.1.1.jar - - - - - activation-1.1.jar - 1.1 - - activation-1.1.jar - - - - - log4j-1.2.12.jar - 1.2.12 - - log4j-1.2.12.jar - - - - - iaik_ecc_signed-2.15.jar - 2.15 - - iaik_ecc_signed-2.15.jar - - - - iaik_jce_full_signed-3.16.jar - 3.16 - - iaik_jce_full_signed-3.16.jar - - - - iaik_xsect-1.14.jar - 1.14 - - iaik_xsect-1.14.jar - - - - - jetty-6.1.19.jar - 6.1.19 - - jetty-6.1.19.jar - - - - jetty-util-6.1.19.jar - 6.1.19 - - jetty-util-6.1.19.jar - - - - servlet-api-2.5-20081211.jar - 2.5-20081211 - - servlet-api-2.5-20081211.jar - - - - slf4j-api-1.5.8.jar - 1.5.8 - - slf4j-api-1.5.8.jar - - - - slf4j-log4j12-1.5.8.jar - 1.5.8 - - slf4j-log4j12-1.5.8.jar - - - - - jaxb-api-2.1.jar - 2.1 - - jaxb-api-2.1.jar - - - - jaxb-impl-2.1.9.jar - 2.1.9 - - jaxb-impl-2.1.9.jar - - - - stax-api-1.0-2.jar - 1.0-2 - - stax-api-1.0-2.jar - - - diff --git a/BKUWebStart/src/main/jnlp/template-local.xml b/BKUWebStart/src/main/jnlp/template-local.xml deleted file mode 100644 index 3193255a..00000000 --- a/BKUWebStart/src/main/jnlp/template-local.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - $project.Description - - E-Government Innovationszentrum (EGIZ) - - $project.Description (BKU) MOCCA Web Start - $project.Description - - - - - - - - - - - - - - -#if($offlineAllowed) - -#end - - - -#if($allPermissions) - - - -#end - - - - - - $dependencies - - - - \ No newline at end of file diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml deleted file mode 100644 index 790e60e1..00000000 --- a/BKUWebStart/src/main/jnlp/template.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - $project.Description - - E-Government Innovationszentrum (EGIZ) - - $project.Description (BKU) MOCCA Web Start - $project.Description - - - - - - - - - - - - - - -#if($offlineAllowed) - -#end - - - -#if($allPermissions) - - - -#end - - - - - - $dependencies - - - - - $dependencies - - - - \ No newline at end of file diff --git a/src/main/assemblies/assembly-test.xml b/src/main/assemblies/assembly-test.xml deleted file mode 100644 index 51ff0f85..00000000 --- a/src/main/assemblies/assembly-test.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - assembly-test - - zip - - true - ${artifactId} - - - - at.gv.egiz:bku.commons - - - lib - false - - - - -- cgit v1.2.3 From dd04951a76fc6406755a94ecf547c0797f062fa2 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 28 Aug 2009 17:53:01 +0000 Subject: replace installCertificate servlet with der encoded crt file in webapp/ moved local-webstart profile to BKUWebStart (jnlp-inline goal) help note for internet explorer on visat/7 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@482 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUHelp/pom.xml | 2 +- .../main/webapp/help/de/help.install.cacert.html | 8 +- BKULocal/pom.xml | 2 +- .../at/gv/egiz/bku/local/stal/LocalBKUWorker.java | 1 + .../local/webapp/InstallCertificateServlet.java | 149 --------------------- BKULocal/src/main/webapp/WEB-INF/web.xml | 8 -- BKULocal/src/main/webapp/index.html | 7 +- BKUOnline/pom.xml | 2 +- BKUOnline/src/main/webapp/js/deployJava.js | 3 +- BKUWebStart/keystore.ks | Bin 5635 -> 0 bytes BKUWebStart/pom.xml | 48 +++++++ .../java/at/gv/egiz/bku/webstart/Container.java | 47 ++++--- .../java/at/gv/egiz/bku/webstart/Launcher.java | 6 +- .../java/at/gv/egiz/bku/webstart/TLSServerCA.java | 10 +- BKUWebStart/src/main/jnlp/keystore.ks | Bin 0 -> 5635 bytes .../src/main/jnlp/resources/img/chip128.png | Bin 0 -> 7775 bytes BKUWebStart/src/main/jnlp/resources/img/chip16.png | Bin 0 -> 787 bytes BKUWebStart/src/main/jnlp/resources/img/chip24.png | Bin 0 -> 1227 bytes BKUWebStart/src/main/jnlp/resources/img/chip32.png | Bin 0 -> 1753 bytes BKUWebStart/src/main/jnlp/resources/img/chip48.png | Bin 0 -> 2771 bytes BKUWebStart/src/main/jnlp/resources/img/splash.png | Bin 0 -> 41455 bytes .../src/main/jnlp/resources/img/version.xml | 52 +++++++ BKUWebStart/src/main/jnlp/resources/player.jnlp | 3 + BKUWebStart/src/main/jnlp/template-local.xml | 40 ++++++ BKUWebStartPackage/src/main/jnlp/template.xml | 6 +- pom.xml | 2 +- 26 files changed, 205 insertions(+), 191 deletions(-) delete mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/InstallCertificateServlet.java delete mode 100644 BKUWebStart/keystore.ks create mode 100644 BKUWebStart/src/main/jnlp/keystore.ks create mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip128.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip16.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip24.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip32.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/chip48.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/splash.png create mode 100644 BKUWebStart/src/main/jnlp/resources/img/version.xml create mode 100644 BKUWebStart/src/main/jnlp/resources/player.jnlp create mode 100644 BKUWebStart/src/main/jnlp/template-local.xml (limited to 'BKUWebStart/src') diff --git a/BKUHelp/pom.xml b/BKUHelp/pom.xml index 366a2666..cfdb7178 100644 --- a/BKUHelp/pom.xml +++ b/BKUHelp/pom.xml @@ -7,7 +7,7 @@ at.gv.egiz BKUHelp - 1.3-SNAPSHOT + 1.2.5-SNAPSHOT BKU Help diff --git a/BKUHelp/src/main/webapp/help/de/help.install.cacert.html b/BKUHelp/src/main/webapp/help/de/help.install.cacert.html index a7573102..25c546f0 100644 --- a/BKUHelp/src/main/webapp/help/de/help.install.cacert.html +++ b/BKUHelp/src/main/webapp/help/de/help.install.cacert.html @@ -30,14 +30,20 @@ Um diese Überprüfung zu ermöglichen ist es notwendig das Ausstellerzertifikat, lautend auf O=MOCCA, OU=MOCCA TLS Server CA, im Web-Browser zu installieren.

    + +

    Achtung: Eine automatische Installation des CA Zertifikats als 'Vertrauenswürdiges Stammzertifikat' im Microsoft Zertifikatsspeicher ist in Windows Vista leider nicht möglich. + Sollten Sie Internet Explorer oder Safari in Windows Vista oder 7 benutzen, dann wählen Sie bei der Installation des Zertifikats ausdrücklich 'zu vertrauenswürdigen Stammzertifizierungsstellen hinzufügen'. +

    +

    - Klicken Sie dazu auf die Verknüpfung CA Zertifikat installieren + Klicken Sie dazu auf die Verknüpfung CA Zertifikat installieren und wählen Sie im angezeigten Dialog die Option 'Dieser CA vertrauen um Websites zu identifizieren'. (Anmerkung: Der genaue Wortlaut hängt vom verwendeten Web-Browser ab).

    Bildschirmfoto des Zertifikatsinstallationsdialogs

    Hinweis: Der tatsächliche Dialog kann vom oben dargestellten abweichen und hängt vom verwendeten Web-Browser ab.

    Kopieren Sie diese Verknüpfung und rufen Sie sie in weiteren Web-Browsern ihrer Wahl auf um das Zertifikat auch dort zu installieren.

    +

    Das CA Zertifikat wird ausschließlich zur Identifikation der lokalen Bürgerkartenumgebung verwendet und kann bei der Deinstallation der Bürgerkartenumgebung aus dem Web-Browser entfernt werden.


    diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index 23c626c4..85c83cec 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -111,7 +111,7 @@ BKUHelp at.gv.egiz - 1.3-SNAPSHOT + 1.2.5-SNAPSHOT org.springframework 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 75f71be6..1e3f9a1d 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 @@ -49,6 +49,7 @@ public class LocalBKUWorker extends AbstractBKUWorker { public List handleRequest(List requestList) { signatureCard = null; List responses = super.handleRequest(requestList); + container.setVisible(false); return responses; } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/InstallCertificateServlet.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/InstallCertificateServlet.java deleted file mode 100644 index 0a9d001b..00000000 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/InstallCertificateServlet.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package at.gv.egiz.bku.local.webapp; - -import iaik.pkcs.PKCS7CertList; -import iaik.utils.Util; -import java.io.IOException; -import java.security.cert.Certificate; -import java.security.cert.CertificateException; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * @author Clemens Orthacker - */ -public class InstallCertificateServlet extends HttpServlet { - public static final String HTTPS_REDIRECT = "https://localhost:3496/"; - - public static final String SERVER_CA_CERTIFICATE_ATTRIBUTE = "mocca.tls.server.ca.certificate"; - protected PKCS7CertList p7c; - private static final Log log = LogFactory.getLog(InstallCertificateServlet.class); - - @Override - public void init() throws ServletException { - super.init(); - Certificate caCert = (Certificate) getServletContext().getAttribute(SERVER_CA_CERTIFICATE_ATTRIBUTE); - if (caCert != null) { - try { - p7c = new PKCS7CertList(); - p7c.setCertificateList(new iaik.x509.X509Certificate[] { Util.convertCertificate(caCert) }); - } catch (CertificateException ex) { - log.error("failed to import local ca certificate " + SERVER_CA_CERTIFICATE_ATTRIBUTE, ex); - } - } else { - log.error("failed to import local ca certificate " + SERVER_CA_CERTIFICATE_ATTRIBUTE); - } - } - - /** - * Processes requests for both HTTP GET and POST methods. - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - protected void processRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - -// try { -// SSLContext sslCtx1 = SSLContext.getDefault(); -// log.debug("Default SSLContext (" + sslCtx1.getProtocol() + "): " + sslCtx1.getClass().getName()); -// } catch (NoSuchAlgorithmException ex) { -// log.debug("no sslContext: " + ex.getMessage(), ex); -// } -// -// try { -// SSLContext sslCtx2 = SSLContext.getInstance("TLS"); -// log.debug("TLS SSLContext: " + sslCtx2.getClass().getName()); -// -// SSLServerSocketFactory serverSocketFactory = sslCtx2.getServerSocketFactory(); -// SSLSessionContext serverSessionContext = sslCtx2.getServerSessionContext(); -// -// if (serverSocketFactory != null) { -// log.debug("SSL ServerSocketFactory: " + serverSocketFactory.getClass().getName()); -// } -// if (serverSessionContext != null) { -// log.debug("SSL ServerSessionContext: " + serverSessionContext.getClass().getName()); -// } -// } catch (NoSuchAlgorithmException ex) { -// log.debug("no sslContext: " + ex.getMessage(), ex); -// } -// -// try { -// SSLContext sslCtx3 = SSLContext.getInstance("SSLv3"); -// log.debug("TLS SSLContext: " + sslCtx3.getClass().getName()); -// } catch (NoSuchAlgorithmException ex) { -// log.debug("no sslContext: " + ex.getMessage(), ex); -// } - - - - - - if (p7c != null) { - log.debug("returning local ca certificate"); - response.setContentType("application/x-x509-ca-cert"); - p7c.writeTo(response.getOutputStream()); - response.getOutputStream().flush(); - } else { - log.debug("no local ca certificate, redirecting to " + HTTPS_REDIRECT); - response.sendRedirect(HTTPS_REDIRECT); - } - - } - - // - /** - * Handles the HTTP GET method. - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Handles the HTTP POST method. - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Returns a short description of the servlet. - * @return a String containing servlet description - */ - @Override - public String getServletInfo() { - return "Short description"; - }// -} diff --git a/BKULocal/src/main/webapp/WEB-INF/web.xml b/BKULocal/src/main/webapp/WEB-INF/web.xml index 8768dbd8..c4ea1e54 100644 --- a/BKULocal/src/main/webapp/WEB-INF/web.xml +++ b/BKULocal/src/main/webapp/WEB-INF/web.xml @@ -39,10 +39,6 @@ PINManagementServlet at.gv.egiz.bku.local.webapp.PINManagementServlet - - InstallCertificateServlet - at.gv.egiz.bku.local.webapp.InstallCertificateServlet - BKUServlet /http-security-layer-request @@ -57,10 +53,6 @@ PINManagementServlet /PINManagement - - InstallCertificateServlet - /installCertificate - index.html index.htm diff --git a/BKULocal/src/main/webapp/index.html b/BKULocal/src/main/webapp/index.html index c5be17fe..0156b5e5 100644 --- a/BKULocal/src/main/webapp/index.html +++ b/BKULocal/src/main/webapp/index.html @@ -34,7 +34,7 @@ Logo

Um die Bürgerkartenumgebung zu verwenden installieren Sie bitte - zunächst das CA Zertifikat. + zunächst das CA Zertifikat¹.

Weiters können Sie

@@ -46,6 +46,11 @@


+

+ ¹Eine automatisierte Installation ist mit Microsoft Internet Explorer in Windows Vista oder 7 leider nicht möglich, + siehe dazu Hilfe. +

+