From 32d17447a258188b2d534bcb0bf65a659ba7b7d0 Mon Sep 17 00:00:00 2001 From: mcentner Date: Fri, 29 Aug 2008 12:11:34 +0000 Subject: Initial import. git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/src/main/java/META-INF/MANIFEST.MF | 3 + .../at/gv/egiz/bku/online/applet/BKUApplet.java | 101 ++++++++ .../at/gv/egiz/bku/online/applet/BKUWorker.java | 286 +++++++++++++++++++++ .../online/applet/InternalSSLSocketFactory.java | 101 ++++++++ .../applet/InternalSSLSocketFactoryException.java | 45 ++++ .../gv/egiz/bku/online/applet/Messages.properties | 58 +++++ .../egiz/bku/online/applet/Messages_de.properties | 42 +++ .../at/gv/egiz/bku/online/applet/images/logo.png | Bin 0 -> 4035 bytes .../at/gv/egiz/stal/client/STALServiceTest.java | 96 +++++++ 9 files changed, 732 insertions(+) create mode 100644 BKUApplet/src/main/java/META-INF/MANIFEST.MF create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java create mode 100644 BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties create mode 100644 BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties create mode 100644 BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png create mode 100644 BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java (limited to 'BKUApplet/src') diff --git a/BKUApplet/src/main/java/META-INF/MANIFEST.MF b/BKUApplet/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 00000000..5e949512 --- /dev/null +++ b/BKUApplet/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java new file mode 100644 index 00000000..56cc5ea2 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java @@ -0,0 +1,101 @@ +/* +* 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.online.applet; + +import java.util.Locale; +import java.util.ResourceBundle; + +import javax.net.ssl.HttpsURLConnection; +import javax.swing.JApplet; + +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.BKUGUIFactory; + +/** + * + * + * + */ +public class BKUApplet extends JApplet { + + private static Log log = LogFactory.getLog(BKUApplet.class); + + public final static String RESOURCE_BUNDLE_BASE = "at/gv/egiz/bku/online/applet/Messages"; + + public final static String LOCALE_PARAM_KEY = "Locale"; + public final static String LOGO_URL_KEY="LogoURL"; + public final static String WSDL_URL="WSDL_URL"; + public final static String SESSION_ID="SessionID"; + + protected ResourceBundle resourceBundle; + protected BKUWorker worker; + protected Thread workerThread; + + public BKUApplet() { + } + + public void init() { + log.debug("Called init()"); + try { + HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getSocketFactory()); + HttpsURLConnection.setDefaultHostnameVerifier(InternalSSLSocketFactory.getHostNameVerifier()); + } catch (InternalSSLSocketFactoryException e) { + log.error(e); + } + String localeString = getMyAppletParameter(LOCALE_PARAM_KEY); + if (localeString != null) { + resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE, + new Locale(localeString)); + } else { + resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE); + } + BKUGUIFacade gui = BKUGUIFactory.createGUI(); + gui.init(getContentPane(), localeString); + worker = new BKUWorker(gui, this, resourceBundle); + } + + public void start() { + log.debug("Called start()"); + workerThread = new Thread(worker); + workerThread.start(); + } + + public void stop() { + log.debug("Called stop()"); + if ((workerThread != null) && (workerThread.isAlive())) { + workerThread.interrupt(); + } + } + + public void destroy() { + log.debug("Called destroy()"); + } + + /** + * Applet configuration parameters + * + * @param paramKey + * @return + */ + public String getMyAppletParameter(String paramKey) { + log.info("Getting parameter: "+paramKey+ ": "+ getParameter(paramKey)); + return getParameter(paramKey); + } +} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java new file mode 100644 index 00000000..38fd6428 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java @@ -0,0 +1,286 @@ +/* +* 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.online.applet; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.ResourceBundle; + +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; +import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; +import at.gv.egiz.smcc.SignatureCard; +import at.gv.egiz.smcc.util.SMCCHelper; +import at.gv.egiz.stal.QuitRequest; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.service.GetNextRequestResponseType; +import at.gv.egiz.stal.service.GetNextRequestType; +import at.gv.egiz.stal.service.ObjectFactory; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.STALService; + +public class BKUWorker extends AbstractSMCCSTAL implements Runnable, + ActionListener, SMCCSTALRequestHandler { + + private static Log log = LogFactory.getLog(BKUWorker.class); + + protected BKUGUIFacade gui; + protected BKUApplet parent; + private STALPortType stalPort; + protected List actionCommandList = new ArrayList(); + protected Boolean actionPerformed = false; + protected boolean finished = false; + protected ResourceBundle errorMessages; + + /** + * + * @param gui + * must not be null + */ + public BKUWorker(BKUGUIFacade gui, BKUApplet parent, + ResourceBundle errorMessageBundle) { + if ((gui == null) || (parent == null) || (errorMessageBundle == null)) { + throw new NullPointerException("Parameter must not be set to null"); + } + this.gui = gui; + this.parent = parent; + this.errorMessages = errorMessageBundle; + addRequestHandler(QuitRequest.class, this); + } + + private STALPortType getSTALPort() throws MalformedURLException { + URL wsdlURL = null; + String wsdlLocation = parent.getMyAppletParameter(BKUApplet.WSDL_URL); + URL codebase = parent.getCodeBase(); + log.debug("Connecting to webservice: " + wsdlLocation); + if (wsdlLocation != null) { + try { + if (codebase.getProtocol().equalsIgnoreCase("file")) { + // for debugging in appletrunner + wsdlURL = new URL(wsdlLocation); + } else { + wsdlURL = new URL(codebase, wsdlLocation); + } + } catch (MalformedURLException ex) { + log.fatal("Paremeter 'wsdlLocation' is not a vailid URL.", ex); + throw new MalformedURLException(ex.getMessage()); + } + } else { + log.fatal("Paremeter 'wsdlLocation' is not set."); + throw new MalformedURLException("Null WSDL url"); + } + log.debug("Found WSDL url: " + wsdlURL); + QName endpointName = new QName("http://www.egiz.gv.at/wsdl/stal", + "STALService"); + STALService stal = new STALService(wsdlURL, endpointName); + return stal.getSTALPort(); + } + + @Override + public void run() { + gui.showWelcomeDialog(); + try { + stalPort = getSTALPort(); + } catch (Exception e) { + log.fatal("Failed to call STAL service.", e); + actionCommandList.clear(); + actionCommandList.add("ok"); + gui.showErrorDialog(errorMessages.getString("failed.WS")); + try { + waitForAction(); + } catch (InterruptedException e1) { + log.error(e1); + } + return; + } + + ObjectFactory factory = new ObjectFactory(); + GetNextRequestType nextRequest = factory.createGetNextRequestType(); + + String sessionId = parent.getMyAppletParameter(BKUApplet.SESSION_ID); + if (sessionId == null) { + // use the testsession for testing + sessionId = "TestSession"; + } + nextRequest.setSessionId(sessionId); + do { + GetNextRequestResponseType resp = stalPort.getNextRequest(nextRequest); + log.info("Got " + resp.getRequest().size() + " requests from server."); + List stalRequests = resp.getRequest(); + List responses = handleRequest(stalRequests); + log.info("Got " + responses.size() + " responses."); + nextRequest = factory.createGetNextRequestType(); + nextRequest.setSessionId(sessionId); + nextRequest.getResponse().addAll(responses); + } while (!finished); + log.info("Done " + Thread.currentThread().getName()); + gui.showWelcomeDialog(); + sendRedirect(); + } + + protected void sendRedirect() { + log.info("Done, sending redirect to get BKU response"); + String redirectURL = parent.getMyAppletParameter("redirectURL"); + String redirectTarget = parent.getMyAppletParameter("redirectTarget"); + log.info("Redirecting to: " + redirectURL + " target: " + redirectTarget); + URL url = null; + if (redirectURL != null) { + try { + url = new URL(parent.getCodeBase(),redirectURL + ";jsessionid=" + + parent.getMyAppletParameter(BKUApplet.SESSION_ID)); + } catch (MalformedURLException ex) { + log.warn("Parameter 'redirectURL': " + redirectURL + + " not a valid URL.", ex); + // gui.showErrorDialog(errorMsg, okListener, actionCommand) + } + if (url != null) { + if (redirectTarget == null) { + log.info("Done. Trying to redirect to " + url + " ..."); + parent.getAppletContext().showDocument(url); + } else { + log.info("Done. Trying to redirect to " + url + " (target=" + + redirectTarget + ") ..."); + parent.getAppletContext().showDocument(url, redirectTarget); + } + } + } else { + log.error("No redirect URL set"); + } + } + + protected synchronized void waitForAction() throws InterruptedException { + log.info("Waiting for Action"); + while (!actionPerformed) { + wait(); + } + actionPerformed = false; + } + + protected synchronized void actionOccured() { + log.info("Received Action"); + actionPerformed = true; + notifyAll(); + } + + @Override + public void actionPerformed(ActionEvent e) { + log.info("Action: " + e); + if (actionCommandList != null) { + if (actionCommandList.contains(e.getActionCommand())) { + actionOccured(); + } + } else { + actionOccured(); + } + } + + @Override + protected boolean waitForCard() { + SMCCHelper smccHelper = new SMCCHelper(); + actionCommandList.clear(); + actionCommandList.add("cancel"); + // while no sigcard found or cancel button pressed + int oldValue = SMCCHelper.PC_SC_NOT_SUPPORTED; // this is a save default + while ((signatureCard == null) && (!actionPerformed)) { + switch (smccHelper.getResultCode()) { + case SMCCHelper.PC_SC_NOT_SUPPORTED: + actionCommandList.clear(); + actionCommandList.add("ok"); + gui.showErrorDialog(errorMessages.getString("nopcscsupport"), this, + "ok"); + try { + waitForAction(); + } catch (InterruptedException e) { + log.error(e); + } + return true; + case SMCCHelper.TERMINAL_NOT_PRESENT: + actionCommandList.clear(); + actionCommandList.add("ok"); + gui.showErrorDialog(errorMessages.getString("nocardterminal"), this, + "ok"); + try { + waitForAction(); + } catch (InterruptedException e) { + log.error(e); + } + return true; + case SMCCHelper.CARD_NOT_SUPPORTED: + if (oldValue != SMCCHelper.CARD_NOT_SUPPORTED) { + actionCommandList.clear(); + actionCommandList.add("cancel"); + gui.showCardNotSupportedDialog(this, "cancel"); + oldValue = SMCCHelper.CARD_NOT_SUPPORTED; + } + break; + case SMCCHelper.NO_CARD: + if (oldValue != SMCCHelper.NO_CARD) { + actionCommandList.clear(); + actionCommandList.add("cancel"); + gui.showInsertCardDialog(this, "cancel"); + oldValue = SMCCHelper.NO_CARD; + } + break; + case SMCCHelper.CARD_FOUND: + gui.showWelcomeDialog(); + signatureCard = smccHelper.getSignatureCard(errorMessages.getLocale()); + return false; + } + smccHelper.update(3000); + } + return signatureCard == null; + } + + @Override + public STALResponse handleRequest(STALRequest request) { + if (request instanceof QuitRequest) { + finished = true; + } else { + log.error("Unexpected request to handle: " + request); + } + return null; + } + + @Override + public void init(SignatureCard sc, BKUGUIFacade gui) { + } + + @Override + public SMCCSTALRequestHandler newInstance() { + return this; + } + + @Override + public boolean requireCard() { + return false; + } + + @Override + protected BKUGUIFacade getGUI() { + return gui; + } +} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java new file mode 100644 index 00000000..ab04d2b6 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java @@ -0,0 +1,101 @@ +/* +* 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.online.applet; + +import java.io.IOException; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.X509TrustManager; + +public class InternalSSLSocketFactory { + + private SSLSocketFactory factory; + + public static SSLSocketFactory getSocketFactory() throws InternalSSLSocketFactoryException { + return new InternalSSLSocketFactory().factory; + } + + public static HostnameVerifier getHostNameVerifier() throws InternalSSLSocketFactoryException { + return (new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }); + } + + public InternalSSLSocketFactory() throws InternalSSLSocketFactoryException { + SSLContext sslContext; + try { + sslContext = SSLContext.getInstance("TLSv1"); + sslContext.getClientSessionContext().setSessionTimeout(0); + KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); + + KeyStore keyStore = KeyStore.getInstance("JKS"); + keyStore.load(null, null); + keyManagerFactory.init(keyStore, null); + + sslContext.init(keyManagerFactory.getKeyManagers(), + new X509TrustManager[] { new AcceptAllTrustManager() }, + null); + } catch (NoSuchAlgorithmException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (CertificateException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (IOException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (KeyStoreException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (UnrecoverableKeyException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (KeyManagementException e) { + throw new InternalSSLSocketFactoryException(e); + } + + this.factory = sslContext.getSocketFactory(); + } + + class AcceptAllTrustManager implements X509TrustManager { + + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + public void checkClientTrusted(X509Certificate[] chain, String authType) { + } + + public void checkServerTrusted(X509Certificate[] chain, String authType) { + //FIXME + } + } +}; diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java new file mode 100644 index 00000000..c620284a --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java @@ -0,0 +1,45 @@ +/* +* 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.online.applet; + +/** + * + * @author mcentner + */ +public class InternalSSLSocketFactoryException extends Exception { + + public InternalSSLSocketFactoryException(Throwable cause) { + super(cause); + } + + public InternalSSLSocketFactoryException(String message, Throwable cause) { + super(message, cause); + } + + public InternalSSLSocketFactoryException(String message) { + super(message); + } + + public InternalSSLSocketFactoryException() { + } + +} diff --git a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties new file mode 100644 index 00000000..752004e8 --- /dev/null +++ b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties @@ -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. + +# -------- BEGIN bootstrap applet -----------# +java16required=This Applet requires Java 1.6 or higher to run. \ + Please download and install a recent version of Java. \ +

For Windows, Linux and Solaris plattforms you can download Java from \ + http://java.sun.com/javase/downloads.\ +

+ +failedtostart=Failed to start Applet. \ +

{0}

+# -------- END bootstrap applet -----------# + + +applet.name=Online Citicen Card Environment (CCE) + +nopcscsupport=The Java plattform does not seem to provide \ +a PC/SC interface to acces a smartcard. + +nocardterminal=Can not find a connected smartcard reader.\ +

Either there is no smartcard reader connected, or \ + no PC/SC driver is installed for a connected smartcard reader.

+ +insertcard=Please insert your citicen card (B\u00FCrgerkarte) into your \ + smartcard reader. + +unsupportedcard=The inserted smartcard is not supported.\ +

Please insert your citicen card (B\u00FCrgerkarte) \ + into your smartcard reader.

+ +enterpin=Please enter {0} \(min {1}, max {2} digits\). + +enterpinretries=Please enter {0} \(min {1}, max {2} digits, {3} retries left\). + +pinwrong=Entered PIN is wrong. + +button.ok=Ok + +button.cancel=Cancel + +status.findpcsc=Looking for PC/SC support + +status.findsupportedcard=Looking for a supported smartcard + +failed.WS=Webservice cannot be reached. \ No newline at end of file diff --git a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties new file mode 100644 index 00000000..e6b815e9 --- /dev/null +++ b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties @@ -0,0 +1,42 @@ +# 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. + +# -------- BEGIN bootstrap applet -----------# +java16required=Dieses Applet ben\u00F6tigt Java Version 1.6 oder h\u00F6her. \ + Bitte installieren sie eine aktulle Version von Java. \ +

F\u00FCr Windows, Linux and Solaris kann Java von \ + http://java.sun.com/javase/downloads \ + heruntergeladen werden.

+ +failedtostart=Das Applet konnte nicht gestartet werden. \ +

{0}

+# -------- END bootstrap applet -----------# + +applet.name=Online B\u00FCrgerkartenumgebung (BKU) + +nopcscsupport=Die Java-Installation stellt keine \ + PC/SC-Schnittstelle zum Zugriff auf eine Chipkarte zur Verf\u00FCgung. + +nocardterminal=Es konnte kein Chipkartenleser gefunden werden.\ +

Entweder, es ist kein Chipkartenleser angeschlossen, oder \ + f\u00FCr den angeschlossenen Chipkartenleser ist kein PC/SC-Treiber \ + installiert.

+ +insertcard=Bitte stecken Sie ihre B\u00FCrgerkarte in den Chipkartenleser. + +unsupportedcard=Die gesteckte Chipkarte wird nicht unterst\u00FCtzt.\ +

Bitte stecken Sie ihre B\u00FCrgerkare in den Chipkartenleser

+ +failed.WS=Das Webservice kann nicht erreicht werden. \ No newline at end of file diff --git a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png new file mode 100644 index 00000000..eee4be4f Binary files /dev/null and b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png differ diff --git a/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java b/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java new file mode 100644 index 00000000..9b58798d --- /dev/null +++ b/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java @@ -0,0 +1,96 @@ +/* +* 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.stal.client; + +import static org.junit.Assert.assertNotNull; + +import java.net.MalformedURLException; +import java.net.URL; + +import javax.xml.namespace.QName; + +import org.junit.Test; + +import at.gv.egiz.stal.InfoboxReadRequest; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.service.GetHashDataInputFault; +import at.gv.egiz.stal.service.GetHashDataInputResponseType; +import at.gv.egiz.stal.service.GetHashDataInputType; +import at.gv.egiz.stal.service.GetNextRequestResponseType; +import at.gv.egiz.stal.service.GetNextRequestType; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.STALService; + +/** + * + * @author clemens + */ +public class STALServiceTest { + +// @Test + public void callSTAL() { + try { + URL endpointURL = new URL("http://localhost:8080/bkuonline/stal?wsdl"); + QName endpointName = new QName("http://www.egiz.gv.at/wsdl/stal", "STALService"); + STALService stal = new STALService(endpointURL, endpointName); +// stal = new STALService(); + STALPortType port = stal.getSTALPort(); + + GetNextRequestType nrReq = new GetNextRequestType(); + nrReq.setSessionId("TestSession"); //STALServiceImpl.TEST_SESSION_ID); +// req.getResponse().add(new ErrorResponse(1234)); + GetNextRequestResponseType nrResp = port.getNextRequest(nrReq); + assertNotNull(nrResp); + System.out.println("got response: " + nrResp.getRequest().size()); + for (STALRequest stalReq : nrResp.getRequest()) { + if (stalReq instanceof InfoboxReadRequest) { + String ibid = ((InfoboxReadRequest) stalReq).getInfoboxIdentifier(); + String did = ((InfoboxReadRequest) stalReq).getDomainIdentifier(); + System.out.println(" received InfoboxReadRequest for " + ibid + ", " + did); + } else { + System.out.println(" received STAL request " + stalReq.getClass().getName()); + } + } + + GetHashDataInputType hdReq = new GetHashDataInputType(); + hdReq.setSessionId("TestSession"); //STALServiceImpl.TEST_SESSION_ID); + GetHashDataInputType.Reference ref = new GetHashDataInputType.Reference(); + ref.setID("refId"); + hdReq.getReference().add(ref); + GetHashDataInputResponseType hdResp = port.getHashDataInput(hdReq); + GetHashDataInputResponseType.Reference hdRef = hdResp.getReference().get(0); + System.out.println("got HashDataInput " + new String(hdRef.getValue())); + + + } catch (GetHashDataInputFault ex) { + ex.printStackTrace(); + } catch (MalformedURLException ex) { + ex.printStackTrace(); + } + } + + @Test + public void testSTAL() { + //TODO + } + +} -- cgit v1.2.3