diff options
691 files changed, 22547 insertions, 16077 deletions
diff --git a/BKUApplet/keystore.ks b/BKUApplet/keystore.ks Binary files differindex 824c3a40..ba0b4652 100644 --- a/BKUApplet/keystore.ks +++ b/BKUApplet/keystore.ks diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml index de0d95ff..1c27294e 100644 --- a/BKUApplet/pom.xml +++ b/BKUApplet/pom.xml @@ -1,14 +1,14 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>BKUApplet</artifactId> <name>BKU Applet</name> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <build> <plugins> <plugin> @@ -20,28 +20,13 @@ <goal>unpack-dependencies</goal> </goals> <configuration> - <includeGroupIds>at.gv.egiz</includeGroupIds> + <includeScope>runtime</includeScope> <!-- don't include transitive dependency BKUFonts [runtime] from BKUCommonGUI --> - <excludeTransitive>true</excludeTransitive> + <excludeTransitive>false</excludeTransitive> <outputDirectory>${project.build.outputDirectory}</outputDirectory> <excludes>META-INF\/</excludes> </configuration> </execution> - <execution> - <!-- appletviewer target/test-classes/appletTest.html - | commons-logging and iaik_jce_me4se are transitive dependencies - |--> - <id>copy_testapplet</id> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory>${project.build.directory}/test-classes</outputDirectory> - <includeGroupIds>at.gv.egiz,commons-logging,iaik</includeGroupIds> - <includeArtifactIds>commons-logging,iaik_jce_me4se</includeArtifactIds> - <stripVersion>true</stripVersion> - </configuration> - </execution> </executions> </plugin> <plugin> @@ -118,27 +103,43 @@ <dependency> <groupId>at.gv.egiz</groupId> <artifactId>smcc</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + <optional>true</optional> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>STAL</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + <optional>true</optional> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>STALService</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + <optional>true</optional> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>smccSTAL</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + <optional>true</optional> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUCommonGUI</artifactId> - <version>1.2.14-SNAPSHOT</version> - </dependency> + <version>${project.parent.version}</version> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-jdk14</artifactId> + <scope>runtime</scope> + <optional>true</optional> + </dependency> </dependencies> </project>
\ No newline at end of file diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java index d5f8dd69..6fa9d45f 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java @@ -37,12 +37,17 @@ import java.util.List; import javax.xml.bind.JAXBElement; import javax.xml.ws.WebServiceException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> */ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { + private final Logger log = LoggerFactory.getLogger(AbstractBKUWorker.class); + protected BKUApplet applet; protected String sessionId; @@ -55,7 +60,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { sessionId = applet.getParameter(BKUApplet.SESSION_ID); if (sessionId == null) { sessionId = "TestSession"; - log.warn("using dummy sessionId " + sessionId); + log.warn("Using dummy sessionId {}.", sessionId); } } @@ -85,7 +90,8 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { // (rather use validator) if (requests.size() == 0) { - log.error("Received empty NextRequestResponse: no STAL requests to handle. (STAL-X requests might not have gotten unmarshalled)"); + log.error("Received empty NextRequestResponse: no STAL requests to handle. " + + "(STAL-X requests might not have gotten unmarshalled)"); throw new RuntimeException("No STAL requests to handle."); } @@ -105,7 +111,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { try { stalRequests.add(stalTranslator.translate(req)); } catch (TranslationException ex) { - log.error("Received unknown request from server STAL: " + ex.getMessage()); + log.error("Received unknown request from server STAL. {}", ex.getMessage()); throw new RuntimeException(ex); } } @@ -117,7 +123,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { try { responses.add(stalTranslator.translate(stalResponse)); } catch (TranslationException ex) { - log.error("Received unknown response from STAL: " + ex.getMessage()); + log.error("Received unknown response from STAL.{}", ex.getMessage()); throw new RuntimeException(ex); } } @@ -131,7 +137,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { } else { Throwable cause = ex.getCause(); if (cause != null && cause instanceof InterruptedException) { - log.info("do not return error response, client might want to resume session"); + log.info("Do not return error response, client might want to resume session."); finished = true; } err.setErrorCode(4000); @@ -160,13 +166,13 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { } while (!finished); - log.info("Finished " + Thread.currentThread().getName()); + log.info("Finished {}.", Thread.currentThread().getName()); } catch (WebServiceException ex) { - log.fatal("communication error with server STAL: " + ex.getMessage(), ex); + log.error("Communication error with server STAL: {}.", ex.getMessage(), ex); showErrorDialog(BKUGUIFacade.ERR_SERVICE_UNREACHABLE, ex); } catch (MalformedURLException ex) { - log.fatal(ex.getMessage(), ex); + log.error(ex.getMessage(), ex); showErrorDialog(BKUGUIFacade.ERR_CONFIG, ex); } catch (Exception ex) { log.error(ex.getMessage(), ex); @@ -213,7 +219,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { try { waitForAction(); } catch (InterruptedException e) { - log.error(e); + log.error("Interrupted.", e); } } diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletSecureViewer.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletSecureViewer.java index c67699af..e9f36c2f 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletSecureViewer.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletSecureViewer.java @@ -33,8 +33,8 @@ import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -42,7 +42,7 @@ import org.apache.commons.logging.LogFactory; */ public class AppletSecureViewer implements SecureViewer { - private static final Log log = LogFactory.getLog(AppletSecureViewer.class); + private static final Logger log = LoggerFactory.getLogger(AppletSecureViewer.class); protected BKUGUIFacade gui; protected STALPortType stalPort; @@ -81,8 +81,7 @@ public class AppletSecureViewer implements SecureViewer { throws DigestException, Exception { if (verifiedDataToBeSigned == null) { - log.info("retrieve data to be signed for dsig:SignedInfo " + - signedInfo.getId()); + log.info("Retrieve data to be signed for dsig:SignedInfo {}.", signedInfo.getId()); List<GetHashDataInputResponseType.Reference> hdi = getHashDataInput(signedInfo.getReference()); verifiedDataToBeSigned = verifyHashDataInput(signedInfo.getReference(), @@ -106,16 +105,12 @@ public class AppletSecureViewer implements SecureViewer { GetHashDataInputType request = new GetHashDataInputType(); request.setSessionId(sessId); -// HashMap<String, ReferenceType> idSignedRefMap = new HashMap<String, ReferenceType>(); for (ReferenceType signedRef : signedReferences) { //don't get Manifest, QualifyingProperties, ... if (signedRef.getType() == null) { String signedRefId = signedRef.getId(); if (signedRefId != null) { - if (log.isTraceEnabled()) { - log.trace("requesting hashdata input for reference " + signedRefId); - } -// idSignedRefMap.put(signedRefId, signedRef); + log.trace("Requesting hashdata input for reference {}.", signedRefId); GetHashDataInputType.Reference ref = new GetHashDataInputType.Reference(); ref.setID(signedRefId); request.getReference().add(ref); @@ -127,12 +122,14 @@ public class AppletSecureViewer implements SecureViewer { } if (request.getReference().size() < 1) { - log.error("No signature data (apart from any QualifyingProperties or a Manifest) for session " + sessId); + log.error("No signature data (apart from any QualifyingProperties or a Manifest) for session {}.", sessId); throw new Exception("No signature data (apart from any QualifyingProperties or a Manifest)"); } if (log.isDebugEnabled()) { - log.debug("WebService call GetHashDataInput for " + request.getReference().size() + " references in session " + sessId); + log.debug( + "WebService call GetHashDataInput for {} references in session {}.", + request.getReference().size(), sessId); } GetHashDataInputResponseType response = stalPort.getHashDataInput(request); return response.getReference(); @@ -154,7 +151,7 @@ public class AppletSecureViewer implements SecureViewer { for (ReferenceType signedRef : signedReferences) { if (signedRef.getType() == null) { - log.info("Verifying digest for signed reference " + signedRef.getId()); + log.info("Verifying digest for signed reference {}.", signedRef.getId()); String signedRefId = signedRef.getId(); byte[] signedDigest = signedRef.getDigestValue(); @@ -191,12 +188,9 @@ public class AppletSecureViewer implements SecureViewer { byte[] hashDataInputDigest = digest(hdi, signedDigestAlg); - if (log.isDebugEnabled()) { - log.debug("Comparing digest to claimed digest value for reference " + signedRefId); - } -// log.warn("***************** DISABLED HASHDATA VERIFICATION"); + log.debug("Comparing digest to claimed digest value for reference {}.", signedRefId); if (!Arrays.equals(hashDataInputDigest, signedDigest)) { - log.error("Bad digest value for reference " + signedRefId); + log.error("Bad digest value for reference {}.", signedRefId); throw new DigestException("Bad digest value for reference " + signedRefId); } @@ -207,7 +201,6 @@ public class AppletSecureViewer implements SecureViewer { return verifiedHashDataInputs; } - //TODO private byte[] digest(byte[] hashDataInput, String mdAlg) throws NoSuchAlgorithmException { if ("http://www.w3.org/2000/09/xmldsig#sha1".equals(mdAlg)) { mdAlg = "SHA-1"; 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 index 2fa4889a..7873b263 100644 --- 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 @@ -18,8 +18,6 @@ package at.gv.egiz.bku.online.applet; import at.gv.egiz.bku.online.applet.viewer.URLFontLoader; import at.gv.egiz.bku.gui.BKUGUIFacade.Style; -import at.gv.egiz.bku.gui.DefaultHelpListener; -import at.gv.egiz.bku.gui.AbstractHelpListener; import at.gv.egiz.bku.gui.SwitchFocusListener; import at.gv.egiz.smcc.SignatureCardFactory; import at.gv.egiz.stal.service.translator.STALTranslator; @@ -35,11 +33,13 @@ import javax.net.ssl.HttpsURLConnection; import javax.swing.JApplet; import javax.swing.JPanel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIImpl; +import at.gv.egiz.bku.gui.DeafHelpListener; +import at.gv.egiz.bku.gui.HelpListener; import at.gv.egiz.bku.gui.viewer.FontProvider; import at.gv.egiz.stal.service.STALPortType; import at.gv.egiz.stal.service.STALService; @@ -56,7 +56,9 @@ import javax.xml.namespace.QName; public class BKUApplet extends JApplet { private static final long serialVersionUID = 1L; - private static Log log = LogFactory.getLog(BKUApplet.class); + + private final Logger log = LoggerFactory.getLogger(BKUApplet.class); + /** * Applet parameter keys */ @@ -71,8 +73,9 @@ public class BKUApplet extends JApplet { public static final String BACKGROUND_COLOR = "BackgroundColor"; public static final String REDIRECT_URL = "RedirectURL"; public static final String REDIRECT_TARGET = "RedirectTarget"; - public static final String HASHDATA_DISPLAY_FRAME = "frame"; public static final String ENFORCE_RECOMMENDED_PIN_LENGTH = "EnforceRecommendedPINLength"; + + /** * STAL WSDL namespace and service name */ @@ -88,22 +91,21 @@ public class BKUApplet extends JApplet { static { String tmp = UNKNOWN_VERSION; + Logger log = LoggerFactory.getLogger(BKUApplet.class); try { String BKUAppletJar = BKUApplet.class.getProtectionDomain().getCodeSource().getLocation().toString(); URL manifestURL = new URL("jar:" + BKUAppletJar + "!/META-INF/MANIFEST.MF"); - if (log.isTraceEnabled()) { - log.trace("read version information from " + manifestURL); - } + 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); + log.error("Failed to read version.", ex); } finally { VERSION = tmp; - log.debug("BKU Applet " + VERSION); + log.debug("BKU Applet {}.", VERSION); } } @@ -112,6 +114,7 @@ public class BKUApplet extends JApplet { */ protected AppletBKUWorker worker; protected Thread workerThread; + protected HelpListener helpListener; /* * (non-Javadoc) @@ -139,16 +142,15 @@ public class BKUApplet extends JApplet { "URL for locating help files, e.g. '../help/' (no help provided if missing)"}}; } - /** * Factory method to create and wire HelpListener, GUI and BKUWorker. * (Config via applet parameters, see BKUApplet.* constants) */ @Override public void init() { - log.info("Welcome to MOCCA " + VERSION); - log.trace("Called init()"); - showStatus("Initializing MOCCA applet"); + log.info("Welcome to MOCCA {}.", VERSION); + log.trace("Called init()."); + showStatus("Initializing MOCCA applet."); HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance()); @@ -156,12 +158,12 @@ public class BKUApplet extends JApplet { if (locale != null) { this.setLocale(new Locale(locale)); } - log.trace("default locale: " + Locale.getDefault()); - log.debug("setting locale: " + getLocale()); + log.trace("Default locale: {}.", Locale.getDefault()); + log.debug("Applet locale set to: {}.", getLocale()); if (Boolean.parseBoolean(getParameter(ENFORCE_RECOMMENDED_PIN_LENGTH))) { SignatureCardFactory.ENFORCE_RECOMMENDED_PIN_LENGTH = true; - log.debug("enforce recommended pin length = " + SignatureCardFactory.ENFORCE_RECOMMENDED_PIN_LENGTH); + log.debug("Enforce recommended pin length = {}.", SignatureCardFactory.ENFORCE_RECOMMENDED_PIN_LENGTH); } BKUGUIFacade.Style guiStyle; @@ -173,27 +175,30 @@ public class BKUApplet extends JApplet { } else { guiStyle = BKUGUIFacade.Style.simple; } - log.debug("setting gui-style: " + guiStyle); + log.debug("Setting gui-style: {}.", guiStyle); URL backgroundImgURL = null; try { backgroundImgURL = getURLParameter(BACKGROUND_IMG, null); - log.debug("setting background: " + backgroundImgURL); + log.debug("Setting background: {}.", backgroundImgURL); } catch (MalformedURLException ex) { - log.warn("cannot load applet background image: " + ex.getMessage()); + log.warn("Cannot load applet background image. {}", ex.getMessage()); } - AbstractHelpListener helpListener = null; - try { - helpListener = new DefaultHelpListener(getAppletContext(), - getURLParameter(HELP_URL, null), getLocale()); - if (log.isDebugEnabled()) { - log.debug("setting helpURL: " + getURLParameter(HELP_URL, null)); - } - } catch (MalformedURLException ex) { - log.warn("failed to load help URL: " + ex.getMessage() + ", disabling help"); - } + helpListener = new DeafHelpListener(getParameter(HELP_URL), getLocale()); + SwitchFocusListener switchFocusListener = new SwitchFocusListener( + getAppletContext(), "focusToBrowser"); + + +//ViewerHelpListener example: +// try { +// String absoluteHelpURL = new URL(getCodeBase(), getParameter(HELP_URL)).toString(); +// helpListener = new ViewerHelpListener(getAppletContext(), absoluteHelpURL, getLocale()); +// } catch (MalformedURLException ex) { +// log.error("invalid help URL, help disabled", ex); +// } + // Note: We need a panel in order to be able to set the background // properly. // Setting the background without a panel has side effects with the @@ -205,10 +210,10 @@ public class BKUApplet extends JApplet { if (backgroundColor != null && backgroundColor.startsWith("#")) { try { Color color = new Color(Integer.parseInt(backgroundColor.substring(1), 16)); - log.debug("setting background color to " + color); + log.debug("Setting background color to {}.", color); contentPanel.setBackground(color); } catch (NumberFormatException e) { - log.debug("failed to set background color '" + backgroundColor + "'"); + log.debug("Failed to set background color '{}'.", backgroundColor); } } @@ -216,30 +221,30 @@ public class BKUApplet extends JApplet { URLFontLoader fontProvider = new URLFontLoader(getCodeBase()); fontProvider.loadInBackground(); BKUGUIFacade gui = createGUI(contentPanel, getLocale(), guiStyle, - backgroundImgURL, fontProvider, helpListener, null); + backgroundImgURL, fontProvider, helpListener, switchFocusListener); worker = createBKUWorker(this, gui); } catch (MalformedURLException ex) { - log.fatal("failed to load font provider URL", ex); + log.error("Failed to load font provider URL.", ex); System.err.println("invalid font provider URL " + ex.getMessage()); } } @Override public void start() { - log.trace("Called start()"); + log.trace("Called start()."); if (worker != null) { showStatus("Starting MOCCA applet"); workerThread = new Thread(worker); workerThread.start(); } else { - log.debug("cannot start uninitialzed MOCCA applet"); + log.debug("Cannot start uninitialzed MOCCA applet."); } } @Override public void stop() { - log.trace("Called stop()"); + log.trace("Called stop()."); showStatus("Stopping MOCCA applet"); if ((workerThread != null) && (workerThread.isAlive())) { workerThread.interrupt(); @@ -248,7 +253,11 @@ public class BKUApplet extends JApplet { @Override public void destroy() { - log.trace("Called destroy()"); + log.trace("Called destroy()."); + } + + public String getHelpURL() { + return helpListener.getHelpURL(); } // /////////////////////////////////////////////////////////////////////////// @@ -256,7 +265,7 @@ public class BKUApplet extends JApplet { // /////////////////////////////////////////////////////////////////////////// protected BKUGUIFacade createGUI(Container contentPane, Locale locale, Style guiStyle, URL backgroundImgURL, - FontProvider fontProvider, AbstractHelpListener helpListener, + FontProvider fontProvider, HelpListener helpListener, SwitchFocusListener switchFocusListener) { return new BKUGUIImpl(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener, switchFocusListener); @@ -277,7 +286,7 @@ public class BKUApplet extends JApplet { */ public STALPortType getSTALPort() throws MalformedURLException { URL wsdlURL = getURLParameter(WSDL_URL, null); - log.debug("setting STAL WSDL: " + wsdlURL); + log.debug("Setting STAL WSDL: {}.", wsdlURL); QName endpointName = new QName(STAL_WSDL_NS, STAL_SERVICE); STALService stal = new STALService(wsdlURL, endpointName); return stal.getSTALPort(); @@ -304,25 +313,26 @@ public class BKUApplet extends JApplet { try { AppletContext ctx = getAppletContext(); if (ctx == null) { - log.error("no applet context (applet might already have been destroyed)"); + log.error("No applet context (applet might already have been destroyed)."); return; } URL redirectURL = getURLParameter(REDIRECT_URL, sessionId); String redirectTarget = getParameter(REDIRECT_TARGET); if (redirectTarget == null) { - log.info("Done. Redirecting to " + redirectURL + " ..."); + log.info("Done. Redirecting to {}.", redirectURL); ctx.showDocument(redirectURL); } else { - log.info("Done. Redirecting to " + redirectURL + " (target=" + redirectTarget + ") ..."); + log.info("Done. Redirecting to {} (target={}).", redirectURL, redirectTarget); ctx.showDocument(redirectURL, redirectTarget); } } catch (MalformedURLException ex) { - log.warn("Failed to redirect: " + ex.getMessage(), ex); - // gui.showErrorDialog(errorMsg, okListener, actionCommand) + log.warn("Failed to redirect.", ex); } } public void getFocusFromBrowser() { + + log.debug("Obtained focus from browser."); worker.getFocusFromBrowser(); } @@ -348,11 +358,11 @@ public class BKUApplet extends JApplet { } return url; } catch (MalformedURLException ex) { - log.error("applet paremeter " + urlParam + " is not a valid URL: " + ex.getMessage()); + log.error("Applet paremeter {} ist not a valid URL. {}", urlParam, ex.getMessage()); throw ex; } } else { - log.error("applet paremeter " + paramKey + " not set"); + log.error("Applet paremeter {} not set.", paramKey); throw new MalformedURLException(paramKey + " not set"); } } 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 index a02e56eb..c9bf81ca 100644 --- 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 @@ -31,8 +31,8 @@ import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class InternalSSLSocketFactory extends SSLSocketFactory { @@ -40,8 +40,7 @@ public class InternalSSLSocketFactory extends SSLSocketFactory { private static InternalSSLSocketFactory instance = new InternalSSLSocketFactory(); - private final static Log log = LogFactory - .getLog(InternalSSLSocketFactory.class); + private final Logger log = LoggerFactory.getLogger(InternalSSLSocketFactory.class); private SSLSocket sslSocket; @@ -107,19 +106,19 @@ public class InternalSSLSocketFactory extends SSLSocketFactory { } public boolean isEgovAgency() { - log.info("Checking if server is egov agency"); + log.info("Checking if server is egov agency."); if (sslSocket != null) { try { X509Certificate cert = (X509Certificate) sslSocket.getSession() .getPeerCertificates()[0]; - log.info("Server cert: " + cert); + log.info("Server cert: {}.", cert); return isGovAgency(cert); } catch (SSLPeerUnverifiedException e) { - log.error(e); + log.error("Failed to check server cert.", e); return false; } } - log.info("Not a SSL connection"); + log.info("Not a SSL connection."); return false; } @@ -146,7 +145,8 @@ public class InternalSSLSocketFactory extends SSLSocketFactory { } } } catch (CertificateParsingException e) { - log.error(e); + Logger log = LoggerFactory.getLogger(InternalSSLSocketFactory.class); + log.error("Failed to parse certificate.", e); } if ((cert.getExtensionValue("1.2.40.0.10.1.1.1") != null) || (cert.getExtensionValue("1.2.40.0.10.1.1.2") != null)) { diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/viewer/URLFontLoader.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/viewer/URLFontLoader.java index 49615887..d30080d0 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/viewer/URLFontLoader.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/viewer/URLFontLoader.java @@ -16,17 +16,20 @@ */ package at.gv.egiz.bku.online.applet.viewer; -import at.gv.egiz.bku.gui.viewer.FontProviderException; -import at.gv.egiz.bku.gui.viewer.FontProvider; import java.awt.Font; import java.awt.FontFormatException; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.ExecutionException; + import javax.swing.SwingWorker; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.gui.viewer.FontProvider; +import at.gv.egiz.bku.gui.viewer.FontProviderException; /** * @@ -34,29 +37,24 @@ import org.apache.commons.logging.LogFactory; */ public class URLFontLoader extends SwingWorker<Font, Object> implements FontProvider { - protected static final Log log = LogFactory.getLog(URLFontLoader.class); + private final Logger log = LoggerFactory.getLogger(URLFontLoader.class); + protected URL fontURL; protected Font font; public URLFontLoader(URL codebase) throws MalformedURLException { this.fontURL = new URL(codebase, SANSMONO_FONT_RESOURCE); - if (log.isDebugEnabled()) { - log.debug("[" + Thread.currentThread().getName() + "] setting font load URL: " + fontURL); - } + log.debug("[{}] setting font load URL: {}.", Thread.currentThread().getName(), fontURL); } public void loadInBackground() { - if (log.isDebugEnabled()) { - log.debug("[" + Thread.currentThread().getName() + "] scheduling font loading in background: " + fontURL); - } + log.debug("[{}] scheduling font loading in background: {}.", Thread.currentThread().getName(), fontURL); this.execute(); } @Override protected Font doInBackground() throws MalformedURLException, FontFormatException, IOException { - if (log.isDebugEnabled()) { - log.debug("[" + Thread.currentThread().getName() + "] loading font in background..."); - } + log.debug("[{}] loading font in background.", Thread.currentThread().getName()); return Font.createFont(Font.TRUETYPE_FONT, fontURL.openStream()); } @@ -67,16 +65,15 @@ public class URLFontLoader extends SwingWorker<Font, Object> implements FontProv */ @Override public Font getFont() throws FontProviderException { - log.debug("[" + Thread.currentThread().getName() + "] get font (EDT?)"); + log.debug("[{}] get font (EDT?)", Thread.currentThread().getName()); try { return get(); } catch (InterruptedException ex) { - log.error("font loader interrupted"); -// Thread.currentThread().interrupt(); - throw new FontProviderException("font loader interrupted", ex); + log.error("Font loader interrupted."); + throw new FontProviderException("Font loader interrupted.", ex); } catch (ExecutionException ex) { - log.error("failed to load font", ex.getCause()); - throw new FontProviderException("failed to load font", ex.getCause()); + log.error("Failed to load font. {}", ex.getCause()); + throw new FontProviderException("Failed to load font.", ex.getCause()); } } } diff --git a/BKUApplet/src/main/resources/simplelog.properties b/BKUApplet/src/main/resources/simplelog.properties deleted file mode 100644 index d62508cf..00000000 --- a/BKUApplet/src/main/resources/simplelog.properties +++ /dev/null @@ -1,25 +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. - -# Logging detail level, -# Must be one of ("trace", "debug", "info", "warn", "error", or "fatal"). -org.apache.commons.logging.simplelog.defaultlog=debug -# Logs the Log instance used -org.apache.commons.logging.simplelog.showlogname=true -#Logs the class name with package(or Path) -#( Valid Values "true","false". Default Value "true") -org.apache.commons.logging.simplelog.showShortLogname=true -#Logs date and time( Valid Values "true","false". Default Value "false") -org.apache.commons.logging.simplelog.showdatetime=false diff --git a/BKUAppletExt/keystore.ks b/BKUAppletExt/keystore.ks Binary files differindex 824c3a40..ba0b4652 100644 --- a/BKUAppletExt/keystore.ks +++ b/BKUAppletExt/keystore.ks diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index b79dd260..c60864bc 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -1,45 +1,62 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>BKUAppletExt</artifactId> <name>BKU Applet Extension</name> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <description /> <dependencies> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>STALExt</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + <optional>true</optional> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>STALXService</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + <optional>true</optional> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>smccSTAL</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + <optional>true</optional> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUApplet</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + <optional>true</optional> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUGuiExt</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + <optional>true</optional> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>smccSTALExt</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-jdk14</artifactId> + <scope>runtime</scope> + <optional>true</optional> </dependency> </dependencies> <build> @@ -98,8 +115,8 @@ <goal>unpack-dependencies</goal> </goals> <configuration> - <includeGroupIds>at.gv.egiz</includeGroupIds> - <excludeTransitive>true</excludeTransitive> + <includeScope>runtime</includeScope> + <excludeTransitive>false</excludeTransitive> <outputDirectory>${project.build.outputDirectory}</outputDirectory> <excludes>META-INF\/</excludes> </configuration> 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 4f2f1331..b8526730 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 @@ -16,13 +16,12 @@ */ package at.gv.egiz.bku.online.applet; -import at.gv.egiz.bku.gui.AbstractHelpListener; import at.gv.egiz.bku.gui.ActivationGUI; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.SwitchFocusListener; import at.gv.egiz.bku.gui.BKUGUIFacade.Style; +import at.gv.egiz.bku.gui.HelpListener; import at.gv.egiz.bku.gui.viewer.FontProvider; -import at.gv.egiz.bku.online.applet.BKUApplet; import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; import at.gv.egiz.bku.smccstal.CardMgmtRequestHandler; import at.gv.egiz.stal.ext.APDUScriptRequest; @@ -35,8 +34,8 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.Locale; import javax.xml.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -45,7 +44,7 @@ import org.apache.commons.logging.LogFactory; public class ActivationApplet extends BKUApplet { private static final long serialVersionUID = 1L; - private static Log log = LogFactory.getLog(ActivationApplet.class); + private final Logger log = LoggerFactory.getLogger(ActivationApplet.class); @Override public void init() { @@ -53,7 +52,7 @@ public class ActivationApplet extends BKUApplet { if (worker instanceof AbstractSMCCSTAL) { CardMgmtRequestHandler handler = new CardMgmtRequestHandler(); ((AbstractSMCCSTAL) worker).addRequestHandler(APDUScriptRequest.class, handler); - log.debug("Registered CardMgmtRequestHandler"); + log.debug("Registered CardMgmtRequestHandler."); } else { log.warn("Cannot register CardMgmtRequestHandler."); } @@ -67,9 +66,9 @@ public class ActivationApplet extends BKUApplet { @Override public STALPortType getSTALPort() throws MalformedURLException { URL wsdlURL = getURLParameter(WSDL_URL, null); - log.debug("setting STAL WSDL: " + wsdlURL); + log.debug("Setting STAL WSDL: {}.", wsdlURL); QName endpointName = new QName(STAL_WSDL_NS, STAL_SERVICE); - log.info("creating STAL-X enabled webservice port"); + log.info("Creating STAL-X enabled webservice port."); STALService stal = new STALService(wsdlURL, endpointName); return stal.getSTALPort(); } @@ -87,7 +86,7 @@ public class ActivationApplet extends BKUApplet { Style guiStyle, URL backgroundImgURL, FontProvider fontProvider, - AbstractHelpListener helpListener, + HelpListener helpListener, SwitchFocusListener switchFocusListener) { return new ActivationGUI(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener, switchFocusListener); } diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java index bf323969..99e7ca3c 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java @@ -16,8 +16,8 @@ */ package at.gv.egiz.bku.online.applet; -import at.gv.egiz.bku.gui.AbstractHelpListener; import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.bku.gui.HelpListener; import at.gv.egiz.bku.gui.PINManagementGUI; import at.gv.egiz.bku.gui.PINManagementGUIFacade; import at.gv.egiz.bku.gui.SwitchFocusListener; @@ -25,31 +25,29 @@ import at.gv.egiz.bku.gui.viewer.FontProvider; import java.awt.Container; import java.net.URL; import java.util.Locale; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** - * + * * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> */ public class PINManagementApplet extends BKUApplet { - private static final long serialVersionUID = 1L; - private static Log log = LogFactory.getLog(PINManagementApplet.class); + private static final long serialVersionUID = 1L; + + @Override + protected BKUGUIFacade createGUI(Container contentPane, Locale locale, + BKUGUIFacade.Style guiStyle, URL backgroundImgURL, + FontProvider fontProvider, HelpListener helpListener, + SwitchFocusListener switchFocusListener) { + return new PINManagementGUI(contentPane, locale, guiStyle, + backgroundImgURL, fontProvider, helpListener, + switchFocusListener); + } + + @Override + protected AppletBKUWorker createBKUWorker(BKUApplet applet, BKUGUIFacade gui) { + return new PINManagementBKUWorker(applet, (PINManagementGUIFacade) gui); + } - @Override - protected BKUGUIFacade createGUI(Container contentPane, - Locale locale, - BKUGUIFacade.Style guiStyle, - URL backgroundImgURL, - FontProvider fontProvider, - AbstractHelpListener helpListener, - SwitchFocusListener switchFocusListener) { - return new PINManagementGUI(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener, switchFocusListener); - } - @Override - protected AppletBKUWorker createBKUWorker(BKUApplet applet, BKUGUIFacade gui) { - return new PINManagementBKUWorker(applet, (PINManagementGUIFacade) gui); - } } 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 5dedcedb..b9f31f42 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 @@ -22,15 +22,16 @@ 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; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * This BKU Worker does not connect to STAL webservice * (no Internet connection permitted while activating PINs). @@ -38,6 +39,8 @@ import java.util.List; * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> */ public class PINManagementBKUWorker extends AppletBKUWorker { + + private final Logger log = LoggerFactory.getLogger(PINManagementBKUWorker.class); public PINManagementBKUWorker(BKUApplet applet, PINManagementGUIFacade gui) { super(applet, gui); @@ -59,9 +62,9 @@ public class PINManagementBKUWorker extends AppletBKUWorker { if (responses.size() == 1) { STALResponse response = responses.get(0); if (response instanceof PINManagementResponse) { - log.debug("PIN management dialog terminated"); + log.debug("PIN management dialog terminated."); } else if (response instanceof ErrorResponse) { - log.debug("PIN management dialog terminated with error"); + log.debug("PIN management dialog terminated with error."); } else { throw new RuntimeException("Invalid STAL response: " + response.getClass().getName()); } diff --git a/BKUCertificates/pom.xml b/BKUCertificates/pom.xml index eb7541aa..8227014f 100644 --- a/BKUCertificates/pom.xml +++ b/BKUCertificates/pom.xml @@ -1,9 +1,9 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <groupId>at.gv.egiz</groupId> <artifactId>BKUCertificates</artifactId> diff --git a/BKUCommonGUI/pom.xml b/BKUCommonGUI/pom.xml index e426f7fe..ccb47235 100644 --- a/BKUCommonGUI/pom.xml +++ b/BKUCommonGUI/pom.xml @@ -1,33 +1,26 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>BKUCommonGUI</artifactId> <name>BKU GUI</name> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <dependencies> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>smcc</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>STAL</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <scope>compile</scope> </dependency> - <!-- see BKUFonts.pom - <dependency> - <groupId>at.gv.egiz</groupId> - <artifactId>BKUFonts</artifactId> - <version>1.0</version> - <scope>runtime</scope> - </dependency--> </dependencies> <build> <plugins> diff --git a/BKUCommonGUI/src/main/java/META-INF/MANIFEST.MF b/BKUCommonGUI/src/main/java/META-INF/MANIFEST.MF deleted file mode 100644 index 5e949512..00000000 --- a/BKUCommonGUI/src/main/java/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0
-Class-Path:
-
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 deleted file mode 100644 index 6fd1ffea..00000000 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java +++ /dev/null @@ -1,103 +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.ActionEvent; -import java.awt.event.ActionListener; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Locale; -import java.util.ResourceBundle; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Implement the showDocument(URL) method to provide an actual HelpListener. - * This class does not keep a GUI reference and subclasses should not interfere with the GUI. - * Therefore, any errors occurring in showDocument() should be handled/displayed within - * showDocument() and exceptions thrown from showDocument() are logged, not displayed in the GUI. - * <br/> - * The help URL is build as [baseURL]/[locale]/[helpTopic].html - * (note that no session information is contained). - * - * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> - */ -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; - protected ResourceBundle messages; - - public AbstractHelpListener(URL baseURL, Locale locale) { - if (baseURL == null || "".equals(baseURL.toString())) { - throw new RuntimeException("no help URL provided"); - } - this.baseURL = baseURL; - this.locale = locale; - if (locale != null) { - messages = ResourceBundle.getBundle(BKUGUIFacade.MESSAGES_BUNDLE, locale); - } else { - messages = ResourceBundle.getBundle(BKUGUIFacade.MESSAGES_BUNDLE); - } - } - - @Override - public void actionPerformed(ActionEvent e) { - log.debug("received help action: " + e.getActionCommand()); - URL helpURL = constructHelpURL(baseURL, e.getActionCommand()); - try { - showDocument(helpURL, e.getActionCommand()); - } catch (Exception ex) { - log.error("could not display help document " + helpURL + ": " + ex.getMessage()); - } - } - - private URL constructHelpURL(URL baseURL, String helpTopic) { - URL helpURL = baseURL; - log.trace("constructing help URL: " + helpURL); - try { - // 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, "de/" + helpTopic + ".html"); - log.trace("constructing help URL: " + helpURL); - } - } catch (MalformedURLException ex) { - log.error("Failed to construct help URL for help item " + helpTopic + ": " + ex.getMessage()); - } - return helpURL; - } - - /** - * Errors from HelpListeners should not (are not) displayed in the applet, - * but should rather be in the HelpListener specific way. - * Therefore, implementations SHOULD NOT throw exceptions (these are only logged). - * @param helpDocument - * @throws java.lang.Exception - */ - public abstract void showDocument(URL helpDocument, String helpTopic) throws Exception; -} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index 1e23c64c..b7ab156f 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -17,7 +17,7 @@ package at.gv.egiz.bku.gui; import at.gv.egiz.stal.HashDataInput; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import java.awt.Color; import java.awt.event.ActionListener; import java.util.List; @@ -46,10 +46,14 @@ public interface BKUGUIFacade { public static final String DEFAULT_BACKGROUND = "/at/gv/egiz/bku/gui/chip32.png"; public static final String DEFAULT_ICON = "/at/gv/egiz/bku/gui/chiperling105.png"; public static final String HELP_IMG = "/at/gv/egiz/bku/gui/help.png"; + public static final String HELP_IMG_L = "/at/gv/egiz/bku/gui/help_l.png"; + public static final String HELP_IMG_XL = "/at/gv/egiz/bku/gui/help_xl.png"; + public static final String HELP_IMG_XXL = "/at/gv/egiz/bku/gui/help_xxl.png"; public static final String HELP_IMG_FOCUS = "/at/gv/egiz/bku/gui/help.png"; //help_focus.png"; public static final String HASHDATA_FONT = "Monospaced"; public static final Color ERROR_COLOR = Color.RED; public static final Color HYPERLINK_COLOR = Color.BLUE; + public static final Color HELP_COLOR = new Color(70, 148, 169); public static final String TITLE_WELCOME = "title.welcome"; public static final String TITLE_INSERTCARD = "title.insertcard"; public static final String TITLE_CARD_NOT_SUPPORTED = "title.cardnotsupported"; @@ -114,11 +118,17 @@ public interface BKUGUIFacade { public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix"; public static final String ALT_HELP = "alt.help"; - public void showEnterPINDirect(PINSpec spec, int retries); + public static final String SIGDATA_TOOLTIPTEXT = "dialog.sigpin.infolabel.sigdata.tooltiptext"; + public static final String SWITCH_FOCUS_DUMMY_LABEL_NAME = "DummyLabel"; + + public enum DIALOG_TYPE {DIALOGUE_UNDEFINED, DIALOGUE_VERIFY_PIN, DIALOGUE_ENTER_PIN, DIALOGUE_SHOW_SIG_DATA, DIALOGUE_SIGNATURE_PIN, DIALOGUE_MESSAGE}; + + + public void showEnterPINDirect(PinInfo pinInfo, int retries); - public void showEnterPIN(PINSpec spec, int retries); + public void showEnterPIN(PinInfo pinInfo, int retries); - public void showSignatureDataDialog(PINSpec spec, ActionListener listener, String string, ActionListener aThis0, String string0, ActionListener aThis1, String string1); + public void showSignatureDataDialog(PinInfo pinInfo, ActionListener listener, String string, ActionListener aThis0, String string0, ActionListener aThis1, String string1); public void correctionButtonPressed(); @@ -134,11 +144,11 @@ public interface BKUGUIFacade { */ public Locale getLocale(); - public void showVerifyPINDialog(PINSpec pinSpec, int numRetries, + public void showVerifyPINDialog(PinInfo pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand); - public void showSignaturePINDialog(PINSpec pinSpec, int numRetries, + public void showSignaturePINDialog(PinInfo pinSpec, int numRetries, ActionListener signListener, String signCommand, ActionListener cancelListener, String cancelCommand, ActionListener viewerListener, String viewerCommand); 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 e005836c..d806c5fa 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 @@ -20,15 +20,19 @@ package at.gv.egiz.bku.gui; import at.gv.egiz.bku.gui.viewer.FontProviderException; import at.gv.egiz.bku.gui.viewer.FontProvider; import at.gv.egiz.bku.gui.viewer.SecureViewerSaveDialog; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.stal.HashDataInput; import java.awt.Color; +import java.awt.Component; import java.awt.Container; import java.awt.Cursor; +import java.awt.FocusTraversalPolicy; import java.awt.Font; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.KeyAdapter; @@ -36,16 +40,19 @@ import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.net.URL; import java.text.MessageFormat; import java.util.List; import java.util.Locale; import java.util.ResourceBundle; -import java.util.logging.Level; -import java.util.logging.Logger; + +import javax.swing.BorderFactory; import javax.swing.GroupLayout; import javax.swing.ImageIcon; import javax.swing.JButton; +import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; @@ -59,1607 +66,2730 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.text.BadLocationException; import javax.swing.text.Document; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * + * * @author clemens */ public class BKUGUIImpl implements BKUGUIFacade { - - protected static final Log log = LogFactory.getLog(BKUGUIImpl.class); - protected enum PinLabelPosition { - LEFT, ABOVE - } + private final Logger log = LoggerFactory.getLogger(BKUGUIImpl.class); - protected HelpMouseListener helpMouseListener; - protected HelpKeyListener helpKeyListener; - protected SwitchFocusFocusListener switchFocusKeyListener; - protected SecureViewerDialog secureViewer; - protected FontProvider fontProvider; - - protected Container contentPane; - protected ResourceBundle messages; - /** left and right side main panels */ - protected JPanel iconPanel; - protected JPanel contentPanel; - /** right side content panels and layouts */ - protected JPanel headerPanel; - protected JPanel mainPanel; - protected JPanel buttonPanel; - /** right side fixed labels */ - protected JLabel titleLabel; - protected JLabel helpLabel; - protected JLabel switchFocusDummyLabel; - /** remember the pinfield to return to worker */ - protected JPasswordField pinField; - protected Document pinpadPIN; - - protected int buttonSize; - - /** gui style config (default 'simple') */ - protected boolean renderHeaderPanel = false; - protected boolean renderIconPanel = false; - protected boolean renderCancelButton = false; - protected boolean shortText = false; - protected PinLabelPosition pinLabelPos = PinLabelPosition.LEFT; - protected boolean renderRefId = false; - - /** - * set contentPane - * init message bundle - * configure the style - * register the help listener - * create GUI (on event-dispatching thread) - * - * @param contentPane - * @param locale - * @param guiStyle - * @param background - * @param helpListener - */ - public BKUGUIImpl(Container contentPane, - Locale locale, - Style guiStyle, - URL background, - FontProvider fontProvider, - ActionListener helpListener, - SwitchFocusListener switchFocusListener) { - this.contentPane = contentPane; - - loadMessageBundle(locale); - - if (guiStyle == Style.advanced) { - renderHeaderPanel = true; - renderIconPanel = false; - renderCancelButton = true; - renderRefId = true; - } else if (guiStyle == Style.tiny) { - shortText = true; - pinLabelPos = PinLabelPosition.ABOVE; - } - - // ensure that buttons can be fired with enter key too - UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE); - - registerHelpListener(helpListener); - - registerSwitchFocusListener(switchFocusListener); - - this.fontProvider = fontProvider; - createGUI(background); - } - - private void createGUI(final URL background) { - - try { - - log.debug("scheduling gui initialization"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - log.debug("[" + Thread.currentThread().getName() + "] initializing gui"); - - if (renderIconPanel) { - initIconPanel(background); - initContentPanel(null); - } else { - initContentPanel(background); - } - - GroupLayout layout = new GroupLayout(contentPane); - contentPane.setLayout(layout); - - if (renderIconPanel) { - layout.setHorizontalGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(iconPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addContainerGap()); - layout.setVerticalGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(iconPanel, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap()); - } else { - layout.setHorizontalGroup(layout.createSequentialGroup() - // left border - .addContainerGap() - .addComponent(contentPanel) - .addContainerGap()); - layout.setVerticalGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(contentPanel) - .addContainerGap()); - } - } - }); - } catch (Exception ex) { - throw new RuntimeException("Failed to init GUI: " + ex.getMessage()); - } - } - - protected void initIconPanel(URL background) { - if (background == null) { - background = getClass().getResource(DEFAULT_ICON); - } - if ("file".equals(background.getProtocol())) { - log.warn("file:// background images not permitted: " + background + - ", loading default background"); - background = getClass().getResource(DEFAULT_ICON); - } - log.debug("loading icon panel background " + background); - - iconPanel = new JPanel(); - JLabel iconLabel = new JLabel(); - iconLabel.setIcon(new ImageIcon(background)); - - GroupLayout iconPanelLayout = new GroupLayout(iconPanel); - iconPanel.setLayout(iconPanelLayout); - iconPanelLayout.setHorizontalGroup( - iconPanelLayout.createSequentialGroup() - .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); - iconPanelLayout.setVerticalGroup( - iconPanelLayout.createSequentialGroup() - .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); - } + protected enum PinLabelPosition { + LEFT, ABOVE + } - protected void initContentPanel(URL background) { - - if (background == null) { - log.debug("no background image set"); -// contentPanel = new ImagePanel(getClass().getResource(DEFAULT_BACKGROUND)); - contentPanel = new JPanel(); - } else if ("file".equals(background.getProtocol())) { - log.warn("file:// background images not permitted: " + background); - contentPanel = new JPanel(); - } else { - log.debug("loading background " + background); - contentPanel = new ImagePanel(background); - } - contentPanel.setOpaque(false); - mainPanel = new JPanel(); - mainPanel.setOpaque(false); - buttonPanel = new JPanel(); - buttonPanel.setOpaque(false); - - helpLabel = new JLabel(); - helpLabel.setIcon(new ImageIcon(getClass().getResource(HELP_IMG))); - helpLabel.getAccessibleContext().setAccessibleName(getMessage(ALT_HELP)); - helpLabel.setFocusable(true); - helpLabel.addMouseListener(helpMouseListener); - helpLabel.addKeyListener(helpKeyListener); - helpLabel.addFocusListener(new FocusAdapter() { - - @Override - public void focusGained(FocusEvent e) { - - helpLabel.setIcon(new ImageIcon(getClass().getResource(HELP_IMG_FOCUS))); - } - - @Override - public void focusLost(FocusEvent e) { - - helpLabel.setIcon(new ImageIcon(getClass().getResource(HELP_IMG))); - } - - - }); - helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - - switchFocusDummyLabel = new JLabel(); - switchFocusDummyLabel.setText(""); - switchFocusDummyLabel.setFocusable(true); - switchFocusDummyLabel.addFocusListener(switchFocusKeyListener); - - buttonSize = initButtonSize(); - - if (renderHeaderPanel) { - headerPanel = new JPanel(); - headerPanel.setOpaque(false); - - titleLabel = new JLabel(); - titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() | - java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2)); - - GroupLayout headerPanelLayout = new GroupLayout(headerPanel); - headerPanel.setLayout(headerPanelLayout); - - headerPanelLayout.setHorizontalGroup( - headerPanelLayout.createSequentialGroup() - .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(switchFocusDummyLabel) - .addComponent(helpLabel) - ); - headerPanelLayout.setVerticalGroup( - headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) - .addComponent(switchFocusDummyLabel) - .addComponent(helpLabel) - ); - } - - GroupLayout contentPanelLayout = new GroupLayout(contentPanel); - contentPanel.setLayout(contentPanelLayout); - - // align header, main and button to the right - GroupLayout.ParallelGroup horizontalContent = - contentPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING); //LEADING); - GroupLayout.SequentialGroup verticalContent = - contentPanelLayout.createSequentialGroup(); - - if (renderHeaderPanel) { - horizontalContent - .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE); - verticalContent - .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); - - } - horizontalContent - .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); //Short.MAX_VALUE); - verticalContent - .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); - - contentPanelLayout.setHorizontalGroup(horizontalContent); //Outer); - contentPanelLayout.setVerticalGroup(verticalContent); + protected Component primaryFocusHolder; + protected SecureViewerDialog secureViewer; + + protected HelpListener helpListener; + protected SwitchFocusFocusListener switchFocusKeyListener; + protected FontProvider fontProvider; + + protected Container contentPane; + protected WindowCloseAdapter windowCloseAdapter; + protected ResourceBundle messages; + /** left and right side main panels */ + protected JPanel iconPanel; + protected JPanel contentPanel; + /** right side content panels and layouts */ + protected JPanel headerPanel; + protected JPanel mainPanel; + protected JPanel buttonPanel; + /** right side fixed labels */ + protected JLabel titleLabel; + protected JLabel msgTitleLabel; + protected JLabel helpLabel; + protected JLabel switchFocusDummyLabel; + /** remember the pinfield to return to worker */ + protected JPasswordField pinField; + protected Document pinpadPIN; + + protected JButton okButton; + protected JButton backButton; + protected JButton enterPINButton; + protected final JButton cancelButton; + protected JLabel infoLabel; + protected final JLabel pinsizeLabel; + protected final JLabel signPinLabel; + protected final JButton signButton; + protected JLabel cardPinLabel; + protected JLabel pinLabel; + protected JPasswordField pinpadPINField; + protected JLabel msgLabel; + protected boolean showMessageOKButton; + protected JLabel refIdLabel; + protected JScrollPane hashDataScrollPane; + protected JTable hashDataTable; + protected HyperlinkRenderer hyperlinkRenderer; + protected int baseTableRowHeight; + + protected FocusBorder sigDataFocusBorder; + protected FocusBorder helpFocusBorder; + + protected Method methodToRunAtResize; + + protected int buttonSize; + protected int baseButtonSize; + protected Integer baseWidth; + protected Integer baseHeight; + protected int baseFontSize; + + /** gui style config (default 'simple') */ + protected boolean renderHeaderPanel = false; + protected boolean renderIconPanel = false; + protected boolean renderCancelButton = false; + protected boolean shortText = false; + protected PinLabelPosition pinLabelPos = PinLabelPosition.LEFT; + protected boolean renderRefId = false; + protected boolean useFocusTraversalPolicy = false; + +// protected HashDataInput storedSelection; + protected List<HashDataInput> signedReferences; + protected Integer referenceIndex; + private at.gv.egiz.bku.gui.BKUGUIImpl.SignedReferencesSelectionListener.SignedReferencesListDisplayer storedBackToListListener; + + /** + * set contentPane init message bundle configure the style register the help + * listener create GUI (on event-dispatching thread) + * + * @param contentPane + * @param locale + * @param guiStyle + * @param background + * @param helpListener + */ + public BKUGUIImpl(Container contentPane, Locale locale, Style guiStyle, + URL background, FontProvider fontProvider, + HelpListener helpListener, SwitchFocusListener switchFocusListener) { + this.contentPane = contentPane; + Window w = SwingUtilities.getWindowAncestor(contentPane); + if (w != null && w instanceof JFrame) { + this.windowCloseAdapter = new WindowCloseAdapter(); + ((JFrame) w).addWindowListener(windowCloseAdapter); } + + loadMessageBundle(locale); + + cancelButton = new JButton(); + infoLabel = new JLabel(); + cardPinLabel = new JLabel(); + pinsizeLabel = new JLabel(); + signPinLabel = new JLabel(); + signButton = new JButton(); + pinLabel = new JLabel(); + pinpadPINField = new JPasswordField(); + msgLabel = new JLabel(); + showMessageOKButton = false; + + this.baseFontSize = new JLabel().getFont().getSize(); + this.baseTableRowHeight = new JTable().getRowHeight(); + + if (guiStyle == Style.advanced) { + renderHeaderPanel = true; + renderIconPanel = false; + renderCancelButton = true; + renderRefId = true; + useFocusTraversalPolicy = true; + } else if (guiStyle == Style.tiny) { + shortText = true; + pinLabelPos = PinLabelPosition.ABOVE; + } + + // ensure that buttons can be fired with enter key too + UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE); + + registerSwitchFocusListener(switchFocusListener); + + this.fontProvider = fontProvider; + this.helpListener = helpListener; + createGUI(background); - /** - * BKUWorker inits signaturecard with locale - * @return - */ - @Override - public Locale getLocale() { - return messages.getLocale(); - } + } - /** - * to be overridden by subclasses providing additional resource messages - * @param key - * @return - */ - protected String getMessage(String key) { - return messages.getString(key); - } + private void createGUI(final URL background) { + + try { + + log.debug("Scheduling gui initialization."); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("[{}] Initializing gui.", Thread.currentThread().getName()); + + if (renderIconPanel) { + initIconPanel(background); + initContentPanel(null); + } else { + initContentPanel(background); + } + + contentPanel.addComponentListener(new ComponentAdapter() { + + @Override + public void componentResized(ComponentEvent e) { + + log.debug("Component resize detected."); + + resize(); + } + + }); + + GroupLayout layout = new GroupLayout(contentPane); + contentPane.setLayout(layout); + + if (renderIconPanel) { + layout + .setHorizontalGroup(layout + .createSequentialGroup() + .addContainerGap() + .addComponent(iconPanel, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(contentPanel, + GroupLayout.DEFAULT_SIZE, + GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addContainerGap()); + layout + .setVerticalGroup(layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + layout + .createParallelGroup( + GroupLayout.Alignment.LEADING) + .addComponent( + iconPanel, + GroupLayout.Alignment.TRAILING, + GroupLayout.DEFAULT_SIZE, + GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addComponent( + contentPanel, + GroupLayout.DEFAULT_SIZE, + GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)) + .addContainerGap()); + } else { + layout.setHorizontalGroup(layout + .createSequentialGroup() + // left border + .addContainerGap().addComponent(contentPanel) + .addContainerGap()); + layout.setVerticalGroup(layout.createSequentialGroup() + .addContainerGap().addComponent(contentPanel) + .addContainerGap()); + } + } + }); + + } catch (Exception ex) { + throw new RuntimeException("Failed to init GUI: " + ex.getMessage()); + } + } - /** - * to be overridden by subclasses providing additional resource messages - * @param key - * @return - */ - protected boolean hasMessage(String key) { - return messages.containsKey(key); - } + protected void initIconPanel(URL background) { + if (background == null) { + background = getClass().getResource(DEFAULT_ICON); + } + if ("file".equals(background.getProtocol())) { + log.warn("file:// background images not permitted: {}, " + + "loading default background", background); + background = getClass().getResource(DEFAULT_ICON); + } + log.debug("Loading icon panel background {}.", background); + + iconPanel = new JPanel(); + JLabel iconLabel = new JLabel(); + iconLabel.setIcon(new ImageIcon(background)); + + GroupLayout iconPanelLayout = new GroupLayout(iconPanel); + iconPanel.setLayout(iconPanelLayout); + iconPanelLayout.setHorizontalGroup(iconPanelLayout + .createSequentialGroup().addComponent(iconLabel, + GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE)); + iconPanelLayout.setVerticalGroup(iconPanelLayout + .createSequentialGroup().addComponent(iconLabel, + GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE)); + } + + protected void initContentPanel(URL background) { + + if (background == null) { + log.debug("No background image set."); + // contentPanel = new + // ImagePanel(getClass().getResource(DEFAULT_BACKGROUND)); + contentPanel = new JPanel(); + } else if ("file".equals(background.getProtocol())) { + log.warn("file:// background images not permitted: {}.", background); + contentPanel = new JPanel(); + } else { + log.debug("Loading background {}.", background); + contentPanel = new ImagePanel(background); + } + contentPanel.setOpaque(false); + mainPanel = new JPanel(); + mainPanel.setOpaque(false); + buttonPanel = new JPanel(); + buttonPanel.setOpaque(false); + + okButton = new JButton(); + backButton = new JButton(); + enterPINButton = new JButton(); + + sigDataFocusBorder = new FocusBorder(HYPERLINK_COLOR); + helpFocusBorder = new FocusBorder(HELP_COLOR); + + if (helpListener.implementsListener()) { + helpLabel = new JLabel(); + helpLabel.setIcon(new ImageIcon(getClass().getResource(HELP_IMG))); + helpLabel.getAccessibleContext().setAccessibleName( + getMessage(ALT_HELP)); + helpLabel.setFocusable(true); + helpLabel.addMouseListener(helpListener); + helpLabel.addKeyListener(helpListener); + helpLabel.addFocusListener(new FocusAdapter() { + + @Override + public void focusGained(FocusEvent e) { + + log.debug("Help label obtained focus."); + updateHelpLabelIcon(); + } + + @Override + public void focusLost(FocusEvent e) { + + updateHelpLabelIcon(); + } + + }); + helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } + + // This is a hidden label. When it gains focus, it hands over focus to + // the web browser + switchFocusDummyLabel = new JLabel(); + switchFocusDummyLabel.setText(""); + switchFocusDummyLabel.setName(SWITCH_FOCUS_DUMMY_LABEL_NAME); + switchFocusDummyLabel.setFocusable(true); + switchFocusDummyLabel.addFocusListener(switchFocusKeyListener); + + buttonSize = initButtonSize(); + baseButtonSize = buttonSize; + + titleLabel = new JLabel(); + msgTitleLabel = new JLabel(); + + if (renderHeaderPanel) { + headerPanel = new JPanel(); + headerPanel.setOpaque(false); + + titleLabel.setFocusable(true); + titleLabel.setFont(titleLabel.getFont().deriveFont( + titleLabel.getFont().getStyle() | java.awt.Font.BOLD, + titleLabel.getFont().getSize() + 2)); + + GroupLayout headerPanelLayout = new GroupLayout(headerPanel); + headerPanel.setLayout(headerPanelLayout); + + GroupLayout.SequentialGroup horizontalHeader = headerPanelLayout + .createSequentialGroup().addComponent(titleLabel, 0, + GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE); + + GroupLayout.ParallelGroup verticalHeader = headerPanelLayout + .createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, + Short.MAX_VALUE); + + if (helpListener.implementsListener()) { + horizontalHeader.addPreferredGap( + LayoutStyle.ComponentPlacement.UNRELATED, 0, + Short.MAX_VALUE).addComponent(helpLabel); + verticalHeader.addComponent(helpLabel); + } + + horizontalHeader.addComponent(switchFocusDummyLabel); + verticalHeader.addComponent(switchFocusDummyLabel); + + headerPanelLayout.setHorizontalGroup(horizontalHeader); + headerPanelLayout.setVerticalGroup(verticalHeader); + } + + GroupLayout contentPanelLayout = new GroupLayout(contentPanel); + contentPanel.setLayout(contentPanelLayout); + + // align header, main and button to the right + GroupLayout.ParallelGroup horizontalContent = contentPanelLayout + .createParallelGroup(GroupLayout.Alignment.TRAILING); // LEADING); + GroupLayout.SequentialGroup verticalContent = contentPanelLayout + .createSequentialGroup(); + + if (renderHeaderPanel) { + horizontalContent.addComponent(headerPanel, 0, + GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE); + verticalContent.addComponent(headerPanel, 0, + GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); + + } + horizontalContent.addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE).addComponent(buttonPanel, 0, + GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); // Short.MAX_VALUE); + verticalContent.addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE).addPreferredGap( + LayoutStyle.ComponentPlacement.UNRELATED).addComponent( + buttonPanel, 0, GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE); + + contentPanelLayout.setHorizontalGroup(horizontalContent); // Outer); + contentPanelLayout.setVerticalGroup(verticalContent); + + } + + /** + * BKUWorker inits signaturecard with locale + * + * @return + */ + @Override + public Locale getLocale() { + return messages.getLocale(); + } + + /** + * to be overridden by subclasses providing additional resource messages + * + * @param key + * @return + */ + protected String getMessage(String key) { + return messages.getString(key); + } + + /** + * to be overridden by subclasses providing additional resource messages + * + * @param key + * @return + */ + protected boolean hasMessage(String key) { + return messages.containsKey(key); + } @Override - public void showVerifyPINDialog(final PINSpec pinSpec, final int numRetries, + public void showVerifyPINDialog(final PinInfo pinSpec, final int numRetries, final ActionListener okListener, final String okCommand, final ActionListener cancelListener, final String cancelCommand) { - - log.debug("scheduling verify pin dialog"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - log.debug("[" + Thread.currentThread().getName() + "] show verify pin dialog"); - - mainPanel.removeAll(); - buttonPanel.removeAll(); - - if (renderHeaderPanel) { - if (numRetries < 0) { - String verifyTitle = getMessage(TITLE_VERIFY_PIN); - titleLabel.setText(MessageFormat.format(verifyTitle, new Object[]{pinSpec.getLocalizedName()})); - } else { - titleLabel.setText(getMessage(TITLE_RETRY)); - } - } - - JButton okButton = new JButton(); - okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - okButton.setText(getMessage(BUTTON_OK)); - okButton.setEnabled(pinSpec.getMinLength() <= 0); - okButton.setActionCommand(okCommand); - okButton.addActionListener(okListener); - - JLabel cardPinLabel = new JLabel(); - cardPinLabel.setFont(cardPinLabel.getFont().deriveFont(cardPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - String pinLabel = getMessage(LABEL_PIN); - cardPinLabel.setText(MessageFormat.format(pinLabel, new Object[]{pinSpec.getLocalizedName()})); - - pinField = new JPasswordField(); - pinField.setText(""); - pinField.setDocument(new PINDocument(pinSpec.getMinLength(), pinSpec.getMaxLength(), pinSpec.getRexepPattern(), okButton)); - pinField.setActionCommand(okCommand); - pinField.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if (pinField.getPassword().length >= pinSpec.getMinLength()) { - okListener.actionPerformed(e); - } - } - }); - - JLabel infoLabel = new JLabel(); - if (numRetries < 0) { - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - String infoPattern = getMessage(MESSAGE_ENTERPIN); - if (shortText) { - infoLabel.setText(MessageFormat.format(infoPattern, new Object[] {"PIN"})); - } else { - infoLabel.setText(MessageFormat.format(infoPattern, new Object[] {pinSpec.getLocalizedName()})); - } - helpMouseListener.setHelpTopic(HELP_VERIFY_PIN); - helpKeyListener.setHelpTopic(HELP_VERIFY_PIN); - } else { - String retryPattern; - if (numRetries < 2) { - retryPattern = getMessage(MESSAGE_LAST_RETRY); - } else { - retryPattern = getMessage(MESSAGE_RETRIES); - } - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD)); - infoLabel.setText(MessageFormat.format(retryPattern, new Object[]{String.valueOf(numRetries)})); - infoLabel.setForeground(ERROR_COLOR); - helpMouseListener.setHelpTopic(HELP_RETRY); - helpKeyListener.setHelpTopic(HELP_RETRY); - } - - JLabel pinsizeLabel = new JLabel(); - pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, pinsizeLabel.getFont().getSize()-2)); - pinsizeLabel.setText(MessageFormat.format(getMessage(LABEL_PINSIZE), pinSpec.getLocalizedLength())); - - 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(switchFocusDummyLabel) - .addComponent(helpLabel) - ; - infoVertical - .addComponent(switchFocusDummyLabel) - .addComponent(helpLabel) - ; - } - - // align pinfield and pinsize to the right - GroupLayout.ParallelGroup pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING); - GroupLayout.Group pinVertical; - - if (pinLabelPos == PinLabelPosition.ABOVE) { - pinHorizontal - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); - pinVertical = mainPanelLayout.createSequentialGroup() - .addComponent(cardPinLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); - } else { - pinHorizontal - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); - pinVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(cardPinLabel) - .addComponent(pinField); - } - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(infoHorizontal) - .addGroup(pinHorizontal)); - - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(infoVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pinVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinsizeLabel)); - - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup() - .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); - GroupLayout.Group buttonVertical; - - if (renderCancelButton) { - 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); - } else { - buttonVertical = buttonPanelLayout.createSequentialGroup() - .addComponent(okButton); - } - - buttonPanelLayout.setHorizontalGroup(buttonHorizontal); - buttonPanelLayout.setVerticalGroup(buttonVertical); - -// pinField.requestFocusInWindow(); -// helpLabel.requestFocus(); - pinField.requestFocus(); - contentPanel.validate(); - - } - }); - } - @Override - public void showEnterPINDirect(PINSpec pinSpec, int retries) { - if (retries < 0) { - showMessageDialog(TITLE_VERIFY_PINPAD, MESSAGE_ENTERPIN_PINPAD_DIRECT, new Object[] { - pinSpec.getLocalizedName(), pinSpec.getLocalizedLength() }); - } else { - showMessageDialog(TITLE_RETRY, MESSAGE_RETRIES, new Object[]{String.valueOf(retries) }); - } - } + log.debug("Scheduling verify pin dialog."); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("[{}] Show verify pin dialog.", Thread.currentThread() + .getName()); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + // avoid that dummy label gains focus during load + switchFocusDummyLabel.setFocusable(false); + + if (renderHeaderPanel) { + if (numRetries < 0) { + String verifyTitle = getMessage(TITLE_VERIFY_PIN); + titleLabel.setText(MessageFormat.format(verifyTitle, + new Object[] { pinSpec.getLocalizedName() })); + } else { + titleLabel.setText(getMessage(TITLE_RETRY)); + } + } + + okButton.setFont(okButton.getFont().deriveFont( + okButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + okButton.setText(getMessage(BUTTON_OK)); + okButton.setEnabled(pinSpec.getMinLength() <= 0); + okButton.setActionCommand(okCommand); + okButton.addActionListener(okListener); + + cardPinLabel.setFont(cardPinLabel.getFont() + .deriveFont( + cardPinLabel.getFont().getStyle() + & ~java.awt.Font.BOLD)); + String pinLabel = getMessage(LABEL_PIN); + cardPinLabel.setText(MessageFormat.format(pinLabel, + new Object[] { pinSpec.getLocalizedName() })); + + pinField = new JPasswordField(); + pinField.setText(""); + pinField.setName("PINField"); + pinField.setDocument(new PINDocument(pinSpec.getMinLength(), + pinSpec.getMaxLength(), pinSpec.getRexepPattern(), + okButton)); + pinField.setActionCommand(okCommand); + pinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (pinField.getPassword().length >= pinSpec + .getMinLength()) { + okListener.actionPerformed(e); + } + } + }); + + pinField.addFocusListener(new FocusAdapter() { + + @Override + public void focusGained(FocusEvent e) { + + // focus has been set accordingly - re-enable dummy + // label + switchFocusDummyLabel.setFocusable(true); + } + + }); + + infoLabel = new JLabel(); + if (numRetries < 0) { + infoLabel.setFont(infoLabel.getFont().deriveFont( + infoLabel.getFont().getStyle() + & ~java.awt.Font.BOLD)); + String infoPattern = getMessage(MESSAGE_ENTERPIN); + if (shortText) { + infoLabel.setText(MessageFormat.format(infoPattern, + new Object[] { "PIN" })); + } else { + infoLabel.setText(MessageFormat.format(infoPattern, + new Object[] { pinSpec.getLocalizedName() })); + } + helpListener.setHelpTopic(HELP_VERIFY_PIN); + } else { + String retryPattern; + if (numRetries < 2) { + retryPattern = getMessage(MESSAGE_LAST_RETRY); + } else { + retryPattern = getMessage(MESSAGE_RETRIES); + } + infoLabel.setFont(infoLabel.getFont() + .deriveFont( + infoLabel.getFont().getStyle() + | java.awt.Font.BOLD)); + infoLabel.setText(MessageFormat.format(retryPattern, + new Object[] { String.valueOf(numRetries) })); + infoLabel.setForeground(ERROR_COLOR); + helpListener.setHelpTopic(HELP_RETRY); + } + + pinsizeLabel.setFont(pinsizeLabel.getFont() + .deriveFont( + pinsizeLabel.getFont().getStyle() + & ~java.awt.Font.BOLD, + pinsizeLabel.getFont().getSize() - 2)); + pinsizeLabel.setText(MessageFormat + .format(getMessage(LABEL_PINSIZE), pinSpec + .getLocalizedLength())); + + pinField.getAccessibleContext().setAccessibleDescription( + cardPinLabel.getText() + pinsizeLabel.getText()); + + 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) { + + if (helpListener.implementsListener()) { + infoHorizontal.addPreferredGap( + LayoutStyle.ComponentPlacement.UNRELATED, 0, + Short.MAX_VALUE).addComponent(helpLabel); + infoVertical.addComponent(helpLabel); + } + infoHorizontal.addComponent(switchFocusDummyLabel); + infoVertical.addComponent(switchFocusDummyLabel); + } + + // align pinfield and pinsize to the right + GroupLayout.ParallelGroup pinHorizontal = mainPanelLayout + .createParallelGroup(GroupLayout.Alignment.TRAILING); + GroupLayout.Group pinVertical; + + if (pinLabelPos == PinLabelPosition.ABOVE) { + pinHorizontal.addGroup( + mainPanelLayout.createParallelGroup( + GroupLayout.Alignment.LEADING) + .addComponent(cardPinLabel, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE) + .addComponent(pinField, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)).addComponent( + pinsizeLabel, GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE); + pinVertical = mainPanelLayout.createSequentialGroup() + .addComponent(cardPinLabel).addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE); + } else { + pinHorizontal + .addGroup( + mainPanelLayout + .createSequentialGroup() + .addComponent(cardPinLabel, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinField, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)) + .addComponent(pinsizeLabel, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE); + pinVertical = mainPanelLayout.createParallelGroup( + GroupLayout.Alignment.BASELINE).addComponent( + cardPinLabel).addComponent(pinField); + } + + mainPanelLayout.setHorizontalGroup(mainPanelLayout + .createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(infoHorizontal).addGroup(pinHorizontal)); + + mainPanelLayout + .setVerticalGroup(mainPanelLayout + .createSequentialGroup().addGroup(infoVertical) + .addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addGroup(pinVertical).addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel)); + + if (renderCancelButton) { + cancelButton.setFont(cancelButton.getFont().deriveFont( + cancelButton.getFont().getStyle() + & ~java.awt.Font.BOLD)); + cancelButton.setText(getMessage(BUTTON_CANCEL)); + cancelButton.setActionCommand(cancelCommand); + cancelButton.addActionListener(cancelListener); + } + + renderVerifyPINDialogueButtonPanel(); + + updateMethodToRunAtResize("at.gv.egiz.bku.gui.BKUGUIImpl", + "renderVerifyPINDialogueButtonPanel"); + + if (windowCloseAdapter != null) { + windowCloseAdapter.registerListener(cancelListener, cancelCommand); + } - @Override - public void showEnterPIN(final PINSpec pinSpec, final int retries) { - showEnterPIN(pinSpec, retries, TITLE_VERIFY_PINPAD, MESSAGE_ENTERPIN_PINPAD, null); - } + primaryFocusHolder = pinField; + + pinField.requestFocus(); + contentPanel.validate(); + + resize(); - protected void showEnterPIN(final PINSpec pinSpec, final int retries, final String titleKey, final String messageKey, final Object[] messageParams) { - log.debug("scheduling pinpad dialog"); + } + }); + } - SwingUtilities.invokeLater(new Runnable() { + @SuppressWarnings("unchecked") + protected void updateMethodToRunAtResize(String className, String methodName) { + + try { + Class<at.gv.egiz.bku.gui.BKUGUIImpl> thisClass = (Class<at.gv.egiz.bku.gui.BKUGUIImpl>) Class + .forName(className); + Method m = thisClass.getMethod(methodName); + methodToRunAtResize = m; + } catch (SecurityException e1) { + log.error("Unable to store rendering method.", e1); + } catch (NoSuchMethodException e1) { + log.error("Unable to store rendering method.", e1); + } catch (ClassNotFoundException e) { + log.error("Unable to store rendering method.", e); + } - @Override - public void run() { + } - log.debug("[" + Thread.currentThread().getName() + "] show pinpad dialog"); + public void renderVerifyPINDialogueButtonPanel() { - mainPanel.removeAll(); - buttonPanel.removeAll(); + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); - if (renderHeaderPanel) { - if (retries < 0) { - titleLabel.setText(getMessage(titleKey)); - } else { - titleLabel.setText(getMessage(TITLE_RETRY)); - } - } + GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout + .createSequentialGroup().addComponent(okButton, + GroupLayout.PREFERRED_SIZE, buttonSize, + GroupLayout.PREFERRED_SIZE); + GroupLayout.Group buttonVertical; - final JLabel infoLabel = new JLabel(); - if (retries < 0) { - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - infoLabel.setText(MessageFormat.format(getMessage(messageKey), messageParams)); - helpMouseListener.setHelpTopic(HELP_PINPAD); - helpKeyListener.setHelpTopic(HELP_PINPAD); - } else { - String retryPattern; - if (retries == 1) { - retryPattern = getMessage(MESSAGE_LAST_RETRY); - } else { - retryPattern = getMessage(MESSAGE_RETRIES); - } - infoLabel.setText(MessageFormat.format(retryPattern, new Object[]{String.valueOf(retries)})); - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD)); - infoLabel.setForeground(ERROR_COLOR); - helpMouseListener.setHelpTopic(HELP_RETRY); - helpKeyListener.setHelpTopic(HELP_RETRY); - } + if (renderCancelButton) { - JLabel pinLabel = new JLabel(); - pinLabel.setFont(pinLabel.getFont().deriveFont(pinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - String pinName = getMessage(LABEL_PIN); - pinLabel.setText(MessageFormat.format(pinName, new Object[]{pinSpec.getLocalizedName()})); - - JPasswordField pinpadPINField = new JPasswordField(); - pinpadPINField.setText(""); - pinpadPINField.setEnabled(false); - pinpadPIN = pinpadPINField.getDocument(); - - JLabel pinsizeLabel = new JLabel(); - pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, pinsizeLabel.getFont().getSize()-2)); - pinsizeLabel.setText(MessageFormat.format(getMessage(LABEL_PINSIZE), pinSpec.getLocalizedLength())); - - 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(switchFocusDummyLabel) - .addComponent(helpLabel) - ; - infoVertical - .addComponent(switchFocusDummyLabel) - .addComponent(helpLabel) - ; - } + buttonHorizontal.addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED).addComponent( + cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, + GroupLayout.PREFERRED_SIZE); + buttonVertical = buttonPanelLayout.createParallelGroup( + GroupLayout.Alignment.BASELINE).addComponent(okButton) + .addComponent(cancelButton); + } else { + buttonVertical = buttonPanelLayout.createSequentialGroup() + .addComponent(okButton); + } - // align pinfield and pinsize to the right - GroupLayout.Group pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING); - GroupLayout.SequentialGroup pinVertical = mainPanelLayout.createSequentialGroup(); - - if (pinLabelPos == PinLabelPosition.ABOVE) { - pinHorizontal - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(pinpadPINField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); - pinVertical - .addComponent(pinLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinpadPINField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinsizeLabel); - } else { // PinLabelPosition.LEFT - pinHorizontal - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinpadPINField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); - pinVertical - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(pinLabel) - .addComponent(pinpadPINField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinsizeLabel); - } + buttonPanelLayout.setHorizontalGroup(buttonHorizontal); + buttonPanelLayout.setVerticalGroup(buttonVertical); + + } + + @Override + public void showEnterPINDirect(PinInfo pinSpec, int retries) { + if (retries < 0) { + showMessageDialog(TITLE_VERIFY_PINPAD, + MESSAGE_ENTERPIN_PINPAD_DIRECT, new Object[] { + pinSpec.getLocalizedName(), + pinSpec.getLocalizedLength() }); + } else { + showMessageDialog(TITLE_RETRY, MESSAGE_RETRIES, + new Object[] { String.valueOf(retries) }); + } + } + + @Override + public void showEnterPIN(final PinInfo pinSpec, final int retries) { + showEnterPIN(pinSpec, retries, TITLE_VERIFY_PINPAD, + MESSAGE_ENTERPIN_PINPAD, null); + } + + protected void showEnterPIN(final PinInfo pinSpec, final int retries, + final String titleKey, final String messageKey, + final Object[] messageParams) { + log.debug("Scheduling pinpad dialog."); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("[{}] show pinpad dialog.", Thread.currentThread().getName()); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + // avoid that dummy label gains focus during load + switchFocusDummyLabel.setFocusable(false); + + if (renderHeaderPanel) { + if (retries < 0) { + titleLabel.setText(getMessage(titleKey)); + } else { + titleLabel.setText(getMessage(TITLE_RETRY)); + } + } + + infoLabel = new JLabel(); + if (retries < 0) { + infoLabel.setFont(infoLabel.getFont().deriveFont( + infoLabel.getFont().getStyle() + & ~java.awt.Font.BOLD)); + infoLabel.setText(MessageFormat.format( + getMessage(messageKey), messageParams)); + helpListener.setHelpTopic(HELP_PINPAD); + } else { + String retryPattern; + if (retries == 1) { + retryPattern = getMessage(MESSAGE_LAST_RETRY); + } else { + retryPattern = getMessage(MESSAGE_RETRIES); + } + infoLabel.setText(MessageFormat.format(retryPattern, + new Object[] { String.valueOf(retries) })); + infoLabel.getAccessibleContext().setAccessibleName( + infoLabel.getText()); + infoLabel.setFont(infoLabel.getFont() + .deriveFont( + infoLabel.getFont().getStyle() + | java.awt.Font.BOLD)); + infoLabel.setForeground(ERROR_COLOR); + helpListener.setHelpTopic(HELP_RETRY); + } + + pinLabel.setFont(pinLabel.getFont().deriveFont( + pinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + String pinName = getMessage(LABEL_PIN); + pinLabel.setText(MessageFormat.format(pinName, + new Object[] { pinSpec.getLocalizedName() })); + + pinpadPINField.setText(""); + pinpadPINField.setEnabled(false); + pinpadPIN = pinpadPINField.getDocument(); + + pinsizeLabel.setFont(pinsizeLabel.getFont() + .deriveFont( + pinsizeLabel.getFont().getStyle() + & ~java.awt.Font.BOLD, + pinsizeLabel.getFont().getSize() - 2)); + pinsizeLabel.setText(MessageFormat + .format(getMessage(LABEL_PINSIZE), pinSpec + .getLocalizedLength())); + + 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) { + + if (helpListener.implementsListener()) { + infoHorizontal.addPreferredGap( + LayoutStyle.ComponentPlacement.UNRELATED, 0, + Short.MAX_VALUE).addComponent(helpLabel); + infoVertical.addComponent(helpLabel); + } + infoHorizontal.addComponent(switchFocusDummyLabel); + infoVertical.addComponent(switchFocusDummyLabel); + + } + + // align pinfield and pinsize to the right + GroupLayout.Group pinHorizontal = mainPanelLayout + .createParallelGroup(GroupLayout.Alignment.TRAILING); + GroupLayout.SequentialGroup pinVertical = mainPanelLayout + .createSequentialGroup(); + + if (pinLabelPos == PinLabelPosition.ABOVE) { + pinHorizontal.addGroup( + mainPanelLayout.createParallelGroup( + GroupLayout.Alignment.LEADING) + .addComponent(pinLabel, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE) + .addComponent(pinpadPINField, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)).addComponent( + pinsizeLabel, GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE); + pinVertical.addComponent(pinLabel).addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinpadPINField, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel); + } else { // PinLabelPosition.LEFT + pinHorizontal + .addGroup( + mainPanelLayout + .createSequentialGroup() + .addComponent(pinLabel, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinpadPINField, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)) + .addComponent(pinsizeLabel, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE); + pinVertical.addGroup( + mainPanelLayout.createParallelGroup( + GroupLayout.Alignment.BASELINE) + .addComponent(pinLabel).addComponent( + pinpadPINField)).addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel); + } + + mainPanelLayout.setHorizontalGroup(mainPanelLayout + .createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(infoHorizontal).addGroup(pinHorizontal)); + + mainPanelLayout + .setVerticalGroup(mainPanelLayout + .createSequentialGroup().addGroup(infoVertical) + .addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addGroup(pinVertical)); + + infoLabel.setFocusable(true); + + infoLabel.addFocusListener(new FocusAdapter() { + + @Override + public void focusGained(FocusEvent e) { + + // focus has been set accordingly - re-enable dummy + // label + switchFocusDummyLabel.setFocusable(true); + } + + }); + + String accessibleData = cutOffHTMLTags(infoLabel.getText()) + + cutOffHTMLTags(pinLabel.getText()) + + cutOffHTMLTags(pinsizeLabel.getText()); + + infoLabel.getAccessibleContext().setAccessibleName( + accessibleData); + infoLabel.getAccessibleContext().setAccessibleDescription( + accessibleData); + + primaryFocusHolder = infoLabel; + + // delete potentially stored method to be run as nothing has to + // be re-rendered + methodToRunAtResize = null; + + infoLabel.requestFocus(); + + contentPanel.validate(); + + resize(); + } + }); + } + + // simple utility method to retrieve plain text from HTML + protected String cutOffHTMLTags(String str) { + + char[] arr = str.toCharArray(); + StringBuffer result = new StringBuffer(); + boolean inTag = false; - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(infoHorizontal) - .addGroup(pinHorizontal)); + for (int i = 0; i < arr.length; i++) { - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(infoVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pinVertical)); + char c = arr[i]; - contentPanel.validate(); - } - }); - } + if (c == '<') { + inTag = true; + } + + if (!inTag) { + + result.append(c); + } + + if (c == '>') { + + inTag = false; + } + } + + return result.toString(); + } @Override - public void showSignatureDataDialog(PINSpec spec, + public void showSignatureDataDialog(PinInfo spec, final ActionListener enterPINListener, final String enterPINCommand, final ActionListener cancelListener, final String cancelCommand, final ActionListener hashdataListener, final String hashdataCommand) { - log.debug("scheduling signature-data dialog"); + log.debug("Scheduling signature-data dialog."); - SwingUtilities.invokeLater(new Runnable() { + SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { + @Override + public void run() { - log.debug("[" + Thread.currentThread().getName() + "] show signature-data dialog"); + log.debug("[{}] show signature-data dialog.", + Thread.currentThread().getName()); - mainPanel.removeAll(); - buttonPanel.removeAll(); + mainPanel.removeAll(); + buttonPanel.removeAll(); - if (renderHeaderPanel) { - titleLabel.setText(getMessage(TITLE_SIGNATURE_DATA)); - } + // specify policy to ensure correct focus traversal + if (useFocusTraversalPolicy) { - final JLabel infoLabel = new JLabel(); - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - if (shortText) { - infoLabel.setText(getMessage(MESSAGE_HASHDATALINK_TINY)); - } else { - infoLabel.setText(getMessage(MESSAGE_HASHDATALINK)); - } - infoLabel.setFocusable(true); - infoLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - infoLabel.setForeground(HYPERLINK_COLOR); - infoLabel.addMouseListener(new MouseAdapter() { + contentPanel.setFocusCycleRoot(true); + contentPanel + .setFocusTraversalPolicy(new AdvancedShowSigDataGUIFocusTraversalPolicy()); + } - @Override - public void mouseClicked(MouseEvent me) { - ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand); - hashdataListener.actionPerformed(e); - } - }); + // avoid that dummy label gains focus during load + switchFocusDummyLabel.setFocusable(false); - infoLabel.addKeyListener(new KeyAdapter() { + if (renderHeaderPanel) { + titleLabel.setText(getMessage(TITLE_SIGNATURE_DATA)); + } - @Override - public void keyPressed(KeyEvent e) { + infoLabel = new JLabel(); + infoLabel.setFont(infoLabel.getFont().deriveFont( + infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + if (shortText) { + infoLabel.setText(getMessage(MESSAGE_HASHDATALINK_TINY)); + } else { + infoLabel.setText(getMessage(MESSAGE_HASHDATALINK)); + } + infoLabel.getAccessibleContext().setAccessibleName( + infoLabel.getText()); + infoLabel.setFocusable(true); - if(e.getKeyCode() == KeyEvent.VK_ENTER) { - ActionEvent e1 = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand); - hashdataListener.actionPerformed(e1); - } - } + infoLabel.setToolTipText(getMessage(SIGDATA_TOOLTIPTEXT)); + infoLabel.getAccessibleContext().setAccessibleDescription( + getMessage(SIGDATA_TOOLTIPTEXT)); + infoLabel.getAccessibleContext().setAccessibleName( + getMessage(SIGDATA_TOOLTIPTEXT)); - }); + infoLabel.setCursor(Cursor + .getPredefinedCursor(Cursor.HAND_CURSOR)); + infoLabel.setForeground(HYPERLINK_COLOR); + infoLabel.addMouseListener(new MouseAdapter() { - infoLabel.addFocusListener(new FocusAdapter() { + @Override + public void mouseClicked(MouseEvent me) { + ActionEvent e = new ActionEvent(this, + ActionEvent.ACTION_PERFORMED, hashdataCommand); + hashdataListener.actionPerformed(e); + } + }); - @Override - public void focusGained(FocusEvent e) { + infoLabel.addKeyListener(new KeyAdapter() { - if (shortText) { - infoLabel.setText(getMessage(MESSAGE_HASHDATALINK_TINY_FOCUS)); - } else { - infoLabel.setText(getMessage(MESSAGE_HASHDATALINK_FOCUS)); - } - } + @Override + public void keyPressed(KeyEvent e) { - @Override - public void focusLost(FocusEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + ActionEvent e1 = new ActionEvent(this, + ActionEvent.ACTION_PERFORMED, + hashdataCommand); + hashdataListener.actionPerformed(e1); + } + } - if (shortText) { - infoLabel.setText(getMessage(MESSAGE_HASHDATALINK_TINY)); - } else { - infoLabel.setText(getMessage(MESSAGE_HASHDATALINK)); - } + }); - } + infoLabel.addFocusListener(new FocusAdapter() { - }); + @Override + public void focusGained(FocusEvent e) { - helpMouseListener.setHelpTopic(HELP_SIGNPIN); - helpKeyListener.setHelpTopic(HELP_SIGNPIN); + infoLabel.setBorder(sigDataFocusBorder); + } - //TODO message panel + @Override + public void focusLost(FocusEvent e) { -// String msgPattern = getMessage(MESSAGE_ENTERPIN_PINPAD); -// String msg = MessageFormat.format(msgPattern, new Object[] { -// pinSpec.getLocalizedName(), pinSpec.getLocalizedLength() }); -// -// JLabel msgLabel = new JLabel(); -// msgLabel.setFont(msgLabel.getFont().deriveFont(msgLabel.getFont().getStyle() & ~Font.BOLD)); -// msgLabel.setText(msg); - - 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(switchFocusDummyLabel) - .addComponent(helpLabel) - ; - infoVertical - .addComponent(switchFocusDummyLabel) - .addComponent(helpLabel) - ; - } - - mainPanelLayout.setHorizontalGroup( - infoHorizontal); -// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) -// .addGroup(infoHorizontal) -// .addComponent(msgLabel)); - - mainPanelLayout.setVerticalGroup( - infoVertical); -// mainPanelLayout.createSequentialGroup() -// .addGroup(infoVertical) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(msgLabel)); - - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup(); - GroupLayout.Group buttonVertical; - - JButton enterPINButton = new JButton(); - enterPINButton.setFont(enterPINButton.getFont().deriveFont(enterPINButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - enterPINButton.setText(getMessage(BUTTON_SIGN)); - enterPINButton.setActionCommand(enterPINCommand); - enterPINButton.addActionListener(enterPINListener); - - if (renderCancelButton) { - 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 - .addComponent(enterPINButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) - ; - buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(enterPINButton) - .addComponent(cancelButton) - ; - } else { - buttonHorizontal - .addComponent(enterPINButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) - ; - buttonVertical = buttonPanelLayout.createSequentialGroup() - .addComponent(enterPINButton) - ; - } - - buttonPanelLayout.setHorizontalGroup(buttonHorizontal); - buttonPanelLayout.setVerticalGroup(buttonVertical); - - contentPanel.validate(); + infoLabel.setBorder(BorderFactory.createEmptyBorder()); + } + + }); + + helpListener.setHelpTopic(HELP_SIGNPIN); + + 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) { + + if (helpListener.implementsListener()) { + infoHorizontal.addPreferredGap( + LayoutStyle.ComponentPlacement.UNRELATED, 0, + Short.MAX_VALUE).addComponent(helpLabel); + infoVertical.addComponent(helpLabel); + } + infoHorizontal.addComponent(switchFocusDummyLabel); + infoVertical.addComponent(switchFocusDummyLabel); + + } + + mainPanelLayout.setHorizontalGroup(infoHorizontal); + mainPanelLayout.setVerticalGroup(infoVertical); + + enterPINButton.setFont(enterPINButton.getFont().deriveFont( + enterPINButton.getFont().getStyle() + & ~java.awt.Font.BOLD)); + enterPINButton.setText(getMessage(BUTTON_SIGN)); + enterPINButton.setActionCommand(enterPINCommand); + enterPINButton.addActionListener(enterPINListener); + + enterPINButton.addFocusListener(new FocusAdapter() { + + @Override + public void focusGained(FocusEvent e) { + + // focus has been set accordingly - re-enable dummy + // label + switchFocusDummyLabel.setFocusable(true); + } + + }); + + if (renderCancelButton) { + cancelButton.setFont(cancelButton.getFont().deriveFont( + cancelButton.getFont().getStyle() + & ~java.awt.Font.BOLD)); + cancelButton.setText(getMessage(BUTTON_CANCEL)); + cancelButton.setActionCommand(cancelCommand); + cancelButton.addActionListener(cancelListener); + } + + updateMethodToRunAtResize("at.gv.egiz.bku.gui.BKUGUIImpl", + "renderShowSignatureDataDialogButtonPanel"); + + renderShowSignatureDataDialogButtonPanel(); + + if (windowCloseAdapter != null) { + windowCloseAdapter.registerListener(cancelListener, cancelCommand); } - }); - } - @Override - public void correctionButtonPressed() { - log.debug("[" + Thread.currentThread().getName() + "] correction button pressed"); - - if (pinpadPIN != null) { - try { - pinpadPIN.remove(0, 1); - } catch (BadLocationException ex) { - } - } - } + primaryFocusHolder = enterPINButton; - @Override - public void allKeysCleared() { - log.debug("[" + Thread.currentThread().getName() + "] all keys cleared"); - - if (pinpadPIN != null) { - try { - pinpadPIN.remove(0, pinpadPIN.getLength()); - } catch (BadLocationException ex) { - } - } - } + enterPINButton.requestFocus(); - @Override - public void validKeyPressed() { - log.debug("[" + Thread.currentThread().getName() + "] valid key pressed"); - - if (pinpadPIN != null) { - try { - pinpadPIN.insertString(0, "*", null); - } catch (BadLocationException ex) { - } - } - } + contentPanel.validate(); - @Override - public void showSignaturePINDialog(final PINSpec pinSpec, final int numRetries, + resize(); + } + }); + } + + public void renderShowSignatureDataDialogButtonPanel() { + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout + .createSequentialGroup(); + GroupLayout.Group buttonVertical; + + if (renderCancelButton) { + + buttonHorizontal.addComponent(enterPINButton, + GroupLayout.PREFERRED_SIZE, buttonSize, + GroupLayout.PREFERRED_SIZE).addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED).addComponent( + cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, + GroupLayout.PREFERRED_SIZE); + buttonVertical = buttonPanelLayout.createParallelGroup( + GroupLayout.Alignment.BASELINE) + .addComponent(enterPINButton).addComponent(cancelButton); + } else { + buttonHorizontal.addComponent(enterPINButton, + GroupLayout.PREFERRED_SIZE, buttonSize, + GroupLayout.PREFERRED_SIZE); + buttonVertical = buttonPanelLayout.createSequentialGroup() + .addComponent(enterPINButton); + } + + buttonPanelLayout.setHorizontalGroup(buttonHorizontal); + buttonPanelLayout.setVerticalGroup(buttonVertical); + + } + + @Override + public void correctionButtonPressed() { + log.debug("[{}] Correction button pressed.", Thread.currentThread().getName()); + + if (pinpadPIN != null) { + try { + pinpadPIN.remove(0, 1); + } catch (BadLocationException ex) { + } + } + } + + @Override + public void allKeysCleared() { + log.debug("[{}] All keys cleared.", Thread.currentThread().getName()); + + if (pinpadPIN != null) { + try { + pinpadPIN.remove(0, pinpadPIN.getLength()); + } catch (BadLocationException ex) { + } + } + } + + @Override + public void validKeyPressed() { + log.debug("[{}] Valid key pressed.", Thread.currentThread().getName()); + + if (pinpadPIN != null) { + try { + pinpadPIN.insertString(0, "*", null); + } catch (BadLocationException ex) { + } + } + } + + @Override + public void showSignaturePINDialog(final PinInfo pinSpec, final int numRetries, final ActionListener signListener, final String signCommand, final ActionListener cancelListener, final String cancelCommand, final ActionListener hashdataListener, final String hashdataCommand) { - log.debug("scheduling signature-pin dialog"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - log.debug("[" + Thread.currentThread().getName() + "] show signature-pin dialog"); - - mainPanel.removeAll(); - buttonPanel.removeAll(); - - if (renderHeaderPanel) { - if (numRetries < 0) { - titleLabel.setText(getMessage(TITLE_SIGN)); - } else { - titleLabel.setText(getMessage(TITLE_RETRY)); - } - } - - final JLabel infoLabel = new JLabel(); - if (numRetries < 0) { - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - if (shortText) { - infoLabel.setText(getMessage(MESSAGE_HASHDATALINK_TINY)); - } else { - infoLabel.setText(getMessage(MESSAGE_HASHDATALINK)); - } - infoLabel.setFocusable(true); - infoLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - infoLabel.setForeground(HYPERLINK_COLOR); - infoLabel.addMouseListener(new MouseAdapter() { - - @Override - public void mouseClicked(MouseEvent me) { - ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand); - hashdataListener.actionPerformed(e); - } - }); - - infoLabel.addKeyListener(new KeyAdapter() { - - @Override - public void keyPressed(KeyEvent e) { - - if(e.getKeyCode() == KeyEvent.VK_ENTER) { - ActionEvent e1 = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand); - hashdataListener.actionPerformed(e1); - } - } - - }); - - infoLabel.addFocusListener(new FocusAdapter() { - - @Override - public void focusGained(FocusEvent e) { - - - if (shortText) { - infoLabel.setText(getMessage(MESSAGE_HASHDATALINK_TINY_FOCUS)); - } else { - infoLabel.setText(getMessage(MESSAGE_HASHDATALINK_FOCUS)); - } - } - - @Override - public void focusLost(FocusEvent e) { - - - if (shortText) { - infoLabel.setText(getMessage(MESSAGE_HASHDATALINK_TINY)); - } else { - infoLabel.setText(getMessage(MESSAGE_HASHDATALINK)); - } - - } - - }); - - helpMouseListener.setHelpTopic(HELP_SIGNPIN); - helpKeyListener.setHelpTopic(HELP_SIGNPIN); - } else { - String retryPattern; - if (numRetries < 2) { - retryPattern = getMessage(MESSAGE_LAST_RETRY); - } else { - retryPattern = getMessage(MESSAGE_RETRIES); - } - infoLabel.setFocusable(true); - infoLabel.setText(MessageFormat.format(retryPattern, new Object[]{String.valueOf(numRetries)})); - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD)); - infoLabel.setForeground(ERROR_COLOR); - helpMouseListener.setHelpTopic(HELP_RETRY); - helpKeyListener.setHelpTopic(HELP_RETRY); - } - - JButton signButton = new JButton(); - signButton.setFont(signButton.getFont().deriveFont(signButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - signButton.setText(getMessage(BUTTON_SIGN)); - signButton.setEnabled(pinSpec.getMinLength() <= 0); - signButton.setActionCommand(signCommand); - signButton.addActionListener(signListener); - - JLabel signPinLabel = new JLabel(); - signPinLabel.setFont(signPinLabel.getFont().deriveFont(signPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - String pinLabel = getMessage(LABEL_PIN); - signPinLabel.setText(MessageFormat.format(pinLabel, new Object[]{pinSpec.getLocalizedName()})); - - pinField = new JPasswordField(); - pinField.setText(""); - pinField.setDocument(new PINDocument(pinSpec.getMinLength(), pinSpec.getMaxLength(), pinSpec.getRexepPattern(), signButton)); - pinField.setActionCommand(signCommand); - pinField.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if (pinField.getPassword().length >= pinSpec.getMinLength()) { - signListener.actionPerformed(e); - } - } - }); - - - JLabel pinsizeLabel = new JLabel(); - pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, pinsizeLabel.getFont().getSize()-2)); - pinsizeLabel.setText(MessageFormat.format(getMessage(LABEL_PINSIZE), pinSpec.getLocalizedLength())); - - 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(switchFocusDummyLabel) - .addComponent(helpLabel) - ; - infoVertical - .addComponent(switchFocusDummyLabel) - .addComponent(helpLabel) - ; - } - - // align pinfield and pinsize to the right - GroupLayout.Group pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING); - GroupLayout.SequentialGroup pinVertical = mainPanelLayout.createSequentialGroup(); - - if (pinLabelPos == PinLabelPosition.ABOVE) { - pinHorizontal - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); - pinVertical - .addComponent(signPinLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinsizeLabel); - } else { // PinLabelPosition.LEFT - pinHorizontal - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); - pinVertical - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(signPinLabel) - .addComponent(pinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinsizeLabel); - } - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(infoHorizontal) - .addGroup(pinHorizontal)); - - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(infoVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pinVertical)); - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup(); - GroupLayout.Group buttonVertical; - - if (renderCancelButton) { - 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 - .addComponent(signButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) - ; - buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(signButton) - .addComponent(cancelButton) - ; - } else { - buttonHorizontal - .addComponent(signButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) - ; - buttonVertical = buttonPanelLayout.createSequentialGroup() - .addComponent(signButton) - ; - } - - buttonPanelLayout.setHorizontalGroup(buttonHorizontal); - buttonPanelLayout.setVerticalGroup(buttonVertical); - -// pinField.requestFocusInWindow(); -// helpLabel.requestFocus(); - pinField.requestFocus(); - contentPanel.validate(); - - } - }); - } + log.debug("Scheduling signature-pin dialog."); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("[{}] Show signature-pin dialog.", Thread.currentThread().getName()); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + // specify policy to ensure correct focus traversal + if (useFocusTraversalPolicy) { + + contentPanel.setFocusCycleRoot(true); + contentPanel + .setFocusTraversalPolicy(new AdvancedSigPinGUIFocusTraversalPolicy()); + } + + // avoid that dummy label gains focus during load + switchFocusDummyLabel.setFocusable(false); + + if (renderHeaderPanel) { + if (numRetries < 0) { + titleLabel.setText(getMessage(TITLE_SIGN)); + } else { + titleLabel.setText(getMessage(TITLE_RETRY)); + } + } + + infoLabel = new JLabel(); + if (numRetries < 0) { + infoLabel.setFont(infoLabel.getFont().deriveFont( + infoLabel.getFont().getStyle() + & ~java.awt.Font.BOLD)); + if (shortText) { + infoLabel + .setText(getMessage(MESSAGE_HASHDATALINK_TINY)); + } else { + infoLabel.setText(getMessage(MESSAGE_HASHDATALINK)); + } + + infoLabel.setToolTipText(getMessage(SIGDATA_TOOLTIPTEXT)); + infoLabel.getAccessibleContext().setAccessibleDescription( + getMessage(SIGDATA_TOOLTIPTEXT)); + infoLabel.getAccessibleContext().setAccessibleName( + getMessage(SIGDATA_TOOLTIPTEXT)); + + infoLabel.setFocusable(true); + infoLabel.setCursor(Cursor + .getPredefinedCursor(Cursor.HAND_CURSOR)); + infoLabel.setForeground(HYPERLINK_COLOR); + infoLabel.addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent me) { + ActionEvent e = new ActionEvent(this, + ActionEvent.ACTION_PERFORMED, + hashdataCommand); + hashdataListener.actionPerformed(e); + } + }); + + infoLabel.addKeyListener(new KeyAdapter() { + + @Override + public void keyPressed(KeyEvent e) { + + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + ActionEvent e1 = new ActionEvent(this, + ActionEvent.ACTION_PERFORMED, + hashdataCommand); + hashdataListener.actionPerformed(e1); + } + } + + }); + + infoLabel.addFocusListener(new FocusAdapter() { + + @Override + public void focusGained(FocusEvent e) { + + infoLabel.setBorder(sigDataFocusBorder); + } + + @Override + public void focusLost(FocusEvent e) { + + infoLabel.setBorder(BorderFactory + .createEmptyBorder()); + } + + }); + + helpListener.setHelpTopic(HELP_SIGNPIN); + } else { + String retryPattern; + if (numRetries < 2) { + retryPattern = getMessage(MESSAGE_LAST_RETRY); + } else { + retryPattern = getMessage(MESSAGE_RETRIES); + } + infoLabel.setFocusable(true); + infoLabel.setText(MessageFormat.format(retryPattern, + new Object[] { String.valueOf(numRetries) })); + + infoLabel.setToolTipText(getMessage(SIGDATA_TOOLTIPTEXT)); + infoLabel.getAccessibleContext().setAccessibleDescription( + getMessage(SIGDATA_TOOLTIPTEXT)); + infoLabel.getAccessibleContext().setAccessibleName( + getMessage(SIGDATA_TOOLTIPTEXT)); + + infoLabel.setFont(infoLabel.getFont() + .deriveFont( + infoLabel.getFont().getStyle() + | java.awt.Font.BOLD)); + infoLabel.setForeground(ERROR_COLOR); + helpListener.setHelpTopic(HELP_RETRY); + } + + signButton.setFont(signButton.getFont().deriveFont( + signButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + signButton.setText(getMessage(BUTTON_SIGN)); + signButton.setEnabled(pinSpec.getMinLength() <= 0); + signButton.setActionCommand(signCommand); + signButton.addActionListener(signListener); + + signPinLabel.setFont(signPinLabel.getFont() + .deriveFont( + signPinLabel.getFont().getStyle() + & ~java.awt.Font.BOLD)); + String pinLabel = getMessage(LABEL_PIN); + signPinLabel.setText(MessageFormat.format(pinLabel, + new Object[] { pinSpec.getLocalizedName() })); + + pinField = new JPasswordField(); + pinField.setText(""); + pinField.setName("PINField"); + pinField.setDocument(new PINDocument(pinSpec.getMinLength(), + pinSpec.getMaxLength(), pinSpec.getRexepPattern(), + signButton)); + pinField.setActionCommand(signCommand); + pinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (pinField.getPassword().length >= pinSpec + .getMinLength()) { + signListener.actionPerformed(e); + } + } + }); + + // FIXME: For some reason, the switchFocusDummyLabel obtains the + // focus even + // if the pinField requests the focus. Therefore, the + // switchFocusDummyLabel is + // deactivated first and enabled only after the pinField has + // obtained the focus + pinField.addFocusListener(new FocusAdapter() { + + @Override + public void focusGained(FocusEvent e) { + + // focus has been set accordingly - re-enable dummy + // label + switchFocusDummyLabel.setFocusable(true); + } + + }); + + pinsizeLabel.setFont(pinsizeLabel.getFont() + .deriveFont( + pinsizeLabel.getFont().getStyle() + & ~java.awt.Font.BOLD, + pinsizeLabel.getFont().getSize() - 2)); + pinsizeLabel.setText(MessageFormat + .format(getMessage(LABEL_PINSIZE), pinSpec + .getLocalizedLength())); + + pinField.getAccessibleContext().setAccessibleDescription( + infoLabel.getText() + signPinLabel.getText() + + pinsizeLabel.getText()); + + 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) { + + if (helpListener.implementsListener()) { + infoHorizontal.addPreferredGap( + LayoutStyle.ComponentPlacement.UNRELATED, 0, + Short.MAX_VALUE).addComponent(helpLabel); + infoVertical.addComponent(helpLabel); + } + infoHorizontal.addComponent(switchFocusDummyLabel); + infoVertical.addComponent(switchFocusDummyLabel); + + } + + // align pinfield and pinsize to the right + GroupLayout.Group pinHorizontal = mainPanelLayout + .createParallelGroup(GroupLayout.Alignment.TRAILING); + GroupLayout.SequentialGroup pinVertical = mainPanelLayout + .createSequentialGroup(); + + if (pinLabelPos == PinLabelPosition.ABOVE) { + pinHorizontal.addGroup( + mainPanelLayout.createParallelGroup( + GroupLayout.Alignment.LEADING) + .addComponent(signPinLabel, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE) + .addComponent(pinField, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)).addComponent( + pinsizeLabel, GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE); + pinVertical.addComponent(signPinLabel).addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel); + } else { // PinLabelPosition.LEFT + pinHorizontal + .addGroup( + mainPanelLayout + .createSequentialGroup() + .addComponent(signPinLabel, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinField, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)) + .addComponent(pinsizeLabel, + GroupLayout.PREFERRED_SIZE, + GroupLayout.DEFAULT_SIZE, + GroupLayout.PREFERRED_SIZE); + pinVertical.addGroup( + mainPanelLayout.createParallelGroup( + GroupLayout.Alignment.BASELINE) + .addComponent(signPinLabel).addComponent( + pinField)).addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel); + } + + mainPanelLayout.setHorizontalGroup(mainPanelLayout + .createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(infoHorizontal).addGroup(pinHorizontal)); + + mainPanelLayout + .setVerticalGroup(mainPanelLayout + .createSequentialGroup().addGroup(infoVertical) + .addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addGroup(pinVertical)); + + if (renderCancelButton) { + cancelButton.setFont(cancelButton.getFont().deriveFont( + cancelButton.getFont().getStyle() + & ~java.awt.Font.BOLD)); + cancelButton.setText(getMessage(BUTTON_CANCEL)); + cancelButton.setActionCommand(cancelCommand); + cancelButton.addActionListener(cancelListener); + } + + updateMethodToRunAtResize("at.gv.egiz.bku.gui.BKUGUIImpl", + "renderSignaturePINDialogueButtonPanel"); + + renderSignaturePINDialogueButtonPanel(); + + if (windowCloseAdapter != null) { + windowCloseAdapter.registerListener(cancelListener, cancelCommand); + } - @Override - public void showErrorDialog( - final String errorMsgKey, final Object[] errorMsgParams, - final ActionListener okListener, final String okCommand) { - - showMessageDialog(TITLE_ERROR, ERROR_COLOR, - errorMsgKey, errorMsgParams, BUTTON_OK, okListener, okCommand); - } + primaryFocusHolder = pinField; - @Override - public void showErrorDialog( - final String errorMsgKey, final Object[] errorMsgParams) { + pinField.requestFocus(); - showMessageDialog(TITLE_ERROR, ERROR_COLOR, - errorMsgKey, errorMsgParams, null, null, null); - } + contentPanel.validate(); - @Override - public void showMessageDialog( - final String titleKey, - final String msgKey, final Object[] msgParams, - final String buttonKey, - final ActionListener okListener, final String okCommand) { - - showMessageDialog(titleKey, null, - msgKey, msgParams, buttonKey, okListener, okCommand); - } + resize(); + } + }); + } - @Override - public void showMessageDialog( - final String titleKey, - final String msgKey, final Object[] msgParams) { + public void renderSignaturePINDialogueButtonPanel() { + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout + .createSequentialGroup(); + GroupLayout.Group buttonVertical; + + if (renderCancelButton) { + + buttonHorizontal.addComponent(signButton, + GroupLayout.PREFERRED_SIZE, buttonSize, + GroupLayout.PREFERRED_SIZE).addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED).addComponent( + cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, + GroupLayout.PREFERRED_SIZE); + buttonVertical = buttonPanelLayout.createParallelGroup( + GroupLayout.Alignment.BASELINE).addComponent(signButton) + .addComponent(cancelButton); + } else { + buttonHorizontal.addComponent(signButton, + GroupLayout.PREFERRED_SIZE, buttonSize, + GroupLayout.PREFERRED_SIZE); + buttonVertical = buttonPanelLayout.createSequentialGroup() + .addComponent(signButton); + } + + buttonPanelLayout.setHorizontalGroup(buttonHorizontal); + buttonPanelLayout.setVerticalGroup(buttonVertical); - showMessageDialog(titleKey, null, - msgKey, msgParams, null, null, null); - } + } - @Override - public void showMessageDialog( - final String titleKey, final String msgKey) { + @Override + public void showErrorDialog(final String errorMsgKey, + final Object[] errorMsgParams, final ActionListener okListener, + final String okCommand) { - showMessageDialog(titleKey, null, - msgKey, null, null, null, null); - } + showMessageDialog(TITLE_ERROR, ERROR_COLOR, errorMsgKey, + errorMsgParams, BUTTON_OK, okListener, okCommand); + } - /** - * - * @param buttonKey if null defaults to BUTTON_OK - */ - private void showMessageDialog( - final String titleKey, final Color titleColor, - final String msgKey, final Object[] msgParams, - final String buttonKey, - final ActionListener okListener, final String okCommand) { - - log.debug("scheduling message dialog"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - log.debug("[" + Thread.currentThread().getName() + "] show message dialog"); - - mainPanel.removeAll(); - buttonPanel.removeAll(); - - if (renderHeaderPanel) { - titleLabel.setText(getMessage(titleKey)); - } - - helpMouseListener.setHelpTopic(msgKey); - helpKeyListener.setHelpTopic(msgKey); - - String msgPattern = getMessage(msgKey); - String msg = MessageFormat.format(msgPattern, msgParams); - - JLabel msgLabel = new JLabel(); - msgLabel.setFont(msgLabel.getFont().deriveFont(msgLabel.getFont().getStyle() & ~Font.BOLD)); - msgLabel.setText(msg); - - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); - - GroupLayout.ParallelGroup mainHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); - GroupLayout.SequentialGroup mainVertical = mainPanelLayout.createSequentialGroup(); - - log.debug("focus to contentPanel"); - contentPanel.requestFocus(); - - if (!renderHeaderPanel) { - JLabel titleLabel = new JLabel(); - titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() | Font.BOLD)); - titleLabel.setText(getMessage(titleKey)); - if (titleColor != null) { - titleLabel.setForeground(titleColor); - } - - mainHorizontal - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(titleLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(switchFocusDummyLabel) - .addComponent(helpLabel) - ); - mainVertical - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(titleLabel) - .addComponent(switchFocusDummyLabel) - .addComponent(helpLabel) - ); - - log.debug("focus to helpLabel"); - helpLabel.requestFocus(); - } - - mainPanelLayout.setHorizontalGroup(mainHorizontal - .addComponent(msgLabel)); - mainPanelLayout.setVerticalGroup(mainVertical - .addComponent(msgLabel)); - - if (okListener != null) { - - JButton okButton = new JButton(); - okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - okButton.setText(getMessage((buttonKey != null) ? buttonKey : BUTTON_OK)); - okButton.setActionCommand(okCommand); - okButton.addActionListener(okListener); - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - buttonPanelLayout.setHorizontalGroup( - buttonPanelLayout.createSequentialGroup() - .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); - buttonPanelLayout.setVerticalGroup( - buttonPanelLayout.createSequentialGroup() - .addComponent(okButton)); - - log.debug("focus to ok-button"); - okButton.requestFocus(); - } - - contentPanel.validate(); - } - }); - } + @Override + public void showErrorDialog(final String errorMsgKey, + final Object[] errorMsgParams) { + showMessageDialog(TITLE_ERROR, ERROR_COLOR, errorMsgKey, + errorMsgParams, null, null, null); + } - @Override - public char[] getPin() { - if (pinField != null) { - char[] pin = pinField.getPassword(); //returns a copy - pinField = null; //garbage collect original pin (make sure to clear char[] after use) - return pin; - } - return null; - } + @Override + public void showMessageDialog(final String titleKey, final String msgKey, + final Object[] msgParams, final String buttonKey, + final ActionListener okListener, final String okCommand) { + showMessageDialog(titleKey, null, msgKey, msgParams, buttonKey, + okListener, okCommand); + } - //////////////////////////////////////////////////////////////////////////// - // SECURE VIEWER - //////////////////////////////////////////////////////////////////////////// + @Override + public void showMessageDialog(final String titleKey, final String msgKey, + final Object[] msgParams) { - - /** - * @param signedReferences - * @param backListener gets notified if pin-dialog has to be redrawn - * (signedRefencesList returns via BACK button) - * @param okCommand - */ - @Override - public void showSecureViewer(final List<HashDataInput> dataToBeSigned, - final ActionListener backListener, final String backCommand) { - - if (dataToBeSigned == null) { - showErrorDialog(getMessage(ERR_NO_HASHDATA), - new Object[] {"no signature data provided"}, - backListener, backCommand); - } else if (dataToBeSigned.size() == 1) { - //TODO pull out (see also SignedReferencesSelectionListener) - if (SecureViewerDialog.SUPPORTED_MIME_TYPES.contains(dataToBeSigned.get(0).getMimeType())) { - try { - log.debug("[" + Thread.currentThread().getName() + "] scheduling secure viewer"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - try { - showMessageDialog(TITLE_SIGNATURE_DATA, MESSAGE_HASHDATA_VIEWER); - showSecureViewer(dataToBeSigned.get(0), backListener, backCommand); - } catch (FontProviderException ex) { - log.error("failed to display secure viewer", ex); - showErrorDialog(ERR_VIEWER, new Object[] {ex.getMessage()}, backListener, backCommand); - } - } - }); - - } catch (Exception ex) { //InterruptedException InvocationTargetException - log.error("Failed to display secure viewer: " + ex.getMessage()); - log.trace(ex); - showErrorDialog(ERR_UNKNOWN, null, backListener, backCommand); - } - } else { - log.debug("[" + Thread.currentThread().getName() + "] mime-type not supported by secure viewer, scheduling save dialog"); - showMessageDialog(TITLE_SIGNATURE_DATA, MESSAGE_UNSUPPORTED_MIMETYPE); - SecureViewerSaveDialog.showSaveDialog(dataToBeSigned.get(0), messages, backListener, backCommand); - } - } else { - showSignedReferencesListDialog(dataToBeSigned, backListener, backCommand); - } - } - - /** - * has to be called from event dispatcher thread - */ - private void showSecureViewer(HashDataInput dataToBeSigned, ActionListener closeListener, String closeCommand) throws FontProviderException { - - log.debug("[" + Thread.currentThread().getName() + "] show secure viewer"); - SecureViewerDialog secureViewer = new SecureViewerDialog(null, messages, - closeListener, closeCommand, - fontProvider, helpMouseListener.getActionListener()); - - // workaround for [#439] - // avoid AlwaysOnTop at least in applet, otherwise make secureViewer AlwaysOnTop since MOCCA Dialog (JFrame created in LocalSTALFactory) is always on top. - Window window = SwingUtilities.getWindowAncestor(contentPane); - if (window != null && window.isAlwaysOnTop()) { - log.debug("make secureViewer alwaysOnTop"); - secureViewer.setAlwaysOnTop(true); - } - secureViewer.setContent(dataToBeSigned); - log.trace("viewer setContent returned"); - } - - - - private void showSignedReferencesListDialog(final List<HashDataInput> signedReferences, - final ActionListener backListener, final String backCommand) { - - log.debug("[" + Thread.currentThread().getName() + "] scheduling signed references list dialog"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - log.debug("[" + Thread.currentThread().getName() + "] show signed references list dialog"); - - mainPanel.removeAll(); - buttonPanel.removeAll(); - - if (renderHeaderPanel) { - titleLabel.setText(getMessage(TITLE_SIGNATURE_DATA)); - } - - helpMouseListener.setHelpTopic(HELP_HASHDATALIST); - helpKeyListener.setHelpTopic(HELP_HASHDATALIST); - - JLabel refIdLabel = new JLabel(); - refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - String refIdLabelPattern = getMessage(MESSAGE_HASHDATALIST); - refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.size()})); - - HashDataTableModel tableModel = new HashDataTableModel(signedReferences, renderRefId); - final JTable hashDataTable = new JTable(tableModel); - hashDataTable.setDefaultRenderer(HashDataInput.class, new HyperlinkRenderer(renderRefId)); - hashDataTable.setTableHeader(null); - - hashDataTable.addMouseMotionListener(new SignedReferencesMouseMotionListener(hashDataTable)); - - hashDataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - hashDataTable.getSelectionModel().addListSelectionListener(new SignedReferencesSelectionListener(signedReferences, backListener, backCommand)); - - JScrollPane hashDataScrollPane = new JScrollPane(hashDataTable); - - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); - - GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup() - .addComponent(refIdLabel); - - GroupLayout.ParallelGroup messageVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(refIdLabel); - - if (!renderHeaderPanel) { - messageHorizontal - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(switchFocusDummyLabel) - .addComponent(helpLabel) - ; - messageVertical - .addComponent(switchFocusDummyLabel) - .addComponent(helpLabel) - ; - } - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(messageHorizontal) - .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); - - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(messageVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(hashDataScrollPane, 0, 0, hashDataTable.getPreferredSize().height+3)); - - JButton backButton = new JButton(); - backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - backButton.setText(getMessage(BUTTON_BACK)); - backButton.setActionCommand(backCommand); - backButton.addActionListener(backListener); - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - buttonPanelLayout.setHorizontalGroup(buttonPanelLayout.createSequentialGroup() - .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); - buttonPanelLayout.setVerticalGroup(buttonPanelLayout.createSequentialGroup() - .addComponent(backButton)); - - contentPanel.validate(); - } - }); - } - - - - /** - * not possible to add mouse listener to TableCellRenderer - * to change cursor on specific columns only, use table.columnAtPoint(e.getPoint()) - * - */ - private class SignedReferencesMouseMotionListener extends MouseMotionAdapter { - - JTable hashDataTable; - - public SignedReferencesMouseMotionListener(JTable table) { - this.hashDataTable = table; - } - - @Override - public void mouseMoved(MouseEvent e) { -// if (hashDataTable.columnAtPoint(e.getPoint()) == 0) { - hashDataTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - } - } - - /////////// - // SignedReferencesList (TODO pull out) - - public class SignedReferencesSelectionListener implements ListSelectionListener { - - List<HashDataInput> signedReferences; - ActionListener backListener; - String backCommand; - - public SignedReferencesSelectionListener(List<HashDataInput> signedReferences, ActionListener backListener, String backCommand) { - this.signedReferences = signedReferences; - this.backListener = backListener; - this.backCommand = backCommand; - } - - @Override - public void valueChanged(ListSelectionEvent event) { - - if (event.getValueIsAdjusting()) { - return; - } - - ListSelectionModel lsm = (ListSelectionModel) event.getSource(); - int selectionIdx = lsm.getMinSelectionIndex(); - - log.debug("[" + Thread.currentThread().getName() + "] reference " + selectionIdx + " selected"); - - if (selectionIdx >= 0) { - final HashDataInput selection = signedReferences.get(selectionIdx); - final SignedReferencesListDisplayer backToListListener = new SignedReferencesListDisplayer(signedReferences, backListener, backCommand); - - if (SecureViewerDialog.SUPPORTED_MIME_TYPES.contains(selection.getMimeType())) { - log.debug("[" + Thread.currentThread().getName() + "] scheduling secure viewer dialog"); - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - try { - showMessageDialog(TITLE_SIGNATURE_DATA, MESSAGE_HASHDATA_VIEWER); - showSecureViewer(selection, backToListListener, null); -// SecureViewerDialog.showSecureViewer(selection, messages, fontProvider, helpMouseListener.getActionListener(), false); - } catch (FontProviderException ex) { - log.error("failed to display secure viewer", ex); - showErrorDialog(BKUGUIFacade.ERR_VIEWER, new Object[] {ex.getMessage()}, backToListListener, null); - } - - } - }); - } else { - log.debug("[" + Thread.currentThread().getName() + "] mime-type not supported by secure viewer, scheduling save dialog"); - showMessageDialog(BKUGUIFacade.TITLE_SIGNATURE_DATA, BKUGUIFacade.MESSAGE_UNSUPPORTED_MIMETYPE); - SecureViewerSaveDialog.showSaveDialog(selection, messages, backToListListener, null); - } - } - } - - /** - * ActionListener that returns to signed references list - */ - private class SignedReferencesListDisplayer implements ActionListener { - List<HashDataInput> sr; - ActionListener bl; - String bc; - - public SignedReferencesListDisplayer(List<HashDataInput> signedReferences, ActionListener backListener, String backCommand) { - sr = signedReferences; - bl = backListener; - bc = backCommand; - } - - @Override - public void actionPerformed(ActionEvent e) { -// log.debug("[" + Thread.currentThread().getName() + "] displaying signed references list"); - showSignedReferencesListDialog(sr, bl, bc); - } - } - } + showMessageDialog(titleKey, null, msgKey, msgParams, null, null, null); + } + @Override + public void showMessageDialog(final String titleKey, final String msgKey) { - //////////////////////////////////////////////////////////////////////////// - // UTILITY METHODS - //////////////////////////////////////////////////////////////////////////// - - private void registerHelpListener(ActionListener helpListener) { - if (helpListener != null) { - this.helpMouseListener = new HelpMouseListener(helpListener); - this.helpKeyListener = new HelpKeyListener(helpListener); - } else { - log.error("no help listener provided, will not be able to display help"); - this.helpMouseListener = new HelpMouseListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - log.error("no help listener registered (requested help topic: " + e.getActionCommand() + ")"); - } - }); - this.helpKeyListener = new HelpKeyListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - log.error("no help listener registered (requested help topic: " + e.getActionCommand() + ")"); - } - }); - } - } + showMessageDialog(titleKey, null, msgKey, null, null, null, null); + } + + /** + * + * @param buttonKey + * if null defaults to BUTTON_OK + */ + private void showMessageDialog(final String titleKey, + final Color titleColor, final String msgKey, + final Object[] msgParams, final String buttonKey, + final ActionListener okListener, final String okCommand) { + + log.debug("Scheduling message dialog."); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("[{}] Show message dialog.", Thread.currentThread().getName()); + + log.debug("ButtonKey: {}.", buttonKey); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + // avoid that dummy label gains focus during load + switchFocusDummyLabel.setFocusable(false); + + if (renderHeaderPanel) { + titleLabel.setText(getMessage(titleKey)); + } - private void registerSwitchFocusListener(ActionListener switchFocusListener) { - if (switchFocusListener != null) { - this.switchFocusKeyListener = new SwitchFocusFocusListener(switchFocusListener); - - } else { - - this.switchFocusKeyListener = new SwitchFocusFocusListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - log.warn("no switch focus listener registered"); - } - }); + helpListener.setHelpTopic(msgKey); + + String msgPattern = getMessage(msgKey); + String msg = MessageFormat.format(msgPattern, msgParams); + + // we need to create a new JLabel object every time in order to + // ensure + // that screen reading software will read each updated label + msgLabel = new JLabel(); + + msgLabel.setFocusable(true); + + msgLabel.setFont(msgLabel.getFont().deriveFont( + msgLabel.getFont().getStyle() & ~Font.BOLD)); + msgLabel.setText(msg); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + GroupLayout.ParallelGroup mainHorizontal = mainPanelLayout + .createParallelGroup(GroupLayout.Alignment.LEADING); + GroupLayout.SequentialGroup mainVertical = mainPanelLayout + .createSequentialGroup(); + + String accessibleData = ""; + + if (!renderHeaderPanel) { + msgTitleLabel = new JLabel(); + msgTitleLabel.setFont(msgTitleLabel.getFont().deriveFont( + msgTitleLabel.getFont().getStyle() | Font.BOLD)); + msgTitleLabel.setText(getMessage(titleKey)); + + if (titleColor != null) { + msgTitleLabel.setForeground(titleColor); + } + + accessibleData = accessibleData + getMessage(titleKey); + + GroupLayout.SequentialGroup titleHorizontal = mainPanelLayout + .createSequentialGroup() + .addComponent(msgTitleLabel); + + GroupLayout.ParallelGroup titleVertical = mainPanelLayout + .createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(msgTitleLabel); + + if (helpListener.implementsListener()) { + titleHorizontal.addPreferredGap( + LayoutStyle.ComponentPlacement.UNRELATED, 0, + Short.MAX_VALUE).addComponent(helpLabel); + titleVertical.addComponent(helpLabel); + } + titleHorizontal.addComponent(switchFocusDummyLabel); + titleVertical.addComponent(switchFocusDummyLabel); + + mainHorizontal.addGroup(titleHorizontal); + mainVertical.addGroup(titleVertical); + + } else { + + accessibleData = accessibleData + titleLabel.getText(); + } + + msgLabel.getAccessibleContext().setAccessibleName( + accessibleData + msgLabel.getText()); + msgLabel.getAccessibleContext().setAccessibleDescription( + accessibleData + msgLabel.getText()); + + msgLabel.addFocusListener(new FocusAdapter() { + + @Override + public void focusGained(FocusEvent e) { + + // focus has been set accordingly - re-enable dummy + // label + switchFocusDummyLabel.setFocusable(true); + } + + }); + + mainPanelLayout.setHorizontalGroup(mainHorizontal + .addComponent(msgLabel)); + mainPanelLayout.setVerticalGroup(mainVertical + .addComponent(msgLabel)); + + if (okListener != null) { + + showMessageOKButton = true; + + okButton.setFont(okButton.getFont() + .deriveFont( + okButton.getFont().getStyle() + & ~java.awt.Font.BOLD)); + okButton.setText(getMessage((buttonKey != null) ? buttonKey + : BUTTON_OK)); + okButton.setActionCommand(okCommand); + okButton.addActionListener(okListener); + + renderShowMessageDialogueButtonPanel(); + + primaryFocusHolder = msgLabel; + + } else { + log.debug("No okListener configured."); + showMessageOKButton = false; + } + + // okListener might be null (up to windowCloseAdapter what to do) + if (windowCloseAdapter != null) { + windowCloseAdapter.registerListener(okListener, okCommand); } - } - - //////////////////////////////////////////////////////////////////////////// - // INITIALIZERS (MAY BE OVERRIDDEN BY SUBCLASSES) - //////////////////////////////////////////////////////////////////////////// - - /** - * Load applet messages bundle. Note that getBundle looks for classes based - * on the default Locale before it selects the base class! - * - * Called from constructor. - * Subclasses may override this method to ensure the message bundle is loaded - * once initButtonSize (called from constructor as well) is called. - * (Only relevant if initButtonSize is overridden as well) - * @param locale - */ - protected void loadMessageBundle(Locale locale) { - if (locale != null) { - // see [#378] Ignoring post parameter 'locale': bundle resolve-order not correct?! - Locale lang = new Locale(locale.getLanguage().substring(0, 2)); - log.debug("loading applet resources for language: " + lang.toString()); - messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, lang); - } else { - log.debug("loading default language applet resources"); - messages = ResourceBundle.getBundle(MESSAGES_BUNDLE); - } - // how the f*** you know the default Messages.properties is de?! - log.debug("applet messages loaded: " + messages.getLocale()); - } - protected int initButtonSize() { - int bs = 0; - - JButton b = new JButton(); - b.setText(getMessage(BUTTON_OK)); - if (b.getPreferredSize().width > bs) { - bs = b.getPreferredSize().width; - } - // need cancel button for message dialog, - // even if renderCancelButton == false - b.setText(getMessage(BUTTON_CANCEL)); - if (b.getPreferredSize().width > bs) { - bs = b.getPreferredSize().width; - } - b.setText(getMessage(BUTTON_SIGN)); - if (b.getPreferredSize().width > bs) { - bs = b.getPreferredSize().width; - } - b.setText(getMessage(BUTTON_BACK)); - if (b.getPreferredSize().width > bs) { - bs = b.getPreferredSize().width; - } - b.setText(getMessage(BUTTON_SAVE)); - if (b.getPreferredSize().width > bs) { - bs = b.getPreferredSize().width; - } - return bs; - } + updateMethodToRunAtResize("at.gv.egiz.bku.gui.BKUGUIImpl", + "renderShowMessageDialogueButtonPanel"); + + // put focus to msgLabel to guarantee that label is read by + // screen reader upon loading + msgLabel.requestFocus(); + + contentPanel.validate(); + + resize(); + } + }); + } + + public void renderShowMessageDialogueButtonPanel() { + + if (showMessageOKButton) { + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup(buttonPanelLayout + .createSequentialGroup().addComponent(okButton, + GroupLayout.PREFERRED_SIZE, buttonSize, + GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup(buttonPanelLayout + .createSequentialGroup().addComponent(okButton)); + } + } + + @Override + public char[] getPin() { + if (pinField != null) { + char[] pin = pinField.getPassword(); // returns a copy + pinField = null; // garbage collect original pin (make sure to clear + // char[] after use) + return pin; + } + return null; + } + + // ////////////////////////////////////////////////////////////////////////// + // SECURE VIEWER + // ////////////////////////////////////////////////////////////////////////// + + /** + * @param signedReferences + * @param backListener + * gets notified if pin-dialog has to be redrawn + * (signedRefencesList returns via BACK button) + * @param okCommand + */ + @Override + public void showSecureViewer(final List<HashDataInput> dataToBeSigned, + final ActionListener backListener, final String backCommand) { + + if (dataToBeSigned == null) { + showErrorDialog(getMessage(ERR_NO_HASHDATA), + new Object[] { "no signature data provided" }, + backListener, backCommand); + } else if (dataToBeSigned.size() == 1) { + // TODO pull out (see also SignedReferencesSelectionListener) + if (SecureViewerDialog.SUPPORTED_MIME_TYPES.contains(dataToBeSigned + .get(0).getMimeType())) { + try { + log.debug("[{}] Scheduling secure viewer.", Thread.currentThread().getName()); + + showMessageDialog(TITLE_SIGNATURE_DATA, + MESSAGE_HASHDATA_VIEWER); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + try { + showSecureViewer(dataToBeSigned.get(0), + backListener, backCommand); + } catch (FontProviderException ex) { + log.error("Failed to display secure viewer.", ex); + showErrorDialog(ERR_VIEWER, new Object[] { ex + .getMessage() }, backListener, + backCommand); + } + } + }); + + } catch (Exception ex) { // InterruptedException + // InvocationTargetException + log.error("Failed to display secure viewer. ", ex); + showErrorDialog(ERR_UNKNOWN, null, backListener, + backCommand); + } + } else { + log.debug("[{}] mime-type not supported by secure viewer, " + + "scheduling save dialog.", Thread.currentThread().getName()); + showMessageDialog(TITLE_SIGNATURE_DATA, + MESSAGE_UNSUPPORTED_MIMETYPE, + new Object[] { dataToBeSigned.get(0).getMimeType() }); + SecureViewerSaveDialog.showSaveDialog(dataToBeSigned.get(0), + messages, backListener, backCommand, + (int) (baseFontSize * getResizeFactor())); + } + } else { + showSignedReferencesListDialog(dataToBeSigned, backListener, + backCommand); + } + } + + /** + * has to be called from event dispatcher thread + */ + private void showSecureViewer(HashDataInput dataToBeSigned, + ActionListener closeListener, String closeCommand) + throws FontProviderException { + + log.debug("[{}] Show secure viewer."); + secureViewer = new SecureViewerDialog(null, messages, closeListener, + closeCommand, fontProvider, helpListener, getResizeFactor()); + + // workaround for [#439] + // avoid AlwaysOnTop at least in applet, otherwise make secureViewer + // AlwaysOnTop since MOCCA Dialog (JFrame created in LocalSTALFactory) + // is always on top. + Window window = SwingUtilities.getWindowAncestor(contentPane); + if (window != null && window.isAlwaysOnTop()) { + log.debug("Make secureViewer alwaysOnTop."); + secureViewer.setAlwaysOnTop(true); + } + + secureViewer.setContent(dataToBeSigned); + log.trace("Viewer setContent returned."); + } + + private void openSecureViewerDialog() { + + final HashDataInput storedSelection = signedReferences.get(referenceIndex); + + if (SecureViewerDialog.SUPPORTED_MIME_TYPES.contains(storedSelection + .getMimeType())) { + log.debug("[{}] Scheduling secure viewer dialog.", Thread.currentThread().getName()); + + showMessageDialog(TITLE_SIGNATURE_DATA, + MESSAGE_HASHDATA_VIEWER); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + try { + showSecureViewer(storedSelection, storedBackToListListener, + null); + // SecureViewerDialog.showSecureViewer(selection, + // messages, fontProvider, + // helpMouseListener.getActionListener(), + // false); + } catch (FontProviderException ex) { + log.error("Failed to display secure viewer.", ex); + showErrorDialog(BKUGUIFacade.ERR_VIEWER, + new Object[] { ex.getMessage() }, + storedBackToListListener, null); + } + + } + }); + } else { + log.debug("[{}] Mime-type not supported by secure viewer, " + + "scheduling save dialog.", Thread.currentThread().getName()); + showMessageDialog(BKUGUIFacade.TITLE_SIGNATURE_DATA, + BKUGUIFacade.MESSAGE_UNSUPPORTED_MIMETYPE, + new Object[] { storedSelection.getMimeType() }); + SecureViewerSaveDialog.showSaveDialog(storedSelection, messages, + storedBackToListListener, null, + (int) (baseFontSize * getResizeFactor())); + } + + + } + + private void showSignedReferencesListDialog( + final List<HashDataInput> signedReferences, + final ActionListener backListener, final String backCommand) { + + log.debug("[{}] Scheduling signed references list dialog.", Thread.currentThread().getName()); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("[{}] Show signed references list dialog.", Thread.currentThread().getName()); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + if (renderHeaderPanel) { + titleLabel.setText(getMessage(TITLE_SIGNATURE_DATA)); + } + + helpListener.setHelpTopic(HELP_HASHDATALIST); + + refIdLabel = new JLabel(); + refIdLabel.setFont(refIdLabel.getFont().deriveFont( + refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + String refIdLabelPattern = getMessage(MESSAGE_HASHDATALIST); + refIdLabel.setText(MessageFormat.format(refIdLabelPattern, + new Object[] { signedReferences.size() })); + + HashDataTableModel tableModel = new HashDataTableModel( + signedReferences, renderRefId); + hashDataTable = new JTable(tableModel); + + hyperlinkRenderer = new HyperlinkRenderer(renderRefId); + + hashDataTable.setDefaultRenderer(HashDataInput.class, + hyperlinkRenderer); + hashDataTable.setTableHeader(null); + + hashDataTable + .addMouseMotionListener(new SignedReferencesMouseMotionListener( + hashDataTable)); + + hashDataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + + hashDataTable + .setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + hashDataTable.getSelectionModel().addListSelectionListener( + new SignedReferencesSelectionListener(signedReferences, + backListener, backCommand)); + + + hashDataTable.addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent e) { + + openSecureViewerDialog(); + } + + }); + + hashDataTable.addKeyListener(new KeyAdapter() { + + @Override + public void keyPressed(KeyEvent e) { + + if(e.getKeyCode() == KeyEvent.VK_ENTER) { + + log.debug("Detected Enter Key."); + + openSecureViewerDialog(); + } + + } + + }); + + hashDataScrollPane = new JScrollPane(hashDataTable); + + backButton.setFont(backButton.getFont().deriveFont( + backButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + backButton.setText(getMessage(BUTTON_BACK)); + backButton.setActionCommand(backCommand); + backButton.addActionListener(backListener); + + primaryFocusHolder = hashDataTable; + + updateMethodToRunAtResize("at.gv.egiz.bku.gui.BKUGUIImpl", "renderSignedReferenceListButtonandTable"); + + renderSignedReferenceListButtonandTable(); + + hashDataTable.requestFocus(); + + contentPanel.validate(); + + resize(); + } + }); + } + + public void renderSignedReferenceListButtonandTable() { + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout + .createSequentialGroup().addComponent(refIdLabel); + + GroupLayout.ParallelGroup messageVertical = mainPanelLayout + .createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(refIdLabel); + + if (!renderHeaderPanel) { + + if (helpListener.implementsListener()) { + messageHorizontal.addPreferredGap( + LayoutStyle.ComponentPlacement.UNRELATED, 0, + Short.MAX_VALUE).addComponent(helpLabel); + messageVertical.addComponent(helpLabel); + } + messageHorizontal.addComponent(switchFocusDummyLabel); + messageVertical.addComponent(switchFocusDummyLabel); + } + + mainPanelLayout.setHorizontalGroup(mainPanelLayout + .createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(messageHorizontal).addComponent( + hashDataScrollPane, 0, 0, Short.MAX_VALUE)); + + mainPanelLayout + .setVerticalGroup(mainPanelLayout + .createSequentialGroup() + .addGroup(messageVertical) + .addPreferredGap( + LayoutStyle.ComponentPlacement.RELATED) + .addComponent( + hashDataScrollPane, + 0, + 0, + hashDataTable.getPreferredSize().height + 3)); + + + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup(buttonPanelLayout + .createSequentialGroup().addComponent(backButton, + GroupLayout.PREFERRED_SIZE, buttonSize, + GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup(buttonPanelLayout + .createSequentialGroup().addComponent(backButton)); + + } + + /** + * not possible to add mouse listener to TableCellRenderer to change cursor + * on specific columns only, use table.columnAtPoint(e.getPoint()) + * + */ + private class SignedReferencesMouseMotionListener extends + MouseMotionAdapter { + + JTable hashDataTable; + + public SignedReferencesMouseMotionListener(JTable table) { + this.hashDataTable = table; + } + + @Override + public void mouseMoved(MouseEvent e) { + // if (hashDataTable.columnAtPoint(e.getPoint()) == 0) { + hashDataTable.setCursor(Cursor + .getPredefinedCursor(Cursor.HAND_CURSOR)); + } + } + + // ///////// + // SignedReferencesList (TODO pull out) + + public class SignedReferencesSelectionListener implements + ListSelectionListener { + +// List<HashDataInput> signedReferences; + ActionListener backListener; + String backCommand; + + public SignedReferencesSelectionListener( + List<HashDataInput> signedReferences, + ActionListener backListener, String backCommand) { +// this.signedReferences = signedReferences; + BKUGUIImpl.this.signedReferences = signedReferences; + this.backListener = backListener; + this.backCommand = backCommand; + } + + @Override + public void valueChanged(ListSelectionEvent event) { + + if (event.getValueIsAdjusting()) { + return; + } + + ListSelectionModel lsm = (ListSelectionModel) event.getSource(); + int selectionIdx = lsm.getMinSelectionIndex(); + + log.debug("[{}] Reference {} selected.", + Thread.currentThread().getName(), selectionIdx); + + if (selectionIdx >= 0) { +// final HashDataInput selection = signedReferences +// .get(selectionIdx); +// final SignedReferencesListDisplayer backToListListener = new SignedReferencesListDisplayer( +// signedReferences, backListener, backCommand); + + referenceIndex = selectionIdx; + storedBackToListListener = new SignedReferencesListDisplayer( + signedReferences, backListener, backCommand); + +// if (SecureViewerDialog.SUPPORTED_MIME_TYPES.contains(selection +// .getMimeType())) { +// log.debug("[" + Thread.currentThread().getName() +// + "] scheduling secure viewer dialog"); +// +// showMessageDialog(TITLE_SIGNATURE_DATA, +// MESSAGE_HASHDATA_VIEWER); +// +// SwingUtilities.invokeLater(new Runnable() { +// +// @Override +// public void run() { +// try { +// showSecureViewer(selection, backToListListener, +// null); +// // SecureViewerDialog.showSecureViewer(selection, +// // messages, fontProvider, +// // helpMouseListener.getActionListener(), +// // false); +// } catch (FontProviderException ex) { +// log +// .error( +// "failed to display secure viewer", +// ex); +// showErrorDialog(BKUGUIFacade.ERR_VIEWER, +// new Object[] { ex.getMessage() }, +// backToListListener, null); +// } +// +// } +// }); +// } else { +// log +// .debug("[" +// + Thread.currentThread().getName() +// + "] mime-type not supported by secure viewer, scheduling save dialog"); +// showMessageDialog(BKUGUIFacade.TITLE_SIGNATURE_DATA, +// BKUGUIFacade.MESSAGE_UNSUPPORTED_MIMETYPE, +// new Object[] { selection.getMimeType() }); +// SecureViewerSaveDialog.showSaveDialog(selection, messages, +// backToListListener, null, +// (int) (baseFontSize * getResizeFactor())); +// } + } + } + + /** + * ActionListener that returns to signed references list + */ + private class SignedReferencesListDisplayer implements ActionListener { + List<HashDataInput> sr; + ActionListener bl; + String bc; + + public SignedReferencesListDisplayer( + List<HashDataInput> signedReferences, + ActionListener backListener, String backCommand) { + sr = signedReferences; + bl = backListener; + bc = backCommand; + } + + @Override + public void actionPerformed(ActionEvent e) { + // log.debug("[" + Thread.currentThread().getName() + + // "] displaying signed references list"); + showSignedReferencesListDialog(sr, bl, bc); + } + } + } + + // ////////////////////////////////////////////////////////////////////////// + // UTILITY METHODS + // ////////////////////////////////////////////////////////////////////////// + + private void registerSwitchFocusListener(ActionListener switchFocusListener) { + if (switchFocusListener != null) { + this.switchFocusKeyListener = new SwitchFocusFocusListener( + switchFocusListener); + + } else { + + this.switchFocusKeyListener = new SwitchFocusFocusListener( + new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + log.warn("No switch focus listener registered."); + } + }); + } + } + + // ////////////////////////////////////////////////////////////////////////// + // INITIALIZERS (MAY BE OVERRIDDEN BY SUBCLASSES) + // ////////////////////////////////////////////////////////////////////////// + + /** + * Load applet messages bundle. Note that getBundle looks for classes based + * on the default Locale before it selects the base class! + * + * Called from constructor. Subclasses may override this method to ensure + * the message bundle is loaded once initButtonSize (called from constructor + * as well) is called. (Only relevant if initButtonSize is overridden as + * well) + * + * @param locale + */ + protected void loadMessageBundle(Locale locale) { + if (locale != null) { + // see [#378] Ignoring post parameter 'locale': bundle resolve-order + // not correct?! + Locale lang = new Locale(locale.getLanguage().substring(0, 2)); + log.debug("Loading message bundle for language: {}.", lang.toString()); + messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, lang); + } else { + log.debug("Loading default language message bundle."); + messages = ResourceBundle.getBundle(MESSAGES_BUNDLE); + } + + if (log.isDebugEnabled()) { + if (messages.getLocale() == null + || "".equals(messages.getLocale().getLanguage())) { + log.info("Fallback to default locale message bundle."); + } else { + log.info("Applet message bundle loaded for {}.", + messages.getLocale()); + } + } + } + + protected int initButtonSize() { + int bs = 0; + + JButton b = new JButton(); + b.setText(getMessage(BUTTON_OK)); + if (b.getPreferredSize().width > bs) { + bs = b.getPreferredSize().width; + } + // need cancel button for message dialog, + // even if renderCancelButton == false + b.setText(getMessage(BUTTON_CANCEL)); + if (b.getPreferredSize().width > bs) { + bs = b.getPreferredSize().width; + } + b.setText(getMessage(BUTTON_SIGN)); + if (b.getPreferredSize().width > bs) { + bs = b.getPreferredSize().width; + } + b.setText(getMessage(BUTTON_BACK)); + if (b.getPreferredSize().width > bs) { + bs = b.getPreferredSize().width; + } + b.setText(getMessage(BUTTON_SAVE)); + if (b.getPreferredSize().width > bs) { + bs = b.getPreferredSize().width; + } + return bs; + } @Override public void getFocusFromBrowser() { + + log.debug("Try setting focus to current component ..."); + if (primaryFocusHolder == null) { + log.debug("No stored component - set focus to contentPanel ..."); + + primaryFocusHolder = contentPanel; + + } + log.debug("Component to obtain focus: {}.", primaryFocusHolder.getName()); + primaryFocusHolder.requestFocus(); + + } + + protected void updateHelpLabelIcon() { + + if (helpListener.implementsListener()) { + + helpLabel.setIcon(new ImageIcon(getClass().getResource( + getHelpLabelResourceName()))); + + helpLabel.setBorder(helpLabel.hasFocus() ? helpFocusBorder + : BorderFactory.createEmptyBorder()); + } + + } + + protected String getHelpLabelResourceName() { + + double contentPanelWidth = contentPanel.getSize().getWidth(); + String resourceName = HELP_IMG; + + if (contentPanelWidth > 300) { + + resourceName = HELP_IMG_L; + } + + if (contentPanelWidth > 470) { + + resourceName = HELP_IMG_XL; + } + + if (contentPanelWidth > 600) { + + resourceName = HELP_IMG_XXL; + } + + return resourceName; + } + + protected float getResizeFactor() { + + if (baseWidth == null || baseHeight == null || baseWidth == 0 + || baseHeight == 0) { + + // first call - determine base width and height + baseWidth = contentPanel.getWidth(); + baseHeight = contentPanel.getHeight(); + } + + float factor = (float) contentPanel.getSize().getWidth() + / (float) baseWidth; + + return factor; + } + + public void resize() { + + log.debug("Resizing ..."); + updateHelpLabelIcon(); + + float factor = getResizeFactor(); + + this.sigDataFocusBorder.setBorderWidthFactor(factor); + this.helpFocusBorder.setBorderWidthFactor(factor); + + buttonSize = (int) ((float) baseButtonSize * factor); + + if (renderHeaderPanel) { + + titleLabel.setFont(titleLabel.getFont().deriveFont( + (float) ((baseFontSize + 2) * factor))); + } + + if (cancelButton != null) { + + cancelButton.setFont(cancelButton.getFont().deriveFont( + (float) (baseFontSize * factor))); + } + + if (pinField != null) { + pinField.setFont(pinField.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } + + if (infoLabel != null) { + infoLabel.setFont(infoLabel.getFont().deriveFont( + (float) (baseFontSize * factor))); + } + + if (pinsizeLabel != null) { + pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont( + (float) ((baseFontSize * factor) - 2))); + + } + + if (signPinLabel != null) { + + signPinLabel.setFont(signPinLabel.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } + + if (signButton != null) { + + signButton.setFont(signButton.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } + + if (cardPinLabel != null) { + + cardPinLabel.setFont(cardPinLabel.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } + + if (okButton != null) { + + okButton.setFont(okButton.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } + + if (pinLabel != null) { + + pinLabel.setFont(pinLabel.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } + + if (pinpadPINField != null) { + + pinpadPINField.setFont(pinpadPINField.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } + + if (msgTitleLabel != null) { + + msgTitleLabel.setFont(msgTitleLabel.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } + + if (msgLabel != null) { + + msgLabel.setFont(msgLabel.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } + + if (enterPINButton != null) { + + enterPINButton.setFont(enterPINButton.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } - // This method puts the focus to the helpLabel as this - // element is supposed to appear in each dialogue. - helpLabel.requestFocus(); + if (refIdLabel != null) { + + refIdLabel.setFont(refIdLabel.getFont().deriveFont( + (float) (baseFontSize * factor))); + } + + + if (backButton != null) { + + backButton.setFont(backButton.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } + + if (hyperlinkRenderer != null) { + + hyperlinkRenderer.setFontSize((int) (baseFontSize * factor)); + } + + if (hashDataTable != null) { + + hashDataTable.setRowHeight((int) (baseTableRowHeight * factor)); + + } + if (secureViewer != null && secureViewer.isVisible()) { + + secureViewer.resize(factor); + } + + try { + + if (methodToRunAtResize != null) { + log.debug("Running required button panel renderer ..."); + methodToRunAtResize.invoke(this); + } else { + log.debug("No MethodToRun stored."); + } + + } catch (IllegalArgumentException e) { + log.error("Cannot invoke rendering method.", e); + } catch (IllegalAccessException e) { + log.error("Cannot invoke rendering method.", e); + } catch (InvocationTargetException e) { + log.error("Cannot invoke rendering method.", e); + } + + contentPanel.validate(); + + log.debug("Resize done."); + + } + + // TODO: Define FocusTraversalPolicies for other GUIs as well, even if + // focus order is currently correct by chance for other GUIs + public class AdvancedSigPinGUIFocusTraversalPolicy extends + FocusTraversalPolicy { + + @Override + public Component getComponentAfter(Container container, + Component component) { + + if (component.equals(pinField)) { + + if (signButton.isEnabled()) { + + return signButton; + } else { + + return cancelButton; + } + } + + if (component.equals(signButton)) { + + return cancelButton; + } + + if (component.equals(cancelButton)) { + + return infoLabel; + } + if (component.equals(infoLabel)) { + + if (helpLabel != null && helpLabel.isVisible()) { + + return helpLabel; + } else { + + return switchFocusDummyLabel; + } + } + + if (component.equals(helpLabel)) { + + return switchFocusDummyLabel; + } + + // should never be the case + if (component.equals(switchFocusDummyLabel)) { + + return pinField; + } + + // default + return pinField; + } + + @Override + public Component getComponentBefore(Container container, + Component component) { + + if (component.equals(pinField)) { + + return switchFocusDummyLabel; + } + + if (component.equals(signButton)) { + + return pinField; + } + + if (component.equals(cancelButton)) { + + if (signButton != null && signButton.isVisible() + && signButton.isEnabled()) { + + return signButton; + + } else { + + return pinField; + } + } + + if (component.equals(infoLabel)) { + + return cancelButton; + } + + if (component.equals(helpLabel)) { + + return infoLabel; + } + + // should never be the case + if (component.equals(switchFocusDummyLabel)) { + + if (helpLabel != null && helpLabel.isVisible()) { + + return helpLabel; + } else { + + return infoLabel; + } + } + + // default + return pinField; + } + + @Override + public Component getDefaultComponent(Container container) { + + return pinField; + } + + @Override + public Component getFirstComponent(Container container) { + + return pinField; + } + + @Override + public Component getLastComponent(Container container) { + + return switchFocusDummyLabel; + } + } + + public class AdvancedShowSigDataGUIFocusTraversalPolicy extends + FocusTraversalPolicy { + + @Override + public Component getComponentAfter(Container container, + Component component) { + + if (component.equals(enterPINButton)) { + + return cancelButton; + } + + if (component.equals(cancelButton)) { + + return infoLabel; + } + if (component.equals(infoLabel)) { + + if (helpLabel != null && helpLabel.isVisible()) { + + return helpLabel; + } else { + + return switchFocusDummyLabel; + } + } + + if (component.equals(helpLabel)) { + + return switchFocusDummyLabel; + } + + // should never be the case + if (component.equals(switchFocusDummyLabel)) { + + return enterPINButton; + } + + // default + return enterPINButton; + } + + @Override + public Component getComponentBefore(Container container, + Component component) { + + if (component.equals(enterPINButton)) { + + return switchFocusDummyLabel; + } + + if (component.equals(cancelButton)) { + + return enterPINButton; + } + + if (component.equals(infoLabel)) { + + return cancelButton; + } + + if (component.equals(helpLabel)) { + + return infoLabel; + } + + // should never be the case + if (component.equals(switchFocusDummyLabel)) { + + if (helpLabel != null && helpLabel.isVisible()) { + + return helpLabel; + } else { + + return infoLabel; + } + } + + // default + return enterPINButton; + } + + @Override + public Component getDefaultComponent(Container container) { + + return enterPINButton; + } + + @Override + public Component getFirstComponent(Container container) { + + return enterPINButton; + } + + @Override + public Component getLastComponent(Container container) { + + return switchFocusDummyLabel; + } } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUIcons.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUIcons.java index 92d6897b..b0e43291 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUIcons.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUIcons.java @@ -22,8 +22,8 @@ import java.io.IOException; import java.net.URL; import java.util.ArrayList; import javax.imageio.ImageIO; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -31,24 +31,23 @@ import org.apache.commons.logging.LogFactory; */ public class BKUIcons { - protected static final Log log = LogFactory.getLog(BKUIcons.class); - - /** 16x16, 24x24, 32x32, 48x48, 128x128 pixels */ + /** 128x128, 48x48, 32x32, 24x24, 16x16 pixels */ public static final ArrayList<Image> icons = new ArrayList<Image>(); static { String[] iconResources = new String[] { - "/at/gv/egiz/bku/gui/chip16.png", - "/at/gv/egiz/bku/gui/chip24.png", - "/at/gv/egiz/bku/gui/chip32.png", + "/at/gv/egiz/bku/gui/chip128.png", "/at/gv/egiz/bku/gui/chip48.png", - "/at/gv/egiz/bku/gui/chip128.png" }; + "/at/gv/egiz/bku/gui/chip32.png", + "/at/gv/egiz/bku/gui/chip24.png", + "/at/gv/egiz/bku/gui/chip16.png"}; for (String ir : iconResources) { URL resource = BKUIcons.class.getResource(ir); if (ir != null) { try { icons.add(ImageIO.read(resource)); } catch (IOException ex) { + Logger log = LoggerFactory.getLogger(BKUIcons.class); log.warn("failed to load mocca icon " + ir, ex); } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DeafHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DeafHelpListener.java new file mode 100644 index 00000000..a4ce79b0 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DeafHelpListener.java @@ -0,0 +1,67 @@ +/* + * 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.KeyEvent; +import java.awt.event.MouseEvent; +import java.util.Locale; + +public class DeafHelpListener extends HelpListener { + + // localization in helpListener (pass message bundle, getLocale, add language to helpContext) or outside? + public DeafHelpListener(String helpURL, Locale locale) { + super(helpURL, locale); + } + + @Override + public boolean implementsListener() { + return false; + } + + @Override + public void mouseClicked(MouseEvent arg0) { + } + + @Override + public void keyPressed(KeyEvent arg0) { + } + + @Override + public void mousePressed(MouseEvent e) { + } + + @Override + public void mouseReleased(MouseEvent e) { + } + + @Override + public void mouseEntered(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + @Override + public void keyTyped(KeyEvent e) { + } + + @Override + public void keyReleased(KeyEvent e) { + } + +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java deleted file mode 100644 index 032c8fe5..00000000 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java +++ /dev/null @@ -1,81 +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.applet.AppletContext; -import java.net.URL; -import java.util.Locale; -import javax.swing.SwingUtilities; - -/** - * - * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> - */ -public class DefaultHelpListener extends AbstractHelpListener { - - /** - * applet context to open external links in help pages, - * if null, no external links will be opened - */ - protected AppletContext ctx; - - /** - * - * @param ctx open external links via applet context - * @param helpURL - * @param locale - */ - public DefaultHelpListener(AppletContext ctx, URL helpURL, Locale locale) { - super(helpURL, locale); - this.ctx = ctx; - } - - /** - * external links in help document are not opened - * @param helpURL - * @param locale - */ - public DefaultHelpListener(URL helpURL, Locale locale) { - super(helpURL, locale); - this.ctx = null; - } - - /** - * blocks until help viewer returns (is closed) - * @param helpURL - * @param helpTopic ignored - */ - @Override - public void showDocument(final URL helpURL, final String helpTopic) { - log.debug("schedule help dialog"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - log.debug("show help dialog"); - - if (ctx == null) { - HelpViewer.showHelpDialog(helpURL, messages); - } else { - HelpViewer.showHelpDialog(ctx, helpURL, messages); - } - } - }); - } -} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/FocusBorder.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/FocusBorder.java new file mode 100644 index 00000000..2c25d46b --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/FocusBorder.java @@ -0,0 +1,69 @@ +package at.gv.egiz.bku.gui; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.geom.Rectangle2D; + +import javax.swing.border.Border; + + +public class FocusBorder implements Border { + + private static final Color DEFAULT_COLOR = Color.BLACK; + + private Color color; + private float borderWidthFactor; + + public FocusBorder() { + + this.color = DEFAULT_COLOR; + this.borderWidthFactor = 1.0f; + } + + public FocusBorder(Color borderColor) { + + this.color = borderColor; + this.borderWidthFactor = 1.0f; + } + + @Override + public Insets getBorderInsets(Component c) { + + return new Insets(3, 3, 6, 6); + } + + @Override + public boolean isBorderOpaque() { + + return true; + } + + @Override + public void paintBorder(Component c, Graphics g, int x, int y, int width, + int height) { + Graphics2D g2 = (Graphics2D) g; + + g2.setPaint(color); + float[] dash1 = { 2.0f }; + + g2.setStroke(new BasicStroke(1.0f * borderWidthFactor, BasicStroke.CAP_BUTT, + BasicStroke.JOIN_MITER, 10.0f, dash1, 0.0f)); + + g2.draw(new Rectangle2D.Double(x + 1, y + 1, width - 6, height - 6)); + + } + + public void setColor(Color color) { + this.color = color; + } + + public void setBorderWidthFactor(float borderWidthFactor) { + + this.borderWidthFactor = borderWidthFactor; + } + +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java index 70842102..320c92a9 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java @@ -19,8 +19,6 @@ package at.gv.egiz.bku.gui; import at.gv.egiz.stal.HashDataInput; import java.util.List; import javax.swing.table.DefaultTableModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * @@ -28,10 +26,10 @@ import org.apache.commons.logging.LogFactory; */ class HashDataTableModel extends DefaultTableModel { - protected static final Log log = LogFactory.getLog(HashDataTableModel.class); - + private static final long serialVersionUID = 1L; + /** HashDataInput in first column, register hyperlinkrenderer only here */ - protected Class[] types; + protected Class<?>[] types; protected List<HashDataInput> hashDataInputs; public HashDataTableModel(List<HashDataInput> hashDataInputs, boolean twoColLayout) { @@ -52,7 +50,7 @@ class HashDataTableModel extends DefaultTableModel { } @Override - public Class getColumnClass(int columnIndex) { + public Class<?> getColumnClass(int columnIndex) { return types[columnIndex]; } @@ -60,4 +58,4 @@ class HashDataTableModel extends DefaultTableModel { public boolean isCellEditable(int rowIndex, int columnIndex) { return false; } -}
\ No newline at end of file +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpKeyListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpKeyListener.java deleted file mode 100644 index 4ca20f7e..00000000 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpKeyListener.java +++ /dev/null @@ -1,46 +0,0 @@ -package at.gv.egiz.bku.gui;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- *
- * @author Thomas Zefferer <thomas.zefferer@iaik.tugraz.at>
- */
-public class HelpKeyListener extends KeyAdapter {
-
- protected static final Log log = LogFactory.getLog(HelpKeyListener.class);
-
- protected ActionListener helpListener;
- protected String locale;
- protected String topic;
-
- public HelpKeyListener(ActionListener externalHelpListener) {
- super();
- this.helpListener = externalHelpListener;
- }
-
- public void setHelpTopic(String topic) {
- log.trace("setting help topic: " + topic);
- this.topic = topic;
- }
-
- public ActionListener getActionListener() {
- return helpListener;
- }
-
- @Override
- public void keyPressed(KeyEvent arg0) {
-
- if(arg0.getKeyCode() == KeyEvent.VK_ENTER) {
- ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, topic);
- helpListener.actionPerformed(e);
- }
- }
-
-}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpListener.java new file mode 100644 index 00000000..dc597656 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpListener.java @@ -0,0 +1,84 @@ +/* + * 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.KeyListener; +import java.awt.event.MouseListener; +import java.util.Locale; +import java.util.ResourceBundle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public abstract class HelpListener implements MouseListener, KeyListener, HelpURLProvider { + + public static final String MESSAGE_BUNDLE = "at/gv/egiz/bku/gui/Messages"; + + private final Logger log = LoggerFactory.getLogger(HelpListener.class); + private String helpURL; + protected String helpTopic; + protected ResourceBundle messageBundle; + + // localization in helpListener (pass message bundle, getLocale, add language to helpContext) or outside? + public HelpListener(String helpURL, Locale locale) { +// this.codebase = codebase; + this.helpURL = helpURL; + + if (locale != null) { + log.trace("Check for support of requested help locale {}.", locale.getLanguage().substring(0,2)); + messageBundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, + new Locale(locale.getLanguage().substring(0, 2))); + } else { + messageBundle = ResourceBundle.getBundle(MESSAGE_BUNDLE); + } + if (!"".equals(messageBundle.getLocale().getLanguage())) { + log.trace("Using help locale '{}'.", messageBundle.getLocale().getLanguage().substring(0,2)); + helpURL += messageBundle.getLocale().getLanguage().substring(0,2) + '/'; + } else { + log.trace("Using help locale 'default'."); + } + + log.debug("Setting help context to {}.", helpURL); + } + + @Override + public synchronized void setHelpTopic(String topic) { + log.trace("Setting help topic: {}.", topic); + helpTopic = topic; + } + + @Override + public synchronized String getHelpURL() { + if (helpTopic == null) { + log.debug("No help topic set, return index."); + return helpURL + "index.html"; + } + String url = helpURL + helpTopic + ".html"; + log.debug("Return help topic: {}.", url); + return url; + } + + /** + * By default, HelpListener cannot handle action events and acts as (deaf) help context only. + * Subclasses may add listener functionality. + * + * Whether a listener is available so that GUI elements may be included to provide context help. + * (whether a help icon shall be included) + * @return true if this HelpListener implements the Mouse/KeyListeners + */ + public abstract boolean implementsListener(); + +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java deleted file mode 100644 index b7bbe971..00000000 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java +++ /dev/null @@ -1,54 +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.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class HelpMouseListener extends MouseAdapter { - - protected static final Log log = LogFactory.getLog(HelpMouseListener.class); - - protected ActionListener helpListener; - protected String locale; - protected String topic; - - public HelpMouseListener(ActionListener externalHelpListener) { - super(); - this.helpListener = externalHelpListener; - } - - public void setHelpTopic(String topic) { - log.trace("setting help topic: " + topic); - this.topic = topic; - } - - public ActionListener getActionListener() { - return helpListener; - } - - @Override - public void mouseClicked(MouseEvent arg0) { - ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, topic); - helpListener.actionPerformed(e); - } -} diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/conf/DummyConfiguration.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpURLProvider.java index 1e0e5aa9..f310705c 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/conf/DummyConfiguration.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpURLProvider.java @@ -1,13 +1,13 @@ /* * 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. @@ -15,18 +15,19 @@ * limitations under the License. */ -package at.gv.egiz.bku.conf; + +package at.gv.egiz.bku.gui; /** - * + * Make current context dependent help topic available (outside the applet). + * Updated by the GUI whenever the current help topic changes. + * * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> */ -public class DummyConfiguration extends Configuration { +public interface HelpURLProvider { - public DummyConfiguration() { - this.setMaxDataUrlHops(MAX_DATAURL_HOPS_DEFAULT); - //this.set... - } + void setHelpTopic(String helpTopic); + String getHelpURL(); } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java index 0f887f78..bfd797e8 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java @@ -39,8 +39,8 @@ import javax.swing.LayoutStyle; import javax.swing.SwingUtilities; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -49,7 +49,10 @@ import org.apache.commons.logging.LogFactory; public class HelpViewer extends JDialog implements ActionListener { - protected static final Log log = LogFactory.getLog(HelpViewer.class); + private static final long serialVersionUID = 1L; + + private final Logger log = LoggerFactory.getLogger(HelpViewer.class); + private static HelpViewer dialog; protected ResourceBundle messages; protected AppletContext ctx; @@ -128,7 +131,7 @@ public class HelpViewer extends JDialog } private JPanel createViewerPanel(URL helpURL) { //String viewerLabelText, - log.debug("viewer dialog: " + helpURL.toString()); + log.debug("Viewer dialog: {}.", helpURL.toString()); final JEditorPane viewer = new JEditorPane(); viewer.setEditable(false); @@ -146,7 +149,7 @@ public class HelpViewer extends JDialog final URL url = e.getURL(); if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (ctx != null) { - log.debug("open external link in help viewer: " + url); + log.debug("Open external link in help viewer: {}.", url); ctx.showDocument(url, "_blank"); } else { SwingUtilities.invokeLater(new Runnable() { diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java index 6af22815..9552bdde 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java @@ -26,10 +26,14 @@ import javax.swing.table.DefaultTableCellRenderer; */ public class HyperlinkRenderer extends DefaultTableCellRenderer { + private static final long serialVersionUID = 1L; + protected boolean renderReferenceId; + protected int fontSize; public HyperlinkRenderer(boolean renderReferenceId) { this.renderReferenceId = renderReferenceId; + this.fontSize = super.getFont().getSize(); } /** @@ -49,6 +53,13 @@ public class HyperlinkRenderer extends DefaultTableCellRenderer { } } super.setText("<html><u>" + hrefText + "</u></html>"); + super.setFont(super.getFont().deriveFont((float) (fontSize))); setForeground(BKUGUIFacade.HYPERLINK_COLOR); } + + public void setFontSize(int fontSize) { + + this.fontSize = fontSize; + } + } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java index 6a738acb..f18bef6b 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java @@ -30,6 +30,8 @@ import javax.swing.JPanel; */ public class ImagePanel extends JPanel { + private static final long serialVersionUID = 1L; + protected Image backgroundImg; public ImagePanel(URL background) { diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java index b0c8ecd4..f4942a61 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java @@ -28,10 +28,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.BufferedReader; @@ -56,8 +52,8 @@ import javax.swing.text.Document; import javax.swing.text.EditorKit; import javax.swing.text.StyledEditorKit; import javax.swing.text.html.HTMLEditorKit; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -65,7 +61,9 @@ import org.apache.commons.logging.LogFactory; */ public class SecureViewerDialog extends JDialog { - /** don't import BKUFonts in order not to load BKUFonts.jar + private static final long serialVersionUID = 1L; + +/** don't import BKUFonts in order not to load BKUFonts.jar * BKUApplet includes BKUFonts as runtime dependency only, the jar is copied to the applet dir in BKUOnline with dependency-plugin * BKUViewer has compile dependency BKUFonts, transitive in BKUOnline and BKULocal */ @@ -77,14 +75,25 @@ public class SecureViewerDialog extends JDialog { SUPPORTED_MIME_TYPES.add("application/xhtml+xml"); SUPPORTED_MIME_TYPES.add("text/html"); } - protected static final Log log = LogFactory.getLog(SecureViewerDialog.class); -// private static SecureViewerDialog dialog; + private final Logger log = LoggerFactory.getLogger(SecureViewerDialog.class); protected ResourceBundle messages; protected JEditorPane viewer; protected JLabel viewerLabel; protected JScrollPane scrollPane; - protected HashDataInput content; //remember for save dialog + protected HashDataInput content; //remember for save dialog and for resizing protected FontProvider fontProvider; + protected HelpListener helpListener; + + protected JButton closeButton; + protected JButton saveButton; + + protected int baseFontSize; + protected int baseButtonSize; + + protected float resizeFactor; + + protected ActionListener closeListener; + protected String closeCommand; /** * Create and display a modal SecureViewer dialog. @@ -95,14 +104,25 @@ public class SecureViewerDialog extends JDialog { */ public SecureViewerDialog(Frame owner, ResourceBundle messages, ActionListener closeListener, String closeCommand, - FontProvider fontProvider, ActionListener helpListener) { - super(owner, messages.getString(BKUGUIFacade.WINDOWTITLE_VIEWER), true); + FontProvider fontProvider, + HelpListener helpListener, float resizeFactor) { + super(owner, messages.getString(BKUGUIFacade.WINDOWTITLE_VIEWER), false); this.setIconImages(BKUIcons.icons); this.messages = messages; this.fontProvider = fontProvider; - + this.helpListener = helpListener; + + this.baseFontSize = new JLabel().getFont().getSize(); + + this.resizeFactor = 1.0f; + this.closeListener = closeListener; + this.closeCommand = closeCommand; + + this.resizeFactor = resizeFactor; + + initContentPane(VIEWER_DIMENSION, - createViewerPanel(helpListener), + createViewerPanel(), createButtonPanel(closeListener, closeCommand)); // also leave defaultWindowClosing HIDE_ON_CLOSE @@ -115,8 +135,28 @@ public class SecureViewerDialog extends JDialog { } else { setLocationByPlatform(true); } + + } + public void resize(float resizeFactor) { + + log.debug("Resizing secure viewer ..."); + this.resizeFactor = resizeFactor; + + getContentPane().removeAll(); + + initContentPane(VIEWER_DIMENSION, + createViewerPanel(), + createButtonPanel(closeListener, closeCommand)); + + this.setContent(content); + + getContentPane().validate(); + + + } + private void initContentPane(Dimension preferredSize, JPanel viewerPanel, JPanel buttonPanel) { Container contentPane = getContentPane(); @@ -135,9 +175,10 @@ public class SecureViewerDialog extends JDialog { /** * @param helpListener may be null */ - private JPanel createViewerPanel(final ActionListener helpListener) { + private JPanel createViewerPanel() { viewer = new JEditorPane(); viewer.setEditable(false); + viewer.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); scrollPane = new JScrollPane(); @@ -156,30 +197,13 @@ public class SecureViewerDialog extends JDialog { infoHorizontal.addComponent(viewerLabel); infoVertical.addComponent(viewerLabel); - if (helpListener != null) { + if (helpListener.implementsListener()) { final JLabel helpLabel = new JLabel(); helpLabel.setFocusable(true); helpLabel.setIcon(new ImageIcon(getClass().getResource(BKUGUIFacade.HELP_IMG))); helpLabel.getAccessibleContext().setAccessibleName(messages.getString(BKUGUIFacade.ALT_HELP)); - helpLabel.addMouseListener(new MouseAdapter() { - - @Override - public void mouseClicked(MouseEvent arg0) { - ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, BKUGUIFacade.HELP_HASHDATAVIEWER); - helpListener.actionPerformed(e); - } - }); - helpLabel.addKeyListener(new KeyAdapter() { - - @Override - public void keyPressed(KeyEvent arg0) { - - if (arg0.getKeyCode() == KeyEvent.VK_ENTER) { - ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, BKUGUIFacade.HELP_HASHDATAVIEWER); - helpListener.actionPerformed(e); - } - } - }); + helpLabel.addMouseListener(helpListener); + helpLabel.addKeyListener(helpListener); helpLabel.addFocusListener(new FocusAdapter() { @@ -220,7 +244,9 @@ public class SecureViewerDialog extends JDialog { */ public void setContent(HashDataInput hashDataInput) { //throws FontProviderException { - log.debug("[" + Thread.currentThread().getName() + "] set viewer content"); + log.debug("[{}] set viewer content.", Thread.currentThread().getName()); + + helpListener.setHelpTopic(BKUGUIFacade.HELP_HASHDATAVIEWER); this.content = null; viewer.setText(null); @@ -229,7 +255,7 @@ public class SecureViewerDialog extends JDialog { if (mimeType == null) { mimeType = "text/plain"; } - log.debug("secure viewer mime type: " + mimeType); + log.debug("Secure viewer mime type: {}.", mimeType); // loads editorkit for text/plain if unrecognized viewer.setContentType(mimeType); @@ -237,11 +263,11 @@ public class SecureViewerDialog extends JDialog { if ("text/plain".equals(mimeType)) { viewer.setEditorKit(new StyledEditorKit()); - viewer.setFont(fontProvider.getFont().deriveFont(Font.PLAIN, viewer.getFont().getSize())); + viewer.setFont(fontProvider.getFont().deriveFont(Font.PLAIN, viewer.getFont().getSize() * resizeFactor)); } else if ("application/xhtml+xml".equals(mimeType)) { viewer.setEditorKit(new HTMLEditorKit()); //reset font if fontprovider font was set before (TODO also html font from fontprovider) - viewer.setFont(new Font("Dialog", Font.PLAIN, viewer.getFont().getSize())); //UIManager.getFont("Label.font")); + viewer.setFont(new Font("Dialog", Font.PLAIN, (int)(viewer.getFont().getSize() * resizeFactor))); //UIManager.getFont("Label.font")); } EditorKit editorKit = viewer.getEditorKit(); @@ -249,7 +275,7 @@ public class SecureViewerDialog extends JDialog { // document.putProperty("IgnoreCharsetDirective", new Boolean(true)); Charset cs = (hashDataInput.getEncoding() == null) ? Charset.forName("UTF-8") : Charset.forName(hashDataInput.getEncoding()); - log.debug("secure viewer encoding: " + cs.toString()); + log.debug("Secure viewer encoding: {}.", cs.toString()); InputStreamReader isr = new InputStreamReader(hashDataInput.getHashDataInput(), cs); Reader contentReader = new BufferedReader(isr); @@ -270,6 +296,11 @@ public class SecureViewerDialog extends JDialog { } viewer.setCaretPosition(0); + if (viewer.getText() != null) { + viewer.getAccessibleContext().setAccessibleDescription( + viewer.getText()); + } + scrollPane.setViewportView(viewer); scrollPane.setPreferredSize(viewer.getPreferredSize()); scrollPane.setAlignmentX(LEFT_ALIGNMENT); @@ -280,21 +311,33 @@ public class SecureViewerDialog extends JDialog { viewerLabel.setText(""); } - log.debug("VIEWER FONT: " + viewer.getFont()); + viewer.setFocusable(Boolean.TRUE); + + log.debug("VIEWER FONT: {}.", viewer.getFont()); setVisible(true); toFront(); + + viewer.requestFocus(); + } private JPanel createButtonPanel(ActionListener closeListener, String closeCommand) { - JButton closeButton = new JButton(); + + closeButton = new JButton(); + closeButton.setText(messages.getString(BKUGUIFacade.BUTTON_CLOSE)); closeButton.setActionCommand(closeCommand); closeButton.addActionListener(new CloseButtonListener(closeListener)); - - JButton saveButton = new JButton(); + closeButton.setFont(closeButton.getFont().deriveFont( + (float) (baseFontSize * resizeFactor))); + + saveButton = new JButton(); saveButton.setText(messages.getString(BKUGUIFacade.BUTTON_SAVE)); saveButton.addActionListener(new SaveButtonListener()); + saveButton.setFont(saveButton.getFont().deriveFont( + (float) (baseFontSize * resizeFactor))); + int buttonSize = closeButton.getPreferredSize().width; if (saveButton.getPreferredSize().width > buttonSize) { buttonSize = saveButton.getPreferredSize().width; @@ -324,7 +367,7 @@ public class SecureViewerDialog extends JDialog { @Override public void windowClosing(WindowEvent e) { - log.trace("[" + Thread.currentThread().getName() + "] closing secure viewer"); + log.trace("[{}] closing secure viewer.", Thread.currentThread().getName()); setVisible(false); if (closeListener != null) { closeListener.actionPerformed(new ActionEvent(e.getSource(), e.getID(), closeCommand)); @@ -342,7 +385,7 @@ public class SecureViewerDialog extends JDialog { @Override public void actionPerformed(ActionEvent e) { - log.trace("[" + Thread.currentThread().getName() + "] closing secure viewer"); + log.trace("[{}] closing secure viewer.", Thread.currentThread().getName()); setVisible(false); if (closeListener != null) { closeListener.actionPerformed(e); @@ -354,8 +397,8 @@ public class SecureViewerDialog extends JDialog { @Override public void actionPerformed(ActionEvent e) { - log.trace("[" + Thread.currentThread().getName() + "] display secure viewer save dialog"); - SecureViewerSaveDialog.showSaveDialog(content, messages, null, null); + log.trace("[{}] display secure viewer save dialog.", Thread.currentThread().getName()); + SecureViewerSaveDialog.showSaveDialog(content, messages, null, null, closeButton.getFont().getSize()); } } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusFocusListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusFocusListener.java index 06e37a89..66679291 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusFocusListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusFocusListener.java @@ -1,38 +1,44 @@ -package at.gv.egiz.bku.gui;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- *
- * @author Thomas Zefferer <thomas.zefferer@iaik.tugraz.at>
- */
-public class SwitchFocusFocusListener extends FocusAdapter {
-
- protected static final Log log = LogFactory.getLog(SwitchFocusFocusListener.class);
-
- protected ActionListener swichFocusListener;
-
- public SwitchFocusFocusListener(ActionListener externalSwitchFocusListener) {
- super();
- this.swichFocusListener = externalSwitchFocusListener;
- }
-
- public ActionListener getActionListener() {
- return swichFocusListener;
- }
-
- @Override
- public void focusGained(FocusEvent arg0) {
-
- ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, null);
- swichFocusListener.actionPerformed(e);
- }
-
-
-}
+package at.gv.egiz.bku.gui; + +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Thomas Zefferer <thomas.zefferer@iaik.tugraz.at> + */ +public class SwitchFocusFocusListener extends FocusAdapter { + + private final Logger log = LoggerFactory.getLogger(SwitchFocusFocusListener.class); + + protected ActionListener swichFocusListener; + + public SwitchFocusFocusListener(ActionListener externalSwitchFocusListener) { + super(); + this.swichFocusListener = externalSwitchFocusListener; + } + + public ActionListener getActionListener() { + return swichFocusListener; + } + + @Override + public void focusGained(FocusEvent arg0) { + + log.debug("SwitchFocusFocusListener detected focusGained event!"); + Component comp = arg0.getComponent(); + log.debug("Component that caused event: {}.", comp.getName()); + comp.transferFocus(); + + ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, null); + swichFocusListener.actionPerformed(e); + } + + +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusListener.java index 48b641e2..171d24b8 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SwitchFocusListener.java @@ -1,44 +1,54 @@ -package at.gv.egiz.bku.gui;
-
-import java.applet.AppletContext;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- *
- * @author Thomas Zefferer <thomas.zefferer@iaik.tugraz.at>
- */
-public class SwitchFocusListener implements ActionListener {
-
- protected final static Log log = LogFactory.getLog(SwitchFocusListener.class);
-
- protected AppletContext ctx;
- protected String javascriptFunction;
-
- public SwitchFocusListener(AppletContext ctx, String javascriptFunction) {
-
- this.ctx = ctx;
- this.javascriptFunction = javascriptFunction;
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
-
- try {
- ctx.showDocument
- (new URL("javascript:" + javascriptFunction));
- }
- catch (MalformedURLException me) {
-
- log.warn("Unable to call external javascript function.", me);
- }
-
-
- }
-
-}
+package at.gv.egiz.bku.gui; + +import java.applet.AppletContext; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.net.MalformedURLException; +import java.net.URL; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Thomas Zefferer <thomas.zefferer@iaik.tugraz.at> + */ +public class SwitchFocusListener implements ActionListener { + + private final Logger log = LoggerFactory.getLogger(SwitchFocusListener.class); + + protected String functionName; + protected AppletContext ctx; + protected String javascriptFunction; + + public SwitchFocusListener(AppletContext ctx, String javascriptFunctionName) { + + this.ctx = ctx; + this.functionName = javascriptFunctionName; + buildJSFunction(); + } + + @Override + public void actionPerformed(ActionEvent e) { + + log.debug("SwitchFocusListener fires!"); + + try { + ctx.showDocument + (new URL("javascript:" + javascriptFunction)); + } + catch (MalformedURLException me) { + + log.warn("Unable to call external javascript function.", me); + } + + + } + + protected void buildJSFunction() { + + this.javascriptFunction = functionName + "()"; + + } + +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerHelpListener.java new file mode 100644 index 00000000..4860756d --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerHelpListener.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.gui; + +import java.applet.AppletContext; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Locale; +import javax.swing.SwingUtilities; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ViewerHelpListener extends HelpListener { + + private final Logger log = LoggerFactory.getLogger(ViewerHelpListener.class); + + protected AppletContext appletCtx; + + public ViewerHelpListener(String helpURL, Locale locale) { + super(helpURL, locale); + } + + public ViewerHelpListener(AppletContext ctx, String helpURL, Locale locale) { + super(helpURL, locale); + this.appletCtx = ctx; + } + + protected void displayHelpViewer(final String helpURL) { + log.debug("Schedule help viewer."); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("Show help viewer for {}.", helpURL); + try { + HelpViewer.showHelpDialog(appletCtx, new URL(helpURL), messageBundle); + } catch (MalformedURLException ex) { + log.error("Failed to construct help context URL.", ex); + } + } + }); + } + + @Override + public boolean implementsListener() { + return true; + } + + @Override + public void mouseClicked(MouseEvent arg0) { + displayHelpViewer(getHelpURL()); + } + + @Override + public void keyPressed(KeyEvent arg0) { + displayHelpViewer(getHelpURL()); + } + + @Override + public void mousePressed(MouseEvent e) { + } + + @Override + public void mouseReleased(MouseEvent e) { + } + + @Override + public void mouseEntered(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + @Override + public void keyTyped(KeyEvent e) { + } + + @Override + public void keyReleased(KeyEvent e) { + } +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/WindowCloseAdapter.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/WindowCloseAdapter.java new file mode 100644 index 00000000..ad798aed --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/WindowCloseAdapter.java @@ -0,0 +1,54 @@ +/* + * 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.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> + */ +public class WindowCloseAdapter extends WindowAdapter { + + private final Logger log = LoggerFactory.getLogger(WindowCloseAdapter.class); + + protected ActionListener closeListener; + protected String closeCommand; + + void registerListener(ActionListener closeListener, String closeCommand) { + log.debug("Register close listener for action command {}.", closeCommand); + this.closeListener = closeListener; + this.closeCommand = closeCommand; + } + + @Override + public void windowClosing(WindowEvent e) { + log.debug("Received window closing event: {}.", e.paramString()); + + if (closeListener != null) { + log.debug("Notifying closeListener ..."); + closeListener.actionPerformed(new ActionEvent(e.getSource(), e.getID(), closeCommand)); + } + } + + +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedHTMLEditorKit.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedHTMLEditorKit.java index 680bf1a4..2ae8f87e 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedHTMLEditorKit.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedHTMLEditorKit.java @@ -29,7 +29,8 @@ import javax.swing.text.html.HTMLEditorKit; */ public class RestrictedHTMLEditorKit extends HTMLEditorKit { - + private static final long serialVersionUID = 1L; + public static class RestrictedHTMLFactory extends HTMLFactory { @Override diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/FontProviderException.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/FontProviderException.java index 5a6a277e..ee9b05de 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/FontProviderException.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/FontProviderException.java @@ -23,6 +23,8 @@ package at.gv.egiz.bku.gui.viewer; */ public class FontProviderException extends Exception { + private static final long serialVersionUID = 1L; + public FontProviderException(String msg, Throwable cause) { super(msg, cause); } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java index 3303d4ef..335a8599 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java @@ -1,5 +1,8 @@ package at.gv.egiz.bku.gui.viewer; +import java.awt.Component; +import java.awt.Container; +import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedOutputStream; @@ -8,39 +11,51 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.text.MessageFormat; -import java.util.Locale; import java.util.ResourceBundle; import javax.swing.JFileChooser; +import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; +import javax.swing.UIManager; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.stal.HashDataInput; public class SecureViewerSaveDialog { - protected static final Log log = LogFactory.getLog(SecureViewerSaveDialog.class); - + private static void setFileChooserFont(Component[] comp, Font font) { + for (int i = 0; i < comp.length; i++) { + if (comp[i] instanceof Container) + setFileChooserFont(((Container) comp[i]).getComponents(), font); + try { + comp[i].setFont(font); + } catch (Exception e) { + Logger log = LoggerFactory.getLogger(SecureViewerSaveDialog.class); + log.warn("FileChooser component font could not be set"); + } + } + } + public static void showSaveDialog(final HashDataInput hashDataInput, final ResourceBundle messages, - final ActionListener okListener, final String okCommand) { - - log.debug("[" + Thread.currentThread().getName() - + "] scheduling save dialog"); + final ActionListener okListener, final String okCommand, final int fontSize) { + + final Logger log = LoggerFactory.getLogger(SecureViewerSaveDialog.class); + log.debug("[{}] Scheduling save dialog.", Thread.currentThread().getName()); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - log - .debug("[" + Thread.currentThread().getName() - + "] show save dialog"); + log.debug("[{}] Show save dialog.", Thread.currentThread().getName()); String userHome = System.getProperty("user.home"); + + UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE); JFileChooser fileDialog = new JFileChooser(userHome); fileDialog.setMultiSelectionEnabled(false); @@ -58,6 +73,9 @@ public class SecureViewerSaveDialog { + MimeFilter.getExtension(mimeType); fileDialog.setSelectedFile(new File(userHome, filename)); + setFileChooserFont(fileDialog.getComponents(), new JLabel() + .getFont().deriveFont((float) fontSize)); + // parent contentPane -> placed over applet switch (fileDialog.showSaveDialog(fileDialog)) { case JFileChooser.APPROVE_OPTION: @@ -75,8 +93,8 @@ public class SecureViewerSaveDialog { } } if (log.isDebugEnabled()) { - log.debug("writing hashdata input " + id + " (" + mimeType - + ") to file " + file); + Object[] args = {id, mimeType, file}; + log.debug("Writing hashdata input {} ({}) to file {}.", args); } FileOutputStream fos = null; try { @@ -90,8 +108,7 @@ public class SecureViewerSaveDialog { bos.flush(); bos.close(); } catch (IOException ex) { - log.error("Failed to write " + file + ": " + ex.getMessage()); - log.debug(ex); + log.error("Failed to write.", ex); String errPattern = messages .getString(BKUGUIFacade.ERR_WRITE_HASHDATA); JOptionPane.showMessageDialog(fileDialog, MessageFormat.format( @@ -108,7 +125,7 @@ public class SecureViewerSaveDialog { } break; case JFileChooser.CANCEL_OPTION: - log.debug("cancelled save dialog"); + log.debug("Cancelled save dialog."); break; } if (okListener != null) { diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java b/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java index b9416845..7f76619f 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java @@ -21,8 +21,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory; */ public class ByteArrayHashDataInput implements HashDataInput { - private static final Log log = LogFactory.getLog(ByteArrayHashDataInput.class); + private final Logger log = LoggerFactory.getLogger(ByteArrayHashDataInput.class); protected byte[] hashData; protected String id; @@ -66,7 +66,7 @@ public class ByteArrayHashDataInput implements HashDataInput { } this.hashData = baos.toByteArray(); } catch (IOException ex) { - log.error("Failed to cache provided HashDataInput: " + ex.getMessage(), ex); + log.error("Failed to cache provided HashDataInput: {}.", ex.getMessage(), ex); this.hashData = new byte[0]; } this.id = hdi.getReferenceId(); diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index c09433de..ac8b2777 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -49,7 +49,7 @@ hashdatalink.tiny.focus=<html><a href=\"anzeige\">[Signaturdaten]</a></html> #verwenden sie bitte die von ihrem System zur Verf\u00FCgung gestellte {0} Anwendung. hashdatalist=<html>{0} Signaturdaten:</html> hashdata.viewer=<html>Signaturdaten werden im Betrachter angezeigt -unsupported.mimetype=<html>Signaturdaten k\u00F6nnen nicht angezeigt werden +unsupported.mimetype=<html>Signaturdaten speichern und mit einem geeigneten {0} Betrachter \u00F6ffnen. retries.last=<html>Letzter Versuch!</html> retries=<html>Noch {0} Versuche</html> retries.pinpad.last=<html>Eingabe wiederholen, letzter Versuch!</html> @@ -76,6 +76,7 @@ mimetype.desc.doc=Microsoft Word-Dateien (.doc) mimetype.desc.unknown=Alle Dateien (.*) save.hashdatainput.prefix=Signaturdaten alt.help=Hilfe +dialog.sigpin.infolabel.sigdata.tooltiptext=Signaturdaten in neuem Fenster anzeigen # Error Messages error.no.hashdata=<html>Keine Signaturdaten verf\u00FCgbar: {0}</html> diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties index 4d86d21b..6381bdf9 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties @@ -47,7 +47,7 @@ hashdatalink.tiny.focus=<html><a href=\"anzeige\">[signature data]</a></html> #message.hashdata=<html>Remark: This is a preview of the data to-be signed. For standards compliant display see help.</html> hashdatalist=<html>{0} signature data objects:</html> hashdata.viewer=<html>Signature data is being displayed in viewer -unsupported.mimetype=<html>Signature data cannot be displayed +unsupported.mimetype=<html>Save and open signature data with appropriate {0} viewer. retries.last=<html>Last try!</html> retries=<html>{0} tries left</html> retries.pinpad.last=<html>Re-enter pin, last try!</html> @@ -74,6 +74,8 @@ mimetype.desc.doc=Microsoft Word-files (.doc) mimetype.desc.unknown=All files (.*) save.hashdatainput.prefix=signaturedata alt.help=help +dialog.sigpin.infolabel.sigdata.tooltiptext=Show signature data in new window + # Error Messages error.no.hashdata=<html>No signature data available: {0}</html> diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java index a2a84d6e..373ecaad 100644 --- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java +++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java @@ -20,14 +20,11 @@ */ package at.gv.egiz.bku.gui; -import at.gv.egiz.smcc.PINSpec; -import at.gv.egiz.smcc.STARCOSCard; +import at.gv.egiz.smcc.PinInfo; 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.io.ByteArrayInputStream; -import java.io.InputStream; import java.util.ArrayList; import java.util.List; @@ -47,8 +44,8 @@ public class BKUGUIWorker implements Runnable { public void run() { try { - final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Test-PIN", (byte) 0x81, null); - final PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Test-PIN", (byte) 0x01, null); + final PinInfo signPinSpec = new SimplePinInfo(6, 10, "[0-9]", "Test-PIN", (byte) 0x81, null, PinInfo.UNKNOWN_RETRIES); + final PinInfo cardPinSpec = new SimplePinInfo(4, 4, "[0-9]", "Test-PIN", (byte) 0x01, null, PinInfo.UNKNOWN_RETRIES); final ActionListener cancelListener = new ActionListener() { diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/DummyFontLoader.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/DummyFontLoader.java index 505c4247..26fc1a5e 100644 --- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/DummyFontLoader.java +++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/DummyFontLoader.java @@ -21,8 +21,8 @@ import at.gv.egiz.bku.gui.viewer.FontProviderException; import at.gv.egiz.bku.gui.viewer.FontProvider; import java.awt.Font; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -30,11 +30,11 @@ import org.apache.commons.logging.LogFactory; */ public class DummyFontLoader implements FontProvider { - protected final static Log log = LogFactory.getLog(DummyFontLoader.class); + private final Logger log = LoggerFactory.getLogger(DummyFontLoader.class); @Override public Font getFont() throws FontProviderException { - log.debug("return font"); + log.debug("Return font."); return new Font("monospaced", Font.PLAIN, 10); } diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/SecureViewerDialogTest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/SecureViewerDialogTest.java index 9bbc1b1a..64f7e744 100644 --- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/SecureViewerDialogTest.java +++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/SecureViewerDialogTest.java @@ -7,8 +7,6 @@ package at.gv.egiz.bku.gui; import at.gv.egiz.stal.impl.ByteArrayHashDataInput; import java.awt.Font; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -35,7 +33,7 @@ public class SecureViewerDialogTest { @BeforeClass public static void setUpClass() throws Exception { messages = ResourceBundle.getBundle("at/gv/egiz/bku/gui/Messages"); - secureViewer = new SecureViewerDialog(null, messages,null, null, new DummyFontLoader(), null); + secureViewer = new SecureViewerDialog(null, messages,null, null, new DummyFontLoader(), new DeafHelpListener("../help", messages.getLocale()), 1f); } @AfterClass diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GetPINStatusException.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/SimplePinInfo.java index 66b15887..3e583118 100644 --- a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GetPINStatusException.java +++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/SimplePinInfo.java @@ -1,41 +1,46 @@ /* * 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; +package at.gv.egiz.bku.gui; + +import at.gv.egiz.smcc.PinInfo; +import java.util.Locale; /** * * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> */ -public class GetPINStatusException extends SignatureCardException { - - /** - * Creates a new instance of <code>GetStatusException</code> without detail message. - */ - public GetPINStatusException() { - } - - - /** - * Constructs an instance of <code>GetStatusException</code> with the specified detail message. - * @param msg the detail message. - */ - public GetPINStatusException(String msg) { - super(msg); - } +public class SimplePinInfo extends PinInfo { + + String name; + + public SimplePinInfo(int minLength, int maxLength, String rexepPattern, String name, byte kid, byte[] contextAID, int maxRetries) { + super(minLength, maxLength, rexepPattern, null, null, kid, contextAID, maxRetries); + this.name = name; + } + + @Override + public String getLocalizedName() { + return name; + } + + @Override + public String getLocalizedName(Locale locale) { + return name; + } + } diff --git a/BKUCommonGUI/src/test/resources/commons-logging.properties b/BKUCommonGUI/src/test/resources/commons-logging.properties deleted file mode 100644 index 29292562..00000000 --- a/BKUCommonGUI/src/test/resources/commons-logging.properties +++ /dev/null @@ -1 +0,0 @@ -org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger diff --git a/BKUFonts/.classpath b/BKUFonts/.classpath deleted file mode 100644 index d2236dff..00000000 --- a/BKUFonts/.classpath +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/fonts"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> - <classpathentry kind="output" path="target/classes"/> -</classpath> diff --git a/BKUFonts/.project b/BKUFonts/.project deleted file mode 100644 index 484ff825..00000000 --- a/BKUFonts/.project +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>BKUFonts</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.wst.common.project.facet.core.builder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.maven.ide.eclipse.maven2Builder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.wst.validation.validationbuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> - <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.maven.ide.eclipse.maven2Nature</nature> - <nature>org.eclipse.wst.common.project.facet.core.nature</nature> - </natures> -</projectDescription> diff --git a/BKUFonts/.settings/org.eclipse.jdt.core.prefs b/BKUFonts/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 9db35b19..00000000 --- a/BKUFonts/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Fri Nov 06 15:23:46 CET 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/BKUFonts/.settings/org.eclipse.wst.common.component b/BKUFonts/.settings/org.eclipse.wst.common.component deleted file mode 100644 index d7d79bb4..00000000 --- a/BKUFonts/.settings/org.eclipse.wst.common.component +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project-modules id="moduleCoreId" project-version="1.5.0"> - <wb-module deploy-name="BKUFonts"> - <wb-resource deploy-path="/" source-path="/src/main/fonts"/> - </wb-module> -</project-modules> diff --git a/BKUFonts/.settings/org.eclipse.wst.common.project.facet.core.xml b/BKUFonts/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index f68988cf..00000000 --- a/BKUFonts/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<faceted-project> - <installed facet="jst.java" version="6.0"/> - <installed facet="jst.utility" version="1.0"/> -</faceted-project> diff --git a/BKUFonts/.settings/org.maven.ide.eclipse.prefs b/BKUFonts/.settings/org.maven.ide.eclipse.prefs deleted file mode 100644 index 51d61132..00000000 --- a/BKUFonts/.settings/org.maven.ide.eclipse.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Fri Nov 06 15:23:22 CET 2009 -activeProfiles= -eclipse.preferences.version=1 -fullBuildGoals=process-test-resources -includeModules=false -resolveWorkspaceProjects=true -resourceFilterGoals=process-resources resources\:testResources -skipCompilerPlugin=true -version=1 diff --git a/BKUFonts/pom.xml b/BKUFonts/pom.xml index 6f0b929e..abcb8339 100644 --- a/BKUFonts/pom.xml +++ b/BKUFonts/pom.xml @@ -1,22 +1,28 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <groupId>at.gv.egiz</groupId> <artifactId>BKUFonts</artifactId> - <version>1.2</version> + <version>${mocca.fonts.version}</version> <name>BKU Fonts</name> <description> + <!-- + | ResourceFontLoader needs font resources on runtime classpath. + | Runtime dependency on BKUFonts ensures that transitive dependency + | remains (not true for provided), see BKUViewer, BKULocal and + | BKUOnline --> + This module is used in validator(s) and viewer and is a direct dependency of - - BKUViewer (attention, this is the validator!) - TextValidator depends on the fonts. (compile scope, make available for BKULocal/Online TextValidator) - (TextValidator should rather use a FontProvider) - - BKUOnline: - - direct/provided if jar inclusion in applet dir, but do not enforce inclusion as WEB-INF/lib - - transitive from BKUViewer if unpack-fonts to applet dir + - bkucommon (direct runtime dependency) + - BKUViewer (transitive runtime from bkucommon) + TextValidator depends on the fonts. (TextValidator should rather use a FontProvider) + - BKUOnline (transitive runtime from bkucommon/bkuviewer) + unpack-fonts to applet dir and include jar in WEB-INF/lib + - BKULocal (transitive runtime from bkucommon/bkuviewer) - removed the BKUCommonGUI (runtime; propagate dependency to BKUApplet): no real dependency: BKUCommonGUI contains SecureFontProvider interface only (which does not state how fonts are loaded); implementations should depend no BKUFonts @@ -38,4 +44,4 @@ </resource> </resources> </build> -</project>
\ No newline at end of file +</project> diff --git a/BKUGuiExt/pom.xml b/BKUGuiExt/pom.xml index beae2480..85f06b1e 100644 --- a/BKUGuiExt/pom.xml +++ b/BKUGuiExt/pom.xml @@ -1,24 +1,24 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <groupId>at.gv.egiz</groupId> <artifactId>BKUGuiExt</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <name>BKU GUI Extension</name> <dependencies> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>STALXService</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>smccSTAL</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> </dependencies> </project>
\ No newline at end of file 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 index 37f30340..524a8067 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java @@ -30,18 +30,23 @@ import javax.swing.JProgressBar; import javax.swing.LayoutStyle; import javax.swing.SwingUtilities; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> */ 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"; + + private final Logger log = LoggerFactory.getLogger(ActivationGUI.class); protected JProgressBar progressBar; @@ -50,7 +55,7 @@ public class ActivationGUI extends CardMgmtGUI implements ActivationGUIFacade { Style guiStyle, URL backgroundImgURL, FontProvider fontProvider, - AbstractHelpListener helpListener, + HelpListener helpListener, SwitchFocusListener switchFocusListener) { super(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener, switchFocusListener); @@ -60,14 +65,14 @@ public class ActivationGUI extends CardMgmtGUI implements ActivationGUIFacade { @Override public void showActivationProgressDialog(final int currentStep, final int maxProgress, final ActionListener cancelListener, final String cancelCommand) { - log.debug("scheduling activation progress dialog (step " + currentStep + ")"); + log.debug("Scheduling activation progress dialog (step {}).", currentStep); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - log.debug("show activation progress dialog (step " + currentStep + ")"); + log.debug("Show activation progress dialog (step {}).", currentStep); mainPanel.removeAll(); buttonPanel.removeAll(); @@ -85,7 +90,7 @@ public class ActivationGUI extends CardMgmtGUI implements ActivationGUIFacade { infoLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); } - helpMouseListener.setHelpTopic(HELP_ACTIVATION); + helpListener.setHelpTopic(HELP_ACTIVATION); progressBar.setIndeterminate(false); progressBar.setStringPainted(true); @@ -163,14 +168,14 @@ public class ActivationGUI extends CardMgmtGUI implements ActivationGUIFacade { @Override public void showIdleDialog(final ActionListener cancelListener, final String cancelCommand) { - log.debug("scheduling idle dialog"); + log.debug("Scheduling idle dialog."); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - log.debug("show idle dialog"); + log.debug("Show idle dialog."); mainPanel.removeAll(); buttonPanel.removeAll(); @@ -188,7 +193,7 @@ public class ActivationGUI extends CardMgmtGUI implements ActivationGUIFacade { infoLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); } - helpMouseListener.setHelpTopic(HELP_ACTIVATION); + helpListener.setHelpTopic(HELP_ACTIVATION); progressBar.setIndeterminate(true); progressBar.setStringPainted(true); 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 index 3fc14d04..860a1097 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java @@ -16,7 +16,6 @@ */ package at.gv.egiz.bku.gui; -import at.gv.egiz.bku.gui.*; import java.awt.event.ActionListener; /** 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 index 98f44d55..b8ffd942 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java @@ -23,6 +23,9 @@ import java.net.URL; import java.util.Locale; import java.util.ResourceBundle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * Common superclass for Activation and PinManagement GUIs * @@ -39,10 +42,9 @@ public class CardMgmtGUI extends BKUGUIImpl { Style guiStyle, URL backgroundImgURL, FontProvider fontProvider, - AbstractHelpListener helpListener, + HelpListener helpListener, SwitchFocusListener switchFocusListener) { - super(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener, switchFocusListener); - + super(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener, switchFocusListener); } @Override @@ -51,7 +53,8 @@ public class CardMgmtGUI extends BKUGUIImpl { if (locale != null) { Locale lang = new Locale(locale.getLanguage().substring(0,2)); - log.debug("loading applet resources for language: " + lang.toString()); + Logger log = LoggerFactory.getLogger(CardMgmtGUI.class); + log.debug("Loading applet resources for language: {}.", lang); cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE, lang); } else { cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE); 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 index 4dcc388f..08f148c9 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java @@ -18,7 +18,7 @@ package at.gv.egiz.bku.gui; import at.gv.egiz.bku.gui.viewer.FontProvider; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import java.awt.Container; import java.awt.Cursor; import java.awt.Font; @@ -27,7 +27,6 @@ import java.awt.event.ActionListener; 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; @@ -39,49 +38,69 @@ 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; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * TODO pull out ResourceBundle to common superclass for activationGUI and pinMgmtGUI + * TODO pull out ResourceBundle to common superclass for activationGUI and + * pinMgmtGUI + * * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> */ -public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFacade { +public class PINManagementGUI extends CardMgmtGUI implements + PINManagementGUIFacade { - protected static final Log log = LogFactory.getLog(PINManagementGUI.class); + private final Logger log = LoggerFactory.getLogger(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, - FontProvider fontProvider, - AbstractHelpListener helpListener, - SwitchFocusListener switchFocusListener) { - super(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener, switchFocusListener); - } - - @Override - public char[] getOldPin() { - if (oldPinField != null) { - char[] pin = oldPinField.getPassword(); - oldPinField = null; - return pin; - } - return null; - } + protected PinInfo pinSpec; + + protected JButton cancelButton; + protected JTable pinStatusTable; + protected JLabel mgmtLabel; + protected PINStatusRenderer pinStatusRenderer; +// protected int baseTableRowHeight; + protected JButton activateButton; + + protected JLabel pinpadLabel; + protected JLabel oldPinLabel; + protected JLabel repeatPinLabel; + protected JLabel pinLabel; + protected JPasswordField repeatPinField; + protected JLabel pinsizeLabel; + + + public PINManagementGUI(Container contentPane, Locale locale, + Style guiStyle, URL backgroundImgURL, FontProvider fontProvider, + HelpListener helpListener, SwitchFocusListener switchFocusListener) { + super(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, + helpListener, switchFocusListener); + + cancelButton = new JButton(); + this.pinStatusRenderer = new PINStatusRenderer(cardmgmtMessages); + this.activateButton = new JButton(); + + } + + @Override + public char[] getOldPin() { + if (oldPinField != null) { + char[] pin = oldPinField.getPassword(); + oldPinField = null; + return pin; + } + return null; + } + + @Override + public PinInfo getSelectedPinInfo() { + return pinSpec; + } @Override - public PINSpec getSelectedPINSpec() { - return pinSpec; - } - - @Override - public void showPINManagementDialog(final Map<PINSpec, STATUS> pins, + public void showPINManagementDialog(final PinInfo[] pins, final ActionListener activateListener, final String activateCmd, final String changeCmd, @@ -90,36 +109,35 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac final ActionListener cancelListener, final String cancelCmd) { - log.debug("scheduling PIN managment dialog"); - - SwingUtilities.invokeLater(new Runnable() { + log.debug("Scheduling PIN managment dialog."); - @Override - public void run() { - log.debug("show PIN management dialog"); + SwingUtilities.invokeLater(new Runnable() { - mainPanel.removeAll(); - buttonPanel.removeAll(); + @Override + public void run() { + log.debug("Show PIN management dialog."); - helpMouseListener.setHelpTopic(HELP_PINMGMT); - helpKeyListener.setHelpTopic(HELP_PINMGMT); + mainPanel.removeAll(); + buttonPanel.removeAll(); + helpListener.setHelpTopic(HELP_PINMGMT); - JLabel mgmtLabel = new JLabel(); - mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + 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)); - } + if (renderHeaderPanel) { + titleLabel.setText(getMessage(TITLE_PINMGMT)); + String infoPattern = getMessage(MESSAGE_PINMGMT); + mgmtLabel.setText(MessageFormat.format(infoPattern, pins.length)); + } 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)); + final PINStatusTableModel tableModel = new PINStatusTableModel(pins); + pinStatusTable = new JTable(tableModel); +// pinStatusTable.setDefaultRenderer(PINSpec.class, new PINSpecRenderer()); + pinStatusTable.setDefaultRenderer(PinInfo.class, pinStatusRenderer); pinStatusTable.setTableHeader(null); pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); // pinStatusTable.addMouseMotionListener(new MouseMotionAdapter() { @@ -134,42 +152,56 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac // } // }); - final JButton activateButton = new JButton(); - activateButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - activateButton.addActionListener(activateListener); + primaryFocusHolder = pinStatusTable; - pinStatusTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - pinStatusTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + activateButton.setFont(activateButton.getFont().deriveFont( + activateButton.getFont().getStyle() + & ~java.awt.Font.BOLD)); + activateButton.addActionListener(activateListener); - @Override - public void valueChanged(final ListSelectionEvent e) { - //invoke later to allow thread to paint selection background - SwingUtilities.invokeLater(new Runnable() { + pinStatusTable + .setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + pinStatusTable.getSelectionModel().addListSelectionListener( + new ListSelectionListener() { - @Override + @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); + pinSpec = (PinInfo) tableModel.getValueAt(selectionIdx, 1); + PinInfo.STATE status = pinSpec.getState(); - if (status == STATUS.NOT_ACTIV) { - activateButton.setText(getMessage(BUTTON_ACTIVATE)); + if (status == PinInfo.STATE.NOT_ACTIV) { + activateButton + .setText(getMessage(BUTTON_ACTIVATE)); activateButton.setEnabled(true); - activateButton.setActionCommand(activateCmd); - } else if (status == STATUS.BLOCKED) { - activateButton.setText(getMessage(BUTTON_UNBLOCK)); + activateButton + .setActionCommand(activateCmd); + } else if (status == PinInfo.STATE.BLOCKED) { + activateButton + .setText(getMessage(BUTTON_UNBLOCK)); activateButton.setEnabled(true); - activateButton.setActionCommand(unblockCmd); - } else if (status == STATUS.ACTIV) { - activateButton.setText(getMessage(BUTTON_CHANGE)); + activateButton + .setActionCommand(unblockCmd); + } else if (status == PinInfo.STATE.ACTIV) { + activateButton + .setText(getMessage(BUTTON_CHANGE)); activateButton.setEnabled(true); - activateButton.setActionCommand(changeCmd); - } else if (status == STATUS.UNKNOWN) { - activateButton.setText(getMessage(BUTTON_VERIFY)); + activateButton + .setActionCommand(changeCmd); + } else if (status == PinInfo.STATE.UNKNOWN) { + activateButton + .setText(getMessage(BUTTON_VERIFY)); activateButton.setEnabled(true); - activateButton.setActionCommand(verifyCmd); + activateButton + .setActionCommand(verifyCmd); } } } @@ -177,69 +209,129 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac } }); - //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(switchFocusDummyLabel) - .addComponent(helpLabel); - messageVertical - .addComponent(switchFocusDummyLabel) - .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); - - helpLabel.requestFocus(); - contentPanel.validate(); + // 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(switchFocusDummyLabel) + // .addComponent(helpLabel); + // messageVertical + // .addComponent(switchFocusDummyLabel) + // .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); + + updateMethodToRunAtResize("at.gv.egiz.bku.gui.PINManagementGUI", "renderPINManagmentTableAndButtons"); + + renderPINManagmentTableAndButtons(); + + pinStatusTable.requestFocus(); + contentPanel.validate(); + + if (windowCloseAdapter != null) { + windowCloseAdapter.registerListener(cancelListener, cancelCmd); } - }); - } - - @Override - public void showModifyPINDirect(DIALOG type, PINSpec pinSpec, int retries) { + + resize(); + + } + }); + } + + public void renderPINManagmentTableAndButtons() { + + // It is necessary to remove old components in order to ensure + // the correct rendering of the status table and the button panel + mainPanel.removeAll(); + buttonPanel.removeAll(); + + JScrollPane pinStatusScrollPane = new JScrollPane(pinStatusTable); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout + .createSequentialGroup().addComponent(mgmtLabel); + GroupLayout.Group messageVertical = mainPanelLayout + .createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(mgmtLabel); + if (!renderHeaderPanel) { + messageHorizontal.addPreferredGap( + LayoutStyle.ComponentPlacement.UNRELATED, 0, + Short.MAX_VALUE).addComponent(switchFocusDummyLabel) + .addComponent(helpLabel); + messageVertical.addComponent(switchFocusDummyLabel).addComponent( + helpLabel); + } + + mainPanelLayout.setHorizontalGroup(mainPanelLayout.createParallelGroup( + 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)); + + 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); + + } + +@Override + public void showModifyPINDirect(DIALOG type, PinInfo pinSpec, int retries) { String title, msg; Object[] params; if (retries < 0) { @@ -251,475 +343,616 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac } params[1] = pinSpec.getLocalizedLength(); if (type == DIALOG.CHANGE) { - log.debug("show change pin dialog"); + log.debug("Show change pin dialog."); title = TITLE_CHANGE_PIN; msg = MESSAGE_CHANGE_PINPAD_DIREKT; } else if (type == DIALOG.ACTIVATE) { - log.debug("show activate pin dialog"); + log.debug("Show activate pin dialog."); title = TITLE_ACTIVATE_PIN; msg = MESSAGE_ACTIVATE_PINPAD_DIREKT; } else if (type == DIALOG.VERIFY) { - log.debug("show verify pin dialog"); + log.debug("Show verify pin dialog."); title = TITLE_VERIFY_PINPAD; msg = MESSAGE_ENTERPIN_PINPAD_DIRECT; } else { - log.debug("show unblock pin dialog"); + log.debug("Show unblock pin dialog."); title = TITLE_UNBLOCK_PIN; msg = MESSAGE_UNBLOCK_PINPAD_DIREKT; } - } 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); - } + } 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); + } @Override - public void showPINDialog(DIALOG type, PINSpec pinSpec, int retries, + public void showPINDialog(DIALOG type, PinInfo pinSpec, int retries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand) { - showPINDialog(type, pinSpec, retries, false, - okListener, okCommand, cancelListener, cancelCommand); + showPINDialog(type, pinSpec, retries, false, okListener, okCommand, + cancelListener, cancelCommand); } - - private void showPINDialog(final DIALOG type, final PINSpec pinSpec, + private void showPINDialog(final DIALOG type, final PinInfo 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; - HELP_TOPIC = HELP_PINMGMT; - - 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; - } else if (type == DIALOG.VERIFY) { - log.debug("show verify pin dialog"); - TITLE = TITLE_VERIFY_PIN; - MESSAGE_MGMT = MESSAGE_ENTERPIN; - } 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(); - - helpMouseListener.setHelpTopic(HELP_TOPIC); - helpKeyListener.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); - helpMouseListener.setHelpTopic(HELP_RETRY); - helpKeyListener.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(switchFocusDummyLabel) - .addComponent(helpLabel); - infoVertical - .addComponent(switchFocusDummyLabel) - .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_ENTERPIN_PINPAD); - pinpadLabel.setText(MessageFormat.format(pinpadPattern, - new Object[] { pinSpec.getLocalizedName(), pinSpec.getLocalizedLength() })); - - pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(pinpadLabel); - pinVertical = mainPanelLayout.createSequentialGroup() - .addComponent(pinpadLabel); - } else { - - final 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 || type == DIALOG.UNBLOCK) ? 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) { - 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.setActionCommand(okCommand); - repeatPinField.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if (okButton.isEnabled()) { - okListener.actionPerformed(e); - } - } - }); - - if (type == DIALOG.CHANGE || type == DIALOG.UNBLOCK) { - oldPinLabel = new JLabel(); - oldPinLabel.setFont(oldPinLabel.getFont().deriveFont(oldPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - String oldPinLabelPattern = getMessage((type == DIALOG.CHANGE) ? LABEL_OLD_PIN : LABEL_PUK); - oldPinLabel.setText(MessageFormat.format(oldPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); - - oldPinField = new JPasswordField(); - oldPinField.setText(""); - oldPinField.setActionCommand(okCommand); - oldPinField.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if (oldPinField.getPassword().length >= pinSpec.getMinLength()) { - pinField.requestFocusInWindow(); - } - } - }); - - ExtendedPinDocument oldPinDocument = - new ExtendedPinDocument(pinSpec.getMinLength(), pinSpec.getMaxLength(), - pinSpec.getRexepPattern(), okButton); - ComparePinDocument newPinDocument = - new ComparePinDocument(pinSpec.getRecMinLength(), pinSpec.getRecMaxLength(), pinSpec.getRexepPattern(), - okButton); - ComparePinDocument confirmPinDocument = - new ComparePinDocument(pinSpec.getRecMinLength(), pinSpec.getRecMaxLength(), pinSpec.getRexepPattern(), - okButton); - - oldPinDocument.newPIN = newPinDocument; - oldPinDocument.confirmPIN = confirmPinDocument; - - newPinDocument.compareTo = confirmPinDocument; - newPinDocument.currentPIN = oldPinDocument; - confirmPinDocument.compareTo = newPinDocument; - confirmPinDocument.currentPIN = oldPinDocument; - - oldPinField.setDocument(oldPinDocument); - pinField.setDocument(newPinDocument); - repeatPinField.setDocument(confirmPinDocument); - - } else { - // else -> ACTIVATE (not verify, not change) - ComparePinDocument newPinDocument = - new ComparePinDocument(pinSpec.getRecMinLength(), pinSpec.getRecMaxLength(), pinSpec.getRexepPattern(), - okButton); - ComparePinDocument confirmPinDocument = - new ComparePinDocument(pinSpec.getRecMinLength(), pinSpec.getRecMaxLength(), pinSpec.getRexepPattern(), - okButton); - - newPinDocument.compareTo = confirmPinDocument; - confirmPinDocument.compareTo = newPinDocument; - - pinField.setDocument(newPinDocument); - repeatPinField.setDocument(confirmPinDocument); - } - } else { - // VERIFY - pinField.setDocument( - new PINDocument(pinSpec.getMinLength(), pinSpec.getMaxLength(), pinSpec.getRexepPattern(), 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, pinSpec.getLocalizedLength())); - - //////////////////////////////////////////////////////////////// - // 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 || type == DIALOG.UNBLOCK) { - 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)); - - helpLabel.requestFocus(); - 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; - } + log.debug("Scheduling pin dialog."); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + String HELP_TOPIC, TITLE, MESSAGE_MGMT, MESSAGE_MGMT_PARAM; + HELP_TOPIC = HELP_PINMGMT; + + 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; + } else if (type == DIALOG.VERIFY) { + log.debug("Show verify pin dialog."); + TITLE = TITLE_VERIFY_PIN; + MESSAGE_MGMT = MESSAGE_ENTERPIN; + } 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); + + 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(switchFocusDummyLabel).addComponent( + helpLabel); + infoVertical.addComponent(switchFocusDummyLabel) + .addComponent(helpLabel); + } + + GroupLayout.ParallelGroup pinHorizontal; + GroupLayout.SequentialGroup pinVertical; + + if (pinpad) { + pinpadLabel = new JLabel(); + pinpadLabel.setFont(mgmtLabel.getFont().deriveFont( + mgmtLabel.getFont().getStyle() & ~Font.BOLD)); + String pinpadPattern = getMessage(MESSAGE_ENTERPIN_PINPAD); + pinpadLabel.setText(MessageFormat.format(pinpadPattern, + new Object[] { pinSpec.getLocalizedName(), + pinSpec.getLocalizedLength() })); + + pinHorizontal = mainPanelLayout.createParallelGroup( + GroupLayout.Alignment.LEADING).addComponent( + pinpadLabel); + pinVertical = mainPanelLayout.createSequentialGroup() + .addComponent(pinpadLabel); + } else { + + 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); + + pinLabel = new JLabel(); + pinLabel.setFont(pinLabel.getFont().deriveFont( + pinLabel.getFont().getStyle() & ~Font.BOLD)); + String pinLabelPattern = (type == DIALOG.CHANGE || type == DIALOG.UNBLOCK) ? getMessage(LABEL_NEW_PIN) + : getMessage(LABEL_PIN); + pinLabel.setText(MessageFormat.format(pinLabelPattern, + new Object[] { pinSpec.getLocalizedName() })); + + 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) { + 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.setActionCommand(okCommand); + repeatPinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (okButton.isEnabled()) { + okListener.actionPerformed(e); + } + } + }); + + if (type == DIALOG.CHANGE || type == DIALOG.UNBLOCK) { + oldPinLabel = new JLabel(); + oldPinLabel.setFont(oldPinLabel.getFont() + .deriveFont( + oldPinLabel.getFont().getStyle() + & ~java.awt.Font.BOLD)); + String oldPinLabelPattern = getMessage((type == DIALOG.CHANGE) ? LABEL_OLD_PIN + : LABEL_PUK); + oldPinLabel.setText(MessageFormat.format( + oldPinLabelPattern, new Object[] { pinSpec + .getLocalizedName() })); + + oldPinField = new JPasswordField(); + oldPinField.setText(""); + oldPinField.setActionCommand(okCommand); + oldPinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (oldPinField.getPassword().length >= pinSpec + .getMinLength()) { + pinField.requestFocusInWindow(); + } + } + }); + + ExtendedPinDocument oldPinDocument = new ExtendedPinDocument( + pinSpec.getMinLength(), pinSpec + .getMaxLength(), pinSpec + .getRexepPattern(), okButton); + ComparePinDocument newPinDocument = new ComparePinDocument( + pinSpec.getRecMinLength(), pinSpec + .getRecMaxLength(), pinSpec + .getRexepPattern(), okButton); + ComparePinDocument confirmPinDocument = new ComparePinDocument( + pinSpec.getRecMinLength(), pinSpec + .getRecMaxLength(), pinSpec + .getRexepPattern(), okButton); + + oldPinDocument.newPIN = newPinDocument; + oldPinDocument.confirmPIN = confirmPinDocument; + + newPinDocument.compareTo = confirmPinDocument; + newPinDocument.currentPIN = oldPinDocument; + confirmPinDocument.compareTo = newPinDocument; + confirmPinDocument.currentPIN = oldPinDocument; + + oldPinField.setDocument(oldPinDocument); + pinField.setDocument(newPinDocument); + repeatPinField.setDocument(confirmPinDocument); + + primaryFocusHolder = oldPinField; + + } else { + // else -> ACTIVATE (not verify, not change) + ComparePinDocument newPinDocument = new ComparePinDocument( + pinSpec.getRecMinLength(), pinSpec + .getRecMaxLength(), pinSpec + .getRexepPattern(), okButton); + ComparePinDocument confirmPinDocument = new ComparePinDocument( + pinSpec.getRecMinLength(), pinSpec + .getRecMaxLength(), pinSpec + .getRexepPattern(), okButton); + + newPinDocument.compareTo = confirmPinDocument; + confirmPinDocument.compareTo = newPinDocument; + + pinField.setDocument(newPinDocument); + repeatPinField.setDocument(confirmPinDocument); + + primaryFocusHolder = pinField; + } + } else { + // VERIFY + pinField.setDocument(new PINDocument(pinSpec + .getMinLength(), pinSpec.getMaxLength(), + pinSpec.getRexepPattern(), okButton)); + + primaryFocusHolder = pinField; + } + + 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, + pinSpec.getLocalizedLength())); + + // ////////////////////////////////////////////////////////////// + // 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 { + +//<<<<<<< .mine +// if (windowCloseAdapter != null) { +// windowCloseAdapter.registerListener(cancelListener, cancelCommand); +// } +//======= + if (type == DIALOG.CHANGE || type == DIALOG.UNBLOCK) { + 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))); +//>>>>>>> .r684 + + 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); + + 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); + + + updateMethodToRunAtResize("at.gv.egiz.bku.gui.PINManagementGUI", "renderPINDialogButtonPanel"); + + renderPINDialogButtonPanel(); + + 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(); + + if (windowCloseAdapter != null) { + windowCloseAdapter.registerListener(cancelListener, cancelCommand); + } + + resize(); + + } + }); + } + + public void renderPINDialogButtonPanel() { + + 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; + + + 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); + + } + + @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; + } @Override - public void showEnterCurrentPIN(DIALOG type, PINSpec pinSpec, int retries) { + public void showEnterCurrentPIN(DIALOG type, PinInfo pinSpec, int retries) { String title, message; // Object[] params = null; - + if (type == PINManagementGUIFacade.DIALOG.VERIFY) { title = PINManagementGUIFacade.TITLE_VERIFY_PINPAD; message = BKUGUIFacade.MESSAGE_ENTERPIN_PINPAD; -// params = new Object[]{pinSpec.getLocalizedName(), pinSpec.getLocalizedLength()}; } else if (type == PINManagementGUIFacade.DIALOG.ACTIVATE) { title = PINManagementGUIFacade.TITLE_ACTIVATE_PIN; message = PINManagementGUIFacade.MESSAGE_ACTIVATE_PINPAD_CURRENT; -// params = new Object[]{pinSpec.getLocalizedName(), pinSpec.getLocalizedLength()}; } else if (type == PINManagementGUIFacade.DIALOG.CHANGE) { title = PINManagementGUIFacade.TITLE_CHANGE_PIN; message = PINManagementGUIFacade.MESSAGE_CHANGE_PINPAD_CURRENT; -// params = new Object[]{pinSpec.getLocalizedName(), pinSpec.getLocalizedLength()}; } else { //if (type == DIALOG.UNBLOCK) { title = PINManagementGUIFacade.TITLE_UNBLOCK_PIN; message = PINManagementGUIFacade.MESSAGE_UNBLOCK_PINPAD_CURRENT; -// params = new Object[]{pinSpec.getLocalizedName(), pinSpec.getLocalizedLength()}; } showEnterPIN(pinSpec, retries, title, message, null); } @Override - public void showEnterNewPIN(DIALOG type, PINSpec pinSpec) { + public void showEnterNewPIN(DIALOG type, PinInfo pinSpec) { String title, message; if (type == PINManagementGUIFacade.DIALOG.ACTIVATE) { title = PINManagementGUIFacade.TITLE_ACTIVATE_PIN; @@ -731,7 +964,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac title = PINManagementGUIFacade.TITLE_UNBLOCK_PIN; message = PINManagementGUIFacade.MESSAGE_UNBLOCK_PINPAD_NEW; } else { - log.error("enterNewPIN not supported for dialog type " + type); + log.error("EnterNewPIN not supported for dialog type {}.", type); showErrorDialog(ERR_UNKNOWN, null); return; } @@ -739,7 +972,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac } @Override - public void showConfirmNewPIN(DIALOG type, PINSpec pinSpec) { + public void showConfirmNewPIN(DIALOG type, PinInfo pinSpec) { String title, message; if (type == PINManagementGUIFacade.DIALOG.ACTIVATE) { title = PINManagementGUIFacade.TITLE_ACTIVATE_PIN; @@ -751,11 +984,104 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac title = PINManagementGUIFacade.TITLE_UNBLOCK_PIN; message = PINManagementGUIFacade.MESSAGE_UNBLOCK_PINPAD_CONFIRM; } else { - log.error("enterNewPIN not supported for dialog type " + type); + log.error("EnterNewPIN not supported for dialog type {}.", type); showErrorDialog(ERR_UNKNOWN, null); return; } showEnterPIN(pinSpec, -1, title, message, null); } + @Override + public void resize() { + + log.debug("Resizing PINManagementApplet ..."); + + float factor = getResizeFactor(); + + if (mgmtLabel != null) { + + mgmtLabel.setFont(mgmtLabel.getFont().deriveFont( + (float) (baseFontSize * factor))); + } + + if (pinStatusRenderer != null) { + + pinStatusRenderer.setFontSize((int) (baseFontSize * factor)); + } + + if (pinStatusTable != null) { + + pinStatusTable.setRowHeight((int) (baseTableRowHeight * factor)); + pinStatusTable.setFont(pinStatusTable.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } + + if (activateButton != null) { + + activateButton.setFont(activateButton.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } + + if (cancelButton != null) { + + cancelButton.setFont(cancelButton.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } + + + if (pinpadLabel != null) { + pinpadLabel.setFont(pinpadLabel.getFont().deriveFont( + (float) (baseFontSize * factor))); + } + + if (okButton != null) { + okButton.setFont(okButton.getFont().deriveFont( + (float) (baseFontSize * factor))); + } + + if (pinLabel != null) { + pinLabel.setFont(pinLabel.getFont().deriveFont( + (float) (baseFontSize * factor))); + } + + if (repeatPinLabel != null) { + repeatPinLabel.setFont(repeatPinLabel.getFont().deriveFont( + (float) (baseFontSize * factor))); + } + + if (oldPinLabel != null) { + oldPinLabel.setFont(oldPinLabel.getFont().deriveFont( + (float) (baseFontSize * factor))); + } + + if (pinField != null) { + pinField.setFont(pinField.getFont().deriveFont( + (float) (baseFontSize * factor))); + } + + if (repeatPinField != null) { + + repeatPinField.setFont(repeatPinField.getFont().deriveFont( + (float) (baseFontSize * factor))); + } + + if (oldPinField != null) { + + oldPinField.setFont(oldPinField.getFont().deriveFont( + (float) (baseFontSize * factor))); + } + + if (pinsizeLabel != null) { + pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont( + (float) ((baseFontSize-2) * factor))); + } + + super.resize(); + + + } + } 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 index 46ae18b9..c768a1e9 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java @@ -17,9 +17,8 @@ package at.gv.egiz.bku.gui; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import java.awt.event.ActionListener; -import java.util.Map; /** * @@ -91,39 +90,40 @@ public interface PINManagementGUIFacade extends BKUGUIFacade { 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 STATUS { ACTIV, NOT_ACTIV, BLOCKED, UNKNOWN }; public enum DIALOG { VERIFY, ACTIVATE, CHANGE, UNBLOCK }; + public enum PIN_MANAGEMENT_DIALOG_TYPE {DIALOGUE_UNDEFINED, DIALOGUE_PIN_MANAGEMENT, DIALOGUE_PIN}; /** * list pins */ - public void showPINManagementDialog(Map<PINSpec, STATUS> pins, + public void showPINManagementDialog(PinInfo[] pins, ActionListener activateListener, String activateCmd, String changeCmd, String unblockCmd, String verifyCmd, ActionListener cancelListener, String cancelCmd); /** * "software" pin-entry dialog (activate, change, unblock, verify) */ - public void showPINDialog(DIALOG type, PINSpec pinSpec, int retries, + public void showPINDialog(DIALOG type, PinInfo pinSpec, int retries, ActionListener okListener, String okCmd, ActionListener cancelListener, String cancelCmd); /** * <b>direct</b> pinpad pin-entry dialog */ - public void showModifyPINDirect(DIALOG type, PINSpec pinSpec, int retries); + public void showModifyPINDirect(DIALOG type, PinInfo pinSpec, int retries); /** * <b>start/finish</b> pinpad pin-entry dialog */ - public void showEnterCurrentPIN(DIALOG type, PINSpec pinSpec, int retries); + public void showEnterCurrentPIN(DIALOG type, PinInfo pinSpec, int retries); - public void showEnterNewPIN(DIALOG type, PINSpec pinSpec); + public void showEnterNewPIN(DIALOG type, PinInfo pinSpec); - public void showConfirmNewPIN(DIALOG type, PINSpec pinSpec); + public void showConfirmNewPIN(DIALOG type, PinInfo pinSpec); public char[] getOldPin(); - public PINSpec getSelectedPINSpec(); + public PinInfo getSelectedPinInfo(); } 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 index e3d73e1f..7504965e 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java @@ -17,10 +17,8 @@ package at.gv.egiz.bku.gui; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import javax.swing.table.DefaultTableCellRenderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * @@ -28,12 +26,25 @@ import org.apache.commons.logging.LogFactory; */ public class PINSpecRenderer extends DefaultTableCellRenderer { - private static final Log log = LogFactory.getLog(PINSpecRenderer.class); + private static final long serialVersionUID = 1L; + + protected int fontSize; + + public PINSpecRenderer() { + this.fontSize = super.getFont().getSize(); + } + @Override protected void setValue(Object value) { - PINSpec pinSpec = (PINSpec) value; + PinInfo pinSpec = (PinInfo) value; super.setText(pinSpec.getLocalizedName()); + super.setFont(super.getFont().deriveFont((float) (fontSize))); } + public void setFontSize(int fontSize) { + + this.fontSize = fontSize; + } + } 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 index 83ff74f2..d3fd61d1 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java @@ -17,7 +17,7 @@ package at.gv.egiz.bku.gui; -import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; +import at.gv.egiz.smcc.PinInfo; import java.awt.Color; import java.awt.Font; import java.util.ResourceBundle; @@ -29,33 +29,45 @@ import javax.swing.table.DefaultTableCellRenderer; */ public class PINStatusRenderer extends DefaultTableCellRenderer { -// private static final Log log = LogFactory.getLog(PINStatusRenderer.class); - + private static final long serialVersionUID = 1L; + 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; + protected int fontSize; public PINStatusRenderer(ResourceBundle messages) { this.messages = messages; + this.fontSize = super.getFont().getSize(); } @Override protected void setValue(Object value) { - STATUS pinStatus = (STATUS) value; + PinInfo.STATE pinStatus = ((PinInfo) value).getState(); + super.setFont(super.getFont().deriveFont(super.getFont().getStyle() | Font.BOLD)); + super.setFont(super.getFont().deriveFont((float) (fontSize))); - if (pinStatus == STATUS.NOT_ACTIV) { + if (pinStatus == PinInfo.STATE.NOT_ACTIV) { super.setForeground(RED); - super.setText("<html>" + messages.getString(PINManagementGUIFacade.STATUS_NOT_ACTIVE) + "</html>"); - } else if (pinStatus == STATUS.ACTIV) { + super.setText("<html>" + messages.getString(PINManagementGUIFacade.STATUS_NOT_ACTIVE)); + } else if (pinStatus == PinInfo.STATE.ACTIV) { super.setForeground(GREEN); - super.setText("<html>" + messages.getString(PINManagementGUIFacade.STATUS_ACTIVE) + "</html>"); - } else if (pinStatus == STATUS.BLOCKED) { + super.setText("<html>" + messages.getString(PINManagementGUIFacade.STATUS_ACTIVE) + " (" + ((PinInfo) value).getRetries() + ")"); + } else if (pinStatus == PinInfo.STATE.BLOCKED) { super.setForeground(RED); - super.setText("<html>" + messages.getString(PINManagementGUIFacade.STATUS_BLOCKED) + "</html>"); - } else { + super.setText("<html>" + messages.getString(PINManagementGUIFacade.STATUS_BLOCKED)); + } else if (pinStatus == PinInfo.STATE.UNKNOWN) { super.setForeground(Color.BLACK); - super.setText("<html>" + messages.getString(PINManagementGUIFacade.STATUS_UNKNOWN) + "</html>"); + super.setText("<html>" + messages.getString(PINManagementGUIFacade.STATUS_UNKNOWN)); + } else { + super.setForeground(Color.RED); + super.setText("<html>" + messages.getString(PINManagementGUIFacade.STATUS_UNKNOWN)); } } + + public void setFontSize(int fontSize) { + + this.fontSize = fontSize; + } } 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 index 052c13b2..18ab5e88 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java @@ -16,9 +16,7 @@ */ 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 at.gv.egiz.smcc.PinInfo; import javax.swing.table.DefaultTableModel; /** @@ -27,27 +25,20 @@ import javax.swing.table.DefaultTableModel; */ public class PINStatusTableModel extends DefaultTableModel { -// protected static final Log log = LogFactory.getLog(PINStatusTableModel.class); - protected Class[] types; + private static final long serialVersionUID = 1L; - public PINStatusTableModel(Map<PINSpec, STATUS> pinStatuses) { + protected Class<?>[] types; + + public PINStatusTableModel(PinInfo[] pinSpecs) { 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) }); + types = new Class<?>[] { String.class, PinInfo.class }; + for (PinInfo pinSpec : pinSpecs) { + addRow(new Object[] { pinSpec.getLocalizedName(), 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) { + public Class<?> getColumnClass(int columnIndex) { return types[columnIndex]; } 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 index b9c0e5f8..0dcdf033 100644 --- a/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java +++ b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java @@ -20,7 +20,7 @@ */ package at.gv.egiz.bku.gui; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.stal.HashDataInput; import at.gv.egiz.stal.impl.ByteArrayHashDataInput; import java.awt.event.ActionEvent; @@ -44,7 +44,7 @@ public class BKUGUIWorker implements Runnable { public void run() { try { - final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN", (byte)0x00, null); + final PinInfo signPinSpec = new SimplePinInfo(6, 10, "[0-9]", "Signatur-PIN", (byte)0x00, null, PinInfo.UNKNOWN_RETRIES); final ActionListener cancelListener = new ActionListener() { diff --git a/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/SimplePinInfo.java b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/SimplePinInfo.java new file mode 100644 index 00000000..3e583118 --- /dev/null +++ b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/SimplePinInfo.java @@ -0,0 +1,46 @@ +/* + * 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.PinInfo; +import java.util.Locale; + +/** + * + * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> + */ +public class SimplePinInfo extends PinInfo { + + String name; + + public SimplePinInfo(int minLength, int maxLength, String rexepPattern, String name, byte kid, byte[] contextAID, int maxRetries) { + super(minLength, maxLength, rexepPattern, null, null, kid, contextAID, maxRetries); + this.name = name; + } + + @Override + public String getLocalizedName() { + return name; + } + + @Override + public String getLocalizedName(Locale locale) { + return name; + } + +} diff --git a/BKUHelp/pom.xml b/BKUHelp/pom.xml index 9fabf80d..8d8001e3 100644 --- a/BKUHelp/pom.xml +++ b/BKUHelp/pom.xml @@ -1,13 +1,13 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <groupId>at.gv.egiz</groupId> <artifactId>BKUHelp</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <name>BKU Help</name> <build> <resources> diff --git a/BKUHelp/src/main/webapp/help/cardnotsupported.html b/BKUHelp/src/main/webapp/help/cardnotsupported.html new file mode 100644 index 00000000..3da1a7e0 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/cardnotsupported.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="cardnotsupported.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Die Karte wird nicht unterstützt</h1> + <p>Die im Kartenleser gesteckte Chipkarte wird nicht unterstützt.</p> + <p>Bitte stecken Sie eine unterstützte Chipkarte (Bürgerkarte) in den Kartenleser. Derzeit werden die folgenden Chipkarten unterstützt:</p> + <ul> + <li><strong>e-card</strong> <br /> + Chipkarte der <a href="http://www.sozialversicherung.at">Österreichischen Sozialversicherung</a></li> + <li><strong>a-sign premium</strong> <br /> + Chipkarte der <a href="http://www.a-trust.at">A-Trust GmbH</a> bzw. diverse andere Chipkarten mit der Aufschrift 'a-sign premium'.</li> + </ul> + <p>Sind mehrere unterstützte Kartenleser angeschlossen, stecken sie eine unterstützte Chipkarte (Bürgerkarte) in einen der angeschlossenen Kartenleser. Wird die Chipkarte erkannt wechselt die Bildschirmanzeige. Wird die Chipkarte nicht erkannt, wird der Kartenleser möglicherweise nicht unterstützt. Stecken Sie die Chipkarte daher in einen anderen Kartenleser.</p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/cardnotsupported.png b/BKUHelp/src/main/webapp/help/cardnotsupported.png Binary files differnew file mode 100644 index 00000000..c3b7ce6b --- /dev/null +++ b/BKUHelp/src/main/webapp/help/cardnotsupported.png diff --git a/BKUHelp/src/main/webapp/help/css/help.css b/BKUHelp/src/main/webapp/help/css/help.css new file mode 100644 index 00000000..28f9767b --- /dev/null +++ b/BKUHelp/src/main/webapp/help/css/help.css @@ -0,0 +1,81 @@ +@charset "UTF-8"; +body { + font: 100% Verdana, Arial, Helvetica, sans-serif; + background: #666666; + margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */ + padding: 0; + text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */ + color: #000000; +} + +/* Tips for Elastic layouts +1. Since the elastic layouts overall sizing is based on the user's default fonts size, they are more unpredictable. Used correctly, they are also more accessible for those that need larger fonts size since the line length remains proportionate. +2. Sizing of divs in this layout are based on the 100% font size in the body element. If you decrease the text size overall by using a font-size: 80% on the body element or the #container, remember that the entire layout will downsize proportionately. You may want to increase the widths of the various divs to compensate for this. +3. If font sizing is changed in differing amounts on each div instead of on the overall design (ie: #sidebar1 is given a 70% font size and #mainContent is given an 85% font size), this will proportionately change each of the divs overall size. You may want to adjust based on your final font sizing. +*/ +.twoColElsLtHdr #container { + width: 46em; /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */ + background: #FFFFFF; + margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */ + border: 1px solid #000000; + text-align: left; /* this overrides the text-align: center on the body element. */ +} +.twoColElsLtHdr #header { + background: #DDDDDD; + padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */ +} +.twoColElsLtHdr #header h1 { + margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */ + padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */ +} + +/* Tips for sidebar1: +1. Be aware that if you set a font-size value on this div, the overall width of the div will be adjusted accordingly. +2. Since we are working in ems, it's best not to use padding on the sidebar itself. It will be added to the width for standards compliant browsers creating an unknown actual width. +3. Space between the side of the div and the elements within it can be created by placing a left and right margin on those elements as seen in the ".twoColElsLtHdr #sidebar1 p" rule. +*/ +.twoColElsLtHdr #sidebar1 { + float: left; + width: 210px; + padding: 15px 0; /* top and bottom padding create visual space within this div */ + background-color: #FFFFFF; +} +.twoColElsLtHdr #sidebar1 h3, .twoColElsLtHdr #sidebar1 p { + margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */ + margin-right: 10px; +} + +/* Tips for mainContent: +1. If you give this #mainContent div a font-size value different than the #sidebar1 div, the margins of the #mainContent div will be based on its font-size and the width of the #sidebar1 div will be based on its font-size. You may wish to adjust the values of these divs. +2. The space between the mainContent and sidebar1 is created with the left margin on the mainContent div. No matter how much content the sidebar1 div contains, the column space will remain. You can remove this left margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. +3. To avoid float drop, you may need to test to determine the approximate maximum image/element size since this layout is based on the user's font sizing combined with the values you set. However, if the user has their browser font size set lower than normal, less space will be available in the #mainContent div than you may see on testing. +4. In the Internet Explorer Conditional Comment below, the zoom property is used to give the mainContent "hasLayout." This avoids several IE-specific bugs that may occur. +*/ +.twoColElsLtHdr #mainContent { + margin: 0 1.5em 0 15em; /* the right margin can be given in ems or pixels. It creates the space down the right side of the page. */ + padding: 0 10px; +} +.twoColElsLtHdr #footer { + padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */ + background:#DDDDDD; +} +.twoColElsLtHdr #footer p { + margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */ + padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */ +} + +/* Miscellaneous classes for reuse */ +.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ + float: right; + margin-left: 8px; +} +.fltlft { /* this class can be used to float an element left in your page */ + float: left; + margin-right: 8px; +} +.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */ + clear:both; + height:0; + font-size: 1px; + line-height: 0px; +}
\ No newline at end of file diff --git a/BKUHelp/src/main/webapp/help/en/cardnotsupported.html b/BKUHelp/src/main/webapp/help/en/cardnotsupported.html new file mode 100644 index 00000000..92a23c04 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/cardnotsupported.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="cardnotsupported.png" alt="applet screenshot" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Die Karte wird nicht unterstützt</h1> + <p>Die im Kartenleser gesteckte Chipkarte wird nicht unterstützt.</p> + <p>Bitte stecken Sie eine unterstützte Chipkarte (Bürgerkarte) in den Kartenleser. Derzeit werden die folgenden Chipkarten unterstützt:</p> + <ul> + <li><strong>e-card</strong> <br /> + Chipkarte der <a href="http://www.sozialversicherung.at">Österreichischen Sozialversicherung</a></li> + <li><strong>a-sign premium</strong> <br /> + Chipkarte der <a href="http://www.a-trust.at">A-Trust GmbH</a> bzw. diverse andere Chipkarten mit der Aufschrift 'a-sign premium'.</li> + </ul> + <p>Sind mehrere unterstützte Kartenleser angeschlossen, stecken sie eine unterstützte Chipkarte (Bürgerkarte) in einen der angeschlossenen Kartenleser. Wird die Chipkarte erkannt wechselt die Bildschirmanzeige. Wird die Chipkarte nicht erkannt, wird der Kartenleser möglicherweise nicht unterstützt. Stecken Sie die Chipkarte daher in einen anderen Kartenleser.</p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/cardnotsupported.png b/BKUHelp/src/main/webapp/help/en/cardnotsupported.png Binary files differnew file mode 100644 index 00000000..c3b7ce6b --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/cardnotsupported.png diff --git a/BKUHelp/src/main/webapp/help/en/error.card.locked.html b/BKUHelp/src/main/webapp/help/en/error.card.locked.html new file mode 100644 index 00000000..01c67de5 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/error.card.locked.html @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="error.card.locked.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Fehler: Bürgerkarte ist gesperrt</h1> + <p>Die Bürgerkartenfunktion auf der gesteckten Chipkarte ist gesperrt. Es stehen keine weiteren Versuche zur Eingabe einer PIN zur Verfügung, da zu oft eine falsche PIN eingegeben wurde.</p> + <p>Bitte wenden sie sich an den Aussteller der Karte.</p> +<ul> + <li><strong>e-card</strong> <br /> + Chipkarte der <a href="http://www.sozialversicherung.at">Österreichischen Sozialversicherung</a></li> + <li><strong>a-sign premium</strong> <br /> + Chipkarte der <a href="http://www.a-trust.at">A-Trust GmbH</a> bzw. diverse andere Chipkarten mit der Aufschrift 'a-sign premium'.</li> + </ul> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/error.card.locked.png b/BKUHelp/src/main/webapp/help/en/error.card.locked.png Binary files differnew file mode 100644 index 00000000..3e50661a --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/error.card.locked.png diff --git a/BKUHelp/src/main/webapp/help/en/error.card.notactivated.html b/BKUHelp/src/main/webapp/help/en/error.card.notactivated.html new file mode 100644 index 00000000..ff55ea27 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/error.card.notactivated.html @@ -0,0 +1,44 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="error.card.notactivated.png" alt="applet screenshot" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Fehler: Bürgerkartenfunktion ist nicht aktiviert.</h1> + <p>Die im Kartenleser gesteckte Chipkarte wird unterstützt, jedoch ist die Bürgerkartenfunktion auf der Chipkarte noch nicht aktiviert.</p> + <p>Um die gesteckte Chipkarte als Bürgerkarte verwenden zu können, + muss zuerst die + Bürgerkartenfunktion aktiviert werden. Für Informationen dazu siehe <a href="http://www.buergerkarte.at/de/aktivieren/">Aktivierung der Bürgerkartenfunktion</a> auf <a href="http://www.buergerkarte.at">www.buergerkarte.at</a>.</p> + <p><br class="clearfloat" /> + </p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/error.card.notactivated.png b/BKUHelp/src/main/webapp/help/en/error.card.notactivated.png Binary files differnew file mode 100644 index 00000000..5761a110 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/error.card.notactivated.png diff --git a/BKUHelp/src/main/webapp/help/en/error.cardterminal.html b/BKUHelp/src/main/webapp/help/en/error.cardterminal.html new file mode 100644 index 00000000..737e9877 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/error.cardterminal.html @@ -0,0 +1,43 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="error.cardterminal.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Fehler: Es konnte kein Kartenleser gefunden werden.</h1> + <p>Für den Zugriff auf die Bürgerkarte ist ein Chipkartenleser erforderlich. Es werden grundsätzlich alle Kartenleser unterstützt, die über die PC/SC-Schnittstelle angesprochen werden können und im Betriebssystem erfolgreich installiert wurden. Es können mehrere unterstützte Kartenleser gleichzeitig angeschlossen werden.</p> + <p>Kartenleser die, die nicht über die PC/SC-Schnittstelle angesprochen werden können (z.B. Kartenleser für die nur CT-API-Treiber verfügbar sind) werden nicht unterstützt.</p> + + <p><br class="clearfloat" /> + </p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/error.cardterminal.png b/BKUHelp/src/main/webapp/help/en/error.cardterminal.png Binary files differnew file mode 100644 index 00000000..1a7c8c70 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/error.cardterminal.png diff --git a/BKUHelp/src/main/webapp/help/en/error.pcsc.html b/BKUHelp/src/main/webapp/help/en/error.pcsc.html new file mode 100644 index 00000000..1a093eb6 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/error.pcsc.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="error.pcsc.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Fehler: Es konnte keine PC/SC-Schnittstelle gefunden werden</h1> + <p>Die Software für den Zugriff auf die Bürgerkarte konnte keine PC/SC-Schnittstelle für den Zugriff auf Kartenleser erkennen. + Das Betriebssystem scheint keine PC/SC-Schnittstelle zur Verfügung zu stellen.</p> + <p>Häufige Ursachen für dieses Problem sind + <ul> + <li>Der PC/SC Dienst läuft nicht</li> + <li>Die entsprechende PC/SC Bibliothek kann von Java nicht gefunden werden + (<a href="http://java.sun.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunPCSCProvider">weitere Informationen</a>).</li> + </ul> + </p> + <p>Unter Betriebssystemen die PCSC-Lite verwenden (Linux u.a.) tritt dieses Problem auch auf, + wenn kein Kartenleser angeschlossen ist und daher der entsprechende Dienst nicht gestartet wurde. + <br class="clearfloat" /> + </p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/error.pcsc.png b/BKUHelp/src/main/webapp/help/en/error.pcsc.png Binary files differnew file mode 100644 index 00000000..cc022615 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/error.pcsc.png diff --git a/BKUHelp/src/main/webapp/help/en/error.pin.timeout.html b/BKUHelp/src/main/webapp/help/en/error.pin.timeout.html new file mode 100644 index 00000000..7c965dbc --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/error.pin.timeout.html @@ -0,0 +1,45 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="error.pin.timeout.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Fehler: Zeitüberschreitung bei der PIN-Eingabe am Kartenleser.</h1> + <p>Bei sicheren Kartenlesern mit integrierter PIN-Eingabe wird der Signaturvorgang aus Sicherheitsgründen nach Ablauf einer definierten Zeitspanne abgebrochen. + Diese beträgt im Normalfall eine Minute bis zur Eingabe der ersten Stelle des PINs. + Für die Eingabe jeder weiteren Stelle ist diese Zeitspanne jedoch - abhängig vom verwendeten Kartenleser - kürzer. + </p> + + <p><br class="clearfloat" /> + </p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/error.pin.timeout.png b/BKUHelp/src/main/webapp/help/en/error.pin.timeout.png Binary files differnew file mode 100644 index 00000000..961d58da --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/error.pin.timeout.png diff --git a/BKUHelp/src/main/webapp/help/en/error.ws.unreachable.html b/BKUHelp/src/main/webapp/help/en/error.ws.unreachable.html new file mode 100644 index 00000000..707a0aa1 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/error.ws.unreachable.html @@ -0,0 +1,40 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="error.ws.unreachable.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Fehler: Der Server ist nicht erreichbar</h1> + <p>Die Software zum Zugriff auf die Bürgerkarte konnte den Server nicht erreichen. Möglicherweise besteht derzeit ein Problem mit dem Dienst. Probieren Sie es daher zu einem späteren Zeitpunkt nochmal. Sollte das Problem dauerhaft bestehen, wenden Sie sich bitte an den Betreiber der Anwendung.</p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/error.ws.unreachable.png b/BKUHelp/src/main/webapp/help/en/error.ws.unreachable.png Binary files differnew file mode 100644 index 00000000..80019733 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/error.ws.unreachable.png diff --git a/BKUHelp/src/main/webapp/help/en/help.activate.pin.html b/BKUHelp/src/main/webapp/help/en/help.activate.pin.html new file mode 100644 index 00000000..cdd304f0 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.activate.pin.html @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.pin.mgmt.png" alt="applet screenshot" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1>Aktivieren der PIN</h1> + <p>Noch nicht aktivierte PINs werden als <em style="color:red; font-weight:bold">NICHT AKTIV</em> angeführt + und können über die Schaltfläche 'Aktivieren' gesetzt werden. + </p> + <p style="text-align: center"><img src="help.pin.mgmt-1.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Geben Sie dazu die gewünschte PIN im dafür vorgesehenen Feld ein und wiederholen Sie diese im Feld 'Bestätigung'. + </p> + <p style="text-align: center"><img src="help.pin.activate.png" alt="Bildschirmfoto" width="295" height="200" /></p> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/help.cardpin.html b/BKUHelp/src/main/webapp/help/en/help.cardpin.html new file mode 100644 index 00000000..bba7f5c0 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.cardpin.html @@ -0,0 +1,42 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.cardpin1.png" alt="applet screenshot" width="190" height="130"/></p> + <p><img src="help.cardpin2.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Lesen von Informationen von der Chipkarte</h1> + <p>Sie werden aufgefordert ihre Karten-PIN bzw. Infobox-PIN (abhängig von der verwendeten Bürgerkarte) einzugeben um das Auslesen von Informationen zur Identifikation (Personenbindung) bzw. Vollmachten zu ermöglichen.</p> + <p><a href="http://www.buergerkarte.at/de/datenschutz-sicherheit/">Details</a> zu den auf der Bürgerkarte gespeicherten Informationen finden sie auf <a href="http://www.buergerkarte.at">www.buergerkarte.at</a>.</p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/help.cardpin1.png b/BKUHelp/src/main/webapp/help/en/help.cardpin1.png Binary files differnew file mode 100644 index 00000000..1bceccf5 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.cardpin1.png diff --git a/BKUHelp/src/main/webapp/help/en/help.cardpin2.png b/BKUHelp/src/main/webapp/help/en/help.cardpin2.png Binary files differnew file mode 100644 index 00000000..12d17be0 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.cardpin2.png diff --git a/BKUHelp/src/main/webapp/help/en/help.change.pin.html b/BKUHelp/src/main/webapp/help/en/help.change.pin.html new file mode 100644 index 00000000..204f323b --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.change.pin.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.pin.mgmt.png" alt="applet screenshot" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1>Ändern der PIN</h1> + <p>Bereits aktivierte PINs werden als <em style="color:green; font-weight:bold">AKTIV</em> angeführt + und können über die Schaltfläche 'Ändern' geändert werden. + </p> + <p style="text-align: center"><img src="help.pin.mgmt.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Geben Sie dazu die alte und neue PIN im jeweils dafür vorgesehenen Feld ein und wiederholen Sie die + neue PIN im Feld 'Bestätigung'. + </p> + <p style="text-align: center"><img src="help.pin.change.png" alt="Bildschirmfoto" width="295" height="200" /></p> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/help.hashdataviewer.html b/BKUHelp/src/main/webapp/help/en/help.hashdataviewer.html new file mode 100644 index 00000000..874cec3a --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.hashdataviewer.html @@ -0,0 +1,42 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>CitizenCard - Help</title>
+<link href="/help/css/help.css" rel="stylesheet" type="text/css" />
+<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/>
+<!--[if IE]>
+<style type="text/css">
+/* place css fixes for all versions of IE in this conditional comment */
+.twoColElsLtHdr #sidebar1 { padding-top: 30px; }
+.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; }
+/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
+</style>
+<![endif]-->
+</head>
+
+<body class="twoColElsLtHdr">
+
+<div id="container">
+ <div id="header">
+ <h1>Online Help</h1>
+ <!-- end #header --></div>
+ <div id="sidebar1">
+ <p><img src="help.hashdataviewer.png" alt="Bildschirmfoto des Applets" height="130" width="150"/></p>
+ <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p>
+ <!-- end #sidebar1 --></div>
+ <div id="mainContent">
+ <h1> Anzeige der Signaturdaten </h1>
+ <p>Dieses Fenster zeigt die zu signierenden Daten an. Dies können entweder reine Textdaten oder XHTML sein. Im Falle von XHML erhalten Sie den Hinweis, dass es sich bei den dargestellten Daten nur um eine Voransicht handelt. Um die Daten standardkonform darzustellen, müssen diese abgespeichert und mit einem geeigneten XHTML Betrachter geöffnen werden.</p>
+ <p>In jedem Fall können die zu signierenden abgespeichert werden.</p>
+ <p><img src="help.hashdataviewer.png" alt="Bildschirmfoto des Applets" height="300" width="353"/></p>
+ <p><br class="clearfloat" /></p>
+ </div>
+ <div id="footer">
+ <p>
+ <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a>
+ </p>
+ </div>
+<!-- end #container --></div>
+</body>
+</html>
diff --git a/BKUHelp/src/main/webapp/help/en/help.hashdataviewer.png b/BKUHelp/src/main/webapp/help/en/help.hashdataviewer.png Binary files differnew file mode 100644 index 00000000..83004322 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.hashdataviewer.png diff --git a/BKUHelp/src/main/webapp/help/en/help.install.cacert.html b/BKUHelp/src/main/webapp/help/en/help.install.cacert.html new file mode 100644 index 00000000..f2071ba0 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.install.cacert.html @@ -0,0 +1,58 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="mainContent" style="margin: 1.5em 1.5em 0 1.5em"> + <h1>Installation des CA Zertifikats</h1> + <p>Die lokale Bürgerkartenumgebung (MOCCA Webstart) authentifiziert sich mittels eines TLS Zertifikats ausgestellt auf + <code>CN=127.0.0.1, O=MOCCA, OU=MOCCA TLS Server</code>. + 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 + <code>O=MOCCA, OU=MOCCA TLS Server CA</code>, im Web-Browser zu installieren. + </p> + + <p><strong>Achtung:</strong> 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'. + </p> + + <p> + Klicken Sie dazu auf die Verknüpfung <a href="/ca.crt">CA Zertifikat installieren</a> + 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). + </p> + <p><img src="help.install.cacert.png" alt="Bildschirmfoto des Zertifikatsinstallationsdialogs" height="287" width="565"/></p> + <p style="font-size:70%;"><strong>Hinweis:</strong> Der tatsächliche Dialog kann vom oben dargestellten abweichen und hängt vom verwendeten Web-Browser ab.</p> + <p>Kopieren Sie diese Verknüpfung und rufen Sie sie in weiteren Web-Browsern ihrer Wahl auf um das Zertifikat auch dort zu installieren.</p> + + <p>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.</p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/help.install.cacert.png b/BKUHelp/src/main/webapp/help/en/help.install.cacert.png Binary files differnew file mode 100644 index 00000000..0c1b2564 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.install.cacert.png diff --git a/BKUHelp/src/main/webapp/help/en/help.pin.activate.png b/BKUHelp/src/main/webapp/help/en/help.pin.activate.png Binary files differnew file mode 100644 index 00000000..4790cdf6 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.pin.activate.png diff --git a/BKUHelp/src/main/webapp/help/en/help.pin.change.png b/BKUHelp/src/main/webapp/help/en/help.pin.change.png Binary files differnew file mode 100644 index 00000000..a0fa8643 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.pin.change.png diff --git a/BKUHelp/src/main/webapp/help/en/help.pin.mgmt-1.png b/BKUHelp/src/main/webapp/help/en/help.pin.mgmt-1.png Binary files differnew file mode 100644 index 00000000..b17b3b40 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.pin.mgmt-1.png diff --git a/BKUHelp/src/main/webapp/help/en/help.pin.mgmt-2.png b/BKUHelp/src/main/webapp/help/en/help.pin.mgmt-2.png Binary files differnew file mode 100644 index 00000000..429c87eb --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.pin.mgmt-2.png diff --git a/BKUHelp/src/main/webapp/help/en/help.pin.mgmt-3.png b/BKUHelp/src/main/webapp/help/en/help.pin.mgmt-3.png Binary files differnew file mode 100644 index 00000000..76b11f69 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.pin.mgmt-3.png diff --git a/BKUHelp/src/main/webapp/help/en/help.pin.mgmt-4.png b/BKUHelp/src/main/webapp/help/en/help.pin.mgmt-4.png Binary files differnew file mode 100644 index 00000000..5be7c709 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.pin.mgmt-4.png diff --git a/BKUHelp/src/main/webapp/help/en/help.pin.mgmt.html b/BKUHelp/src/main/webapp/help/en/help.pin.mgmt.html new file mode 100644 index 00000000..9bafec39 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.pin.mgmt.html @@ -0,0 +1,78 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.pin.mgmt.png" alt="applet screenshot" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1>PIN Verwaltung</h1> + <p>Mit Hilfe der PIN Verwaltung können Sie Karten-PINs <a href="#activate">aktivieren</a>, <a href="#change">ändern</a> und <a href="#unblock">entsperren</a>, + wobei der unterstützte Funktionsumfang vom Typ und Zustand der verwendeten Karte abhängt. + </p> + <h3><a name="change">Ändern der PIN</a></h3> + <p>Bereits aktivierte PINs werden als <em style="color:green; font-weight:bold">AKTIV</em> angeführt + und können über die Schaltfläche 'Ändern' geändert werden. + </p> + <p style="text-align: center"><img src="help.pin.mgmt.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Geben Sie dazu die alte und neue PIN im jeweils dafür vorgesehenen Feld ein und wiederholen Sie die + neue PIN im Feld 'Bestätigung'. + </p> + <p style="text-align: center"><img src="help.pin.change.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Bei Karten mit dem ACOS Betriebssystem müssen die PINs verifiziert werden um ihren Status zu ermitteln. + Den Status dieser als <em style="color:black; font-weight:bold">UNBEKANNT</em> angeführten PINs können Sie über die Schaltfläche 'Abfragen' verifizieren. + </p> + <p style="text-align: center"><img src="help.pin.mgmt-3.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p> + Geben Sie dazu die PIN im dafür vorgesehenen Feld ein. + </p> + <p style="text-align: center"><img src="help.pin.verify.png" alt="Bildschirmfoto" width="295" height="200" /></p> + + <h3><a name="activate">Aktivieren der PIN</a></h3> + <p>Noch nicht aktivierte PINs werden als <em style="color:red; font-weight:bold">NICHT AKTIV</em> angeführt + und können über die Schaltfläche 'Aktivieren' gesetzt werden. + </p> + <p style="text-align: center"><img src="help.pin.mgmt-1.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Geben Sie dazu die gewünschte PIN im dafür vorgesehenen Feld ein und wiederholen Sie diese im Feld 'Bestätigung'. + </p> + <p style="text-align: center"><img src="help.pin.activate.png" alt="Bildschirmfoto" width="295" height="200" /></p> + + <h3><a name="unblock">Entsperren der PIN</a></h3> + <p>Durch mehrmalige falsche Eingabe gesperrte PINs werden als <em style="color:red; font-weight:bold">GESPERRT</em> angeführt + und können über die Schaltfläche 'Entsperren' mit einer PUK neu gesetzt werden. + Das Entsperren wird nur von Karten mit dem ACOS Betriebssystem unterstützt. + </p> + <p style="text-align: center"><img src="help.pin.mgmt-2.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Momentan wird das Entsperren von PINs noch nicht unterstützt. + </p> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/help.pin.mgmt.png b/BKUHelp/src/main/webapp/help/en/help.pin.mgmt.png Binary files differnew file mode 100644 index 00000000..44ad3398 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.pin.mgmt.png diff --git a/BKUHelp/src/main/webapp/help/en/help.pin.verify.png b/BKUHelp/src/main/webapp/help/en/help.pin.verify.png Binary files differnew file mode 100644 index 00000000..0c7a7852 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.pin.verify.png diff --git a/BKUHelp/src/main/webapp/help/en/help.retry.html b/BKUHelp/src/main/webapp/help/en/help.retry.html new file mode 100644 index 00000000..9e18fe63 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.retry.html @@ -0,0 +1,41 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.retry.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Falsche PIN</h1> + <p>Die eingegebene PIN war falsch. Bitte geben Sie die korrekte PIN ein.</p> + <p>Die Anzahl der noch möglichen Versuche wird angezeigt.</p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/help.retry.png b/BKUHelp/src/main/webapp/help/en/help.retry.png Binary files differnew file mode 100644 index 00000000..00716afb --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.retry.png diff --git a/BKUHelp/src/main/webapp/help/en/help.signpin-1.png b/BKUHelp/src/main/webapp/help/en/help.signpin-1.png Binary files differnew file mode 100644 index 00000000..1c5c8570 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.signpin-1.png diff --git a/BKUHelp/src/main/webapp/help/en/help.signpin.html b/BKUHelp/src/main/webapp/help/en/help.signpin.html new file mode 100644 index 00000000..2bd61447 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.signpin.html @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.signpin.png" alt="applet screenshot" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Erstellen einer elektronischen Signatur</h1> + <p>Sie werden aufgefordert die Signatur-PIN einzugeben, um eine elektronische Signatur zu erstellen.</p> + <p style="text-align: center"><img src="help.signpin-1.png" alt="Bildschirmfoto" width="278" height="146" /></p> + <ol> + <li>Klicken Sie auf 'Signaturdaten anzeigen' um die zu signierenden Daten anzuzeigen.</li> + <li>Geben Sie im Formularfeld die Signatur-PIN ein.</li> + <li>Klicken Sie auf die Schaltfläche 'Signieren' um die elektronische Signatur zu erstellen.</li> + </ol> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/help.signpin.png b/BKUHelp/src/main/webapp/help/en/help.signpin.png Binary files differnew file mode 100644 index 00000000..37bef2d5 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.signpin.png diff --git a/BKUHelp/src/main/webapp/help/en/help.unblock.pin.html b/BKUHelp/src/main/webapp/help/en/help.unblock.pin.html new file mode 100644 index 00000000..6c62c421 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.unblock.pin.html @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.pin.mgmt.png" alt="applet screenshot" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1>Entsperren der PIN</h1> + <p>Durch mehrmalige falsche Eingabe gesperrte PINs werden als <em style="color:red; font-weight:bold">GESPERRT</em> angeführt + und können über die Schaltfläche 'Entsperren' mit einer PUK neu gesetzt werden. + Das Entsperren wird nur von Karten mit dem ACOS Betriebssystem unterstützt. + </p> + <p style="text-align: center"><img src="help.pin.mgmt-2.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Momentan wird das Entsperren von PINs noch nicht unterstützt. + </p> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/help.unsupported.mimetype.html b/BKUHelp/src/main/webapp/help/en/help.unsupported.mimetype.html new file mode 100644 index 00000000..79c06cac --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.unsupported.mimetype.html @@ -0,0 +1,41 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>CitizenCard - Help</title>
+<link href="/help/css/help.css" rel="stylesheet" type="text/css" />
+<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/>
+<!--[if IE]>
+<style type="text/css">
+/* place css fixes for all versions of IE in this conditional comment */
+.twoColElsLtHdr #sidebar1 { padding-top: 30px; }
+.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; }
+/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
+</style>
+<![endif]-->
+</head>
+
+<body class="twoColElsLtHdr">
+
+<div id="container">
+ <div id="header">
+ <h1>Online Help</h1>
+ <!-- end #header --></div>
+ <div id="sidebar1">
+ <p><img src="help.unsupported.mimetype.png" alt="applet screenshot" height="130" width="150"/></p>
+ <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p>
+ <!-- end #sidebar1 --></div>
+ <div id="mainContent">
+ <h1>Signaturdaten können nicht dargestellt werden</h1>
+ <p>Die Signaturdatenanzeige unterstützt reine Textdaten sowie XHTML, andere MIME-Typen können nicht angezeigt werden.
+ Um die Daten standardkonform darzustellen, müssen diese abgespeichert und mit einem geeigneten externen Betrachter geöffnen werden.</p>
+ <p><br class="clearfloat" /></p>
+ </div>
+ <div id="footer">
+ <p>
+ <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a>
+ </p>
+ </div>
+<!-- end #container --></div>
+</body>
+</html>
diff --git a/BKUHelp/src/main/webapp/help/en/help.verify.pin.html b/BKUHelp/src/main/webapp/help/en/help.verify.pin.html new file mode 100644 index 00000000..e97b1163 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/help.verify.pin.html @@ -0,0 +1,51 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.pin.mgmt.png" alt="applet screenshot" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1>PIN Abfragen</h1> + <p>Bei Karten mit dem ACOS Betriebssystem müssen die PINs verifiziert werden um ihren Status zu ermitteln. + Den Status dieser als <em style="color:black; font-weight:bold">UNBEKANNT</em> angeführten PINs können Sie über die Schaltfläche 'Abfragen' verifizieren. + </p> + <p style="text-align: center"><img src="help.pin.mgmt-3.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p> + Geben Sie dazu die PIN im dafür vorgesehenen Feld ein. + </p> + <p style="text-align: center"><img src="help.pin.verify.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Nach erfolgreicher Eingabe wird die PIN entsprechend ihrem Status als <em style="color:green; font-weight:bold">AKTIV</em>, <em style="color:red; font-weight:bold">NICHT AKTIV</em> oder <em style="color:red; font-weight:bold">GESPERRT</em> angeführt. + </p> + <p style="text-align: center"><img src="help.pin.mgmt-4.png" alt="Bildschirmfoto" width="295" height="200" /></p> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/index.html b/BKUHelp/src/main/webapp/help/en/index.html new file mode 100644 index 00000000..e0f86909 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/index.html @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title>CitizenCard - Help</title> + <link href="/help/css/help.css" rel="stylesheet" type="text/css" /> + <link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> + </head> + + <body class="twoColElsLtHdr"> + + <div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="welcome.png" alt="applet screenshot" width="190" height="130"/></p> + <p>Help icon above CitizenCard dialog</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1>CitizenCard-Environment Help</h1> + <p> + The context-dependent CitizenCard Environment help is available via + the help icon in the top right corner above the CitizenCard dialog. + Alternatively, the individual help pages can be accessed or bookmarked directly from the browser. + </p> + <p>Answers to frequently asked questions can be found in the following help pages: </p> + <ul> + <li><a href="help.install.cacert.html">CA certificate installation (MOCCA Webstart only)</a></li> + <li><a href="error.pcsc.html">PC/SC installation error</a></li> + <li><a href="cardnotsupported.html">Supported signature cards</a></li> + <li><a href="help.cardpin.html">Accessing protected card data (pin entry)</a></li> + <li><a href="help.signpin.html">Signature creation</a></li> + <li><a href="help.retry.html">Wrong PIN</a></li> + <li><a href="help.hashdataviewer.html">Signature data display</a></li> + <li><a href="help.pin.mgmt.html">PIN management</a></li> + <li><a href="help.change.pin.html">Change PIN</a></li> + </ul> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> + <!-- end #container --></div> + </body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/insertcard.html b/BKUHelp/src/main/webapp/help/en/insertcard.html new file mode 100644 index 00000000..7216a3fe --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/insertcard.html @@ -0,0 +1,43 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="insertcard.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Bitte die Bürgerkarte in den Kartenleser stecken</h1> + <p>Die Software für den Zugriff auf die Bürgerkarte hat einen oder mehrere unterstützte Kartenleser gefunden.</p> + <p>Bitte stecken Sie nun ihre Bürgerkarte in den Kartenleser. Wird die Karte erkannt, welchselt die Bildschirmanzeige.</p> + <p>Sollten Sie mehrere Kartenleser angeschlossen haben, wählen Sie einen beliebigen aus. Wird die Karte im ausgewählten Kartenleser nicht erkannt, wird dieser Kartenleser eventuell nicht unterstützt. Probieren Sie es daher in einem anderen Kartenleser nochmal. + </p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/insertcard.png b/BKUHelp/src/main/webapp/help/en/insertcard.png Binary files differnew file mode 100644 index 00000000..62a22975 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/insertcard.png diff --git a/BKUHelp/src/main/webapp/help/en/wait.html b/BKUHelp/src/main/webapp/help/en/wait.html new file mode 100644 index 00000000..73ca8200 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/wait.html @@ -0,0 +1,40 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="wait.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Bitte warten ...</h1> + <p>Die Software für den Zugriff auf die Bürgerkarte ist damit beschäftigt, einen Befehl auszuführen bzw. auf einen neuen Befehl vom Server zu warten. </p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/wait.png b/BKUHelp/src/main/webapp/help/en/wait.png Binary files differnew file mode 100644 index 00000000..63a38fbf --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/wait.png diff --git a/BKUHelp/src/main/webapp/help/en/welcome.html b/BKUHelp/src/main/webapp/help/en/welcome.html new file mode 100644 index 00000000..a26df4ac --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/welcome.html @@ -0,0 +1,41 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>CitizenCard - Help</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online Help</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="welcome.png" alt="applet screenshot" width="190" height="130"/></p> + <p><strong>Note</strong> that the screenshot may differ slightly from the actual web page.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Willkommen </h1> + <p>Die Anzeige "Willkommen" erfolgt unmittelbar nachdem die Software für den Zugriff auf die Bürgerkarte erfolgreich im Browser geladen wurde.</p> + <p>Die Software versucht nun eine Verbindung mit dem Server aufzunehmen um Befehle für den Zugriff auf die Bürgerkarte zu erhalten.</p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/en/welcome.png b/BKUHelp/src/main/webapp/help/en/welcome.png Binary files differnew file mode 100644 index 00000000..78133b4d --- /dev/null +++ b/BKUHelp/src/main/webapp/help/en/welcome.png diff --git a/BKUHelp/src/main/webapp/help/error.card.locked.html b/BKUHelp/src/main/webapp/help/error.card.locked.html new file mode 100644 index 00000000..d49bc1e9 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/error.card.locked.html @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="error.card.locked.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Fehler: Bürgerkarte ist gesperrt</h1> + <p>Die Bürgerkartenfunktion auf der gesteckten Chipkarte ist gesperrt. Es stehen keine weiteren Versuche zur Eingabe einer PIN zur Verfügung, da zu oft eine falsche PIN eingegeben wurde.</p> + <p>Bitte wenden sie sich an den Aussteller der Karte.</p> +<ul> + <li><strong>e-card</strong> <br /> + Chipkarte der <a href="http://www.sozialversicherung.at">Österreichischen Sozialversicherung</a></li> + <li><strong>a-sign premium</strong> <br /> + Chipkarte der <a href="http://www.a-trust.at">A-Trust GmbH</a> bzw. diverse andere Chipkarten mit der Aufschrift 'a-sign premium'.</li> + </ul> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/error.card.locked.png b/BKUHelp/src/main/webapp/help/error.card.locked.png Binary files differnew file mode 100644 index 00000000..3e50661a --- /dev/null +++ b/BKUHelp/src/main/webapp/help/error.card.locked.png diff --git a/BKUHelp/src/main/webapp/help/error.card.notactivated.html b/BKUHelp/src/main/webapp/help/error.card.notactivated.html new file mode 100644 index 00000000..3e04cc93 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/error.card.notactivated.html @@ -0,0 +1,44 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="error.card.notactivated.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Fehler: Bürgerkartenfunktion ist nicht aktiviert.</h1> + <p>Die im Kartenleser gesteckte Chipkarte wird unterstützt, jedoch ist die Bürgerkartenfunktion auf der Chipkarte noch nicht aktiviert.</p> + <p>Um die gesteckte Chipkarte als Bürgerkarte verwenden zu können, + muss zuerst die + Bürgerkartenfunktion aktiviert werden. Für Informationen dazu siehe <a href="http://www.buergerkarte.at/de/aktivieren/">Aktivierung der Bürgerkartenfunktion</a> auf <a href="http://www.buergerkarte.at">www.buergerkarte.at</a>.</p> + <p><br class="clearfloat" /> + </p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/error.card.notactivated.png b/BKUHelp/src/main/webapp/help/error.card.notactivated.png Binary files differnew file mode 100644 index 00000000..5761a110 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/error.card.notactivated.png diff --git a/BKUHelp/src/main/webapp/help/error.cardterminal.html b/BKUHelp/src/main/webapp/help/error.cardterminal.html new file mode 100644 index 00000000..a4c3ee3f --- /dev/null +++ b/BKUHelp/src/main/webapp/help/error.cardterminal.html @@ -0,0 +1,43 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="error.cardterminal.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Fehler: Es konnte kein Kartenleser gefunden werden.</h1> + <p>Für den Zugriff auf die Bürgerkarte ist ein Chipkartenleser erforderlich. Es werden grundsätzlich alle Kartenleser unterstützt, die über die PC/SC-Schnittstelle angesprochen werden können und im Betriebssystem erfolgreich installiert wurden. Es können mehrere unterstützte Kartenleser gleichzeitig angeschlossen werden.</p> + <p>Kartenleser die, die nicht über die PC/SC-Schnittstelle angesprochen werden können (z.B. Kartenleser für die nur CT-API-Treiber verfügbar sind) werden nicht unterstützt.</p> + + <p><br class="clearfloat" /> + </p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/error.cardterminal.png b/BKUHelp/src/main/webapp/help/error.cardterminal.png Binary files differnew file mode 100644 index 00000000..1a7c8c70 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/error.cardterminal.png diff --git a/BKUHelp/src/main/webapp/help/error.pcsc.html b/BKUHelp/src/main/webapp/help/error.pcsc.html new file mode 100644 index 00000000..53cefb30 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/error.pcsc.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="error.pcsc.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Fehler: Es konnte keine PC/SC-Schnittstelle gefunden werden</h1> + <p>Die Software für den Zugriff auf die Bürgerkarte konnte keine PC/SC-Schnittstelle für den Zugriff auf Kartenleser erkennen. + Das Betriebssystem scheint keine PC/SC-Schnittstelle zur Verfügung zu stellen.</p> + <p>Häufige Ursachen für dieses Problem sind + <ul> + <li>Der PC/SC Dienst läuft nicht</li> + <li>Die entsprechende PC/SC Bibliothek kann von Java nicht gefunden werden + (<a href="http://java.sun.com/javase/6/docs/technotes/guides/security/SunProviders.html#SunPCSCProvider">weitere Informationen</a>).</li> + </ul> + </p> + <p>Unter Betriebssystemen die PCSC-Lite verwenden (Linux u.a.) tritt dieses Problem auch auf, + wenn kein Kartenleser angeschlossen ist und daher der entsprechende Dienst nicht gestartet wurde. + <br class="clearfloat" /> + </p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/error.pcsc.png b/BKUHelp/src/main/webapp/help/error.pcsc.png Binary files differnew file mode 100644 index 00000000..cc022615 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/error.pcsc.png diff --git a/BKUHelp/src/main/webapp/help/error.pin.timeout.html b/BKUHelp/src/main/webapp/help/error.pin.timeout.html new file mode 100644 index 00000000..ca0d1a53 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/error.pin.timeout.html @@ -0,0 +1,45 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="error.pin.timeout.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Fehler: Zeitüberschreitung bei der PIN-Eingabe am Kartenleser.</h1> + <p>Bei sicheren Kartenlesern mit integrierter PIN-Eingabe wird der Signaturvorgang aus Sicherheitsgründen nach Ablauf einer definierten Zeitspanne abgebrochen. + Diese beträgt im Normalfall eine Minute bis zur Eingabe der ersten Stelle des PINs. + Für die Eingabe jeder weiteren Stelle ist diese Zeitspanne jedoch - abhängig vom verwendeten Kartenleser - kürzer. + </p> + + <p><br class="clearfloat" /> + </p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/error.pin.timeout.png b/BKUHelp/src/main/webapp/help/error.pin.timeout.png Binary files differnew file mode 100644 index 00000000..961d58da --- /dev/null +++ b/BKUHelp/src/main/webapp/help/error.pin.timeout.png diff --git a/BKUHelp/src/main/webapp/help/error.ws.unreachable.html b/BKUHelp/src/main/webapp/help/error.ws.unreachable.html new file mode 100644 index 00000000..ea4d94f1 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/error.ws.unreachable.html @@ -0,0 +1,40 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="error.ws.unreachable.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Fehler: Der Server ist nicht erreichbar</h1> + <p>Die Software zum Zugriff auf die Bürgerkarte konnte den Server nicht erreichen. Möglicherweise besteht derzeit ein Problem mit dem Dienst. Probieren Sie es daher zu einem späteren Zeitpunkt nochmal. Sollte das Problem dauerhaft bestehen, wenden Sie sich bitte an den Betreiber der Anwendung.</p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/error.ws.unreachable.png b/BKUHelp/src/main/webapp/help/error.ws.unreachable.png Binary files differnew file mode 100644 index 00000000..80019733 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/error.ws.unreachable.png diff --git a/BKUHelp/src/main/webapp/help/help.activate.pin.html b/BKUHelp/src/main/webapp/help/help.activate.pin.html new file mode 100644 index 00000000..2a5f7193 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.activate.pin.html @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.pin.mgmt.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1>Aktivieren der PIN</h1> + <p>Noch nicht aktivierte PINs werden als <em style="color:red; font-weight:bold">NICHT AKTIV</em> angeführt + und können über die Schaltfläche 'Aktivieren' gesetzt werden. + </p> + <p style="text-align: center"><img src="help.pin.mgmt-1.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Geben Sie dazu die gewünschte PIN im dafür vorgesehenen Feld ein und wiederholen Sie diese im Feld 'Bestätigung'. + </p> + <p style="text-align: center"><img src="help.pin.activate.png" alt="Bildschirmfoto" width="295" height="200" /></p> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/help.cardpin.html b/BKUHelp/src/main/webapp/help/help.cardpin.html new file mode 100644 index 00000000..609e4faa --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.cardpin.html @@ -0,0 +1,42 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.cardpin1.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><img src="help.cardpin2.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Lesen von Informationen von der Chipkarte</h1> + <p>Sie werden aufgefordert ihre Karten-PIN bzw. Infobox-PIN (abhängig von der verwendeten Bürgerkarte) einzugeben um das Auslesen von Informationen zur Identifikation (Personenbindung) bzw. Vollmachten zu ermöglichen.</p> + <p><a href="http://www.buergerkarte.at/de/datenschutz-sicherheit/">Details</a> zu den auf der Bürgerkarte gespeicherten Informationen finden sie auf <a href="http://www.buergerkarte.at">www.buergerkarte.at</a>.</p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/help.cardpin1.png b/BKUHelp/src/main/webapp/help/help.cardpin1.png Binary files differnew file mode 100644 index 00000000..1bceccf5 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.cardpin1.png diff --git a/BKUHelp/src/main/webapp/help/help.cardpin2.png b/BKUHelp/src/main/webapp/help/help.cardpin2.png Binary files differnew file mode 100644 index 00000000..12d17be0 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.cardpin2.png diff --git a/BKUHelp/src/main/webapp/help/help.change.pin.html b/BKUHelp/src/main/webapp/help/help.change.pin.html new file mode 100644 index 00000000..64fe213c --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.change.pin.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.pin.mgmt.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1>Ändern der PIN</h1> + <p>Bereits aktivierte PINs werden als <em style="color:green; font-weight:bold">AKTIV</em> angeführt + und können über die Schaltfläche 'Ändern' geändert werden. + </p> + <p style="text-align: center"><img src="help.pin.mgmt.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Geben Sie dazu die alte und neue PIN im jeweils dafür vorgesehenen Feld ein und wiederholen Sie die + neue PIN im Feld 'Bestätigung'. + </p> + <p style="text-align: center"><img src="help.pin.change.png" alt="Bildschirmfoto" width="295" height="200" /></p> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/help.hashdataviewer.html b/BKUHelp/src/main/webapp/help/help.hashdataviewer.html new file mode 100644 index 00000000..98823e39 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.hashdataviewer.html @@ -0,0 +1,42 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Bürgerkarte - Hilfe</title>
+<link href="/help/css/help.css" rel="stylesheet" type="text/css" />
+<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/>
+<!--[if IE]>
+<style type="text/css">
+/* place css fixes for all versions of IE in this conditional comment */
+.twoColElsLtHdr #sidebar1 { padding-top: 30px; }
+.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; }
+/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
+</style>
+<![endif]-->
+</head>
+
+<body class="twoColElsLtHdr">
+
+<div id="container">
+ <div id="header">
+ <h1>Online-Hilfe</h1>
+ <!-- end #header --></div>
+ <div id="sidebar1">
+ <p><img src="help.hashdataviewer.png" alt="Bildschirmfoto des Applets" height="130" width="150"/></p>
+ <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p>
+ <!-- end #sidebar1 --></div>
+ <div id="mainContent">
+ <h1> Anzeige der Signaturdaten </h1>
+ <p>Dieses Fenster zeigt die zu signierenden Daten an. Dies können entweder reine Textdaten oder XHTML sein. Im Falle von XHML erhalten Sie den Hinweis, dass es sich bei den dargestellten Daten nur um eine Voransicht handelt. Um die Daten standardkonform darzustellen, müssen diese abgespeichert und mit einem geeigneten XHTML Betrachter geöffnen werden.</p>
+ <p>In jedem Fall können die zu signierenden abgespeichert werden.</p>
+ <p><img src="help.hashdataviewer.png" alt="Bildschirmfoto des Applets" height="300" width="353"/></p>
+ <p><br class="clearfloat" /></p>
+ </div>
+ <div id="footer">
+ <p>
+ <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a>
+ </p>
+ </div>
+<!-- end #container --></div>
+</body>
+</html>
diff --git a/BKUHelp/src/main/webapp/help/help.hashdataviewer.png b/BKUHelp/src/main/webapp/help/help.hashdataviewer.png Binary files differnew file mode 100644 index 00000000..83004322 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.hashdataviewer.png diff --git a/BKUHelp/src/main/webapp/help/help.install.cacert.html b/BKUHelp/src/main/webapp/help/help.install.cacert.html new file mode 100644 index 00000000..0f34c86f --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.install.cacert.html @@ -0,0 +1,58 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="mainContent" style="margin: 1.5em 1.5em 0 1.5em"> + <h1>Installation des CA Zertifikats</h1> + <p>Die lokale Bürgerkartenumgebung authentifiziert sich mittels eines TLS Zertifikats ausgestellt auf + <code>CN=127.0.0.1, O=MOCCA, OU=MOCCA TLS Server</code>. + 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 + <code>O=MOCCA, OU=MOCCA TLS Server CA</code>, im Web-Browser zu installieren. + </p> + + <p><strong>Achtung:</strong> 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'. + </p> + + <p> + Klicken Sie dazu auf die Verknüpfung <a href="/ca.crt">CA Zertifikat installieren</a> + 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). + </p> + <p><img src="help.install.cacert.png" alt="Bildschirmfoto des Zertifikatsinstallationsdialogs" height="287" width="565"/></p> + <p style="font-size:70%;"><strong>Hinweis:</strong> Der tatsächliche Dialog kann vom oben dargestellten abweichen und hängt vom verwendeten Web-Browser ab.</p> + <p>Kopieren Sie diese Verknüpfung und rufen Sie sie in weiteren Web-Browsern ihrer Wahl auf um das Zertifikat auch dort zu installieren.</p> + + <p>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.</p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/help.install.cacert.png b/BKUHelp/src/main/webapp/help/help.install.cacert.png Binary files differnew file mode 100644 index 00000000..0c1b2564 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.install.cacert.png diff --git a/BKUHelp/src/main/webapp/help/help.pin.activate.png b/BKUHelp/src/main/webapp/help/help.pin.activate.png Binary files differnew file mode 100644 index 00000000..4790cdf6 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.pin.activate.png diff --git a/BKUHelp/src/main/webapp/help/help.pin.change.png b/BKUHelp/src/main/webapp/help/help.pin.change.png Binary files differnew file mode 100644 index 00000000..a0fa8643 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.pin.change.png diff --git a/BKUHelp/src/main/webapp/help/help.pin.mgmt-1.png b/BKUHelp/src/main/webapp/help/help.pin.mgmt-1.png Binary files differnew file mode 100644 index 00000000..b17b3b40 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.pin.mgmt-1.png diff --git a/BKUHelp/src/main/webapp/help/help.pin.mgmt-2.png b/BKUHelp/src/main/webapp/help/help.pin.mgmt-2.png Binary files differnew file mode 100644 index 00000000..429c87eb --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.pin.mgmt-2.png diff --git a/BKUHelp/src/main/webapp/help/help.pin.mgmt-3.png b/BKUHelp/src/main/webapp/help/help.pin.mgmt-3.png Binary files differnew file mode 100644 index 00000000..76b11f69 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.pin.mgmt-3.png diff --git a/BKUHelp/src/main/webapp/help/help.pin.mgmt-4.png b/BKUHelp/src/main/webapp/help/help.pin.mgmt-4.png Binary files differnew file mode 100644 index 00000000..5be7c709 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.pin.mgmt-4.png diff --git a/BKUHelp/src/main/webapp/help/help.pin.mgmt.html b/BKUHelp/src/main/webapp/help/help.pin.mgmt.html new file mode 100644 index 00000000..4a4b471b --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.pin.mgmt.html @@ -0,0 +1,78 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.pin.mgmt.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1>PIN Verwaltung</h1> + <p>Mit Hilfe der PIN Verwaltung können Sie Karten-PINs <a href="#activate">aktivieren</a>, <a href="#change">ändern</a> und <a href="#unblock">entsperren</a>, + wobei der unterstützte Funktionsumfang vom Typ und Zustand der verwendeten Karte abhängt. + </p> + <h3><a name="change">Ändern der PIN</a></h3> + <p>Bereits aktivierte PINs werden als <em style="color:green; font-weight:bold">AKTIV</em> angeführt + und können über die Schaltfläche 'Ändern' geändert werden. + </p> + <p style="text-align: center"><img src="help.pin.mgmt.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Geben Sie dazu die alte und neue PIN im jeweils dafür vorgesehenen Feld ein und wiederholen Sie die + neue PIN im Feld 'Bestätigung'. + </p> + <p style="text-align: center"><img src="help.pin.change.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Bei Karten mit dem ACOS Betriebssystem müssen die PINs verifiziert werden um ihren Status zu ermitteln. + Den Status dieser als <em style="color:black; font-weight:bold">UNBEKANNT</em> angeführten PINs können Sie über die Schaltfläche 'Abfragen' verifizieren. + </p> + <p style="text-align: center"><img src="help.pin.mgmt-3.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p> + Geben Sie dazu die PIN im dafür vorgesehenen Feld ein. + </p> + <p style="text-align: center"><img src="help.pin.verify.png" alt="Bildschirmfoto" width="295" height="200" /></p> + + <h3><a name="activate">Aktivieren der PIN</a></h3> + <p>Noch nicht aktivierte PINs werden als <em style="color:red; font-weight:bold">NICHT AKTIV</em> angeführt + und können über die Schaltfläche 'Aktivieren' gesetzt werden. + </p> + <p style="text-align: center"><img src="help.pin.mgmt-1.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Geben Sie dazu die gewünschte PIN im dafür vorgesehenen Feld ein und wiederholen Sie diese im Feld 'Bestätigung'. + </p> + <p style="text-align: center"><img src="help.pin.activate.png" alt="Bildschirmfoto" width="295" height="200" /></p> + + <h3><a name="unblock">Entsperren der PIN</a></h3> + <p>Durch mehrmalige falsche Eingabe gesperrte PINs werden als <em style="color:red; font-weight:bold">GESPERRT</em> angeführt + und können über die Schaltfläche 'Entsperren' mit einer PUK neu gesetzt werden. + Das Entsperren wird nur von Karten mit dem ACOS Betriebssystem unterstützt. + </p> + <p style="text-align: center"><img src="help.pin.mgmt-2.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Momentan wird das Entsperren von PINs noch nicht unterstützt. + </p> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/help.pin.mgmt.png b/BKUHelp/src/main/webapp/help/help.pin.mgmt.png Binary files differnew file mode 100644 index 00000000..44ad3398 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.pin.mgmt.png diff --git a/BKUHelp/src/main/webapp/help/help.pin.verify.png b/BKUHelp/src/main/webapp/help/help.pin.verify.png Binary files differnew file mode 100644 index 00000000..0c7a7852 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.pin.verify.png diff --git a/BKUHelp/src/main/webapp/help/help.retry.html b/BKUHelp/src/main/webapp/help/help.retry.html new file mode 100644 index 00000000..088eb857 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.retry.html @@ -0,0 +1,41 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.retry.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Falsche PIN</h1> + <p>Die eingegebene PIN war falsch. Bitte geben Sie die korrekte PIN ein.</p> + <p>Die Anzahl der noch möglichen Versuche wird angezeigt.</p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/help.retry.png b/BKUHelp/src/main/webapp/help/help.retry.png Binary files differnew file mode 100644 index 00000000..00716afb --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.retry.png diff --git a/BKUHelp/src/main/webapp/help/help.signpin-1.png b/BKUHelp/src/main/webapp/help/help.signpin-1.png Binary files differnew file mode 100644 index 00000000..1c5c8570 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.signpin-1.png diff --git a/BKUHelp/src/main/webapp/help/help.signpin.html b/BKUHelp/src/main/webapp/help/help.signpin.html new file mode 100644 index 00000000..4a0f00eb --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.signpin.html @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.signpin.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Erstellen einer elektronischen Signatur</h1> + <p>Sie werden aufgefordert die Signatur-PIN einzugeben, um eine elektronische Signatur zu erstellen.</p> + <p style="text-align: center"><img src="help.signpin-1.png" alt="Bildschirmfoto" width="278" height="146" /></p> + <ol> + <li>Klicken Sie auf 'Signaturdaten anzeigen' um die zu signierenden Daten anzuzeigen.</li> + <li>Geben Sie im Formularfeld die Signatur-PIN ein.</li> + <li>Klicken Sie auf die Schaltfläche 'Signieren' um die elektronische Signatur zu erstellen.</li> + </ol> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/help.signpin.png b/BKUHelp/src/main/webapp/help/help.signpin.png Binary files differnew file mode 100644 index 00000000..37bef2d5 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.signpin.png diff --git a/BKUHelp/src/main/webapp/help/help.unblock.pin.html b/BKUHelp/src/main/webapp/help/help.unblock.pin.html new file mode 100644 index 00000000..96eed5b2 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.unblock.pin.html @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.pin.mgmt.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1>Entsperren der PIN</h1> + <p>Durch mehrmalige falsche Eingabe gesperrte PINs werden als <em style="color:red; font-weight:bold">GESPERRT</em> angeführt + und können über die Schaltfläche 'Entsperren' mit einer PUK neu gesetzt werden. + Das Entsperren wird nur von Karten mit dem ACOS Betriebssystem unterstützt. + </p> + <p style="text-align: center"><img src="help.pin.mgmt-2.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Momentan wird das Entsperren von PINs noch nicht unterstützt. + </p> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/help.unsupported.mimetype.html b/BKUHelp/src/main/webapp/help/help.unsupported.mimetype.html new file mode 100644 index 00000000..76a29bfd --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.unsupported.mimetype.html @@ -0,0 +1,41 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Bürgerkarte - Hilfe</title>
+<link href="/help/css/help.css" rel="stylesheet" type="text/css" />
+<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/>
+<!--[if IE]>
+<style type="text/css">
+/* place css fixes for all versions of IE in this conditional comment */
+.twoColElsLtHdr #sidebar1 { padding-top: 30px; }
+.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; }
+/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
+</style>
+<![endif]-->
+</head>
+
+<body class="twoColElsLtHdr">
+
+<div id="container">
+ <div id="header">
+ <h1>Online-Hilfe</h1>
+ <!-- end #header --></div>
+ <div id="sidebar1">
+ <p><img src="help.unsupported.mimetype.png" alt="Bildschirmfoto des Applets" height="130" width="150"/></p>
+ <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p>
+ <!-- end #sidebar1 --></div>
+ <div id="mainContent">
+ <h1>Signaturdaten können nicht dargestellt werden</h1>
+ <p>Die Signaturdatenanzeige unterstützt reine Textdaten sowie XHTML, andere MIME-Typen können nicht angezeigt werden.
+ Um die Daten standardkonform darzustellen, müssen diese abgespeichert und mit einem geeigneten externen Betrachter geöffnen werden.</p>
+ <p><br class="clearfloat" /></p>
+ </div>
+ <div id="footer">
+ <p>
+ <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a>
+ </p>
+ </div>
+<!-- end #container --></div>
+</body>
+</html>
diff --git a/BKUHelp/src/main/webapp/help/help.verify.pin.html b/BKUHelp/src/main/webapp/help/help.verify.pin.html new file mode 100644 index 00000000..f666a4e4 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/help.verify.pin.html @@ -0,0 +1,51 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="help.pin.mgmt.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1>PIN Abfragen</h1> + <p>Bei Karten mit dem ACOS Betriebssystem müssen die PINs verifiziert werden um ihren Status zu ermitteln. + Den Status dieser als <em style="color:black; font-weight:bold">UNBEKANNT</em> angeführten PINs können Sie über die Schaltfläche 'Abfragen' verifizieren. + </p> + <p style="text-align: center"><img src="help.pin.mgmt-3.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p> + Geben Sie dazu die PIN im dafür vorgesehenen Feld ein. + </p> + <p style="text-align: center"><img src="help.pin.verify.png" alt="Bildschirmfoto" width="295" height="200" /></p> + <p>Nach erfolgreicher Eingabe wird die PIN entsprechend ihrem Status als <em style="color:green; font-weight:bold">AKTIV</em>, <em style="color:red; font-weight:bold">NICHT AKTIV</em> oder <em style="color:red; font-weight:bold">GESPERRT</em> angeführt. + </p> + <p style="text-align: center"><img src="help.pin.mgmt-4.png" alt="Bildschirmfoto" width="295" height="200" /></p> + + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/index.html b/BKUHelp/src/main/webapp/help/index.html index 3cb6354d..35b15ccd 100644 --- a/BKUHelp/src/main/webapp/help/index.html +++ b/BKUHelp/src/main/webapp/help/index.html @@ -3,8 +3,8 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Bürgerkarte - Hilfe</title> - <link href="help.css" rel="stylesheet" type="text/css" /> - <link rel="shortcut icon" href="chip16.ico" type="image/x-icon"/> + <link href="/help/css/help.css" rel="stylesheet" type="text/css" /> + <link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> </head> <body class="twoColElsLtHdr"> @@ -14,7 +14,7 @@ <h1>Online-Hilfe</h1> <!-- end #header --></div> <div id="sidebar1"> - <p><img src="de/welcome.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><img src="welcome.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> <p>Hilfe-Icon rechts oben im Bürgerkartendialog</p> <!-- end #sidebar1 --></div> <div id="mainContent"> @@ -25,15 +25,15 @@ </p> <p>Häufige gestellte Fragen werden in den folgenden Hilfeseiten behandelt:</p> <ul> - <li><a href="de/help.install.cacert.html">Installation des CA Zertifikats</a></li> - <li><a href="de/error.pcsc.html">Fehler bei der PC/SC Installation</a></li> - <li><a href="de/cardnotsupported.html">Unterstützte Signaturkarten</a></li> - <li><a href="de/help.cardpin.html">Auslesen der Daten auf der Bürgerkarte</a></li> - <li><a href="de/help.signpin.html">Erstellen einer elektronischen Signatur</a></li> - <li><a href="de/help.retry.html">Falsche PIN</a></li> - <li><a href="de/help.hashdataviewer.html">Anzeige der Signaturdaten</a></li> - <li><a href="de/help.pin.mgmt.html">PIN Verwaltung</a></li> - <li><a href="de/help.change.pin.html">Ändern der PIN</a></li> + <li><a href="help.install.cacert.html">Installation des CA Zertifikats (nur lokale Bürgerkartenumgebung)</a></li> + <li><a href="error.pcsc.html">Fehler bei der PC/SC Installation</a></li> + <li><a href="cardnotsupported.html">Unterstützte Signaturkarten</a></li> + <li><a href="help.cardpin.html">Auslesen der Daten auf der Bürgerkarte</a></li> + <li><a href="help.signpin.html">Erstellen einer elektronischen Signatur</a></li> + <li><a href="help.retry.html">Falsche PIN</a></li> + <li><a href="help.hashdataviewer.html">Anzeige der Signaturdaten</a></li> + <li><a href="help.pin.mgmt.html">PIN Verwaltung</a></li> + <li><a href="help.change.pin.html">Ändern der PIN</a></li> </ul> <p><br class="clearfloat" /></p> diff --git a/BKUHelp/src/main/webapp/help/insertcard.html b/BKUHelp/src/main/webapp/help/insertcard.html new file mode 100644 index 00000000..bb64dcc9 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/insertcard.html @@ -0,0 +1,43 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="insertcard.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Bitte die Bürgerkarte in den Kartenleser stecken</h1> + <p>Die Software für den Zugriff auf die Bürgerkarte hat einen oder mehrere unterstützte Kartenleser gefunden.</p> + <p>Bitte stecken Sie nun ihre Bürgerkarte in den Kartenleser. Wird die Karte erkannt, welchselt die Bildschirmanzeige.</p> + <p>Sollten Sie mehrere Kartenleser angeschlossen haben, wählen Sie einen beliebigen aus. Wird die Karte im ausgewählten Kartenleser nicht erkannt, wird dieser Kartenleser eventuell nicht unterstützt. Probieren Sie es daher in einem anderen Kartenleser nochmal. + </p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/insertcard.png b/BKUHelp/src/main/webapp/help/insertcard.png Binary files differnew file mode 100644 index 00000000..62a22975 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/insertcard.png diff --git a/BKUHelp/src/main/webapp/help/wait.html b/BKUHelp/src/main/webapp/help/wait.html new file mode 100644 index 00000000..35ccffe4 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/wait.html @@ -0,0 +1,40 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="wait.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Bitte warten ...</h1> + <p>Die Software für den Zugriff auf die Bürgerkarte ist damit beschäftigt, einen Befehl auszuführen bzw. auf einen neuen Befehl vom Server zu warten. </p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/wait.png b/BKUHelp/src/main/webapp/help/wait.png Binary files differnew file mode 100644 index 00000000..63a38fbf --- /dev/null +++ b/BKUHelp/src/main/webapp/help/wait.png diff --git a/BKUHelp/src/main/webapp/help/welcome.html b/BKUHelp/src/main/webapp/help/welcome.html new file mode 100644 index 00000000..44b6279e --- /dev/null +++ b/BKUHelp/src/main/webapp/help/welcome.html @@ -0,0 +1,41 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Bürgerkarte - Hilfe</title> +<link href="/help/css/help.css" rel="stylesheet" type="text/css" /> +<link rel="shortcut icon" href="/help/chip16.ico" type="image/x-icon"/> +<!--[if IE]> +<style type="text/css"> +/* place css fixes for all versions of IE in this conditional comment */ +.twoColElsLtHdr #sidebar1 { padding-top: 30px; } +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; } +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */ +</style> +<![endif]--> +</head> + +<body class="twoColElsLtHdr"> + +<div id="container"> + <div id="header"> + <h1>Online-Hilfe</h1> + <!-- end #header --></div> + <div id="sidebar1"> + <p><img src="welcome.png" alt="Bildschirmfoto des Applets" width="190" height="130"/></p> + <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p> + <!-- end #sidebar1 --></div> + <div id="mainContent"> + <h1> Willkommen </h1> + <p>Die Anzeige "Willkommen" erfolgt unmittelbar nachdem die Software für den Zugriff auf die Bürgerkarte erfolgreich im Browser geladen wurde.</p> + <p>Die Software versucht nun eine Verbindung mit dem Server aufzunehmen um Befehle für den Zugriff auf die Bürgerkarte zu erhalten.</p> + <p><br class="clearfloat" /></p> + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a> + </p> + </div> +<!-- end #container --></div> +</body> +</html> diff --git a/BKUHelp/src/main/webapp/help/welcome.png b/BKUHelp/src/main/webapp/help/welcome.png Binary files differnew file mode 100644 index 00000000..78133b4d --- /dev/null +++ b/BKUHelp/src/main/webapp/help/welcome.png diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index fa1655ef..19e2633a 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -1,21 +1,16 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>BKULocal</artifactId> <packaging>war</packaging> <name>BKU Local</name> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> - <scm> - <developerConnection>scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal</developerConnection> - <connection>scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal</connection> - <url>scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal</url> - </scm> <build> <plugins> <plugin> @@ -72,42 +67,54 @@ <dependency> <groupId>at.gv.egiz</groupId> <artifactId>STAL</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>bkucommon</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>smcc</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>smccSTAL</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUGuiExt</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>smccSTALExt</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUViewer</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> <dependency> <artifactId>BKUHelp</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + </dependency> + <dependency> + <groupId>iaik</groupId> + <artifactId>iaik_xsect</artifactId> + </dependency> + <dependency> + <groupId>iaik</groupId> + <artifactId>iaik_jce_full_signed</artifactId> + </dependency> + <dependency> + <groupId>iaik</groupId> + <artifactId>iaik_ecc_signed</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> @@ -116,21 +123,42 @@ <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> - <version>2.5</version> <scope>provided</scope> </dependency> <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - <version>2.5.5</version> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <scope>runtime</scope> </dependency> <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <scope>compile</scope> </dependency> </dependencies> - <properties> - <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server> - </properties> + <profiles> + <profile> + <id>tomcat-deploy</id> + <dependencies> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>compile</scope> + </dependency> + </dependencies> + <properties> + <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server> + </properties> + </profile> + </profiles> </project> diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/accesscontroller/SpringSecurityManager.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/accesscontroller/SpringSecurityManager.java deleted file mode 100644 index 3f50fc78..00000000 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/accesscontroller/SpringSecurityManager.java +++ /dev/null @@ -1,65 +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.accesscontroller;
-
-import java.io.IOException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.context.ResourceLoaderAware;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.ResourceLoader;
-
-import at.gv.egiz.bku.accesscontroller.SecurityManagerFacade;
-import at.gv.egiz.bku.conf.Configurator;
-
-public class SpringSecurityManager extends SecurityManagerFacade implements
- ResourceLoaderAware {
-
- private ResourceLoader resourceLoader;
-
- private static Log log = LogFactory.getLog(SpringSecurityManager.class);
-
- protected Configurator config;
-
- public void setConfig(Configurator config) {
- this.config = config;
- }
-
- public void init() {
- String noMatch = config.getProperty("AccessController.acceptNoMatch");
- if (noMatch != null) {
- log.debug("Setting allow now match to: " + noMatch);
- setAllowUnmatched(Boolean.getBoolean(noMatch));
- }
- String policy = config.getProperty("AccessController.policyResource");
- policy = policy.replace("${user.home}", System.getProperty("user.home"));
- log.info("Loading resource: " + policy);
- try {
- Resource res = resourceLoader.getResource(policy);
- init(res.getInputStream());
- } catch (IOException e) {
- log.error(e);
- }
- }
-
- @Override
- public void setResourceLoader(ResourceLoader loader) {
- this.resourceLoader = loader;
- }
-
-}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/conf/SpringConfigurator.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/conf/SpringConfigurator.java deleted file mode 100644 index 7b2641ff..00000000 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/conf/SpringConfigurator.java +++ /dev/null @@ -1,142 +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.conf;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.context.ResourceLoaderAware;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.ResourceLoader;
-
-import at.gv.egiz.bku.conf.Configurator;
-import at.gv.egiz.bku.local.webapp.SpringBKUServlet;
-import at.gv.egiz.bku.slexceptions.SLRuntimeException;
-
-public class SpringConfigurator extends Configurator implements
- ResourceLoaderAware {
-
- private final static Log log = LogFactory.getLog(SpringConfigurator.class);
-
- private ResourceLoader resourceLoader;
-
- public SpringConfigurator() {
- // File configDir = new File(System.getProperty("user.home") +
- // "/.bku/conf");
- // if (configDir.exists()) {
- // log.debug("Found existing config directory: " + configDir);
- // } else {
- // log.info("Config dir not existing, creating new");
- // if (!configDir.mkdirs()) {
- // log.error("Cannot create directory: " + configDir);
- // }
- // }
- }
-
- public void setResource(Resource resource) {
- log.debug("Loading config from: " + resource);
- if (resource != null) {
- Properties props = new Properties();
- try {
- props.load(resource.getInputStream());
- super.setConfiguration(props);
- } catch (IOException e) {
- log.error("Cannot load config", e);
- }
- } else {
- log.warn("Cannot load properties, resource: " + resource);
- }
- }
-
- @Override
- public void configure() {
- if (properties == null) {
- defaultInit();
- }
- super.configure();
- SpringBKUServlet.setConfigurator(this);
- }
-
- public void defaultInit() {
- Properties props = new Properties();
- try {
- props.load(new FileInputStream(System.getProperty("user.home")
- + "/.mocca/war/mocca.war"));
- super.setConfiguration(props);
- } catch (IOException e) {
- log.error("Cannot load config", e);
- }
- }
-
- @Override
- public void setResourceLoader(ResourceLoader loader) {
- this.resourceLoader = loader;
- }
-
- private File getDirectory(String property) {
- property = property
- .replace("${user.home}", System.getProperty("user.home"));
- if (property != null) {
- Resource certDirRes = resourceLoader.getResource(property);
- File certDir;
- try {
- certDir = certDirRes.getFile();
- } catch (IOException e) {
- log.error("Cannot get cert directory", e);
- throw new SLRuntimeException(e);
- }
- if (!certDir.isDirectory()) {
- log.error("Expecting directory as SSL.certDirectory parameter");
- throw new SLRuntimeException(
- "Expecting directory as SSL.certDirectory parameter");
- }
- return certDir;
- }
- return null;
-
- }
-
- @Override
- protected File getCADir() {
- String caDirectory = getProperty("SSL.caDirectory");
- return getDirectory(caDirectory);
- }
-
- @Override
- protected File getCertDir() {
- String certDirectory = getProperty("SSL.certDirectory");
- return getDirectory(certDirectory);
- }
-
- @Override
- protected InputStream getManifest() {
- Resource r = resourceLoader.getResource("META-INF/MANIFEST.MF");
- if ((r != null) && r.isReadable()) {
- try {
- return r.getInputStream();
- } catch (IOException e) {
- log.error("Cannot read manifest data: " + e);
- }
- }
- return null;
- }
-}
\ No newline at end of file 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 index 38dd04d9..a9f21087 100644 --- 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 @@ -30,7 +30,7 @@ public class GUIProxy implements InvocationHandler { JFrame frame; BKUGUIFacade delegate; - static public Object newInstance(BKUGUIFacade gui, JFrame frame, Class[] interfaces) { + static public Object newInstance(BKUGUIFacade gui, JFrame frame, Class<?>[] interfaces) { return java.lang.reflect.Proxy.newProxyInstance(gui.getClass().getClassLoader(), interfaces, new GUIProxy(gui, frame)); diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java index c957e132..ced47d6c 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java @@ -16,46 +16,62 @@ */ package at.gv.egiz.bku.local.gui; -import at.gv.egiz.bku.gui.AbstractHelpListener; -import at.gv.egiz.bku.gui.DefaultHelpListener; +import at.gv.egiz.bku.gui.ViewerHelpListener; import java.awt.Desktop; -import java.io.IOException; -import java.net.URISyntaxException; -import java.net.URL; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.net.URI; import java.util.Locale; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** - * Open help document in browser, fallback to default (swing dialog) if Java Desktop API not supported. + * Open help document in browser, fallback to help viewer (swing dialog) if Java Desktop API not supported. * * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> */ -public class LocalHelpListener extends AbstractHelpListener { +public class LocalHelpListener extends ViewerHelpListener { + private final Logger log = LoggerFactory.getLogger(LocalHelpListener.class); + protected Desktop desktop; - protected DefaultHelpListener fallback; - public LocalHelpListener(URL baseURL, Locale locale) { - super(baseURL, locale); - if (Desktop.isDesktopSupported()) { + public LocalHelpListener(String helpURL, Locale locale) { + super(helpURL, locale); + if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { desktop = Desktop.getDesktop(); } else { - log.info("Java Desktop API not available on current platform (libgnome installed?), falling back to DefaultHelpListener"); - fallback = new DefaultHelpListener(baseURL, locale); + log.warn("Java Desktop API not available on current platform (libgnome installed?), " + + "falling back to help viewer"); + } + } + + @Override + public void mouseClicked(MouseEvent e) { + if (desktop != null) { + try { + desktop.browse(new URI(getHelpURL())); + } catch (Exception ex) { + log.error("Failed display help document {}.", getHelpURL(), ex); + super.mouseClicked(e); + } + } else { + super.mouseClicked(e); } } @Override - public void showDocument(URL helpDocument, String helpTopic) throws IOException, URISyntaxException { + public void keyPressed(KeyEvent e) { if (desktop != null) { - if (!desktop.isSupported(Desktop.Action.BROWSE)) { - log.error("Failed to open default browser: The system provides the Desktop API, but does not support the BROWSE action"); - } else { - Desktop.getDesktop().browse(helpDocument.toURI()); + try { + desktop.browse(new URI(getHelpURL())); + } catch (Exception ex) { + log.error("Failed display help document {}.", getHelpURL(), ex); + super.keyPressed(e); } - } else if (fallback != null) { - fallback.showDocument(helpDocument, helpTopic); } else { - log.error("failed to display help document"); + super.keyPressed(e); } } } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/ExclusiveAccessSTAL.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/ExclusiveAccessSTAL.java new file mode 100644 index 00000000..0b8511e3 --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/ExclusiveAccessSTAL.java @@ -0,0 +1,76 @@ +/* +* Copyright 2009 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.stal; + +import java.util.Collections; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.stal.ErrorResponse; +import at.gv.egiz.stal.STAL; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; + +public class ExclusiveAccessSTAL implements STAL { + + private final Logger log = LoggerFactory.getLogger(ExclusiveAccessSTAL.class); + + private Lock lock = new ReentrantLock(true); + + private long timeout = 30; + + private STAL stal; + + public ExclusiveAccessSTAL(STAL stal) { + if (stal == null) { + throw new NullPointerException("Argument 'stal' must not be null."); + } + this.stal = stal; + } + + @Override + public List<STALResponse> handleRequest( + List<? extends STALRequest> aRequestList) { + + try { + if (lock.tryLock(timeout, TimeUnit.SECONDS)) { + try { + return stal.handleRequest(aRequestList); + } finally { + lock.unlock(); + } + } else { + // time out + log.info("Timeout while waiting for exclusive access to STAL."); + ErrorResponse response = new ErrorResponse(6000); + return Collections.singletonList((STALResponse) response); + } + } catch (InterruptedException e) { + // interrupted + ErrorResponse response = new ErrorResponse(6000); + return Collections.singletonList((STALResponse) response); + } + + } + +} diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/ExclusiveAccessSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/ExclusiveAccessSTALFactory.java new file mode 100644 index 00000000..1dee8e2b --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/ExclusiveAccessSTALFactory.java @@ -0,0 +1,65 @@ +/* +* Copyright 2009 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.stal; + +import java.util.Locale; + +import at.gv.egiz.stal.STAL; +import at.gv.egiz.stal.STALFactory; + +public class ExclusiveAccessSTALFactory implements STALFactory { + + private STALFactory stalFactory; + + private ExclusiveAccessSTAL stal; + + private Locale locale; + + /** + * @return the stalFactory + */ + public STALFactory getStalFactory() { + return stalFactory; + } + + /** + * @param stalFactory the stalFactory to set + */ + public synchronized void setStalFactory(STALFactory stalFactory) { + this.stalFactory = stalFactory; + stalFactory.setLocale(locale); + } + + @Override + public synchronized STAL createSTAL() { + if (stal == null && stalFactory != null) { + STAL delegate = stalFactory.createSTAL(); + stal = new ExclusiveAccessSTAL(delegate); + } + return stal; + } + + @Override + public synchronized void setLocale(Locale locale) { + this.locale = locale; + if (stalFactory != null) { + stalFactory.setLocale(locale); + } + } + +} 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 1e3f9a1d..d2e49039 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,7 +49,7 @@ public class LocalBKUWorker extends AbstractBKUWorker { public List<STALResponse> handleRequest(List<? extends STALRequest> requestList) { signatureCard = null; List<STALResponse> responses = super.handleRequest(requestList); - container.setVisible(false); + container.setVisible(false); return responses; } 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 44322a07..a703ad5c 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 @@ -19,7 +19,6 @@ package at.gv.egiz.bku.local.stal; import at.gv.egiz.bku.viewer.ResourceFontLoader; import java.awt.Dimension; import java.awt.Toolkit; -import java.net.MalformedURLException; import java.util.Locale; @@ -31,10 +30,11 @@ 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; -import java.net.URL; import javax.swing.JFrame; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; + +import org.apache.commons.configuration.Configuration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Creates a PINManagementGUI and a LocalBKUWorker, which in turn registers @@ -44,55 +44,45 @@ import org.apache.commons.logging.LogFactory; */ public class LocalSTALFactory implements STALFactory { - protected static final Log log = LogFactory.getLog(LocalSTALFactory.class); + private final Logger log = LoggerFactory.getLogger(LocalSTALFactory.class); protected static final Dimension PREFERRED_SIZE = new Dimension(318, 200); protected String helpURL; protected Locale locale; + + protected Configuration configuration; + + @Override public STAL createSTAL() { - LocalBKUWorker stal; + final LocalBKUWorker stal; //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("Bürgerkarte"); - if (log.isTraceEnabled()) { - log.debug("alwaysOnTop supported: " + dialog.isAlwaysOnTopSupported()); - } + log.debug("AlwaysOnTop supported: {}.", dialog.isAlwaysOnTopSupported()); // [#439] make mocca dialog alwaysOnTop dialog.setAlwaysOnTop(true); dialog.setIconImages(BKUIcons.icons); - dialog.setUndecorated(true); +// dialog.setUndecorated(true); // dialog.getRootPane().setWindowDecorationStyle(JRootPane.NONE); -// dialog.addWindowListener(new WindowAdapter() { -// -// @Override -// public void windowClosing(WindowEvent e) { -// super.windowClosing(e); -// log.debug("closing window ********************"); -// } -// -// }); + if (locale != null) { dialog.setLocale(locale); } LocalHelpListener helpListener = null; - try { - if (helpURL != null) { - helpListener = new LocalHelpListener(new URL(helpURL), locale); - } else { - log.warn("no HELP URL configured, help system disabled"); - } - } catch (MalformedURLException ex) { - log.error("failed to configure help listener: " + ex.getMessage(), ex); + if (helpURL != null) { + helpListener = new LocalHelpListener(helpURL, locale); + } else { + log.warn("No HELP URL configured, help system disabled."); } PINManagementGUIFacade gui = new PINManagementGUI(dialog.getContentPane(), dialog.getLocale(), BKUGUIFacade.Style.advanced, null, new ResourceFontLoader(), - helpListener, + helpListener, null); BKUGUIFacade proxy = (BKUGUIFacade) GUIProxy.newInstance(gui, dialog, new Class[] { PINManagementGUIFacade.class} ); stal = new LocalBKUWorker(proxy, dialog); @@ -116,11 +106,26 @@ public class LocalSTALFactory implements STALFactory { this.locale = locale; } - public String getHelpURL() { - return helpURL; - } - + /** + * spring injects helpURL + * @param helpURL + */ public void setHelpURL(String helpURL) { this.helpURL = helpURL; } + + /** + * @return the configuration + */ + public Configuration getConfiguration() { + return configuration; + } + + /** + * @param configuration the configuration to set + */ + public void setConfiguration(Configuration configuration) { + this.configuration = configuration; + } + } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSecureViewer.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSecureViewer.java index ae58526c..749a455a 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSecureViewer.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSecureViewer.java @@ -31,8 +31,8 @@ import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.util.Collections; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -40,8 +40,8 @@ import org.apache.commons.logging.LogFactory; */ public class LocalSecureViewer implements SecureViewer { - private static final Log log = LogFactory.getLog(LocalSignRequestHandler.class); - private List<HashDataInput> hashDataInputs = Collections.EMPTY_LIST; + private final Logger log = LoggerFactory.getLogger(LocalSignRequestHandler.class); + private List<HashDataInput> hashDataInputs = Collections.emptyList(); protected BKUGUIFacade gui; @@ -63,8 +63,8 @@ public class LocalSecureViewer implements SecureViewer { ActionListener okListener, String okCommand) throws Exception { if (signedInfo.getReference().size() == 0) { - log.error("No hashdata input selected to be displayed: null"); - throw new Exception("No HashData Input selected to be displayed"); + log.error("No hashdata input selected to be displayed: null."); + throw new Exception("No HashData Input selected to be displayed."); } ArrayList<HashDataInput> selectedHashDataInputs = new ArrayList<HashDataInput>(); @@ -76,8 +76,8 @@ public class LocalSecureViewer implements SecureViewer { boolean hdiAvailable = false; for (HashDataInput hashDataInput : hashDataInputs) { if (dsigRefId.equals(hashDataInput.getReferenceId())) { - log.debug("display hashdata input for dsig:SignedReference " + - dsigRefId); + log.debug("Display hashdata input for dsig:SignedReference {}.", + dsigRefId); selectedHashDataInputs.add( ensureCachedHashDataInput(hashDataInput)); hdiAvailable = true; @@ -85,7 +85,7 @@ public class LocalSecureViewer implements SecureViewer { } } if (!hdiAvailable) { - log.error("no hashdata input for dsig:SignedReference " + dsigRefId); + log.error("No hashdata input for dsig:SignedReference {}.", dsigRefId); throw new Exception( "No HashDataInput available for dsig:SignedReference " + dsigRefId); } @@ -97,8 +97,8 @@ public class LocalSecureViewer implements SecureViewer { } if (selectedHashDataInputs.size() < 1) { - log.error("dsig:SignedInfo does not contain a data reference"); - throw new Exception("dsig:SignedInfo does not contain a data reference"); + log.error("dsig:SignedInfo does not contain a data reference."); + throw new Exception("dsig:SignedInfo does not contain a data reference."); } gui.showSecureViewer(selectedHashDataInputs, okListener, okCommand); } @@ -108,7 +108,7 @@ public class LocalSecureViewer implements SecureViewer { throws IOException { if (!(hashDataInput instanceof DataObjectHashDataInput)) { - log.warn("expected DataObjectHashDataInput for LocalSignRequestHandler, got " + + log.warn("Expected DataObjectHashDataInput for LocalSignRequestHandler, got {}.", hashDataInput.getClass().getName()); InputStream hdIs = hashDataInput.getHashDataInput(); diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java index 9ae1d9b9..a1f77a85 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java @@ -16,8 +16,8 @@ */ package at.gv.egiz.bku.local.stal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.smccstal.SignRequestHandler; import at.gv.egiz.stal.ErrorResponse; @@ -31,7 +31,7 @@ import at.gv.egiz.stal.SignRequest; */ public class LocalSignRequestHandler extends SignRequestHandler { - private static final Log log = LogFactory.getLog(LocalSignRequestHandler.class); + private final Logger log = LoggerFactory.getLogger(LocalSignRequestHandler.class); public LocalSignRequestHandler(LocalSecureViewer secureViewer) { super(secureViewer); @@ -44,7 +44,6 @@ public class LocalSignRequestHandler extends SignRequestHandler { * @param request * @return */ - @SuppressWarnings("unchecked") @Override public STALResponse handleRequest(STALRequest request) throws InterruptedException { @@ -54,7 +53,7 @@ public class LocalSignRequestHandler extends SignRequestHandler { ((LocalSecureViewer) secureViewer).setDataToBeSigned(signReq.getHashDataInput()); return super.handleRequest(request); } else { - log.fatal("Got unexpected STAL request: " + request); + log.error("Got unexpected STAL request: {}.", request); return new ErrorResponse(1000); } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java index 98be4047..cd81b592 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java @@ -16,98 +16,139 @@ */ package at.gv.egiz.bku.local.webapp; +import java.io.ByteArrayInputStream; +import java.io.InputStream; import java.util.Enumeration; import java.util.HashMap; -import java.util.Iterator; import java.util.Locale; import java.util.Map; +import java.util.concurrent.ExecutionException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import at.gv.egiz.bku.binding.HTTPBindingProcessor; +import at.gv.egiz.bku.binding.BindingProcessorFuture; +import at.gv.egiz.bku.binding.BindingProcessorManager; +import at.gv.egiz.bku.binding.HTTPBindingProcessorImpl; import at.gv.egiz.bku.binding.HttpUtil; -import at.gv.egiz.bku.conf.Configurator; +import at.gv.egiz.bku.binding.Id; +import at.gv.egiz.bku.binding.IdFactory; +import at.gv.egiz.bku.binding.InputDecoderFactory; import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage; public class BKURequestHandler extends SpringBKUServlet { - public final static String ENCODING = "UTF-8"; + private static final long serialVersionUID = 1L; - protected Log log = LogFactory.getLog(BKURequestHandler.class); + public final static String ENCODING = "UTF-8"; + private final Logger log = LoggerFactory.getLogger(BKURequestHandler.class); + + @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException { - log.debug("Received SecurityLayer request"); - String acceptLanguage = req.getHeader("Accept-Language"); Locale locale = AcceptLanguage.getLocale(acceptLanguage); - log.debug("Accept-Language locale: " + locale); + log.info("Received request. Accept-Language locale: {}.", locale); - HTTPBindingProcessor bindingProcessor; - bindingProcessor = (HTTPBindingProcessor) getBindingProcessorManager() - .createBindingProcessor(req.getRequestURL().toString(), null, locale); + BindingProcessorManager bindingProcessorManager = getBindingProcessorManager(); + + HTTPBindingProcessorImpl bindingProcessor; + bindingProcessor = (HTTPBindingProcessorImpl) bindingProcessorManager + .createBindingProcessor("HTTP", locale); Map<String, String> headerMap = new HashMap<String, String>(); - for (Enumeration<String> headerName = req.getHeaderNames(); headerName + for (Enumeration<?> headerName = req.getHeaderNames(); headerName .hasMoreElements();) { - String header = headerName.nextElement(); + String header = (String) headerName.nextElement(); if (header != null) { headerMap.put(header, req.getHeader(header)); } } - String charset = req.getCharacterEncoding(); - String contentType = req.getContentType(); - if (charset != null) { - contentType += ";" + charset; + + InputStream inputStream; + String charset; + if (req.getMethod().equals("POST")) { + charset = req.getCharacterEncoding(); + String contentType = req.getContentType(); + if (charset != null) { + contentType += ";" + charset; + } + headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, contentType); + inputStream = req.getInputStream(); + } else { + charset = "UTF-8"; + headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, + InputDecoderFactory.URL_ENCODED); + String queryString = req.getQueryString(); + if (queryString != null) { + inputStream = new ByteArrayInputStream(queryString.getBytes(charset)); + } else { + inputStream = new ByteArrayInputStream(new byte[] {}); + } } - headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, contentType); bindingProcessor.setHTTPHeaders(headerMap); - bindingProcessor.consumeRequestStream(req.getInputStream()); + bindingProcessor.consumeRequestStream(req.getRequestURL().toString(), inputStream); + req.getInputStream().close(); - // fixxme just for testing - bindingProcessor.run(); - if (bindingProcessor.getRedirectURL() != null) { - resp.sendRedirect(bindingProcessor.getRedirectURL()); - return; - } + String redirectURL = bindingProcessor.getRedirectURL(); + + Id id = IdFactory.getInstance().createId(); + BindingProcessorFuture bindingProcessorFuture = bindingProcessorManager + .process(id, bindingProcessor); + + if (redirectURL != null) { + // send redirect and return + resp.sendRedirect(redirectURL); + return; + } + + // wait for the binding processor to finish processing + try { + bindingProcessorFuture.get(); + } catch (InterruptedException e) { + resp.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE); + return; + } catch (ExecutionException e) { + log.error("Request processing failed.", e); + resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + return; + } + resp.setStatus(bindingProcessor.getResponseCode()); - for (Iterator<String> it = bindingProcessor.getResponseHeaders().keySet() - .iterator(); it.hasNext();) { - String header = it.next(); - resp.setHeader(header, bindingProcessor.getResponseHeaders().get(header)); + + // set response headers + Map<String, String> responseHeaders = bindingProcessor.getResponseHeaders(); + for (String header : responseHeaders.keySet()) { + resp.setHeader(header, responseHeaders.get(header)); } - String version = configurator.getProperty(Configurator.SIGNATURE_LAYOUT); - if ((version != null) && (!"".equals(version.trim()))) { - log.debug("setting SignatureLayout header to " + version); - resp.setHeader(Configurator.SIGNATURE_LAYOUT, version); - } else { - log.debug("do not set SignatureLayout header"); + String serverHeader = bindingProcessor.getServerHeaderValue(); + if (serverHeader != null && !serverHeader.isEmpty()) { + resp.setHeader(HttpUtil.HTTP_HEADER_SERVER, serverHeader); + } + String signatureLayout = bindingProcessor.getSignatureLayoutHeaderValue(); + if (signatureLayout != null && !signatureLayout.isEmpty()) { + resp.setHeader("SignatureLayout", signatureLayout); } - - if (configurator.getProperty(Configurator.USERAGENT_CONFIG_P) != null) { - resp.setHeader(HttpUtil.HTTP_HEADER_SERVER, configurator - .getProperty(Configurator.USERAGENT_CONFIG_P)); - } else { - resp.setHeader(HttpUtil.HTTP_HEADER_SERVER, - Configurator.USERAGENT_DEFAULT); - } resp.setContentType(bindingProcessor.getResultContentType()); resp.setCharacterEncoding(ENCODING); bindingProcessor.writeResultTo(resp.getOutputStream(), ENCODING); - req.getInputStream().close(); + resp.getOutputStream().flush(); resp.getOutputStream().close(); - log.debug("Finished Request"); + log.debug("Finished Request."); } + @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException { doPost(req, resp); } + + } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/MoccaContextListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/MoccaContextListener.java new file mode 100644 index 00000000..428190eb --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/MoccaContextListener.java @@ -0,0 +1,93 @@ +/* +* Copyright 2009 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.security.ecc.provider.ECCProvider; +import iaik.security.provider.IAIK; +import iaik.xml.crypto.XSecProvider; + +import java.security.Provider; +import java.security.Security; + +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class MoccaContextListener implements ServletContextListener { + + private Logger log = LoggerFactory.getLogger(MoccaContextListener.class); + + @Override + public void contextDestroyed(ServletContextEvent sce) { + } + + @Override + public void contextInitialized(ServletContextEvent sce) { + + log.info("Registering security providers ..."); + + registerProviders(); + + if (log.isDebugEnabled()) { + StringBuilder sb = new StringBuilder(); + sb.append("Registered providers: "); + int i = 1; + for (Provider prov : Security.getProviders()) { + sb.append("\n" + (i++) + ". : " + prov); + } + log.debug(sb.toString()); + } + } + + protected void registerProvider(Provider provider, int position) { + String name = provider.getName(); + if (Security.getProvider(name) == null) { + // register IAIK provider at first position + try { + Security.insertProviderAt(provider, position); + } catch (SecurityException e) { + log.info("Failed to register required security Provider.", e); + } + } else { + log.info("Required security Provider {} already registered.", name); + } + + } + + protected void registerProviders() { + + registerProvider(new IAIK(), 1); + registerProvider(new ECCProvider(false), 2); + + final String name = XSecProvider.NAME; + if (Security.getProvider(XSecProvider.NAME) == null) { + // register XML Security provider + try { + XSecProvider.addAsProvider(false); + } catch (SecurityException e) { + log.info("Failed to register required security Provider.", e); + } + } else { + log.info("Required security Provider {} already registered.", name); + } + + } + +} 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 index 0c35f1c9..ab41634e 100644 --- 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 @@ -29,8 +29,8 @@ 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; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * PINManagementBKUWorker for non-applet version @@ -38,7 +38,9 @@ import org.apache.commons.logging.LogFactory; */ public class PINManagementServlet extends HttpServlet { - private static final Log log = LogFactory.getLog(PINManagementServlet.class); + private static final long serialVersionUID = 1L; + + private final Logger log = LoggerFactory.getLogger(PINManagementServlet.class); LocalSTALFactory stalFactory; @@ -59,9 +61,7 @@ public class PINManagementServlet extends HttpServlet { STAL pinMgmtSTAL = stalFactory.createSTAL(); List<STALResponse> stalResps = pinMgmtSTAL.handleRequest(Collections.singletonList(new PINManagementRequest())); - if (log.isDebugEnabled()) { - log.debug("received STAL reponse " + stalResps.get(0).getClass()); - } + log.debug("Received STAL reponse {}.", stalResps.get(0).getClass()); pinMgmtSTAL.handleRequest(Collections.singletonList(new QuitRequest())); String redirect = request.getParameter("redirect"); diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/SpringBKUServlet.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/SpringBKUServlet.java index 3bd50ba7..62f393a8 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/SpringBKUServlet.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/SpringBKUServlet.java @@ -19,21 +19,16 @@ package at.gv.egiz.bku.local.webapp; import javax.servlet.http.HttpServlet; import at.gv.egiz.bku.binding.BindingProcessorManager; -import at.gv.egiz.bku.conf.Configurator; public abstract class SpringBKUServlet extends HttpServlet { - public final static String BEAN_NAME = "bindingProcessorManager"; + private static final long serialVersionUID = 1L; - protected static Configurator configurator; + public final static String BEAN_NAME = "bindingProcessorManager"; protected BindingProcessorManager getBindingProcessorManager() { return (BindingProcessorManager) getServletContext() .getAttribute(BEAN_NAME); } - public static void setConfigurator(Configurator conf) { - configurator = conf; - } - } diff --git a/BKULocal/src/main/resources/commons-logging.properties b/BKULocal/src/main/resources/commons-logging.properties deleted file mode 100644 index 0d497b1b..00000000 --- a/BKULocal/src/main/resources/commons-logging.properties +++ /dev/null @@ -1,16 +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. - -org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger diff --git a/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml b/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml index e96bd088..f85479cb 100644 --- a/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml +++ b/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml @@ -1,109 +1,195 @@ <?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
+ <!--
+ 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.
+ -->
<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
- <bean id="STALFactory" class="at.gv.egiz.bku.local.stal.LocalSTALFactory"
- scope="singleton">
- <property name="helpURL" value="http://localhost:3495/help/"/>
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
+
+ <!-- configuration -->
+ <bean id="configurationResource"
+ class="org.springframework.web.context.support.ServletContextParameterFactoryBean">
+ <property name="initParamName" value="configurationResource" />
+ </bean>
+
+ <bean id="configuration" class="at.gv.egiz.bku.spring.ConfigurationFactoryBean">
+ <property name="configurationResource" ref="configurationResource" />
+ </bean>
+
+ <bean id="sslPKIProfile" class="at.gv.egiz.bku.spring.PKIProfileFactoryBean">
+ <property name="configuration" ref="configuration"/>
+ <property name="trustProfileId" value="SSL"/>
</bean>
-
-
- <bean id="bindingProcessorManager" class="at.gv.egiz.bku.binding.BindingProcessorManagerImpl"
- scope="singleton">
- <constructor-arg ref="STALFactory"></constructor-arg>
- <constructor-arg ref="commandInvoker"></constructor-arg>
- <constructor-arg ref="configuration"></constructor-arg>
+
+ <bean id="sslSocketFactory" class="at.gv.egiz.bku.spring.SSLSocketFactoryBean">
+ <property name="configuration" ref="configuration"/>
+ <property name="pkiProfile" ref="sslPKIProfile"/>
</bean>
- <bean
- class="org.springframework.web.context.support.ServletContextAttributeExporter">
- <property name="attributes">
- <map>
- <entry key="bindingProcessorManager">
- <ref bean="bindingProcessorManager" />
- </entry>
- </map>
- </property>
+
+ <bean id="hostnameVerifier" class="at.gv.egiz.bku.spring.ConfigurableHostnameVerifier">
+ <property name="configuration" ref="configuration"/>
</bean>
- <bean id="accessController" class="at.gv.egiz.bku.local.accesscontroller.SpringSecurityManager"
- scope="singleton" init-method="init">
- <property name="config" ref="configurator"/>
- </bean>
-
- <bean id="commandInvoker" class="at.gv.egiz.bku.binding.SLCommandInvokerImpl">
- <property name="securityManager" ref="accessController" />
+ <bean id="urlDereferencer" class="at.gv.egiz.bku.utils.urldereferencer.URLDereferencerImpl"
+ factory-method="getInstance">
+ <property name="SSLSocketFactory" ref="sslSocketFactory"/>
+ <property name="hostnameVerifier" ref="hostnameVerifier"/>
</bean>
+
+ <!-- security manager for the command invoker -->
+ <bean id="securityManager" class="at.gv.egiz.bku.spring.SecurityManagerFactoryBean">
+ <property name="configuration" ref="configuration" />
+ </bean>
- <bean id="slCommandFactory" class="at.gv.egiz.bku.slcommands.SLCommandFactory"
- factory-method="getInstance">
- <property name="commandImpl">
- <map>
- <entry
- key="http://www.buergerkarte.at/namespaces/securitylayer/1.2#:NullOperationRequest"
- value="at.gv.egiz.bku.slcommands.impl.NullOperationCommandImpl" />
- <entry
- key="http://www.buergerkarte.at/namespaces/securitylayer/1.2#:InfoboxReadRequest"
- value="at.gv.egiz.bku.slcommands.impl.InfoboxReadCommandImpl" />
- <entry
- key="http://www.buergerkarte.at/namespaces/securitylayer/1.2#:InfoboxUpdateRequest"
- value="at.gv.egiz.bku.slcommands.impl.InfoboxUpdateCommandImpl" />
- <entry
- key="http://www.buergerkarte.at/namespaces/securitylayer/1.2#:CreateXMLSignatureRequest"
- value="at.gv.egiz.bku.slcommands.impl.CreateXMLSignatureCommandImpl" />
- </map>
- </property>
+ <!-- command invoker -->
+ <bean id="slCommandInvoker" class="at.gv.egiz.bku.binding.SLCommandInvokerImpl">
+ <property name="securityManager" ref="securityManager" />
+ </bean>
+
+ <!-- Security Layer command factory -->
+
+ <bean id="abstractCommandFactory" class="at.gv.egiz.bku.slcommands.AbstractSLCommandFactory"
+ abstract="true">
+ <property name="configuration" ref="configuration"/>
</bean>
- <bean id="infoboxFactory" class="at.gv.egiz.bku.slcommands.impl.InfoboxFactory"
- factory-method="getInstance">
- <property name="infoboxImpl">
- <map>
- <entry
- key="Certificates"
- value="at.gv.egiz.bku.slcommands.impl.CertificatesInfoboxImpl" />
- <entry
- key="IdentityLink"
- value="at.gv.egiz.bku.slcommands.impl.IdentityLinkInfoboxImpl" />
- <entry
- key="CardChannel"
- value="at.gv.egiz.bku.slcommands.impl.CardChannelInfoboxImpl" />
- <entry
- key="SV-Personendaten"
- value="at.gv.egiz.bku.slcommands.impl.SVPersonendatenInfoboxImpl" />
- </map>
- </property>
+ <bean id="certificatesInfoboxFactory"
+ class="at.gv.egiz.bku.slcommands.impl.CertificatesInfoboxFactory" />
+ <bean id="identityLinkInfoboxFactory"
+ class="at.gv.egiz.bku.slcommands.impl.IdentityLinkInfoboxFactory">
+ <property name="identityLinkTransformer">
+ <bean class="at.gv.egiz.idlink.IdentityLinkTransformer">
+ <property name="urlDereferencer" ref="urlDereferencer"/>
+ </bean>
+ </property>
</bean>
-
- <!-- Configure Configuration -->
- <bean id="certValidator" class="at.gv.egiz.bku.conf.CertValidatorImpl"></bean>
-
- <bean id="configurator" class="at.gv.egiz.bku.local.conf.SpringConfigurator"
- init-method="configure">
- <!-- <property name="resource" value="classpath:at/gv/egiz/bku/local/conf/defaultConf.properties"/> -->
- <property name="resource" value="file:${user.home}/.mocca/conf/defaultConf.properties"/>
- <property name="certValidator" ref="certValidator"></property>
+ <!-- not supported -->
+ <!--
+ <bean id="cardChannelInfoboxFactory"
+ class="at.gv.egiz.bku.slcommands.impl.CardChannelInfoboxFactory" />
+ -->
+ <bean id="svPersonendatenInfoboxFactory"
+ class="at.gv.egiz.bku.slcommands.impl.SVPersonendatenInfoboxFactory" />
+
+ <bean id="infoboxFactory" class="at.gv.egiz.bku.slcommands.impl.InfoboxFactory">
+ <property name="infoboxFactories">
+ <map>
+ <entry key="Certificates" value-ref="certificatesInfoboxFactory" />
+ <entry key="IdentityLink" value-ref="identityLinkInfoboxFactory" />
+ <!--
+ <entry key="CardChannel" value-ref="cardChannelInfoboxFactory" />
+ -->
+ <entry key="SV-Personendaten" value-ref="svPersonendatenInfoboxFactory" />
+ </map>
+ </property>
+ </bean>
+
+ <bean id="nullOperationCommandFactory"
+ class="at.gv.egiz.bku.slcommands.impl.NullOperationCommandFactory"
+ parent="abstractCommandFactory" />
+ <bean id="nullOperationRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="NullOperationRequest" />
+ </bean>
+ <bean id="infoboxReadCommandFactory"
+ class="at.gv.egiz.bku.slcommands.impl.InfoboxReadCommandFactory"
+ parent="abstractCommandFactory">
+ <property name="infoboxFactory" ref="infoboxFactory" />
+ </bean>
+ <bean id="infoboxReadRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="InfoboxReadRequest" />
+ </bean>
+ <bean id="infoboxUpdateCommandFactory"
+ class="at.gv.egiz.bku.slcommands.impl.InfoboxUpdateCommandFactory"
+ parent="abstractCommandFactory">
+ <property name="infoboxFactory" ref="infoboxFactory" />
+ </bean>
+ <bean id="infoboxUpdateRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="InfoboxUpdateRequest" />
+ </bean>
+ <bean id="createXMLSignatureCommandFactory"
+ class="at.gv.egiz.bku.slcommands.impl.CreateXMLSignatureCommandFactory"
+ parent="abstractCommandFactory" />
+ <bean id="createXMLSignatureRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="CreateXMLSignatureRequest" />
+ </bean>
+ <bean id="getStatusCommandFactory" class="at.gv.egiz.bku.slcommands.impl.GetStatusCommandFactory"
+ parent="abstractCommandFactory" />
+ <bean id="getStatusRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="GetStatusRequest" />
+ </bean>
+
+ <bean id="slCommandFactory" class="at.gv.egiz.bku.slcommands.SLCommandFactory"
+ factory-method="getInstance">
+ <property name="concreteFactories">
+ <map>
+ <entry key-ref="nullOperationRequest" value-ref="nullOperationCommandFactory" />
+ <entry key-ref="infoboxReadRequest" value-ref="infoboxReadCommandFactory" />
+ <entry key-ref="infoboxUpdateRequest" value-ref="infoboxUpdateCommandFactory" />
+ <entry key-ref="createXMLSignatureRequest" value-ref="createXMLSignatureCommandFactory" />
+ <entry key-ref="getStatusRequest" value-ref="getStatusCommandFactory" />
+ </map>
+ </property>
+ </bean>
+
+ <!-- STAL factory -->
+ <bean id="stalFactory" class="at.gv.egiz.bku.local.stal.ExclusiveAccessSTALFactory">
+ <property name="stalFactory">
+ <bean class="at.gv.egiz.bku.local.stal.LocalSTALFactory" scope="singleton">
+ <property name="helpURL" value="http://localhost:3495/help/" />
+ <property name="configuration" ref="configuration" />
+ </bean>
+ </property>
+ </bean>
+
+ <!-- binding processor factories -->
+ <bean id="httpBindingProcessorFactory" class="at.gv.egiz.bku.binding.HTTPBindingProcessorFactory">
+ <property name="configuration" ref="configuration" />
+ <property name="urlDereferencer" ref="urlDereferencer" />
+ <property name="sslSocketFactory" ref="sslSocketFactory" />
+ <property name="hostnameVerifier" ref="hostnameVerifier" />
+ <property name="slCommandFactory" ref="slCommandFactory" />
</bean>
- <!-- Begin MOCCA Configuration [REFACTORED]
- | Configuration beans (no conf properties file) should be injected directly to module configurators.
- | Currently, only the ReaderFactory configuration is considered.
- |-->
- <import resource="file:${user.home}/.mocca/conf/mocca-conf.xml"/>
+ <!-- binding processor manager -->
+ <bean id="bindingProcessorManager" class="at.gv.egiz.bku.binding.BindingProcessorManagerImpl"
+ scope="singleton">
+ <property name="stalFactory" ref="stalFactory" />
+ <property name="slCommandInvoker" ref="slCommandInvoker" />
+ <property name="factories">
+ <list>
+ <ref bean="httpBindingProcessorFactory"/>
+ </list>
+ </property>
+ </bean>
+
+ <bean id="attributeExporter"
+ class="org.springframework.web.context.support.ServletContextAttributeExporter">
+ <property name="attributes">
+ <map>
+ <entry key="bindingProcessorManager">
+ <ref bean="bindingProcessorManager" />
+ </entry>
+ </map>
+ </property>
+ </bean>
</beans>
\ No newline at end of file diff --git a/BKULocal/src/main/webapp/WEB-INF/conf/configuration.xml b/BKULocal/src/main/webapp/WEB-INF/conf/configuration.xml new file mode 100644 index 00000000..20d27bb0 --- /dev/null +++ b/BKULocal/src/main/webapp/WEB-INF/conf/configuration.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<MoccaConfiguration version="1.0"> + <DataURLConnection> + <!-- + The maximum number of consecutive Security Layer requests received + from DataURL server before execution is aborted. + --> + <MaxHops>50</MaxHops> + </DataURLConnection> +</MoccaConfiguration>
\ No newline at end of file diff --git a/BKULocal/src/main/webapp/WEB-INF/web.xml b/BKULocal/src/main/webapp/WEB-INF/web.xml index c4ea1e54..b8bc8818 100644 --- a/BKULocal/src/main/webapp/WEB-INF/web.xml +++ b/BKULocal/src/main/webapp/WEB-INF/web.xml @@ -18,16 +18,18 @@ <web-app id="bkulocal" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name>http-security-layer-request</display-name> - <!-- Begin Spring Config --> - <context-param> - <param-name>contextConfigLocation</param-name> - <param-value>/WEB-INF/applicationContext.xml</param-value> - </context-param> <listener> - <listener-class> - org.springframework.web.context.ContextLoaderListener - </listener-class> + <listener-class>at.gv.egiz.bku.local.webapp.MoccaContextListener</listener-class> </listener> + + <!-- Begin Spring Config --> + <listener> + <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> + </listener> + <context-param> + <param-name>configurationResource</param-name> + <param-value>file:${user.home}/.mocca/conf/configuration.xml</param-value> + </context-param> <!-- End Spring Config --> <!-- Begin BKU Config --> diff --git a/BKULocal/src/main/webapp/en/index.html b/BKULocal/src/main/webapp/en/index.html new file mode 100644 index 00000000..cfb0f957 --- /dev/null +++ b/BKULocal/src/main/webapp/en/index.html @@ -0,0 +1,64 @@ +<!-- + 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. +--> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title>CitizenCard - Welcome</title> + <link href="/help/css/help.css" rel="stylesheet" type="text/css" /> + <link rel="shortcut icon" href="/img/chip16.ico" type="image/x-icon"/> + </head> + + <body class="twoColElsLtHdr"> + + <div id="container"> + <div id="header"> + <h1>Welcome</h1> + <!-- end #header --></div> + <div id="mainContent" style="margin: 1.5em 1.5em 0 1.5em"> + <div style="float:left; margin-right:1em"> + <img src="/img/chip48.png" alt="Logo" width="48" height="48"/> + </div> + <p>Congratulations, you successfully installed the citizen-card environment MOCCA. + Please install the + <a href="/ca.crt">CA certificate</a>¹ as trusted certificate in your browser. + </p> + + <p style="clear:left; margin-top:1.5em">Please also have a look at</p> + <ul> + <li>the <a href="/help/en/">help topics</a>,</li> + <li>the <a href="/PINManagement?redirect=./index.html">PIN management</a> or </li> + <li>the <a href="/ca.crt">CA certificate installation</a> (you may open this link with another browser as well).</li> + </ul> + + <p><br class="clearfloat" /></p> + + <p style="font-size:80%"> + ¹The automated installation of the CA certificate is not available in Microsoft Windows Vista and Windows 7, + please see <a href="/help/en/help.install.cacert.html">Help</a>. + </p> + + </div> + <div id="footer"> + <p> + <a href="http://www.buergerkarte.at">Austrian CitizenCard</a> | <a href="http://mocca.egovlabs.gv.at">CitizenCard Environment MOCCA</a> + </p> + </div> + <!-- end #container --></div> + </body> +</html> + diff --git a/BKULocal/src/main/webapp/index.html b/BKULocal/src/main/webapp/index.html index c6d6c747..f8c6d2c0 100644 --- a/BKULocal/src/main/webapp/index.html +++ b/BKULocal/src/main/webapp/index.html @@ -19,8 +19,8 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Bürgerkarte - Willkommen</title> - <link href="help/help.css" rel="stylesheet" type="text/css" /> - <link rel="shortcut icon" href="img/chip16.ico" type="image/x-icon"/> + <link href="/help/css/help.css" rel="stylesheet" type="text/css" /> + <link rel="shortcut icon" href="/img/chip16.ico" type="image/x-icon"/> </head> <body class="twoColElsLtHdr"> @@ -31,25 +31,25 @@ <!-- end #header --></div> <div id="mainContent" style="margin: 1.5em 1.5em 0 1.5em"> <div style="float:left; margin-right:1em"> - <img src="img/chip48.png" alt="Logo" width="48" height="48"/> + <img src="/img/chip48.png" alt="Logo" width="48" height="48"/> </div> <p>Sie haben die Bürgerkartenumgebung MOCCA erfolgreich installiert. Um diese zu verwenden installieren Sie bitte noch das - <a href="ca.crt">CA Zertifikat</a>¹ in ihrem Browser. + <a href="/ca.crt">CA Zertifikat</a>¹ in ihrem Browser. </p> <p style="clear:left; margin-top:1.5em">Weiters können Sie</p> <ul> - <li>die <a href="help">Hilfe durchsehen</a>,</li> - <li>die <a href="PINManagement?redirect=./index.html">PIN Verwaltung starten</a> oder </li> - <li>das <a href="ca.crt">CA Zertifikat installieren</a> (rufen Sie diesen Link aus anderen Web-Browsern auf um auch dort das CA Zertifikat zu installieren).</li> + <li>die <a href="/help">Hilfe durchsehen</a>,</li> + <li>die <a href="/PINManagement?redirect=./index.html">PIN Verwaltung starten</a> oder </li> + <li>das <a href="/ca.crt">CA Zertifikat installieren</a> (rufen Sie diesen Link aus anderen Web-Browsern auf um auch dort das CA Zertifikat zu installieren).</li> </ul> <p><br class="clearfloat" /></p> <p style="font-size:80%"> ¹Eine automatisierte Installation ist mit Microsoft Internet Explorer in Windows Vista oder 7 leider nicht möglich, - siehe dazu <a href="help/de/help.install.cacert.html">Hilfe</a>. + siehe dazu <a href="/help/help.install.cacert.html">Hilfe</a>. </p> </div> diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index 262dcba8..20c6ff56 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>BKUOnline</artifactId> <packaging>war</packaging> <name>BKU Online</name> - <version>1.2.14-SNAPSHOT</version> + <version>${parent.version}</version> <pluginRepositories> <pluginRepository> @@ -24,65 +24,84 @@ <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> + <scope>runtime</scope> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>bkucommon</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUViewer</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + </dependency> + <dependency> + <groupId>at.gv.egiz</groupId> + <artifactId>STALService</artifactId> + <version>${project.parent.version}</version> + </dependency> + <dependency> + <groupId>at.gv.egiz</groupId> + <artifactId>STALXService</artifactId> + <version>${project.parent.version}</version> </dependency> <dependency> <artifactId>BKUCertificates</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2</version> + <version>${mocca.certificates.version}</version> + <scope>provided</scope> </dependency> <dependency> <artifactId>BKUHelp</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>iaik</groupId> + <artifactId>iaik_xsect</artifactId> </dependency> + <dependency> + <groupId>iaik</groupId> + <artifactId>iaik_jce_full_signed</artifactId> + </dependency> <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> + <groupId>iaik</groupId> + <artifactId>iaik_ecc_signed</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - <version>2.5</version> - <scope>provided</scope> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - <version>2.5.5</version> + <artifactId>spring-context</artifactId> + <type>jar</type> </dependency> <dependency> - <groupId>at.gv.egiz</groupId> - <artifactId>STALService</artifactId> - <version>1.2.14-SNAPSHOT</version> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <type>jar</type> <scope>compile</scope> </dependency> <dependency> - <groupId>at.gv.egiz</groupId> - <artifactId>STALService</artifactId> - <version>1.2.14-SNAPSHOT</version> + <groupId>commons-configuration</groupId> + <artifactId>commons-configuration</artifactId> </dependency> - <!-- - | TODO move at.buergerkarte.namespaces.cardchannel.service out from STALXService - | so that BKUOnline does not have to depend on STALXService - |--> <dependency> - <groupId>at.gv.egiz</groupId> - <artifactId>STALXService</artifactId> - <version>1.2.14-SNAPSHOT</version> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <scope>provided</scope> </dependency> <!-- | see https://wsit.dev.java.net/issues/show_bug.cgi?id=970 @@ -117,36 +136,16 @@ <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUApplet</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUAppletExt</artifactId> - <version>1.2.14-SNAPSHOT</version> - <scope>provided</scope> - </dependency> - <!-- - | Transitive dependency from BKUViewer, - | set excludeTransitive=false in unpack-fonts - <dependency> - <groupId>at.gv.egiz</groupId> - <artifactId>BKUFonts</artifactId> - <version>1.0</version> - <scope>provided</scope> - </dependency--> - <dependency> - <groupId>iaik</groupId> - <artifactId>iaik_jce_me4se</artifactId> + <version>${project.parent.version}</version> <scope>provided</scope> </dependency> - </dependencies> - <scm> - <developerConnection>scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKUOnline</developerConnection> - <connection>scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKUOnline</connection> - <url>scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKUOnline</url> - </scm> <build> <plugins> <plugin> @@ -160,8 +159,8 @@ </goals> <configuration> <outputDirectory>${project.build.directory}/${project.build.finalName}/applet</outputDirectory> - <includeGroupIds>at.gv.egiz,commons-logging,iaik</includeGroupIds> - <includeArtifactIds>BKUApplet,BKUAppletExt,commons-logging,iaik_jce_me4se</includeArtifactIds> + <includeGroupIds>at.gv.egiz</includeGroupIds> + <includeArtifactIds>BKUApplet,BKUAppletExt</includeArtifactIds> <excludeTransitive>true</excludeTransitive> <stripVersion>true</stripVersion> </configuration> @@ -176,7 +175,7 @@ <includeGroupIds>at.gv.egiz</includeGroupIds> <includeArtifactIds>BKUFonts</includeArtifactIds> <excludes>META-INF/,LICENSE</excludes> - <excludeTransitive>false</excludeTransitive> + <!--excludeTransitive>false</excludeTransitive--> </configuration> </execution> <execution> @@ -218,6 +217,7 @@ <Implementation-Build>${project.version}-r${buildNumber}</Implementation-Build> </manifestEntries> </archive> + <warSourceExcludes>applet/**</warSourceExcludes> </configuration> </plugin> <plugin> @@ -312,7 +312,6 @@ <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUWebStart</artifactId> - <scope>provided</scope> <type>zip</type> </dependency> </dependencies> diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/accesscontroller/SpringSecurityManager.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/accesscontroller/SpringSecurityManager.java deleted file mode 100644 index 5795478b..00000000 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/accesscontroller/SpringSecurityManager.java +++ /dev/null @@ -1,63 +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.online.accesscontroller;
-
-import java.io.IOException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.context.ResourceLoaderAware;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.ResourceLoader;
-
-import at.gv.egiz.bku.accesscontroller.SecurityManagerFacade;
-import at.gv.egiz.bku.conf.Configurator;
-
-public class SpringSecurityManager extends SecurityManagerFacade implements
- ResourceLoaderAware {
-
- private ResourceLoader resourceLoader;
-
- private static Log log = LogFactory.getLog(SpringSecurityManager.class);
-
- protected Configurator config;
-
- public void setConfig(Configurator config) {
- this.config = config;
- }
-
- public void init() {
- String noMatch = config.getProperty("AccessController.acceptNoMatch");
- if (noMatch != null) {
- log.debug("Setting allow now match to: " + noMatch);
- setAllowUnmatched(Boolean.getBoolean(noMatch));
- }
- String policy = config.getProperty("AccessController.policyResource");
- log.info("Loading resource: " + policy);
- try {
- Resource res = resourceLoader.getResource(policy);
- init(res.getInputStream());
- } catch (IOException e) {
- log.error(e);
- }
- }
-
- @Override
- public void setResourceLoader(ResourceLoader loader) {
- this.resourceLoader = loader;
- }
-}
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/conf/SpringConfigurator.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/conf/SpringConfigurator.java deleted file mode 100644 index 6030c1c0..00000000 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/conf/SpringConfigurator.java +++ /dev/null @@ -1,127 +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.online.conf;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.context.ResourceLoaderAware;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.ResourceLoader;
-
-import at.gv.egiz.bku.conf.Configurator;
-import at.gv.egiz.bku.online.webapp.SpringBKUServlet;
-import at.gv.egiz.bku.slexceptions.SLRuntimeException;
-import at.gv.egiz.stal.service.impl.RequestBrokerSTALFactory;
-
-public class SpringConfigurator extends Configurator implements
- ResourceLoaderAware {
-
- private final static Log log = LogFactory.getLog(SpringConfigurator.class);
-
- private ResourceLoader resourceLoader;
-
- public void setResource(Resource resource) {
- log.debug("Loading config from: " + resource);
- if (resource != null) {
- Properties props = new Properties();
- try {
- props.load(resource.getInputStream());
- super.setConfiguration(props);
- } catch (IOException e) {
- log.error("Cannot load config", e);
- }
- } else {
- log.warn("Cannot load properties, resource: " + resource);
- }
- }
-
- public void configureNetwork() {
- super.configureNetwork();
- String appletTimeout = getProperty("AppletTimeout");
- if ((appletTimeout != null)) {
- try {
- long ato = Long.parseLong(appletTimeout);
- log.debug("Setting applet timeout to:"+ato);
- RequestBrokerSTALFactory.setTimeout(ato);
- } catch (NumberFormatException nfe) {
- log.error("Cannot set Applettimeout", nfe);
- }
-
- }
- }
-
- public void configure() {
- super.configure();
- SpringBKUServlet.setConfigurator(this);
- }
-
- @Override
- public void setResourceLoader(ResourceLoader loader) {
- this.resourceLoader = loader;
- }
-
- private File getDirectory(String property) {
- if (property != null) {
- Resource certDirRes = resourceLoader.getResource(property);
- File certDir;
- try {
- certDir = certDirRes.getFile();
- } catch (IOException e) {
- log.error("Cannot get cert directory", e);
- throw new SLRuntimeException(e);
- }
- if (!certDir.isDirectory()) {
- log.error("Expecting directory as SSL.certDirectory parameter");
- throw new SLRuntimeException(
- "Expecting directory as SSL.certDirectory parameter");
- }
- return certDir;
- }
- return null;
-
- }
-
- @Override
- protected File getCADir() {
- String caDirectory = getProperty("SSL.caDirectory");
- return getDirectory(caDirectory);
- }
-
- @Override
- protected File getCertDir() {
- String certDirectory = getProperty("SSL.certDirectory");
- return getDirectory(certDirectory);
- }
-
- @Override
- protected InputStream getManifest() {
- Resource r = resourceLoader.getResource("META-INF/MANIFEST.MF");
- if (r != null) {
- try {
- return r.getInputStream();
- } catch (IOException e) {
- log.error("Cannot read manifest data:", e);
- }
- }
- return null;
- }
-}
\ No newline at end of file diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/spring/ServletContextPathFactoryBean.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/spring/ServletContextPathFactoryBean.java new file mode 100644 index 00000000..27dfcd92 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/spring/ServletContextPathFactoryBean.java @@ -0,0 +1,49 @@ +/* +* Copyright 2009 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.spring; + +import javax.servlet.ServletContext; + +import org.springframework.beans.factory.FactoryBean; +import org.springframework.web.context.ServletContextAware; + +public class ServletContextPathFactoryBean implements FactoryBean, ServletContextAware { + + private String contextPath; + + @Override + public void setServletContext(ServletContext servletContext) { + contextPath = servletContext.getContextPath(); + } + + @Override + public Object getObject() throws Exception { + return contextPath; + } + + @Override + public Class<?> getObjectType() { + return String.class; + } + + @Override + public boolean isSingleton() { + return true; + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AbstractWebRequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AbstractWebRequestHandler.java new file mode 100644 index 00000000..019b8efe --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AbstractWebRequestHandler.java @@ -0,0 +1,327 @@ +/* +* Copyright 2009 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.webapp; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.regex.Pattern; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; + +import at.gv.egiz.bku.binding.HTTPBindingProcessor; +import at.gv.egiz.bku.binding.HttpUtil; +import at.gv.egiz.bku.binding.Id; +import at.gv.egiz.bku.binding.IdFactory; +import at.gv.egiz.bku.binding.InputDecoderFactory; +import at.gv.egiz.bku.utils.StreamUtil; +import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage; + +public abstract class AbstractWebRequestHandler extends SpringBKUServlet { + + private static final long serialVersionUID = 1L; + + public static final String APPLET_PAGE_P = "appletPage"; + public static final String APPLET_PAGE_DEFAULT = "applet.jsp"; + + public static final String PARAM_APPLET_WIDTH = "appletWidth"; + public static final String ATTR_APPLET_WIDTH = "appletWidth"; + + public static final String PARAM_APPLET_HEIGHT = "appletHeight"; + public static final String ATTR_APPLET_HEIGHT = "appletHeight"; + + public static final String PARAM_APPLET_BACKGROUND = "appletBackground"; + public static final String ATTR_APPLET_BACKGROUND = "appletBackground"; + + public static final String PARAM_APPLET_BACKGROUND_COLOR = "appletBackgroundColor"; + public static final String ATTR_APPLET_BACKGROUND_COLOR = "appletBackgroundColor"; + + public static final Pattern PATTERM_APPLET_BACKGROUND_COLOR = Pattern.compile("\\#[0-9a-fA-F]{6}"); + public static final String PARAM_APPLET_GUI_STYLE = "appletGuiStyle"; + public static final String ATTR_APPLET_GUI_STYLE = "appletGuiStyle"; + + public static final String[] VALUES_APPLET_GUI_STYLE = new String[] {"tiny", "simple", "advanced"}; + public static final String PARAM_APPLET_EXTENSION = "appletExtension"; + public static final String ATTR_APPLET_EXTENSION = "appletExtension"; + + public static final String[] VALUES_APPLET_EXTENSION = new String[] {"pin", "activation"}; + public static final String PARAM_LOCALE = "locale"; + public static final String ATTR_LOCALE = "locale"; + + public static final Pattern PATTERN_LOCALE = Pattern.compile("[a-zA-Z][a-zA-Z](_[a-zA-Z][a-zA-Z]){0,2}"); + public static final String REDIRECT_URL_SESSION_ATTRIBUTE = "redirectUrl"; + + private final Logger log = LoggerFactory.getLogger(BKURequestHandler.class); + + protected static String getStringFromStream(InputStream is, String encoding) + throws IOException { + if (is == null) { + return null; + } + if (encoding == null) { + encoding = HttpUtil.DEFAULT_CHARSET; + } + ByteArrayOutputStream os = new ByteArrayOutputStream(); + StreamUtil.copyStream(is, os); + return new String(os.toByteArray(), encoding); + } + + protected abstract String getRequestProtocol(HttpServletRequest req); + + protected HTTPBindingProcessor getBindingProcessor(Id id, HttpServletRequest req, Locale locale) { + + // remove existing binding processor if present + getBindingProcessorManager().removeBindingProcessor(id); + + // create new binding processor + return (HTTPBindingProcessor) getBindingProcessorManager().createBindingProcessor(getRequestProtocol(req), locale); + + } + + @Override + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, + java.io.IOException { + + String msg = (req.getSession(false) == null) ? "New session created." + : "Session already established."; + + Id id = IdFactory.getInstance().createId(req.getSession().getId()); + MDC.put("id", id.toString()); + + String acceptLanguage = req.getHeader("Accept-Language"); + Locale locale = AcceptLanguage.getLocale(acceptLanguage); + + if (log.isInfoEnabled()) { + log.info("Recieved request (Accept-Language locale: {}). {}", locale, msg); + } + + try { + + HTTPBindingProcessor bindingProcessor = getBindingProcessor(id, req, locale); + + Map<String, String> headerMap = new HashMap<String, String>(); + for (Enumeration<?> headerName = req.getHeaderNames(); headerName + .hasMoreElements();) { + String header = (String) headerName.nextElement(); + if (header != null) { + headerMap.put(header, req.getHeader(header)); + } + } + + InputStream inputStream; + String charset; + if (req.getMethod().equals("POST")) { + charset = req.getCharacterEncoding(); + String contentType = req.getContentType(); + if (charset != null) { + contentType += ";" + charset; + } + headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, contentType); + inputStream = req.getInputStream(); + } else { + charset = "UTF-8"; + headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, + InputDecoderFactory.URL_ENCODED); + String queryString = req.getQueryString(); + if (queryString != null) { + inputStream = new ByteArrayInputStream(queryString.getBytes(charset)); + } else { + inputStream = new ByteArrayInputStream(new byte[] {}); + } + } + bindingProcessor.setHTTPHeaders(headerMap); + bindingProcessor.consumeRequestStream(req.getRequestURL().toString(), + inputStream); + + req.getInputStream().close(); + getBindingProcessorManager().process(id, bindingProcessor); + + HttpSession session = req.getSession(); + + log.trace("Looking for applet parameters in request."); + + // appletWidth + String width = getStringFromStream(bindingProcessor + .getFormData(PARAM_APPLET_WIDTH), charset); + if (width != null && !width.isEmpty()) { + try { + // must be a valid integer + session.setAttribute(ATTR_APPLET_WIDTH, Integer.parseInt(width)); + log.debug("Found parameter " + PARAM_APPLET_WIDTH + "='{}'.", width); + } catch (NumberFormatException nfe) { + log.warn("Parameter " + PARAM_APPLET_WIDTH + + " does not contain a valid value.", nfe); + } + } + + // appletHeight + String height = getStringFromStream(bindingProcessor + .getFormData(PARAM_APPLET_HEIGHT), charset); + if (height != null && !height.isEmpty()) { + try { + // must be a valid integer + session.setAttribute(ATTR_APPLET_HEIGHT, Integer.parseInt(height)); + log.debug("Found parameter " + PARAM_APPLET_HEIGHT + "='{}'.", height); + } catch (NumberFormatException nfe) { + log.warn("Parameter " + PARAM_APPLET_HEIGHT + + " does not contain a valid value.", nfe); + } + } + + // appletBackground + String background = getStringFromStream(bindingProcessor + .getFormData(PARAM_APPLET_BACKGROUND), charset); + if (background != null && !background.isEmpty()) { + session.setAttribute(ATTR_APPLET_BACKGROUND, background); + try { + // must be a valid http or https URL + URI backgroundURL = new URI(background); + if ("http".equals(backgroundURL.getScheme()) + || "https".equals(backgroundURL.getScheme())) { + session.setAttribute(ATTR_APPLET_BACKGROUND, backgroundURL + .toASCIIString()); + log.debug("Found parameter " + PARAM_APPLET_BACKGROUND + "='{}'.", + backgroundURL.toASCIIString()); + } else { + log.warn("Parameter " + PARAM_APPLET_BACKGROUND + + "='{}' is not a valid http/https URL.", background); + } + } catch (URISyntaxException e) { + log.warn("Parameter " + PARAM_APPLET_BACKGROUND + + "='{}' is not a valid http/https URL.", background, e); + } + } + + // appletBackgroundColor + String backgroundColor = getStringFromStream(bindingProcessor + .getFormData(PARAM_APPLET_BACKGROUND_COLOR), charset); + if (backgroundColor != null && !backgroundColor.isEmpty()) { + // must be a valid color definition + if (PATTERM_APPLET_BACKGROUND_COLOR.matcher(backgroundColor).matches()) { + session.setAttribute(ATTR_APPLET_BACKGROUND_COLOR, backgroundColor); + log.debug("Faund parameter " + PARAM_APPLET_BACKGROUND_COLOR + + "='{}'.", backgroundColor); + } else { + log.warn("Parameter " + PARAM_APPLET_BACKGROUND_COLOR + + "='{}' is not a valid color definition " + + "(must be of form '#hhhhhh').", backgroundColor); + } + } + + // appletGuiStyle + String guiStyle = getStringFromStream(bindingProcessor + .getFormData(PARAM_APPLET_GUI_STYLE), charset); + if (guiStyle != null && !guiStyle.isEmpty()) { + // must be one of VALUES_APPLET_GUI_STYLE + String style = guiStyle.toLowerCase(); + if (Arrays.asList(VALUES_APPLET_GUI_STYLE).contains(style)) { + session.setAttribute(ATTR_APPLET_GUI_STYLE, style); + log.debug("Found parameter " + PARAM_APPLET_GUI_STYLE + "='{}'.", style); + } else { + StringBuilder sb = new StringBuilder(); + sb.append("Parameter ").append(PARAM_APPLET_GUI_STYLE).append( + "='").append(guiStyle).append("' is not valid (must be one of ") + .append(Arrays.toString(VALUES_APPLET_GUI_STYLE)).append(")."); + log.warn(sb.toString()); + } + } + + // appletExtension + String extension = getStringFromStream(bindingProcessor + .getFormData(PARAM_APPLET_EXTENSION), charset); + if (extension != null && !extension.isEmpty()) { + // must be one of VALUES_APPLET_EXTENSION + String ext = extension.toLowerCase(); + if (Arrays.asList(VALUES_APPLET_EXTENSION).contains(ext)) { + session.setAttribute(ATTR_APPLET_EXTENSION, ext); + log.debug("Found parameter " + PARAM_APPLET_EXTENSION + "='{}'.", ext); + } else { + StringBuilder sb = new StringBuilder(); + sb.append("Parameter ").append(PARAM_APPLET_EXTENSION).append( + "='").append(extension).append("' is not valid (must be one of ") + .append(Arrays.toString(VALUES_APPLET_EXTENSION)).append(")."); + log.warn(sb.toString()); + } + } + + // locale + String localeFormParam = getStringFromStream(bindingProcessor + .getFormData(PARAM_LOCALE), charset); + if (localeFormParam != null && !localeFormParam.isEmpty()) { + // must be a valid locale + if (PATTERN_LOCALE.matcher(localeFormParam).matches()) { + locale = new Locale(localeFormParam); + log.debug("Override accept-language header locale {} " + + "with form param {}.", locale, localeFormParam); + } else { + log.warn("Parameter " + PARAM_LOCALE + + "='{}' is not a valid locale definition.", localeFormParam); + } + } + if (locale != null) { + log.debug("Using locale {}.", locale); + session.setAttribute(ATTR_LOCALE, locale.toString()); + } + + beforeAppletPage(req, bindingProcessor); + + String appletPage = getStringFromStream(bindingProcessor + .getFormData(APPLET_PAGE_P), charset); + if (appletPage == null || appletPage.isEmpty()) { + appletPage = APPLET_PAGE_DEFAULT; + } + log.debug("Sending redirect to UI page '{}'.", appletPage); + resp.sendRedirect(appletPage); + + } finally { + MDC.remove("id"); + } + } + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) + throws ServletException, java.io.IOException { + doPost(req, resp); + } + + /** + * Called before the request is forwarded or redirected to the Applet page. + * + * @param req + * @param bindingProcessor + */ + protected void beforeAppletPage(HttpServletRequest req, + HTTPBindingProcessor bindingProcessor) { + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AppletDispatcher.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AppletDispatcher.java index 24938cd5..9e455621 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AppletDispatcher.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/AppletDispatcher.java @@ -24,8 +24,8 @@ 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; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * prevent applet caching, @@ -35,7 +35,9 @@ import org.apache.commons.logging.LogFactory; */ public class AppletDispatcher extends HttpServlet { - protected final static Log log = LogFactory.getLog(AppletDispatcher.class); + private static final long serialVersionUID = 1L; + + private final Logger log = LoggerFactory.getLogger(AppletDispatcher.class); public static final String DISPATCH_CTX = "dispatch/"; public static final String RAND_PREFIX = "__"; @@ -65,10 +67,7 @@ public class AppletDispatcher extends HttpServlet { uri = archivePattern.matcher(uri).replaceAll(".jar"); // log.trace("removing random suffix " + uri); - if (log.isTraceEnabled()) { - log.trace("dispatching request URI " + request.getRequestURI() + - " to " + uri); - } + log.trace("Dispatching request URI {} to {}.", request.getRequestURI(), uri); RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(uri); dispatcher.forward(request, response); diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java index 7dfec211..d42f911c 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java @@ -16,302 +16,37 @@ */ package at.gv.egiz.bku.online.webapp; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLEncoder; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.regex.Pattern; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -import at.gv.egiz.bku.binding.BindingProcessor; import at.gv.egiz.bku.binding.HTTPBindingProcessor; -import at.gv.egiz.bku.binding.HttpUtil; -import at.gv.egiz.bku.binding.IdFactory; -import at.gv.egiz.bku.utils.StreamUtil; -import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage; +import at.gv.egiz.bku.binding.HTTPBindingProcessorImpl; /** * Handles SL requests and instantiates BindingProcessors * */ -public class BKURequestHandler extends SpringBKUServlet { - - private static final long serialVersionUID = 1L; - - public static final String APPLET_PAGE_P = "appletPage"; - public static final String APPLET_PAGE_DEFAULT = "BKUApplet"; - - public static final String PARAM_APPLET_WIDTH = "appletWidth"; - public static final String ATTR_APPLET_WIDTH = "appletWidth"; - - public static final String PARAM_APPLET_HEIGHT = "appletHeight"; - public static final String ATTR_APPLET_HEIGHT = "appletHeight"; +public class BKURequestHandler extends AbstractWebRequestHandler { - public static final String PARAM_APPLET_BACKGROUND = "appletBackground"; - public static final String ATTR_APPLET_BACKGROUND = "appletBackground"; - - public static final String PARAM_APPLET_BACKGROUND_COLOR = "appletBackgroundColor"; - public static final String ATTR_APPLET_BACKGROUND_COLOR = "appletBackgroundColor"; - public static final Pattern PATTERM_APPLET_BACKGROUND_COLOR = Pattern.compile("\\#[0-9a-fA-F]{6}"); - - public static final String PARAM_APPLET_GUI_STYLE = "appletGuiStyle"; - public static final String ATTR_APPLET_GUI_STYLE = "appletGuiStyle"; - public static final String[] VALUES_APPLET_GUI_STYLE = new String[] {"tiny", "simple", "advanced"}; + private static final long serialVersionUID = 1L; - public static final String PARAM_APPLET_EXTENSION = "appletExtension"; - public static final String ATTR_APPLET_EXTENSION = "appletExtension"; - public static final String[] VALUES_APPLET_EXTENSION = new String[] {"pin", "activation"}; + private final Logger log = LoggerFactory.getLogger(BKURequestHandler.class); - public static final String PARAM_LOCALE = "locale"; - public static final String ATTR_LOCALE = "locale"; - public static final Pattern PATTERN_LOCALE = Pattern.compile("[a-zA-Z][a-zA-Z](_[a-zA-Z][a-zA-Z]){0,2}"); - - public final static String REDIRECT_URL_SESSION_ATTRIBUTE = "redirectUrl"; - - protected Log log = LogFactory.getLog(BKURequestHandler.class); - - private static String getStringFromStream(InputStream is, String encoding) - throws IOException { - if (is == null) { - return null; - } - if (encoding == null) { - encoding = HttpUtil.DEFAULT_CHARSET; - } - ByteArrayOutputStream os = new ByteArrayOutputStream(); - StreamUtil.copyStream(is, os); - return new String(os.toByteArray(), encoding); - } - @Override - protected void doPost(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, java.io.IOException { - log.debug("Received SecurityLayer request"); - - HttpSession session = req.getSession(false); - if (session != null) { - log.warn("Already a session with id: " + session.getId() - + " active, trying to get Bindingprocessor"); - BindingProcessor bp = getBindingProcessorManager().getBindingProcessor( - IdFactory.getInstance().createId(session.getId())); - if (bp != null) { - log.debug("Found binding processor, using this one"); - String appletPage = getStringFromStream( - ((HTTPBindingProcessor) bp).getFormData(APPLET_PAGE_P), - req.getCharacterEncoding()); - getDispatcher(appletPage).forward(req, resp); - return; - } - log.debug("Did not find a binding processor, creating new ..."); - } - session = req.getSession(true); - if (log.isDebugEnabled()) { - log.debug("Using session id: " + session.getId()); - } - - String acceptLanguage = req.getHeader("Accept-Language"); - Locale locale = AcceptLanguage.getLocale(acceptLanguage); - log.debug("Accept-Language locale: " + locale); - - HTTPBindingProcessor bindingProcessor; - bindingProcessor = (HTTPBindingProcessor) getBindingProcessorManager() - .createBindingProcessor(req.getRequestURL().toString(), - session.getId(), locale); - - Map<String, String> headerMap = new HashMap<String, String>(); - for (Enumeration<String> headerName = req.getHeaderNames(); headerName - .hasMoreElements();) { - String header = headerName.nextElement(); - if (header != null) { - headerMap.put(header, req.getHeader(header)); - } - } - String charset = req.getCharacterEncoding(); - String contentType = req.getContentType(); - if (charset != null) { - contentType += ";" + charset; - } - headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, contentType); - bindingProcessor.setHTTPHeaders(headerMap); - bindingProcessor.consumeRequestStream(req.getInputStream()); - req.getInputStream().close(); - getBindingProcessorManager().process(bindingProcessor); - - log.trace("Trying to find applet parameters in request"); - - // appletWidth - String width = getStringFromStream(bindingProcessor - .getFormData(PARAM_APPLET_WIDTH), charset); - if (width != null) { - try { - // must be a valid integer - session.setAttribute(ATTR_APPLET_WIDTH, Integer.parseInt(width)); - log.trace("Found parameter " + PARAM_APPLET_WIDTH + "='" + width +"'."); - } catch (NumberFormatException nfe) { - log.warn("Applet parameter " + PARAM_APPLET_WIDTH + - " does not contain a valid value.", nfe); - } - } - - // appletHeight - String height = getStringFromStream(bindingProcessor - .getFormData(PARAM_APPLET_HEIGHT), charset); - if (height != null) { - try { - // must be a valid integer - session.setAttribute(ATTR_APPLET_HEIGHT, Integer.parseInt(height)); - log.trace("Found parameter " + PARAM_APPLET_HEIGHT + "='" + height + "'."); - } catch (NumberFormatException nfe) { - log.warn("Applet parameter " + PARAM_APPLET_HEIGHT + - " does not contain a valid value.", nfe); - } - } - - // appletBackground - String background = getStringFromStream(bindingProcessor - .getFormData(PARAM_APPLET_BACKGROUND), charset); - if (background != null) { - session.setAttribute(ATTR_APPLET_BACKGROUND, background); - try { - // must be a valid http or https URL - URI backgroundURL = new URI(background); - if ("http".equals(backgroundURL.getScheme()) - || "https".equals(backgroundURL.getScheme())) { - session.setAttribute(ATTR_APPLET_BACKGROUND, backgroundURL.toASCIIString()); - log.trace("Found parameter " + PARAM_APPLET_BACKGROUND + "='" - + backgroundURL.toASCIIString() + "'."); - } else { - log.warn("Applet parameter " + PARAM_APPLET_BACKGROUND + "='" - + background + "' is not a valid http/https URL."); - } - } catch (URISyntaxException e) { - log.warn("Applet parameter " + PARAM_APPLET_BACKGROUND + "='" - + background + "' is not a valid http/https URL.", e); - } - } - - // appletBackgroundColor - String backgroundColor = getStringFromStream(bindingProcessor - .getFormData(PARAM_APPLET_BACKGROUND_COLOR), charset); - if (backgroundColor != null) { - // must be a valid color definition - if (PATTERM_APPLET_BACKGROUND_COLOR.matcher(backgroundColor).matches()) { - session.setAttribute(ATTR_APPLET_BACKGROUND_COLOR, backgroundColor); - log.trace("Faund parameter " + PARAM_APPLET_BACKGROUND_COLOR + "='" - + backgroundColor + "'."); - } else { - log.warn("Applet parameter " + PARAM_APPLET_BACKGROUND_COLOR + "='" - + backgroundColor + "' is not a valid color definition (must be of form '#hhhhhh')."); - } - } - - // appletGuiStyle - String guiStyle = getStringFromStream(bindingProcessor - .getFormData(PARAM_APPLET_GUI_STYLE), charset); - if (guiStyle != null) { - // must be one of VALUES_APPLET_GUI_STYLE - String style = guiStyle.toLowerCase(); - if (Arrays.asList(VALUES_APPLET_GUI_STYLE).contains(style)) { - session.setAttribute(ATTR_APPLET_GUI_STYLE, style); - log.trace("Found parameter " + PARAM_APPLET_GUI_STYLE + "='" - + style + "'."); - } else { - StringBuilder sb = new StringBuilder(); - sb.append("Applet parameter ").append(PARAM_APPLET_GUI_STYLE).append( - "='").append(guiStyle).append("' is not valid (must be one of ") - .append(Arrays.toString(VALUES_APPLET_GUI_STYLE)).append(")."); - log.warn(sb); - } - } - - // appletExtension - String extension = getStringFromStream(bindingProcessor - .getFormData(PARAM_APPLET_EXTENSION), charset); - if (extension != null) { - // must be one of VALUES_APPLET_EXTENSION - String ext = extension.toLowerCase(); - if (Arrays.asList(VALUES_APPLET_EXTENSION).contains(ext)) { - session.setAttribute(ATTR_APPLET_EXTENSION, ext); - log.trace("Found parameter " + PARAM_APPLET_EXTENSION + "='" - + ext + "'."); - } else { - StringBuilder sb = new StringBuilder(); - sb.append("Applet parameter ").append(PARAM_APPLET_EXTENSION).append( - "='").append(extension).append("' is not valid (must be one of ") - .append(Arrays.toString(VALUES_APPLET_EXTENSION)).append(")."); - log.warn(sb); - } - } - - // locale - String localeFormParam = getStringFromStream(bindingProcessor - .getFormData(PARAM_LOCALE), charset); - if (localeFormParam != null) { - // must be a valid locale - if (PATTERN_LOCALE.matcher(localeFormParam).matches()) { - locale = new Locale(localeFormParam); - log.debug("Overrule accept-language header locale " + locale - + " with form param " + localeFormParam + "."); - } else { - log.warn("Parameter " + PARAM_LOCALE + "='" + localeFormParam - + "' is not a valid locale definition."); - } - } - if (locale != null) { - log.debug("Using locale " + locale); - session.setAttribute(ATTR_LOCALE, locale.toString()); - } - + protected void beforeAppletPage(HttpServletRequest req, HTTPBindingProcessor bindingProcessor) { // handle server side redirect url after processing - String redirectUrl = bindingProcessor.getRedirectURL(); + String redirectUrl = ((HTTPBindingProcessorImpl) bindingProcessor).getRedirectURL(); if ( redirectUrl != null) { - log.info("Got redirect URL "+redirectUrl+". Deferring browser redirect."); - session.setAttribute(REDIRECT_URL_SESSION_ATTRIBUTE, redirectUrl); + log.info("Got redirect URL '{}'. Deferring browser redirect.", redirectUrl); + req.getSession().setAttribute(REDIRECT_URL_SESSION_ATTRIBUTE, redirectUrl); } - - String appletPage = getStringFromStream(bindingProcessor - .getFormData(APPLET_PAGE_P), charset); - getDispatcher(appletPage).forward(req, resp); } @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, java.io.IOException { - doPost(req, resp); - } - - private RequestDispatcher getDispatcher(String appletPage) { - RequestDispatcher dispatcher = null; - if (appletPage != null) { - log.trace("requested appletPage " + appletPage); - dispatcher = getServletContext().getNamedDispatcher(appletPage); - } - if (dispatcher == null) { - log.debug("no appletPage requested or appletPage not configured, using default"); - appletPage = APPLET_PAGE_DEFAULT; - dispatcher = getServletContext().getNamedDispatcher(appletPage); - } -// session.setAttribute(APPLET_PAGE_P, appletPage); - log.debug("forward to applet " + appletPage); - - return dispatcher; + protected String getRequestProtocol(HttpServletRequest req) { + return "HTTP"; } } diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaContextListener.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaContextListener.java new file mode 100644 index 00000000..8d65c92e --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaContextListener.java @@ -0,0 +1,128 @@ +/* +* Copyright 2009 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.webapp; + +import iaik.security.ecc.provider.ECCProvider; +import iaik.security.provider.IAIK; +import iaik.xml.crypto.XSecProvider; + +import java.security.Provider; +import java.security.Security; +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.ServletContext; +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class MoccaContextListener implements ServletContextListener { + + public static final String DISABLE_SECURITY_PROVIDER_REGISTRATION = "disableSecurityProviderRegistration"; + + private Logger log = LoggerFactory.getLogger(MoccaContextListener.class); + + private final List<Provider> selfRegisteredProviders = new ArrayList<Provider>(); + + @Override + public void contextDestroyed(ServletContextEvent sce) { + log.info("Deregistering self registered security providers."); + + for (Provider provider : selfRegisteredProviders) { + Security.removeProvider(provider.getName()); + } + selfRegisteredProviders.clear(); + + } + + @Override + public void contextInitialized(ServletContextEvent sce) { + + ServletContext servletContext = sce.getServletContext(); + if (!Boolean.parseBoolean(servletContext.getInitParameter(DISABLE_SECURITY_PROVIDER_REGISTRATION))) { + log.info("Looking for required and registered security providers ..."); + + registerProviders(); + + if (!selfRegisteredProviders.isEmpty()) { + log.warn("Security providers have been registered. " + + "This may affect other contexts in the same container!"); + } + + if (log.isDebugEnabled()) { + StringBuilder sb = new StringBuilder(); + sb.append("Registered providers: "); + int i = 1; + for (Provider prov : Security.getProviders()) { + sb.append("\n" + (i++) + ". : " + prov); + } + log.debug(sb.toString()); + } + } + + + } + + + protected void registerProvider(Provider provider, int position) { + String name = provider.getName(); + if (Security.getProvider(name) == null) { + // register IAIK provider at first position + try { + if (position > 0) { + position = Security.insertProviderAt(provider, position); + } else { + position = Security.addProvider(provider); + } + log.info("Required security Provider {} was not yet registered. " + + "Now registered at position {}.", name, position); + selfRegisteredProviders.add(provider); + } catch (SecurityException e) { + log.info("Failed to register required security Provider.", e); + } + } else { + log.info("Required security Provider {} already registered.", name); + } + + } + + protected void registerProviders() { + + registerProvider(new IAIK(), 1); + registerProvider(new ECCProvider(false), 2); + + final String name = XSecProvider.NAME; + if (Security.getProvider(XSecProvider.NAME) == null) { + // register XML Security provider + try { + XSecProvider.addAsProvider(false); + log.info("Required security Provider {} was not yet registered. " + + "Now registered.", name); + selfRegisteredProviders.add(Security.getProvider(name)); + } catch (SecurityException e) { + log.info("Failed to register required security Provider.", e); + } + } else { + log.info("Required security Provider {} already registered.", name); + } + + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java index 5ffe2399..5fd01775 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java @@ -25,13 +25,14 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import at.gv.egiz.bku.binding.BindingProcessor; import at.gv.egiz.bku.binding.HTTPBindingProcessor; -import at.gv.egiz.bku.binding.HttpUtil; +import at.gv.egiz.bku.binding.Id; import at.gv.egiz.bku.binding.IdFactory; -import at.gv.egiz.bku.conf.Configurator; import at.gv.egiz.bku.utils.NullOutputStream; /** @@ -40,7 +41,9 @@ import at.gv.egiz.bku.utils.NullOutputStream; */ public class ResultServlet extends SpringBKUServlet { - private final static Log log = LogFactory.getLog(ResultServlet.class); + private static final long serialVersionUID = 1L; + + private final Logger log = LoggerFactory.getLogger(ResultServlet.class); private String encoding = "UTF-8"; private String expiredPage = "./expiredError.jsp"; @@ -51,12 +54,12 @@ public class ResultServlet extends SpringBKUServlet { private void myInit() { String enc = getServletContext().getInitParameter("responseEncoding"); if (enc != null) { - log.debug("Init default encoding to: " + enc); + log.trace("Init default encoding to: {}.", enc); encoding = enc; } String expP = getServletConfig().getInitParameter("expiredPage"); if (expP != null) { - log.debug("Init expired page to: " + expP); + log.trace("Init expired page to: {}.", expP); expiredPage = expP; } } @@ -80,75 +83,65 @@ public class ResultServlet extends SpringBKUServlet { protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException { - String version = configurator.getProperty(Configurator.SIGNATURE_LAYOUT); - if ((version != null) && (!"".equals(version.trim()))) { - log.debug("setting SignatureLayout header to " + version); - resp.setHeader(Configurator.SIGNATURE_LAYOUT, version); - } else { - log.debug("do not set SignatureLayout header"); - } - - if (configurator.getProperty(Configurator.USERAGENT_CONFIG_P) != null) { - resp.setHeader(HttpUtil.HTTP_HEADER_SERVER, configurator - .getProperty(Configurator.USERAGENT_CONFIG_P)); - } else { - resp.setHeader(HttpUtil.HTTP_HEADER_SERVER, - Configurator.USERAGENT_DEFAULT); - } HttpSession session = req.getSession(false); if (session == null) { resp.sendRedirect(expiredPage); return; } - String sessionId = session.getId(); - if (sessionId == null) { - resp.sendRedirect(expiredPage); - return; - } - log.debug("Got a result request for session: " + sessionId); - HTTPBindingProcessor bp = (HTTPBindingProcessor) getBindingProcessorManager() - .getBindingProcessor(IdFactory.getInstance().createId(sessionId)); - if (bp == null) { + + Id id = IdFactory.getInstance().createId(session.getId()); + + HTTPBindingProcessor bp; + BindingProcessor bindingProcessor = getBindingProcessorManager().getBindingProcessor(id); + if (bindingProcessor instanceof HTTPBindingProcessor) { + bp = (HTTPBindingProcessor) bindingProcessor; + } else { session.invalidate(); resp.sendRedirect(expiredPage); return; } - String redirectUrl = (String) session - .getAttribute(BKURequestHandler.REDIRECT_URL_SESSION_ATTRIBUTE); - if (redirectUrl == null) { - redirectUrl = bp.getRedirectURL(); - } - if (redirectUrl != null) { - try { - bp.writeResultTo(new NullOutputStream(), encoding); - getBindingProcessorManager().removeBindingProcessor(bp.getId()); - } finally { - log.info("Executing deferred browser redirect to: " + redirectUrl); - resp.sendRedirect(redirectUrl); - session.invalidate(); + MDC.put("id", id.toString()); + + try { + String redirectUrl = (String) session + .getAttribute(AbstractWebRequestHandler.REDIRECT_URL_SESSION_ATTRIBUTE); + if (redirectUrl == null) { + redirectUrl = bp.getRedirectURL(); } - return; - } - - log.trace("setting response code: " + bp.getResponseCode()); - resp.setStatus(bp.getResponseCode()); - resp.setHeader("Cache-Control", "no-store"); // HTTP 1.1 - resp.setHeader("Pragma", "no-cache"); // HTTP 1.0 - resp.setDateHeader("Expires", 0); - for (Iterator<String> it = bp.getResponseHeaders().keySet().iterator(); it - .hasNext();) { - String header = it.next(); - if (log.isTraceEnabled()) { - log.trace("setting response header " + header + ": " + bp.getResponseHeaders().get(header)); + if (redirectUrl != null) { + try { + bp.writeResultTo(new NullOutputStream(), encoding); + getBindingProcessorManager().removeBindingProcessor(bp.getId()); + } finally { + log.info("Sending deferred redirect, RedirectURL={}.", redirectUrl); + resp.sendRedirect(redirectUrl); + session.invalidate(); + } + return; + } + + log.trace("Setting response code: {}.", bp.getResponseCode()); + resp.setStatus(bp.getResponseCode()); + resp.setHeader("Cache-Control", "no-store"); // HTTP 1.1 + resp.setHeader("Pragma", "no-cache"); // HTTP 1.0 + resp.setDateHeader("Expires", 0); + for (Iterator<String> it = bp.getResponseHeaders().keySet().iterator(); it + .hasNext();) { + String header = it.next(); + log.trace("Setting response header {}: {}.", header, bp.getResponseHeaders().get(header)); + resp.setHeader(header, bp.getResponseHeaders().get(header)); } - resp.setHeader(header, bp.getResponseHeaders().get(header)); + resp.setContentType(bp.getResultContentType()); + resp.setCharacterEncoding(encoding); + log.info("Sending result."); + bp.writeResultTo(resp.getOutputStream(), encoding); + resp.getOutputStream().flush(); + session.invalidate(); + getBindingProcessorManager().removeBindingProcessor(bp.getId()); + + } finally { + MDC.remove("id"); } - resp.setContentType(bp.getResultContentType()); - resp.setCharacterEncoding(encoding); - bp.writeResultTo(resp.getOutputStream(), encoding); - resp.getOutputStream().flush(); - session.invalidate(); - getBindingProcessorManager().removeBindingProcessor(bp.getId()); } } diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SessionTimeout.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SessionListener.java index 2b56166c..1bec31b6 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SessionTimeout.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SessionListener.java @@ -14,36 +14,34 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.online.webapp;
-
-import javax.servlet.http.HttpSessionEvent;
-import javax.servlet.http.HttpSessionListener;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.binding.BindingProcessorManager;
-import at.gv.egiz.bku.binding.IdFactory;
-
-/**
- * Session listener to trigger the removal of the BindingProcessor
- *
- */
-public class SessionTimeout implements HttpSessionListener {
-
- private static Log log = LogFactory.getLog(SessionTimeout.class);
-
- @Override
- public void sessionCreated(HttpSessionEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void sessionDestroyed(HttpSessionEvent event) {
- BindingProcessorManager manager = (BindingProcessorManager) event.getSession().getServletContext().getAttribute(SpringBKUServlet.BEAN_NAME);
- log.info("Removing session: "+event.getSession().getId());
- manager.removeBindingProcessor(IdFactory.getInstance().createId(event.getSession().getId()));
- }
-
-}
+package at.gv.egiz.bku.online.webapp; + +import javax.servlet.http.HttpSessionEvent; +import javax.servlet.http.HttpSessionListener; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.binding.BindingProcessorManager; +import at.gv.egiz.bku.binding.IdFactory; + +/** + * Session listener to trigger the removal of the BindingProcessor + * + */ +public class SessionListener implements HttpSessionListener { + + private final Logger log = LoggerFactory.getLogger(SessionListener.class); + + @Override + public void sessionCreated(HttpSessionEvent event) { + } + + @Override + public void sessionDestroyed(HttpSessionEvent event) { + BindingProcessorManager manager = (BindingProcessorManager) event.getSession().getServletContext().getAttribute(SpringBKUServlet.BEAN_NAME); + manager.removeBindingProcessor(IdFactory.getInstance().createId(event.getSession().getId())); + log.info("Session {} destroyed.", event.getSession().getId()); + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ShutdownHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ShutdownHandler.java index 741b5e32..39d7368d 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ShutdownHandler.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ShutdownHandler.java @@ -1,48 +1,48 @@ -/*
- * 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.webapp;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.context.ApplicationEvent;
-import org.springframework.context.ApplicationListener;
-import org.springframework.context.event.ContextClosedEvent;
-
-import at.gv.egiz.bku.binding.BindingProcessorManager;
-
-public class ShutdownHandler implements ApplicationListener {
-
- private static Log log = LogFactory.getLog(ShutdownHandler.class);
-
- private BindingProcessorManager bindingProcessorManager;
-
- public void setBindingProcessorManager(
- BindingProcessorManager bindingProcessorManager) {
- this.bindingProcessorManager = bindingProcessorManager;
- }
-
- @Override
- public void onApplicationEvent(ApplicationEvent event) {
- if (event instanceof ContextClosedEvent) {
- log.info("Shutting down BKU");
- bindingProcessorManager.shutdownNow();
- }
-
- }
-
-}
+/* + * 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.webapp; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.ApplicationEvent; +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextClosedEvent; + +import at.gv.egiz.bku.binding.BindingProcessorManager; + +public class ShutdownHandler implements ApplicationListener { + + private final Logger log = LoggerFactory.getLogger(ShutdownHandler.class); + + private BindingProcessorManager bindingProcessorManager; + + public void setBindingProcessorManager( + BindingProcessorManager bindingProcessorManager) { + this.bindingProcessorManager = bindingProcessorManager; + } + + @Override + public void onApplicationEvent(ApplicationEvent event) { + if (event instanceof ContextClosedEvent) { + log.info("Shutting down MOCCA."); + bindingProcessorManager.shutdownNow(); + } + + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SpringBKUServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SpringBKUServlet.java index 2c6f522e..6a6f11e8 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SpringBKUServlet.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/SpringBKUServlet.java @@ -19,19 +19,15 @@ package at.gv.egiz.bku.online.webapp; import javax.servlet.http.HttpServlet; import at.gv.egiz.bku.binding.BindingProcessorManager; -import at.gv.egiz.bku.conf.Configurator; public abstract class SpringBKUServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L; + public final static String BEAN_NAME="bindingProcessorManager"; - protected static Configurator configurator; - protected BindingProcessorManager getBindingProcessorManager() {
return (BindingProcessorManager) getServletContext().getAttribute(BEAN_NAME);
} - public static void setConfigurator(Configurator conf) { - configurator = conf; - }
}
diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/AbstractCommandSequenceBindingProcessor.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/AbstractCommandSequenceBindingProcessor.java new file mode 100644 index 00000000..897ec227 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/AbstractCommandSequenceBindingProcessor.java @@ -0,0 +1,123 @@ +/* +* Copyright 2009 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.mocca.id; + +import java.util.Collections; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.binding.AbstractBindingProcessor; +import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slcommands.SLCommandContext; +import at.gv.egiz.bku.slcommands.SLResult; +import at.gv.egiz.bku.slexceptions.SLCommandException; +import at.gv.egiz.bku.slexceptions.SLException; +import at.gv.egiz.stal.QuitRequest; + +public abstract class AbstractCommandSequenceBindingProcessor extends AbstractBindingProcessor { + + protected static Logger log = LoggerFactory.getLogger(AbstractCommandSequenceBindingProcessor.class); + + /** + * @return the error + */ + protected Exception getError() { + return error; + } + + /** + * @param error the error to set + */ + protected void setError(Exception error) { + this.error = error; + } + + private Exception error; + + private SLCommandBrocker commandBrocker = new SLCommandBrocker(); + + /** + * External processing? + */ + private boolean external; + + /** + * Constructs a new instance of this IdBindingProcessorImpl with + * the given ID. + */ + public AbstractCommandSequenceBindingProcessor() { + super(); + } + + /** + * @return the external + */ + public boolean isExternal() { + return external; + } + + /** + * @param external the external to set + */ + public void setExternal(boolean external) { + this.external = external; + } + + protected abstract SLCommand getNextCommand(); + + protected abstract void processResult(SLResult result); + + @Override + public synchronized void process() { + + try { + + SLCommand command; + do { + command = getNextCommand(); + SLCommandContext context = new SLCommandContext(getSTAL(), getUrlDereferencer(), locale); + SLResult result = null; + if (external) { + result = commandBrocker.execute(command, context, 3 * 60 * 1000); + } else { + if (command != null) { + result = command.execute(context); + } else { + stal.handleRequest(Collections.singletonList(new QuitRequest())); + } + } + if (result != null) { + processResult(result); + } + } while (command != null); + + } catch (InterruptedException e) { + setError(new SLException(6000)); + } catch (Exception e) { + log.info("BindingProcessor error.", e); + setError(e); + } + + } + + public SLCommand setExternalResult(SLResult slResult) throws SLCommandException, InterruptedException { + return commandBrocker.nextCommand(slResult, 3 * 60 * 1000); + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/DataURLServerServlet.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/DataURLServerServlet.java new file mode 100644 index 00000000..b40fd35f --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/DataURLServerServlet.java @@ -0,0 +1,225 @@ +/* +* Copyright 2009 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.mocca.id; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Iterator; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.xml.XMLConstants; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +import at.gv.egiz.bku.binding.BindingProcessor; +import at.gv.egiz.bku.binding.FormParameter; +import at.gv.egiz.bku.binding.IdFactory; +import at.gv.egiz.bku.binding.InputDecoder; +import at.gv.egiz.bku.binding.InputDecoderFactory; +import at.gv.egiz.bku.online.webapp.SpringBKUServlet; +import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slcommands.SLMarshallerFactory; +import at.gv.egiz.bku.slcommands.SLResult; +import at.gv.egiz.bku.slcommands.impl.DomCreateXMLSignatureResultImpl; +import at.gv.egiz.bku.slcommands.impl.DomErrorResultImpl; +import at.gv.egiz.bku.slcommands.impl.DomInfoboxReadResultImpl; +import at.gv.egiz.bku.slcommands.impl.ErrorResultImpl; +import at.gv.egiz.bku.slcommands.impl.SLCommandImpl; +import at.gv.egiz.bku.slexceptions.SLCommandException; +import at.gv.egiz.bku.utils.DebugInputStream; +import at.gv.egiz.bku.utils.StreamUtil; +import at.gv.egiz.slbinding.SLUnmarshaller; + +public class DataURLServerServlet extends SpringBKUServlet { + + private static Logger log = LoggerFactory.getLogger(DataURLServerServlet.class); + + /** + * + */ + private static final long serialVersionUID = 1L; + + /* (non-Javadoc) + * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + @Override + protected void doPost(HttpServletRequest req, HttpServletResponse resp) + throws ServletException, IOException { + + String userAgent = req.getHeader("User-Agent"); + String contentType = req.getContentType(); + log.debug("Content-Type: " + contentType + " User-Agent: " + userAgent); + + InputDecoder dec = InputDecoderFactory.getDecoder(contentType, req.getInputStream()); + + String sessionId = null; + Element respElement = null; + + Iterator<FormParameter> formParams = dec.getFormParameterIterator(); + while(formParams.hasNext()) { + FormParameter parameter = formParams.next(); + String name = parameter.getFormParameterName(); + if ("SessionID_".equals(name)) { + sessionId = StreamUtil.asString(parameter.getFormParameterValue(), "UTF-8"); + log.debug("SessionID: {}", sessionId); + } else if ("ResponseType".equals(name)) { + String parameterContentType = parameter.getFormParameterContentType(); + if (log.isDebugEnabled()) { + log.debug("ResponseType: ({}) {}.", parameterContentType, StreamUtil.asString(parameter.getFormParameterValue(), "UTF-8")); + } + } else if ("XMLResponse".equals(name)) { + InputStream inputStream = parameter.getFormParameterValue(); + + DebugInputStream di = null; + if (log.isDebugEnabled()) { + di = new DebugInputStream(inputStream); + inputStream = di; + } + + SLUnmarshaller slUnmarshaller = new SLUnmarshaller(); + + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + dbf.setSchema(slUnmarshaller.getSlSchema()); + try { + dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + } catch (ParserConfigurationException e) { + log.warn("Failed to enable secure processing.", e); + } + + // http://www.w3.org/TR/xmldsig-bestpractices/#be-aware-schema-normalization + try { + dbf.setAttribute("http://apache.org/xml/features/validation/schema/normalized-value", Boolean.FALSE); + } catch (IllegalArgumentException e) { + log.warn("Failed to disable schema normalization " + + "(see http://www.w3.org/TR/xmldsig-bestpractices/#be-aware-schema-normalization)", e); + } + + DocumentBuilder documentBuilder; + try { + documentBuilder = dbf.newDocumentBuilder(); + } catch (ParserConfigurationException e) { + log.error("Failed to create parser for Security Layer response." , e); + resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + return; + } + + try { + Document doc = documentBuilder.parse(inputStream); + respElement = doc.getDocumentElement(); + } catch (SAXException e) { + log.info("Failed to parse Security Layer response.", e); + // TODO set error and redirect + resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + return; + } + + if (di != null) { + log.debug("XMLResponse:\n{}", new String(di.getBufferedBytes(), "UTF-8")); + } + + } + + } + + SAMLBindingProcessorImpl bindingProcessor = null; + if (sessionId != null) { + bindingProcessor = getBindingProcessor(sessionId); + } + + if (bindingProcessor != null && respElement != null) { + + SLResult slResult = null; + if ("http://www.buergerkarte.at/namespaces/securitylayer/1.2#".equals(respElement.getNamespaceURI())) { + if ("NullOperationResponse".equals(respElement.getLocalName())) { + slResult = null; + } else if ("InfoboxReadResponse".equals(respElement.getLocalName())) { + slResult = new DomInfoboxReadResultImpl(respElement); + } else if ("CreateXMLSignatureResponse".equals(respElement.getLocalName())) { + slResult = new DomCreateXMLSignatureResultImpl(respElement); + } else if ("ErrorResponse".equals(respElement.getLocalName())) { + slResult = new DomErrorResultImpl(respElement); + } else { + // TODO: report proper error + at.gv.egiz.bku.slexceptions.SLException slException = new at.gv.egiz.bku.slexceptions.SLException(0); + slResult = new ErrorResultImpl(slException, null); + } + + } + + SLCommand slCommand = null; + try { + slCommand = bindingProcessor.setExternalResult(slResult); + } catch (SLCommandException e) { + log.debug(e.getMessage()); + } catch (InterruptedException e) { + // interrupted + } + + if (slCommand instanceof SLCommandImpl<?>) { + JAXBElement<?> request = ((SLCommandImpl<?>) slCommand).getRequest(); + Marshaller marshaller = SLMarshallerFactory.getInstance().createMarshaller(false, false); + try { + + resp.setCharacterEncoding("UTF-8"); + resp.setContentType("text/xml"); + + marshaller.marshal(request, resp.getOutputStream()); + + return; + + } catch (JAXBException e) { + log.error("Failed to marshall Security Layer request.", e); + } + + } + + } + + resp.sendRedirect("bkuResult"); + + } + + protected SAMLBindingProcessorImpl getBindingProcessor(String sessionId) { + + BindingProcessor bp = getBindingProcessorManager().getBindingProcessor( + IdFactory.getInstance().createId(sessionId)); + + if (bp instanceof SAMLBindingProcessorImpl) { + log.debug("Found active BindingProcessor, using this one."); + return (SAMLBindingProcessorImpl) bp; + } + + return null; + + } + + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLink.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLink.java new file mode 100644 index 00000000..fd4ef8e7 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLink.java @@ -0,0 +1,346 @@ +/* +* Copyright 2009 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.mocca.id; + +import iaik.xml.crypto.dom.DOMCryptoContext; +import iaik.xml.crypto.dsig.keyinfo.KeyValueType; + +import java.io.IOException; +import java.io.InputStream; +import java.security.PublicKey; +import java.security.cert.X509Certificate; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.crypto.MarshalException; +import javax.xml.crypto.dom.DOMStructure; +import javax.xml.crypto.dsig.Manifest; +import javax.xml.crypto.dsig.Reference; +import javax.xml.crypto.dsig.XMLObject; +import javax.xml.crypto.dsig.XMLSignature; +import javax.xml.crypto.dsig.XMLSignatureException; +import javax.xml.crypto.dsig.XMLSignatureFactory; +import javax.xml.crypto.dsig.dom.DOMValidateContext; +import javax.xml.crypto.dsig.keyinfo.KeyInfo; +import javax.xml.crypto.dsig.keyinfo.X509Data; + +import oasis.names.tc.saml._1_0.assertion.AnyType; +import oasis.names.tc.saml._1_0.assertion.AssertionType; +import oasis.names.tc.saml._1_0.assertion.AttributeStatementType; +import oasis.names.tc.saml._1_0.assertion.AttributeType; +import oasis.names.tc.saml._1_0.assertion.StatementAbstractType; +import oasis.names.tc.saml._1_0.assertion.SubjectConfirmationType; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import at.gv.e_government.reference.namespace.persondata._20020228_.PhysicalPersonType; +import at.gv.egiz.bku.utils.StreamUtil; + +public class IdLink { + + protected Logger log = LoggerFactory.getLogger(IdLink.class); + + /** + * The IdLink is backed by a DOM. + */ + protected Node node; + + /** + * The <code>Assertion</code> (root element) of the IdLink. + */ + protected AssertionType assertion; + + /** + * The citizen's asserted public keys. + */ + protected List<PublicKey> citizenPublicKeys; + + /** + * The XMLSignature. + */ + protected XMLSignature signature; + + /** + * The assertion's signer certificate. + */ + protected X509Certificate signerCert; + + /** + * Is the assertion's signature manifest valid? + */ + protected Boolean manifestValid; + + /** + * Is the assertion's signature valid? + */ + protected Boolean signatureValid; + + /** + * The personal identifier + */ + protected IdLinkPersonData personData; + + public IdLink(Element node, AssertionType assertion) throws JAXBException { + this.node = node; + this.assertion = assertion; + } + + public PhysicalPersonType getPhysicalPerson() { + + AttributeStatementType attributeStatement = getAttributeStatement(); + if (attributeStatement != null) { + JAXBElement<?> subjectConfirmation = attributeStatement.getSubject().getContent().get(0); + if (subjectConfirmation.getDeclaredType() == SubjectConfirmationType.class) { + Object data = ((SubjectConfirmationType) subjectConfirmation.getValue()) + .getSubjectConfirmationData().getContent().get(0); + if (data instanceof JAXBElement<?> + && ((JAXBElement<?>) data).getValue() instanceof PhysicalPersonType) { + return (PhysicalPersonType) ((JAXBElement<?>) data).getValue(); + } + } + } + + return null; + } + + public AttributeStatementType getAttributeStatement() { + + StatementAbstractType statement = + assertion.getStatementOrSubjectStatementOrAuthenticationStatement().get(0); + + if (statement instanceof AttributeStatementType) { + return (AttributeStatementType) statement; + } + + return null; + + } + + public IdLinkPersonData getPersonData() throws MarshalException { + if (personData == null) { + try { + personData = new IdLinkPersonData(getPhysicalPerson()); + } catch (ParseException e) { + throw new MarshalException(e); + } + } + return personData; + } + + public List<PublicKey> getCitizenPublicKeys() throws MarshalException { + if (citizenPublicKeys == null) { + + citizenPublicKeys = new ArrayList<PublicKey>(); + + AttributeStatementType attributeStatement = getAttributeStatement(); + if (attributeStatement != null) { + List<AttributeType> attributes = attributeStatement.getAttribute(); + for (AttributeType attribute : attributes) { + if ("urn:publicid:gv.at:namespaces:identitylink:1.2".equals(attribute.getAttributeNamespace()) + && "CitizenPublicKey".equals(attribute.getAttributeName())) { + List<AnyType> value = attribute.getAttributeValue(); + if (value.size() == 1 && value.get(0).getContent().size() == 1) { + Object object = value.get(0).getContent().get(0); + if (object instanceof Element) { + Element element = (Element) object; + DOMStructure structure = iaik.xml.crypto.dom.DOMStructure.getInstance(element, new DOMCryptoContext()); + if (structure instanceof KeyValueType) { + citizenPublicKeys.add(((KeyValueType) structure).getPublicKey()); + } + } + } + } + } + } + + } + return citizenPublicKeys; + } + + public XMLSignature getXMLSignature() throws MarshalException { + if (signature == null) { + + Node n = node.getLastChild(); + while (n != null && n.getNodeType() != Node.ELEMENT_NODE) { + n = n.getPreviousSibling(); + } + + if (n != null + && XMLSignature.XMLNS.equals(n.getNamespaceURI()) + && "Signature".equals(n.getLocalName())) { + + XMLSignatureFactory signatureFactory = XMLSignatureFactory.getInstance(); + signature = signatureFactory.unmarshalXMLSignature(new DOMStructure(n)); + } + + + } + return signature; + } + + public X509Certificate getSignerCert() throws MarshalException { + if (signerCert == null) { + + if (getXMLSignature() != null) { + + KeyInfo keyInfo = signature.getKeyInfo(); + if (keyInfo != null) { + List<?> content = keyInfo.getContent(); + for (Object data : content) { + if (data instanceof X509Data) { + List<?> x509Data = ((X509Data) data).getContent(); + for (Object object : x509Data) { + if (object instanceof X509Certificate) { + signerCert = (X509Certificate) object; + return signerCert; + } + } + } + } + } + } + } + return signerCert; + } + + + @SuppressWarnings("unchecked") + public boolean verifySignature() throws MarshalException, XMLSignatureException { + if (signatureValid == null) { + if (getXMLSignature() != null && getSignerCert() != null) { + + DOMValidateContext validateContext = new DOMValidateContext(signerCert.getPublicKey(), node); + validateContext.setProperty("javax.xml.crypto.dsig.cacheReference", Boolean.TRUE); + + signatureValid = signature.validate(validateContext); + + // logging + if (!signatureValid && log.isTraceEnabled()) { + List<Reference> references = signature.getSignedInfo().getReferences(); + for (Reference reference : references) { + if (!Manifest.TYPE.equals(reference.getType())) { + if (!reference.validate(validateContext)) { + InputStream digestInputStream = reference.getDigestInputStream(); + if (digestInputStream != null) { + try { + log.trace("SignedInfo's reference digest input:\n{}", + StreamUtil.asString(digestInputStream, "UTF-8")); + } catch (IOException e) { + log.info("Failed to get SignedInfos's reference digest input", e.toString()); + } + } + } else { + try { + log.trace("Signature canonicalized data:\n{}", StreamUtil.asString(signature + .getSignedInfo().getCanonicalizedData(), "UTF-8")); + } catch (IOException e) { + log.info("Failed to get canonicalized data.", e); + } + } + break; + } + } + } + + } + } + return signatureValid; + } + + @SuppressWarnings("unchecked") + public boolean verifyManifest() throws MarshalException, XMLSignatureException { + if (manifestValid == null) { + if (getXMLSignature() != null && getSignerCert() != null) { + + DOMValidateContext validateContext = new DOMValidateContext(signerCert.getPublicKey(), node); + if (log.isTraceEnabled()) { + // enable reference caching in trace log-level + validateContext.setProperty("javax.xml.crypto.dsig.cacheReference", Boolean.TRUE); + } + boolean valid = false; + + // validate manifest + List<XMLObject> objects = signature.getObjects(); + for (XMLObject object : objects) { + List<?> content = object.getContent(); + if (content.get(0) instanceof Manifest) { + Manifest manifest = (Manifest) content.get(0); + List<Reference> references = manifest.getReferences(); + for (Reference reference : references) { + + valid = reference.validate(validateContext); + + // logging + if (!valid && log.isTraceEnabled()) { + InputStream digestInputStream = reference.getDigestInputStream(); + if (digestInputStream != null) { + try { + log.trace("Manifest's reference digest input:\n{}", + StreamUtil.asString(digestInputStream, "UTF-8")); + } catch (IOException e) { + log.info("Failed to get Manifest's reference digest input", e.toString()); + } + } + } + break; + } + } + } + + // validate reference to manifest + if (valid) { + List<Reference> references = signature.getSignedInfo().getReferences(); + for (Reference reference : references) { + if (Manifest.TYPE.equals(reference.getType())) { + + boolean refValid = reference.validate(validateContext); + + // logging + if (!refValid && log.isTraceEnabled()) { + InputStream digestInputStream = reference.getDigestInputStream(); + if (digestInputStream != null) { + try { + log.trace("SignedInfo's manifest reference digest input:\n{}", + StreamUtil.asString(digestInputStream, "UTF-8")); + } catch (IOException e) { + log.info("Failed to get SignedInfos's manifest reference digest input", e.toString()); + } + } + } + + valid &= refValid; + + } + } + } + + manifestValid = valid; + + } + + } + return manifestValid; + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLinkException.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLinkException.java new file mode 100644 index 00000000..12383861 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLinkException.java @@ -0,0 +1,43 @@ +/* +* Copyright 2009 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.mocca.id; + +public class IdLinkException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public IdLinkException() { + super(); + } + + public IdLinkException(String message, Throwable cause) { + super(message, cause); + } + + public IdLinkException(String message) { + super(message); + } + + public IdLinkException(Throwable cause) { + super(cause); + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLinkFactory.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLinkFactory.java new file mode 100644 index 00000000..90312af3 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLinkFactory.java @@ -0,0 +1,154 @@ +/* +* Copyright 2009 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.mocca.id; + +import java.io.IOException; +import java.net.URL; + +import javax.xml.XMLConstants; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Source; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; + +import oasis.names.tc.saml._1_0.assertion.AssertionType; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +public class IdLinkFactory { + + protected static Logger log = LoggerFactory.getLogger(IdLinkFactory.class); + + public static final String[] SCHEMA_FILES = new String[] { + "at/gv/egiz/mocca/id/idlschema/xmldsig-more.xsd", + "at/gv/egiz/mocca/id/idlschema/xmldsig-core-schema.xsd", + "at/gv/egiz/mocca/id/idlschema/PersonData.xsd", + "at/gv/egiz/mocca/id/idlschema/oasis-sstc-saml-schema-assertion-1.0.xsd"}; + + private static class InstanceHolder { + private static final IdLinkFactory INSTANCE = new IdLinkFactory(); + } + + public static IdLinkFactory getInstance() { + return InstanceHolder.INSTANCE; + } + + static { +// InitDOMStructure.init(); + } + + private final Schema idlSchema; + + private final JAXBContext jaxbContext; + + + private IdLinkFactory() { + + try { + SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + Source[] sources = new Source[SCHEMA_FILES.length]; + for (int i = 0; i < SCHEMA_FILES.length; i++) { + String schemaFile = SCHEMA_FILES[i]; + URL schemaURL = cl.getResource(schemaFile); + if (schemaURL == null) { + throw new RuntimeException("Failed to load schema file " + schemaFile + "."); + } + log.debug("Schema location: " + schemaURL); + sources[i] = new StreamSource(schemaURL.openStream()); + } + idlSchema = schemaFactory.newSchema(sources); + } catch (IOException e) { + log.error("Failed to load identity link schema.", e); + throw new RuntimeException(e); + } catch (SAXException e) { + log.error("Failed to load identity link schema.", e); + throw new RuntimeException(e); + } + + StringBuffer packageNames = new StringBuffer(); + packageNames.append(at.gv.e_government.reference.namespace.persondata._20020228_.ObjectFactory.class.getPackage().getName()); + packageNames.append(":"); + packageNames.append(oasis.names.tc.saml._1_0.assertion.ObjectFactory.class.getPackage().getName()); + + try { + jaxbContext = JAXBContext.newInstance(packageNames.toString()); + } catch (JAXBException e) { + // we should not get an JAXBException initializing the JAXBContext + throw new RuntimeException(e); + } + + } + + public IdLink unmarshallIdLink(InputSource source) throws IdLinkException, + ParserConfigurationException, SAXException, IOException, JAXBException { + + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + dbf.setSchema(idlSchema); + dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + + // http://www.w3.org/TR/xmldsig-bestpractices/#be-aware-schema-normalization + try { + dbf.setAttribute("http://apache.org/xml/features/validation/schema/normalized-value", Boolean.FALSE); + } catch (IllegalArgumentException e) { + log.warn("Failed to disable schema normalization " + + "(see http://www.w3.org/TR/xmldsig-bestpractices/#be-aware-schema-normalization)", e); + } + + DocumentBuilder documentBuilder = dbf.newDocumentBuilder(); + Document doc = documentBuilder.parse(source); + + return unmarshallIdLink(doc.getDocumentElement()); + + } + + public IdLink unmarshallIdLink(Element element) throws IdLinkException, JAXBException { + + Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); + unmarshaller.setSchema(idlSchema); + + Object object = unmarshaller.unmarshal(element); + + IdLink idLink; + if (object instanceof JAXBElement<?> + && ((JAXBElement<?>) object).getDeclaredType() == AssertionType.class) { + idLink = new IdLink(element, (AssertionType) ((JAXBElement<?>) object).getValue()); + } else { + throw new IllegalArgumentException("Parameter node is not a " + + new QName("urn:oasis:names:tc:SAML:1.0:assertion", "Assertion")); + } + + return idLink; + + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLinkKeySelector.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLinkKeySelector.java new file mode 100644 index 00000000..493b92af --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLinkKeySelector.java @@ -0,0 +1,88 @@ +/* +* Copyright 2009 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.mocca.id; + +import java.security.Key; +import java.security.PublicKey; +import java.security.cert.X509Certificate; + +import javax.xml.crypto.AlgorithmMethod; +import javax.xml.crypto.KeySelector; +import javax.xml.crypto.KeySelectorException; +import javax.xml.crypto.KeySelectorResult; +import javax.xml.crypto.MarshalException; +import javax.xml.crypto.XMLCryptoContext; +import javax.xml.crypto.dsig.keyinfo.KeyInfo; +import javax.xml.crypto.dsig.keyinfo.X509Data; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class IdLinkKeySelector extends KeySelector { + + private static Logger log = LoggerFactory.getLogger(IdLinkKeySelector.class); + + private IdLink idLink; + + public IdLinkKeySelector(IdLink idLink) { + super(); + if (idLink == null) { + throw new NullPointerException("Parameter 'idLink' must not be null."); + } + this.idLink = idLink; + } + + @Override + public KeySelectorResult select(KeyInfo keyInfo, Purpose purpose, + AlgorithmMethod method, XMLCryptoContext context) + throws KeySelectorException { + + if (purpose != Purpose.VERIFY) { + throw new KeySelectorException("KeySelector does not support purpose " + + purpose + "."); + } + + try { + for (Object ki : keyInfo.getContent()) { + if (ki instanceof X509Data) { + for (Object xd : ((X509Data) ki).getContent()) { + if (xd instanceof X509Certificate) { + final PublicKey publicKey = ((X509Certificate) xd).getPublicKey(); + if (idLink.getCitizenPublicKeys().contains(publicKey)) { + log.trace("Found matching key {} in identiy link and KeyInfo.", publicKey); + return new KeySelectorResult() { + @Override + public Key getKey() { + return publicKey; + } + }; + } + } + } + } + } + } catch (MarshalException e) { + log.info("Failed to get public keys from identity link.", e); + throw new KeySelectorException(e); + } + + log.info("Did not find matching public keys in the identity link and the KeyInfo."); + return null; + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLinkPersonData.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLinkPersonData.java new file mode 100644 index 00000000..5b6f4453 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/IdLinkPersonData.java @@ -0,0 +1,76 @@ +/* +* Copyright 2009 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.mocca.id; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import at.gv.e_government.reference.namespace.persondata._20020228_.IdentificationType; +import at.gv.e_government.reference.namespace.persondata._20020228_.PhysicalPersonType; + +public class IdLinkPersonData { + + private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); + + protected PersonalIdentifier identifier; + + protected String familyName; + + protected String givenName; + + protected Date dateOfBirth; + + public IdLinkPersonData(PhysicalPersonType physicalPerson) throws ParseException { + familyName = physicalPerson.getName().getFamilyName().get(0).getValue(); + givenName = physicalPerson.getName().getGivenName().get(0); + dateOfBirth = DATE_FORMAT.parse(physicalPerson.getDateOfBirth()); + IdentificationType identificationType = physicalPerson.getIdentification().get(0); + if (identificationType != null) { + identifier = new PersonalIdentifier(identificationType.getType(), + identificationType.getValue().getValue()); + } + } + + public String getGivenName() { + return givenName; + } + + public String getFamilyName() { + return familyName; + } + + public Date getDateOfBirth() throws ParseException { + return dateOfBirth; + } + + public PersonalIdentifier getIdentifier() { + return identifier; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return familyName + ", " + givenName + ", " + DATE_FORMAT.format(dateOfBirth); + } + + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/PersonalIdentifier.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/PersonalIdentifier.java new file mode 100644 index 00000000..ad108dc2 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/PersonalIdentifier.java @@ -0,0 +1,81 @@ +/* +* Copyright 2009 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.mocca.id; + +import iaik.utils.Base64OutputStream; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +public class PersonalIdentifier { + + public static final String PREFIX = "urn:publicid:gv.at:"; + + public static final String BASE_ID = PREFIX + "baseid"; + + + protected String type; + + protected String value; + + public PersonalIdentifier(String type, String value) { + this.type = type; + this.value = value; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @return the value + */ + public String getValue() { + return value; + } + + public PersonalIdentifier getDerivedValue(String domainId) { + + if (BASE_ID.equals(type)) { + try { + MessageDigest md = MessageDigest.getInstance("SHA"); + ByteArrayOutputStream os = new ByteArrayOutputStream(); + Base64OutputStream bos = new Base64OutputStream(os); + bos.write(md.digest((value + '+' + domainId).getBytes("ISO-8859-1"))); + bos.flush(); + return new PersonalIdentifier(domainId, os.toString("ASCII")); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + return null; + + } + + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/QESTemplates.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/QESTemplates.java new file mode 100644 index 00000000..8737d39c --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/QESTemplates.java @@ -0,0 +1,115 @@ +/* +* Copyright 2009 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.mocca.id; + +import java.io.InputStream; +import java.io.StringWriter; +import java.text.DateFormat; +import java.text.ParseException; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import javax.xml.crypto.MarshalException; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import at.gv.egiz.bku.slexceptions.SLRuntimeException; + +public class QESTemplates { + + private Map<String, Templates> templatesMap = Collections.synchronizedMap(new HashMap<String, Templates>()); + + private synchronized Templates getTemplates(String id) { + + Templates templates = templatesMap.get(id); + if (templates == null) { + templates = loadTemplates(id); + templatesMap.put(id, templates); + } + return templates; + + } + + protected Templates loadTemplates(String id) { + + InputStream xsl = QESTemplates.class.getResourceAsStream("/templates/template.xsl"); + if (xsl == null) { + throw new IllegalArgumentException("Template not found."); + } + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + try { + return transformerFactory.newTemplates(new StreamSource(xsl)); + } catch (TransformerConfigurationException e) { + throw new SLRuntimeException(e); + } + + } + + public String createQESTemplate(String id, Locale locale, IdLink idLink, String url, PersonalIdentifier derivedIdentifier, Date dateTime) { + + Templates templates = getTemplates(id); + try { + Transformer transformer = templates.newTransformer(); + + DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, locale); + DateFormat timeFormat = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale); + + IdLinkPersonData personData = idLink.getPersonData(); + + transformer.setParameter("givenName", personData.getGivenName()); + transformer.setParameter("familyName", personData.getFamilyName()); + transformer.setParameter("dateOfBirth", dateFormat.format(personData.getDateOfBirth())); + + transformer.setParameter("url", url); + transformer.setParameter("identifierType", derivedIdentifier.getType()); + transformer.setParameter("identifierValue", derivedIdentifier.getValue()); + + transformer.setParameter("date", dateFormat.format(dateTime)); + transformer.setParameter("time", timeFormat.format(dateTime)); + + + StringWriter writer = new StringWriter(); + transformer.transform(new StreamSource(), new StreamResult(writer)); + + + return writer.toString(); + } catch (TransformerConfigurationException e) { + throw new SLRuntimeException(e); + } catch (TransformerException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (MarshalException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ParseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLBindingProcessorFactory.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLBindingProcessorFactory.java new file mode 100644 index 00000000..9a71b32f --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLBindingProcessorFactory.java @@ -0,0 +1,44 @@ +/* +* Copyright 2009 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.mocca.id; + +import java.util.Collections; +import java.util.Set; + +import at.gv.egiz.bku.binding.AbstractBindingProcessorFactory; +import at.gv.egiz.bku.binding.BindingProcessor; +import at.gv.egiz.bku.binding.BindingProcessorFactory; +import at.gv.egiz.bku.utils.binding.Protocol; + +public class SAMLBindingProcessorFactory extends AbstractBindingProcessorFactory implements BindingProcessorFactory { + + private Set<Protocol> supportedProtocols = Collections.singleton(Protocol.SAML); + + @Override + public Set<Protocol> getSupportedProtocols() { + return supportedProtocols; + } + + @Override + public BindingProcessor createBindingProcessor() { + SAMLBindingProcessorImpl bindingProcessor = new SAMLBindingProcessorImpl(); + configureBindingProcessor(bindingProcessor); + return bindingProcessor; + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLBindingProcessorImpl.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLBindingProcessorImpl.java new file mode 100644 index 00000000..ce4ac425 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLBindingProcessorImpl.java @@ -0,0 +1,357 @@ +/* + * Copyright 2009 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.mocca.id; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.charset.Charset; +import java.util.Collections; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletResponse; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.crypto.MarshalException; +import javax.xml.crypto.dsig.XMLSignature; +import javax.xml.crypto.dsig.XMLSignatureException; +import javax.xml.crypto.dsig.XMLSignatureFactory; +import javax.xml.crypto.dsig.dom.DOMValidateContext; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import at.buergerkarte.namespaces.securitylayer._1.AnyChildrenType; +import at.buergerkarte.namespaces.securitylayer._1.Base64XMLLocRefOptRefContentType; +import at.buergerkarte.namespaces.securitylayer._1.CreateXMLSignatureRequestType; +import at.buergerkarte.namespaces.securitylayer._1.DataObjectInfoType; +import at.buergerkarte.namespaces.securitylayer._1.InfoboxReadParamsBinaryFileType; +import at.buergerkarte.namespaces.securitylayer._1.InfoboxReadRequestType; +import at.buergerkarte.namespaces.securitylayer._1.MetaInfoType; +import at.buergerkarte.namespaces.securitylayer._1.ObjectFactory; +import at.buergerkarte.namespaces.securitylayer._1.TransformsInfoType; +import at.gv.egiz.bku.binding.FormParameter; +import at.gv.egiz.bku.binding.HTTPBindingProcessor; +import at.gv.egiz.bku.binding.HttpUtil; +import at.gv.egiz.bku.binding.InputDecoder; +import at.gv.egiz.bku.binding.InputDecoderFactory; +import at.gv.egiz.bku.slcommands.CreateXMLSignatureResult; +import at.gv.egiz.bku.slcommands.ErrorResult; +import at.gv.egiz.bku.slcommands.InfoboxReadResult; +import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slcommands.SLCommandFactory; +import at.gv.egiz.bku.slcommands.SLResult; +import at.gv.egiz.bku.slexceptions.SLCommandException; +import at.gv.egiz.bku.slexceptions.SLVersionException; + +public class SAMLBindingProcessorImpl extends + AbstractCommandSequenceBindingProcessor implements HTTPBindingProcessor { + + private static final Logger log = LoggerFactory + .getLogger(SAMLBindingProcessorImpl.class); + + private String requestContentType; + + private String domainIdentifier = "urn:publicid:gv.at:wbpk+FN+468924i"; + + private String keyBoxIdentifier = "SecureSignatureKeypair"; + + private String url = "www.egiz.gv.at"; + + private QESTemplates templates = new QESTemplates(); + + private IdLink idLink; + + private Element signature; + + private SLResult errorResponse; + + @Override + protected void processResult(SLResult result) { + if (result instanceof ErrorResult) { + ErrorResult errorResult = (ErrorResult) result; + log.info("Got ErrorResponse {}: {}", errorResult.getErrorCode(), + errorResult.getInfo()); + errorResponse = result; + return; + } else if (result instanceof InfoboxReadResult) { + try { + processInfoboxReadResult((InfoboxReadResult) result); + if (idLink != null) { + try { + IdLinkPersonData personData = idLink.getPersonData(); + log.info("Got idLink for {}.", personData); + } catch (MarshalException e) { + log.info("Failed to unmarshal idLink."); + } + } + } catch (JAXBException e) { + log.info("InfoboxReadResult contains unexpected data.", e); + errorResponse = result; + } catch (IdLinkException e) { + log.info("InfoboxReadResult contains invalid identity link.", e); + errorResponse = result; + } + } else if (result instanceof CreateXMLSignatureResult) { + signature = ((CreateXMLSignatureResult) result).getContent(); + log.info("Got signature."); + boolean valid = validate(signature) && validate(idLink); + log.info("Signature is valid: " + valid); + } + } + + @Override + protected SLCommand getNextCommand() { + + JAXBElement<?> request = null; + if (errorResponse == null) { + if (idLink == null) { + request = createReadInfoboxRequest(domainIdentifier); + } else if (signature == null) { + request = createXMLSignatureRequest(); + } + } + + if (request != null) { + SLCommandFactory commandFactory = SLCommandFactory.getInstance(); + try { + return commandFactory.createSLCommand(request); + } catch (SLCommandException e) { + log.error("Failed to create SLCommand.", e); + setError(e); + } catch (SLVersionException e) { + log.error("Failed to create SLCommand.", e); + setError(e); + } + } + + return null; + } + + protected void processInfoboxReadResult(InfoboxReadResult result) + throws JAXBException, IdLinkException { + + Object object = result.getContent(); + if (object instanceof byte[]) { + log.info("InfoboxReadResult contains unexpected binary data."); + errorResponse = result; + return; + } else if (object instanceof List<?>) { + JAXBException exception = null; + for (Object content : (List<?>) object) { + if (content instanceof Element) { + try { + idLink = IdLinkFactory.getInstance().unmarshallIdLink( + (Element) content); + return; + } catch (JAXBException e) { + exception = e; + } + } + } + if (exception != null) { + throw exception; + } + } + + } + + @Override + public void setHTTPHeaders(Map<String, String> headerMap) { + for (String header : headerMap.keySet()) { + if (HttpUtil.HTTP_HEADER_CONTENT_TYPE.equalsIgnoreCase(header)) { + requestContentType = headerMap.get(header); + } + } + } + + @Override + public void consumeRequestStream(String url, InputStream is) { + InputDecoder inputDecoder = InputDecoderFactory.getDecoder( + requestContentType, is); + Iterator<FormParameter> fpi = inputDecoder.getFormParameterIterator(); + while (fpi.hasNext()) { + FormParameter formParameter = fpi.next(); + if ("BKUUrl".equals(formParameter.getFormParameterName())) { + setExternal(true); + } + } + } + + @Override + public String getResultContentType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void writeResultTo(OutputStream os, String encoding) + throws IOException { + // TODO Auto-generated method stub + + } + + protected JAXBElement<InfoboxReadRequestType> createReadInfoboxRequest( + String domainIdentifier) { + + ObjectFactory factory = new ObjectFactory(); + + InfoboxReadRequestType infoboxReadRequestType = factory + .createInfoboxReadRequestType(); + infoboxReadRequestType.setInfoboxIdentifier("IdentityLink"); + + InfoboxReadParamsBinaryFileType infoboxReadParamsBinaryFileType = factory + .createInfoboxReadParamsBinaryFileType(); + infoboxReadParamsBinaryFileType.setContentIsXMLEntity(true); + infoboxReadRequestType + .setBinaryFileParameters(infoboxReadParamsBinaryFileType); + + if (domainIdentifier != null) { + JAXBElement<String> identityLinkDomainIdentifier = factory + .createIdentityLinkDomainIdentifier(domainIdentifier); + AnyChildrenType anyChildrenType = factory.createAnyChildrenType(); + anyChildrenType.getAny().add(identityLinkDomainIdentifier); + + infoboxReadRequestType.setBoxSpecificParameters(anyChildrenType); + } + + return factory.createInfoboxReadRequest(infoboxReadRequestType); + + } + + protected JAXBElement<CreateXMLSignatureRequestType> createXMLSignatureRequest() { + + ObjectFactory factory = new ObjectFactory(); + + CreateXMLSignatureRequestType createXMLSignatureRequest = factory + .createCreateXMLSignatureRequestType(); + createXMLSignatureRequest.setKeyboxIdentifier(keyBoxIdentifier); + + DataObjectInfoType dataObjectInfoType = factory.createDataObjectInfoType(); + dataObjectInfoType.setStructure("enveloping"); + + TransformsInfoType transformsInfoType = factory.createTransformsInfoType(); + MetaInfoType metaInfoType = factory.createMetaInfoType(); + metaInfoType.setMimeType("application/xhtml+xml"); + transformsInfoType.setFinalDataMetaInfo(metaInfoType); + + dataObjectInfoType.getTransformsInfo().add(transformsInfoType); + + Base64XMLLocRefOptRefContentType contentType = factory + .createBase64XMLLocRefOptRefContentType(); + + PersonalIdentifier identifier; + try { + identifier = idLink.getPersonData().getIdentifier(); + } catch (MarshalException e) { + setError(e); + return null; + } + if ("urn:publicid:gv.at:baseid".equals(identifier.getType())) { + identifier = identifier.getDerivedValue(domainIdentifier); + } + String template = templates.createQESTemplate("test", locale, idLink, "", + identifier, new Date()); + + contentType.setBase64Content(template.getBytes(Charset.forName("UTF-8"))); + + dataObjectInfoType.setDataObject(contentType); + + createXMLSignatureRequest.getDataObjectInfo().add(dataObjectInfoType); + + return factory.createCreateXMLSignatureRequest(createXMLSignatureRequest); + + } + + protected boolean validate(IdLink idLink) { + try { + if (domainIdentifier != null && domainIdentifier.startsWith("urn:publicid:gv.at:ccid")) { + if (!idLink.verifyManifest()) { + log.info("Identity link manifest verification failed."); + return false; + } + } + if (idLink.verifySignature()) { + return true; + } + } catch (MarshalException e) { + log.info("Identity link signature verification failed.", e); + } catch (XMLSignatureException e) { + log.info("Identity link signature verification failed.", e); + } + log.info("Identity link signature verification failed."); + return false; + } + + + protected boolean validate(Element signature) { + + Document doc = signature.getOwnerDocument(); + if (signature != signature.getOwnerDocument().getDocumentElement()) { + doc.replaceChild(signature, doc.getDocumentElement()); + } + + XMLSignatureFactory xmlSignatureFactory = XMLSignatureFactory.getInstance(); + + try { + IdLinkKeySelector keySelector = new IdLinkKeySelector(idLink); + DOMValidateContext validateContext = new DOMValidateContext(keySelector, signature); + + XMLSignature xmlSignature = xmlSignatureFactory + .unmarshalXMLSignature(validateContext); + + return xmlSignature.validate(validateContext); + } catch (MarshalException e) { + log.info("Failed to unmarshall signature.", e); + } catch (XMLSignatureException e) { + log.info("Failed to validate signature.", e); + } + return false; + } + + @Override + public InputStream getFormData(String parameterName) { + if ("appletPage".equals(parameterName)) { + String appletPage = (isExternal()) ? "local.jsp" : "applet.jsp"; + return new ByteArrayInputStream(appletPage.getBytes()); + } + return null; + } + + @Override + public String getRedirectURL() { + return null; + } + + @Override + public int getResponseCode() { + return HttpServletResponse.SC_OK; + } + + @Override + public Map<String, String> getResponseHeaders() { + return Collections.emptyMap(); + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLRequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLRequestHandler.java new file mode 100644 index 00000000..0209ca79 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SAMLRequestHandler.java @@ -0,0 +1,33 @@ +/* +* Copyright 2009 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.mocca.id; + +import javax.servlet.http.HttpServletRequest; + +import at.gv.egiz.bku.online.webapp.AbstractWebRequestHandler; + +public class SAMLRequestHandler extends AbstractWebRequestHandler { + + private static final long serialVersionUID = 1L; + + @Override + protected String getRequestProtocol(HttpServletRequest req) { + return "SAML"; + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SLCommandBrocker.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SLCommandBrocker.java new file mode 100644 index 00000000..2e46a220 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/SLCommandBrocker.java @@ -0,0 +1,100 @@ +/* +* Copyright 2009 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.mocca.id; + +import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slcommands.SLCommandContext; +import at.gv.egiz.bku.slcommands.SLResult; +import at.gv.egiz.bku.slcommands.impl.ErrorResultImpl; +import at.gv.egiz.bku.slexceptions.SLCommandException; + +public class SLCommandBrocker { + + private Sync<SLCommand> commandSync = new Sync<SLCommand>(); + + private Sync<SLResult> resultSync = new Sync<SLResult>(); + + public SLResult execute(SLCommand command, SLCommandContext context, long timeout) throws InterruptedException { + try { + commandSync.put(command, timeout); + if (command != null) { + return resultSync.get(timeout); + } else { + return null; + } + } catch (SLCommandException e) { + return new ErrorResultImpl(e, context.getLocale()); + } + } + + public SLCommand nextCommand(SLResult result, long timeout) throws SLCommandException, InterruptedException { + if (result != null) { + resultSync.put(result, timeout); + } + return commandSync.get(timeout); + } + + public class Sync<R> { + + private boolean available; + + private R r; + + public synchronized R get(long timeout) throws SLCommandException, InterruptedException { + + long t0 = System.currentTimeMillis(); + long elapsed = 0; + + while (!available) { + wait(timeout - elapsed); + elapsed = System.currentTimeMillis() - t0; + if (elapsed > timeout) { + notifyAll(); + throw new SLCommandException(6000); + } + } + + R r = this.r; + this.r = null; + available = false; + notifyAll(); + return r; + } + + public synchronized void put(R r, long timeout) throws SLCommandException, InterruptedException { + + long t0 = System.currentTimeMillis(); + long elapsed = 0; + + while (available) { + wait(timeout - elapsed); + elapsed = System.currentTimeMillis() - t0; + if (elapsed > timeout) { + notifyAll(); + throw new SLCommandException(6000); + } + } + + this.r = r; + available = true; + notifyAll(); + } + + } + +} diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/RequestBrokerSTALFactory.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/RequestBrokerSTALFactory.java index 305d8c1c..5940f505 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/RequestBrokerSTALFactory.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/RequestBrokerSTALFactory.java @@ -19,27 +19,50 @@ package at.gv.egiz.stal.service.impl; import java.util.Locale; +import org.apache.commons.configuration.Configuration; + +import at.gv.egiz.bku.conf.MoccaConfigurationFacade; +import at.gv.egiz.bku.jmx.ComponentMXBean; +import at.gv.egiz.bku.jmx.ComponentState; import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.STALFactory; /** * - * @author clemens + * @author clemens, mcentner */ -public class RequestBrokerSTALFactory implements STALFactory { - - private static long timeout = -1; +public class RequestBrokerSTALFactory implements STALFactory, ComponentMXBean { - @Override - public STAL createSTAL() { - return new STALRequestBrokerImpl(timeout); - } + public final ConfigurationFacade configurationFacade = new ConfigurationFacade(); + + public class ConfigurationFacade implements MoccaConfigurationFacade { + + private Configuration configuration; + + public static final String APPLET_TIMEOUT = "AppletTimeout"; - @Override - public void setLocale(Locale locale) { + public int getAppletTimeout() { + return configuration.getInteger(APPLET_TIMEOUT, -1); } + + } + + public void setConfiguration(Configuration configuration) { + configurationFacade.configuration = configuration; + } + + @Override + public STAL createSTAL() { + return new STALRequestBrokerImpl(configurationFacade.getAppletTimeout()); + } + + @Override + public void setLocale(Locale locale) { + } + + @Override + public ComponentState checkComponentState() { + return new ComponentState(true); + } - public static void setTimeout(long millisec) { - timeout = millisec; - } } diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java index a2447ab7..5705a9f7 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java @@ -34,8 +34,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.xml.bind.JAXBElement; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * An instance of STALRequestBroker is shared between a producer thread (SLCommand) @@ -50,7 +50,7 @@ import org.apache.commons.logging.LogFactory; */ public class STALRequestBrokerImpl implements STALRequestBroker { - private static final Log log = LogFactory.getLog(STALRequestBrokerImpl.class); + private final Logger log = LoggerFactory.getLogger(STALRequestBrokerImpl.class); private ObjectFactory of = new ObjectFactory(); private STALTranslator translator = new STALTranslator(); @@ -173,7 +173,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker { log.trace("waiting to consume response"); responses.wait(timeout); if (System.currentTimeMillis() - beforeWait >= timeout) { - log.warn("timeout while waiting to consume response, cleanup requests"); + log.warn("Timeout while waiting to consume response, cleanup requests."); requests.clear(); hashDataInputs.clear(); return Collections.singletonList((STALResponse) new ErrorResponse(ERR_4500)); @@ -218,7 +218,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker { log.trace("waiting to consume request"); requests.wait(timeout); if (System.currentTimeMillis() - beforeWait >= timeout) { - log.warn("timeout while waiting to consume request"); + log.warn("Timeout while waiting to consume request."); return createSingleQuitRequest(); } } @@ -250,11 +250,11 @@ public class STALRequestBrokerImpl implements STALRequestBroker { } try { synchronized (requests) { - log.trace("received responses, now consume request"); + log.trace("Received responses, now consume request."); if (requests.size() != 0) { requests.clear(); } else { - log.warn("requests queue is empty, response might have already been produced previously "); + log.warn("Requests queue is empty, response might have already been produced previously."); // return QUIT? } } @@ -266,7 +266,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker { log.trace("waiting to produce response"); responses.wait(timeout); if (System.currentTimeMillis() - beforeWait >= timeout) { - log.warn("timeout while waiting to produce response"); + log.warn("Timeout while waiting to produce response."); return createSingleQuitRequest(); } } @@ -281,7 +281,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker { log.trace("notifying response consumers"); responses.notify(); } else { - log.error("Received NextRequest without responses, return QUIT"); + log.error("Received NextRequest without responses, return QUIT."); return createSingleQuitRequest(); } } @@ -292,11 +292,11 @@ public class STALRequestBrokerImpl implements STALRequestBroker { log.trace("waiting to consume request"); requests.wait(timeout); if (System.currentTimeMillis() - beforeWait >= timeout) { - log.warn("timeout while waiting to consume request"); + log.warn("Timeout while waiting to consume request."); return createSingleQuitRequest(); } } - log.trace("don't consume request now, but on next response delivery"); + log.trace("Don't consume request now, but on next response delivery."); return requests; } } catch (InterruptedException ex) { @@ -309,7 +309,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker { @Override public List<HashDataInput> getHashDataInput() { synchronized (requests) { - log.trace("return " + hashDataInputs.size() + " current HashDataInput(s) "); + log.trace("Return {} current HashDataInput(s).", hashDataInputs.size()); return hashDataInputs; } } diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java index c8ab280f..e32dad8f 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java @@ -16,13 +16,30 @@ */ package at.gv.egiz.stal.service.impl; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.jws.WebService; +import javax.servlet.ServletContext; +import javax.xml.bind.JAXBElement; +import javax.xml.ws.WebServiceContext; +import javax.xml.ws.handler.MessageContext; + +import org.slf4j.MDC; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import at.buergerkarte.namespaces.cardchannel.service.CommandAPDUType; import at.buergerkarte.namespaces.cardchannel.service.ScriptType; import at.gv.egiz.bku.binding.BindingProcessor; import at.gv.egiz.bku.binding.BindingProcessorManager; import at.gv.egiz.bku.binding.Id; import at.gv.egiz.bku.binding.IdFactory; - import at.gv.egiz.stal.HashDataInput; import at.gv.egiz.stal.service.GetHashDataInputFault; import at.gv.egiz.stal.service.STALPortType; @@ -38,25 +55,8 @@ import at.gv.egiz.stal.service.types.RequestType; import at.gv.egiz.stal.service.types.ResponseType; import at.gv.egiz.stal.service.types.SignRequestType; import at.gv.egiz.stal.service.types.GetHashDataInputType.Reference; -//import at.gv.egiz.stal.service.types.GetHashDataInputResponseType.Reference; import com.sun.xml.ws.developer.UsesJAXBContext; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import javax.annotation.Resource; -import javax.jws.WebService; -import javax.servlet.ServletContext; -import javax.xml.bind.JAXBElement; -import javax.xml.ws.WebServiceContext; -import javax.xml.ws.handler.MessageContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * @@ -68,10 +68,10 @@ public class STALServiceImpl implements STALPortType { public static final String BINDING_PROCESSOR_MANAGER = "bindingProcessorManager"; public static final Id TEST_SESSION_ID = IdFactory.getInstance().createId("TestSession"); - protected static final Log log = LogFactory.getLog(STALServiceImpl.class); - + private final Logger log = LoggerFactory.getLogger(STALServiceImpl.class); static { + Logger log = LoggerFactory.getLogger(STALServiceImpl.class); if (log.isTraceEnabled()) { log.trace("enabling webservice communication dump"); System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true"); @@ -91,227 +91,242 @@ public class STALServiceImpl implements STALPortType { public GetNextRequestResponseType connect(String sessId) { if (sessId == null) { - throw new NullPointerException("No session id provided"); + throw new NullPointerException("No session id provided."); } Id sessionId = idF.createId(sessId); + MDC.put("id", sessionId.toString()); - if (log.isDebugEnabled()) { - log.debug("Received Connect [" + sessionId + "]"); - } - - if (TEST_SESSION_ID.equals(sessionId)) { - return getTestSessionNextRequestResponse(null); - } - - GetNextRequestResponseType response = new GetNextRequestResponseType(); - response.setSessionId(sessionId.toString()); - - STALRequestBroker stal = getStal(sessionId); - - if (stal != null) { - - List<JAXBElement<? extends RequestType>> requestsOut = ((STALRequestBroker) stal).connect(); - response.getInfoboxReadRequestOrSignRequestOrQuitRequest().addAll(requestsOut); - - if (log.isDebugEnabled()) { - StringBuilder sb = new StringBuilder("Returning initial GetNextRequestResponse ["); - sb.append(sessionId.toString()); - sb.append("] containing "); - sb.append(requestsOut.size()); - sb.append(" requests: "); - for (JAXBElement<? extends RequestType> reqOut : requestsOut) { - sb.append(reqOut.getValue().getClass()); - sb.append(' '); + try { + log.debug("Received Connect."); + + if (TEST_SESSION_ID.equals(sessionId)) { + return getTestSessionNextRequestResponse(null); + } + + GetNextRequestResponseType response = new GetNextRequestResponseType(); + response.setSessionId(sessionId.toString()); + + STALRequestBroker stal = getStal(sessionId); + + if (stal != null) { + + List<JAXBElement<? extends RequestType>> requestsOut = ((STALRequestBroker) stal).connect(); + response.getInfoboxReadRequestOrSignRequestOrQuitRequest().addAll(requestsOut); + + if (log.isDebugEnabled()) { + StringBuilder sb = new StringBuilder("Returning initial GetNextRequestResponse containing "); + sb.append(requestsOut.size()); + sb.append(" requests: "); + for (JAXBElement<? extends RequestType> reqOut : requestsOut) { + sb.append(reqOut.getValue().getClass()); + sb.append(' '); + } + log.debug(sb.toString()); } - log.debug(sb.toString()); + } else { + log.error("Failed to get STAL, returning QuitRequest."); + QuitRequestType quitT = stalObjFactory.createQuitRequestType(); + JAXBElement<QuitRequestType> quit = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT); + response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(quit); } - } else { - log.error("Failed to get STAL for session " + sessionId + ", returning QuitRequest"); - QuitRequestType quitT = stalObjFactory.createQuitRequestType(); - JAXBElement<QuitRequestType> quit = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT); - response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(quit); + return response; + + } finally { + MDC.remove("id"); } - return response; } @Override public GetNextRequestResponseType getNextRequest(GetNextRequestType request) { if (request.getSessionId() == null) { - throw new NullPointerException("No session id provided"); + throw new NullPointerException("No session id provided."); } Id sessionId = idF.createId(request.getSessionId()); + MDC.put("id", sessionId.toString()); - List<JAXBElement<? extends ResponseType>> responsesIn = request.getInfoboxReadResponseOrSignResponseOrErrorResponse(); -// List<ResponseType> responsesIn = request.getInfoboxReadResponseOrSignResponseOrErrorResponse();//getResponse(); + try { - if (log.isDebugEnabled()) { - StringBuilder sb = new StringBuilder("Received GetNextRequest ["); - sb.append(sessionId.toString()); - sb.append("] containing "); - sb.append(responsesIn.size()); - sb.append(" responses: "); - for (JAXBElement<? extends ResponseType> respIn : responsesIn) { - sb.append(respIn.getValue().getClass()); - sb.append(' '); - } - log.debug(sb.toString()); - } - - if (TEST_SESSION_ID.equals(sessionId)) { - return getTestSessionNextRequestResponse(responsesIn); - } - - GetNextRequestResponseType response = new GetNextRequestResponseType(); - response.setSessionId(sessionId.toString()); - - STALRequestBroker stal = getStal(sessionId); - - if (stal != null) { - - List<JAXBElement<? extends RequestType>> requestsOut = ((STALRequestBroker) stal).nextRequest(responsesIn); - response.getInfoboxReadRequestOrSignRequestOrQuitRequest().addAll(requestsOut); + List<JAXBElement<? extends ResponseType>> responsesIn = request.getInfoboxReadResponseOrSignResponseOrErrorResponse(); if (log.isDebugEnabled()) { - StringBuilder sb = new StringBuilder("Returning GetNextRequestResponse ["); - sb.append(sessionId.toString()); - sb.append("] containing "); - sb.append(requestsOut.size()); - sb.append(" requests: "); - for (JAXBElement<? extends RequestType> reqOut : requestsOut) { - sb.append(reqOut.getValue().getClass()); + StringBuilder sb = new StringBuilder("Received GetNextRequest containing "); + sb.append(responsesIn.size()); + sb.append(" responses: "); + for (JAXBElement<? extends ResponseType> respIn : responsesIn) { + sb.append(respIn.getValue().getClass()); sb.append(' '); } log.debug(sb.toString()); } - } else { - log.error("Failed to get STAL for session " + sessionId + ", returning QuitRequest"); - QuitRequestType quitT = stalObjFactory.createQuitRequestType(); - JAXBElement<QuitRequestType> quit = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT); - response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(quit); + + if (TEST_SESSION_ID.equals(sessionId)) { + return getTestSessionNextRequestResponse(responsesIn); + } + + GetNextRequestResponseType response = new GetNextRequestResponseType(); + response.setSessionId(sessionId.toString()); + + STALRequestBroker stal = getStal(sessionId); + + if (stal != null) { + + List<JAXBElement<? extends RequestType>> requestsOut = ((STALRequestBroker) stal).nextRequest(responsesIn); + response.getInfoboxReadRequestOrSignRequestOrQuitRequest().addAll(requestsOut); + + if (log.isDebugEnabled()) { + StringBuilder sb = new StringBuilder("Returning GetNextRequestResponse containing "); + sb.append(requestsOut.size()); + sb.append(" requests: "); + for (JAXBElement<? extends RequestType> reqOut : requestsOut) { + sb.append(reqOut.getValue().getClass()); + sb.append(' '); + } + log.debug(sb.toString()); + } + } else { + log.error("Failed to get STAL, returning QuitRequest."); + QuitRequestType quitT = stalObjFactory.createQuitRequestType(); + JAXBElement<QuitRequestType> quit = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT); + response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(quit); + } + return response; + + } finally { + MDC.remove("id"); } - return response; } @Override public GetHashDataInputResponseType getHashDataInput(GetHashDataInputType request) throws GetHashDataInputFault { if (request.getSessionId() == null) { - throw new NullPointerException("No session id provided"); + throw new NullPointerException("No session id provided."); } Id sessionId = idF.createId(request.getSessionId()); + MDC.put("id", sessionId.toString()); - if (log.isDebugEnabled()) { - log.debug("Received GetHashDataInputRequest for session " + sessionId + " containing " + request.getReference().size() + " reference(s)"); - } - - if (TEST_SESSION_ID.equals(sessionId)) { - return getTestSessionHashDataInputResponse(request.getReference()); - } - - GetHashDataInputResponseType response = new GetHashDataInputResponseType(); - response.setSessionId(sessionId.toString()); - - STALRequestBroker stal = getStal(sessionId); - - if (stal != null) { - List<HashDataInput> hashDataInputs = stal.getHashDataInput(); - - if (hashDataInputs != null) { - - Map<String, HashDataInput> hashDataIdMap = new HashMap<String, HashDataInput>(); - for (HashDataInput hdi : hashDataInputs) { - if (log.isTraceEnabled()) { - log.trace("Provided HashDataInput for reference " + hdi.getReferenceId()); - } - hashDataIdMap.put(hdi.getReferenceId(), hdi); - } - - List<GetHashDataInputType.Reference> reqRefs = request.getReference(); - for (GetHashDataInputType.Reference reqRef : reqRefs) { - String reqRefId = reqRef.getID(); - HashDataInput reqHdi = hashDataIdMap.get(reqRefId); - if (reqHdi == null) { - String msg = "Failed to resolve HashDataInput for reference " + reqRefId; - log.error(msg); - GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); - faultInfo.setErrorCode(1); - faultInfo.setErrorMessage(msg); - throw new GetHashDataInputFault(msg, faultInfo); - } - - InputStream hashDataIS = reqHdi.getHashDataInput(); - if (hashDataIS == null) { - //HashDataInput not cached? - String msg = "Failed to obtain HashDataInput for reference " + reqRefId + ", reference not cached"; - log.error(msg); - GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); - faultInfo.setErrorCode(1); - faultInfo.setErrorMessage(msg); - throw new GetHashDataInputFault(msg, faultInfo); + try { + + if (log.isDebugEnabled()) { + log.debug("Received GetHashDataInputRequest containing {} reference(s).", request.getReference().size()); + } + + if (TEST_SESSION_ID.equals(sessionId)) { + return getTestSessionHashDataInputResponse(request.getReference()); + } + + GetHashDataInputResponseType response = new GetHashDataInputResponseType(); + response.setSessionId(sessionId.toString()); + + STALRequestBroker stal = getStal(sessionId); + + if (stal != null) { + List<HashDataInput> hashDataInputs = stal.getHashDataInput(); + + if (hashDataInputs != null) { + + Map<String, HashDataInput> hashDataIdMap = new HashMap<String, HashDataInput>(); + for (HashDataInput hdi : hashDataInputs) { + if (log.isTraceEnabled()) { + log.trace("Provided HashDataInput for reference {}.", hdi.getReferenceId()); + } + hashDataIdMap.put(hdi.getReferenceId(), hdi); } - ByteArrayOutputStream baos = null; - try { - if (log.isDebugEnabled()) { - log.debug("Resolved HashDataInput " + reqRefId + " (" + reqHdi.getMimeType() + ";charset=" + reqHdi.getEncoding() + ")"); + + List<GetHashDataInputType.Reference> reqRefs = request.getReference(); + for (GetHashDataInputType.Reference reqRef : reqRefs) { + String reqRefId = reqRef.getID(); + HashDataInput reqHdi = hashDataIdMap.get(reqRefId); + if (reqHdi == null) { + String msg = "Failed to resolve HashDataInput for reference " + reqRefId; + log.error(msg); + GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); + faultInfo.setErrorCode(1); + faultInfo.setErrorMessage(msg); + throw new GetHashDataInputFault(msg, faultInfo); } - baos = new ByteArrayOutputStream(hashDataIS.available()); - int c; - while ((c = hashDataIS.read()) != -1) { - baos.write(c); + + InputStream hashDataIS = reqHdi.getHashDataInput(); + if (hashDataIS == null) { + //HashDataInput not cached? + String msg = "Failed to obtain HashDataInput for reference " + reqRefId + ", reference not cached"; + log.error(msg); + GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); + faultInfo.setErrorCode(1); + faultInfo.setErrorMessage(msg); + throw new GetHashDataInputFault(msg, faultInfo); } - GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference(); - ref.setID(reqRefId); - ref.setMimeType(reqHdi.getMimeType()); - ref.setEncoding(reqHdi.getEncoding()); - ref.setFilename(reqHdi.getFilename()); - ref.setValue(baos.toByteArray()); - response.getReference().add(ref); - } catch (IOException ex) { - String msg = "Failed to get HashDataInput for reference " + reqRefId; - log.error(msg, ex); - GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); - faultInfo.setErrorCode(1); - faultInfo.setErrorMessage(msg); - throw new GetHashDataInputFault(msg, faultInfo, ex); - } finally { + ByteArrayOutputStream baos = null; try { - baos.close(); + if (log.isDebugEnabled()) { + Object[] args = {reqRefId, reqHdi.getMimeType(), reqHdi.getEncoding()}; + log.debug("Resolved HashDataInput {} ({};charset={}).", args); + } + baos = new ByteArrayOutputStream(hashDataIS.available()); + int c; + while ((c = hashDataIS.read()) != -1) { + baos.write(c); + } + GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference(); + ref.setID(reqRefId); + ref.setMimeType(reqHdi.getMimeType()); + ref.setEncoding(reqHdi.getEncoding()); + ref.setFilename(reqHdi.getFilename()); + ref.setValue(baos.toByteArray()); + response.getReference().add(ref); } catch (IOException ex) { + String msg = "Failed to get HashDataInput for reference " + reqRefId; + log.error(msg, ex); + GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); + faultInfo.setErrorCode(1); + faultInfo.setErrorMessage(msg); + throw new GetHashDataInputFault(msg, faultInfo, ex); + } finally { + try { + baos.close(); + } catch (IOException ex) { + } } } + return response; + } else { + String msg = "Failed to resolve any HashDataInputs."; + log.error(msg); + GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); + faultInfo.setErrorCode(1); + faultInfo.setErrorMessage(msg); + throw new GetHashDataInputFault(msg, faultInfo); } - return response; } else { - String msg = "Failed to resolve any HashDataInputs for session " + sessionId; + String msg = "Session timeout."; //Failed to get STAL for session " + sessionId; log.error(msg); GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); faultInfo.setErrorCode(1); faultInfo.setErrorMessage(msg); throw new GetHashDataInputFault(msg, faultInfo); } - } else { - String msg = "Session timeout"; //Failed to get STAL for session " + sessionId; - log.error(msg + " " + sessionId); - GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); - faultInfo.setErrorCode(1); - faultInfo.setErrorMessage(msg); - throw new GetHashDataInputFault(msg, faultInfo); + + } finally { + MDC.remove("id"); } } private STALRequestBroker getStal(Id sessionId) { - if (log.isTraceEnabled()) { - log.trace("resolve STAL for session " + sessionId); - } + log.trace("Resolve STAL for session [{}].", sessionId); MessageContext mCtx = wsContext.getMessageContext(); ServletContext sCtx = (ServletContext) mCtx.get(MessageContext.SERVLET_CONTEXT); BindingProcessorManager bpMgr = (BindingProcessorManager) sCtx.getAttribute(BINDING_PROCESSOR_MANAGER); - BindingProcessor bp = bpMgr.getBindingProcessor(sessionId); - return (bp == null) ? null : (bp.isFinished() ? null : (STALRequestBroker) bp.getSTAL()); + BindingProcessor bindingProcessor = bpMgr.getBindingProcessor(sessionId); + if (bindingProcessor != null) { + if (bindingProcessor.getSTAL() instanceof STALRequestBroker) { + return (STALRequestBroker) bindingProcessor.getSTAL(); + } + } + return null; } private GetNextRequestResponseType getTestSessionNextRequestResponse(List<JAXBElement<? extends ResponseType>> responsesIn) { @@ -359,6 +374,7 @@ public class STALServiceImpl implements STALPortType { return response; } + @SuppressWarnings("unused") private void addTestCardChannelRequest(List<JAXBElement<? extends RequestType>> requestList) { log.info("[TestSession] add CARDCHANNEL request"); ScriptType scriptT = ccObjFactory.createScriptType(); @@ -368,6 +384,7 @@ public class STALServiceImpl implements STALPortType { requestList.add(ccObjFactory.createScript(scriptT)); } + @SuppressWarnings("unused") private void addTestInfoboxReadRequest(String infoboxIdentifier, List<JAXBElement<? extends RequestType>> requestList) { log.info("[TestSession] add READ "+ infoboxIdentifier + " request"); InfoboxReadRequestType ibrT = stalObjFactory.createInfoboxReadRequestType(); diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java index 9caf950f..300f01d0 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java @@ -23,8 +23,8 @@ import com.sun.xml.ws.developer.JAXBContextFactory; import java.util.ArrayList; import java.util.List; import javax.xml.bind.JAXBException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -32,8 +32,9 @@ import org.apache.commons.logging.LogFactory; */ public class STALXJAXBContextFactory implements JAXBContextFactory { - private static final Log log = LogFactory.getLog(STALXJAXBContextFactory.class); + private final Logger log = LoggerFactory.getLogger(STALXJAXBContextFactory.class); + @SuppressWarnings("unchecked") @Override public JAXBRIContext createJAXBContext(SEIModel sei, List<Class> classesToBind, List<TypeReference> typeReferences) throws JAXBException { if (log.isTraceEnabled()) { diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/TestSignatureData.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/TestSignatureData.java index 2f58bb3d..45efc890 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/TestSignatureData.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/TestSignatureData.java @@ -6,13 +6,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public final class TestSignatureData { - protected final static Log log = LogFactory.getLog(TestSignatureData.class); - public static final String[] ID = new String[] {"signed-data-reference-0-1214921968-27971781-24309", "signed-data-reference-1"}; public static final String ENCODING = "UTF-8"; @@ -22,6 +20,7 @@ public final class TestSignatureData { HASHDATA_INPUT.put(ID[0], "Ich bin ein einfacher Text. lläöü߀".getBytes(ENCODING)); HASHDATA_INPUT.put(ID[1], "2te referenz".getBytes(ENCODING)); } catch (UnsupportedEncodingException ex) { + Logger log = LoggerFactory.getLogger(TestSignatureData.class); log.error("failed to init signature test data", ex); } } diff --git a/BKUOnline/src/main/policy/50mocca.policy b/BKUOnline/src/main/policy/50mocca.policy index 2d6bc13d..8cda9eb6 100644 --- a/BKUOnline/src/main/policy/50mocca.policy +++ b/BKUOnline/src/main/policy/50mocca.policy @@ -18,8 +18,7 @@ // || IMPORTANT: REVIEW AND ADAPT TO YOUR NEEDS PRIOR TO INSTALLATION // ========================================================================= // -// (set -Djava.security.debug=access,failure and search for "FAILED") -// +// (set -Djava.security.debug=access,failure and search for "denied" (failed)) // // ========== MOCCA CODE PERMISSIONS ======================================= // @@ -27,9 +26,11 @@ // with ${catalina.base}/webapps/<mocca_context> // replace ${catalina.base}/work/Catalina/localhost/bkuonline // with ${catalina.base}/work/Catalina/localhost/<mocca_context> (the path to the compiled JSPs, excl. package dir: org/apache/jsp/) -// replace version info in utils-1.2.10.jar and bkucommon-1.2.10.jar +// replace version info in +// ${catalina.base}/webapps/bkuonline/WEB-INF/lib/utils-1.2.12.jar and +// ${catalina.base}/webapps/bkuonline/WEB-INF/lib/bkucommon-1.2.12.jar // with current version -// replace apps.egiz.gv.at +// replace www.sozialversicherung.gv.at:443 // with <DataURL_host:DataURL_port> // replace localhost:8080 // with <StylesheetURL_host:StylesheetURL_port> @@ -40,7 +41,7 @@ // // replace www.a-trust.at and ksp.ecard.sozialversicherung.gv.at // with <idLink_template_download_URL> -// replace ldap.a-trust.at:389 and ocsp.ecard.sozialversicherung.at:80 +// replace ldap.a-trust.at:389, ocsp.a-trust.at:80 and ocsp.ecard.sozialversicherung.at:80 // with <certificate_revocation_authority_endpoint> (OCSP, CRLs) // @@ -49,6 +50,8 @@ grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" { permission java.lang.RuntimePermission "accessClassInPackage.sun.util.logging.resources"; permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/logging.properties", "read"; + // (for manager webapp) + // permission java.lang.RuntimePermission "setContextClassLoader"; }; grant codeBase "file:${catalina.base}/work/Catalina/localhost/bkuonline" { @@ -58,47 +61,25 @@ grant codeBase "file:${catalina.base}/work/Catalina/localhost/bkuonline" { // =========== MOCCA grants // -grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/classes/-" { - permission java.security.AllPermission; -// permission java.io.FilePermission "${catalina.base}/logs", "read, write"; -// permission java.io.FilePermission "${catalina.base}/logs/*", "read, write"; -// permission java.io.FilePermission "${catalina.base}/logs/*", "delete"; -// permission java.util.PropertyPermission "com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace", "write"; -// permission java.util.PropertyPermission "com.sun.xml.ws.transport.http.HttpAdapter.dump", "write"; -}; - -grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/-" { - // the log4j configuration might want to write logs to ${catalina.base}/logs/bkuonline.log +grant codeBase "file:${catalina.base}/webapps/bkuonline/-" { permission java.io.FilePermission "${catalina.base}/logs", "read, write"; permission java.io.FilePermission "${catalina.base}/logs/*", "read, write"; permission java.io.FilePermission "${catalina.base}/logs/*", "delete"; -}; - -grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/utils-1.2.10.jar" { - permission java.util.PropertyPermission "*", "read"; - permission java.net.SocketPermission "www.a-trust.at:80", "connect, resolve"; - permission java.net.SocketPermission "ksp.ecard.sozialversicherung.gv.at:80", "connect,resolve"; -// permission java.net.SocketPermission "localhost:8080", "connect, resolve"; - permission java.net.SocketPermission "www.xslt-stylesheet-include-url.org:80", "connect, resolve"; - permission java.lang.RuntimePermission "accessDeclaredMembers"; - permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; -}; - -grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/bkucommon-1.2.10.jar" { - permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore", "write"; - permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/-", "write"; - permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/toBeAdded/-", "delete"; - permission java.io.FilePermission "../conf/secret.xml", "read"; + // DataURLs permission java.net.SocketPermission "apps.egiz.gv.at:443", "connect, resolve"; + permission java.net.SocketPermission "www.buergerkarte.at:443", "connect, resolve"; + permission java.net.SocketPermission "www.sozialversicherung.gv.at:443", "connect, resolve"; + + // other resources (crls, persb.xsl, ...) permission java.net.SocketPermission "www.a-trust.at:80", "connect, resolve"; permission java.net.SocketPermission "ksp.ecard.sozialversicherung.gv.at:80", "connect,resolve"; permission java.net.SocketPermission "ldap.a-trust.at:389", "connect, resolve"; + permission java.net.SocketPermission "ocsp.a-trust.at:80", "connect, resolve"; permission java.net.SocketPermission "ocsp.ecard.sozialversicherung.at:80", "connect, resolve"; // permission java.net.SocketPermission "localhost:8080", "connect, resolve"; - permission java.net.SocketPermission "www.xslt-stylesheet-include-url.org:80", "connect, resolve"; - permission java.net.NetPermission "specifyStreamHandler"; - permission java.util.PropertyPermission "*", "read, write"; +// permission java.net.SocketPermission "www.xslt-stylesheet-include-url.org:80", "connect, resolve"; + permission java.security.SecurityPermission "insertProvider.IAIK"; permission java.security.SecurityPermission "putProviderProperty.IAIK"; permission java.security.SecurityPermission "removeProvider.IAIK"; @@ -111,143 +92,127 @@ grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/bkucommon-1. // XMLDSig is moved backwards by XSECT permission java.security.SecurityPermission "insertProvider.XMLDSig"; permission java.security.SecurityPermission "removeProvider.XMLDSig"; + + permission java.util.PropertyPermission "*", "read"; permission java.lang.RuntimePermission "accessDeclaredMembers"; - permission java.lang.RuntimePermission "setFactory"; + permission java.lang.RuntimePermission "getClassLoader"; permission java.lang.RuntimePermission "getProtectionDomain"; + //bkucommon,pki permission java.lang.RuntimePermission "accessClassInPackage.sun.net.www.protocol.ldap"; + //jax-ws jaxb + permission java.lang.RuntimePermission "accessClassInPackage.sun.util.logging.resources"; + //permission java.lang.RuntimePermission "modifyThread"; + //permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; + permission java.net.NetPermission "specifyStreamHandler"; +}; + +grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/classes/-" { +// permission java.util.PropertyPermission "com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace", "write"; +// permission java.util.PropertyPermission "com.sun.xml.ws.transport.http.HttpAdapter.dump", "write"; + + permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore", "write"; + permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/-", "write"; + permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/toBeAdded/-", "delete"; + + permission java.lang.RuntimePermission "defineClassInPackage.java.lang"; + permission java.util.PropertyPermission "*", "read, write"; permission java.lang.RuntimePermission "modifyThread"; + permission java.lang.RuntimePermission "setFactory"; permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; }; -grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/iaik_jce_full_signed-3.16.jar" { +grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/utils-1.2.12.jar" { +// permission java.lang.RuntimePermission "accessDeclaredMembers"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; +}; + +grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/bkucommon-1.2.12.jar" { + permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore", "write"; + permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/-", "write"; + permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/toBeAdded/-", "delete"; + permission java.io.FilePermission "${catalina.base}/temp/*", "read, write"; +// permission java.io.FilePermission "../conf/secret.xml", "read"; permission java.util.PropertyPermission "*", "read, write"; - permission java.security.SecurityPermission "insertProvider.IAIK"; - permission java.security.SecurityPermission "putProviderProperty.IAIK"; - permission java.security.SecurityPermission "removeProvider.IAIK"; - permission java.net.SocketPermission "ldap.a-trust.at:389", "connect, resolve"; - permission java.net.SocketPermission "ocsp.ecard.sozialversicherung.at:80", "connect, resolve"; + permission java.lang.RuntimePermission "modifyThread"; + permission java.lang.RuntimePermission "setFactory"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; }; -grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/iaik_ecc_signed-2.15.jar" { - permission java.security.SecurityPermission "insertProvider.IAIK_ECC"; - permission java.security.SecurityPermission "putProviderProperty.IAIK_ECC"; +grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/iaik_jce_full_signed-3.16.jar" { + permission java.util.PropertyPermission "*", "read, write"; }; grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/iaik_xsect-1.14.jar" { permission java.util.PropertyPermission "*", "read, write"; - permission java.security.SecurityPermission "insertProvider.IAIK"; - permission java.security.SecurityPermission "putProviderProperty.IAIK"; - permission java.security.SecurityPermission "removeProvider.IAIK"; - permission java.security.SecurityPermission "insertProvider.XSECT"; - permission java.security.SecurityPermission "putProviderProperty.XSECT"; - permission java.security.SecurityPermission "insertProvider.XMLDSig"; - permission java.security.SecurityPermission "removeProvider.XMLDSig"; }; grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/iaik_pki-1.0-MOCCA.jar" { permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore", "write"; permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/-", "write"; permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/toBeAdded/-", "delete"; - permission java.net.SocketPermission "www.a-trust.at:80", "connect, resolve"; - permission java.net.SocketPermission "ldap.a-trust.at:389", "connect, resolve"; - permission java.net.SocketPermission "ocsp.ecard.sozialversicherung.at:80", "connect, resolve"; - permission java.net.NetPermission "specifyStreamHandler"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.net.www.protocol.ldap"; + //permission java.net.NetPermission "specifyStreamHandler"; + //permission java.lang.RuntimePermission "accessClassInPackage.sun.net.www.protocol.ldap"; }; grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/xalan-2.7.1.jar" { permission java.io.FilePermission "${java.home}/lib/xalan.properties", "read"; - permission java.util.PropertyPermission "*", "read"; - permission java.lang.RuntimePermission "getClassLoader"; -}; - -grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/serializer-2.7.1.jar" { - permission java.util.PropertyPermission "*", "read"; - permission java.lang.RuntimePermission "getClassLoader"; + //permission java.lang.RuntimePermission "getClassLoader"; }; // allow xsl:include from the specified URL -grant codeBase "jar:file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/xalan-2.7.1.jar!/org/apache/xalan/processor/-" { - permission java.net.SocketPermission "www.xslt-stylesheet-include-url.org:80", "connect, resolve"; -}; +//grant codeBase "jar:file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/xalan-2.7.1.jar!/org/apache/xalan/processor/-" { +// permission java.net.SocketPermission "www.xslt-stylesheet-include-url.org:80", "connect, resolve"; +//}; // allow XSLT document function to reference the specified URL -grant codeBase "jar:file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/xalan-2.7.1.jar!/org/apache/xalan/xsltc/dom/LoadDocument.class" { - permission java.io.FilePermission "../conf/secret.xml", "read"; -}; +//grant codeBase "jar:file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/xalan-2.7.1.jar!/org/apache/xalan/xsltc/dom/LoadDocument.class" { +// permission java.io.FilePermission "../conf/secret.xml", "read"; +//}; // use tomcat/jre endorsed xerces instead grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/xercesImpl-2.9.1.jar" { permission java.io.FilePermission "${java.home}/lib/xerces.properties", "read"; // permission java.io.FilePermission "../conf/secret.xml", "read"; // permission java.net.SocketPermission "www.xslt-stylesheet-include-url.org:80", "connect, resolve"; - permission java.util.PropertyPermission "*", "read"; + permission java.io.FilePermission "/WEB-INF/classes/-", "read"; permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina"; permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.*"; - permission java.lang.RuntimePermission "getClassLoader"; - permission java.lang.RuntimePermission "accessDeclaredMembers"; + //permission java.lang.RuntimePermission "accessDeclaredMembers"; }; grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/commons-logging-1.1.1.jar" { - permission java.util.PropertyPermission "org.apache.commons.logging.*", "read"; - permission java.util.PropertyPermission "log4j.*", "read"; - permission java.util.PropertyPermission "catalina.base", "read"; - permission java.lang.RuntimePermission "getClassLoader"; permission java.lang.RuntimePermission "defineClassInPackage.java.lang"; }; grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/log4j-1.2.12.jar" { permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/log4j.properties", "read"; - // allow log4j to read its own properties - permission java.util.PropertyPermission "log4j.*", "read"; - permission java.util.PropertyPermission "catalina.base", "read"; permission java.lang.RuntimePermission "defineClassInPackage.java.lang"; }; grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/spring-core-2.5.5.jar" { - permission java.lang.RuntimePermission "accessDeclaredMembers"; + //permission java.lang.RuntimePermission "accessDeclaredMembers"; permission java.lang.RuntimePermission "modifyThread"; }; + grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/spring-web-2.5.5.jar" { permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore", "write"; permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/-", "write"; permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/toBeAdded/-", "delete"; - permission java.security.SecurityPermission "insertProvider.IAIK"; - permission java.security.SecurityPermission "putProviderProperty.IAIK"; - permission java.security.SecurityPermission "removeProvider.IAIK"; - permission java.security.SecurityPermission "insertProvider.IAIK_ECC"; - permission java.security.SecurityPermission "putProviderProperty.IAIK_ECC"; - permission java.security.SecurityPermission "insertProvider.XSECT"; - permission java.security.SecurityPermission "putProviderProperty.XSECT"; - permission java.security.SecurityPermission "insertProvider.STAL"; - permission java.security.SecurityPermission "putProviderProperty.STAL"; - permission java.security.SecurityPermission "insertProvider.XMLDSig"; - permission java.security.SecurityPermission "removeProvider.XMLDSig"; permission java.util.PropertyPermission "*", "read, write"; - permission java.lang.RuntimePermission "accessDeclaredMembers"; + //permission java.lang.RuntimePermission "accessDeclaredMembers"; permission java.lang.RuntimePermission "modifyThread"; permission java.lang.RuntimePermission "setFactory"; - permission java.lang.RuntimePermission "getProtectionDomain"; + //permission java.lang.RuntimePermission "getProtectionDomain"; permission java.lang.RuntimePermission "defineClassInPackage.java.lang"; permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; }; + grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/spring-beans-2.5.5.jar" { permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore", "write"; permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/-", "write"; permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/toBeAdded/-", "delete"; - permission java.security.SecurityPermission "insertProvider.IAIK"; - permission java.security.SecurityPermission "putProviderProperty.IAIK"; - permission java.security.SecurityPermission "removeProvider.IAIK"; - permission java.security.SecurityPermission "insertProvider.IAIK_ECC"; - permission java.security.SecurityPermission "putProviderProperty.IAIK_ECC"; - permission java.security.SecurityPermission "insertProvider.XSECT"; - permission java.security.SecurityPermission "putProviderProperty.XSECT"; - permission java.security.SecurityPermission "insertProvider.STAL"; - permission java.security.SecurityPermission "putProviderProperty.STAL"; - permission java.security.SecurityPermission "insertProvider.XMLDSig"; - permission java.security.SecurityPermission "removeProvider.XMLDSig"; permission java.util.PropertyPermission "*", "read, write"; - permission java.lang.RuntimePermission "accessDeclaredMembers"; + //permission java.lang.RuntimePermission "accessDeclaredMembers"; permission java.lang.RuntimePermission "setFactory"; permission java.lang.RuntimePermission "getProtectionDomain"; permission java.lang.RuntimePermission "defineClassInPackage.java.lang"; @@ -257,19 +222,8 @@ grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/spring-conte permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore", "write"; permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/-", "write"; permission java.io.FilePermission "${catalina.base}/webapps/bkuonline/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/toBeAdded/-", "delete"; - permission java.security.SecurityPermission "insertProvider.IAIK"; - permission java.security.SecurityPermission "putProviderProperty.IAIK"; - permission java.security.SecurityPermission "removeProvider.IAIK"; - permission java.security.SecurityPermission "insertProvider.IAIK_ECC"; - permission java.security.SecurityPermission "putProviderProperty.IAIK_ECC"; - permission java.security.SecurityPermission "insertProvider.XSECT"; - permission java.security.SecurityPermission "putProviderProperty.XSECT"; - permission java.security.SecurityPermission "insertProvider.STAL"; - permission java.security.SecurityPermission "putProviderProperty.STAL"; - permission java.security.SecurityPermission "insertProvider.XMLDSig"; - permission java.security.SecurityPermission "removeProvider.XMLDSig"; permission java.util.PropertyPermission "*", "read, write"; - permission java.lang.RuntimePermission "accessDeclaredMembers"; + //permission java.lang.RuntimePermission "accessDeclaredMembers"; permission java.lang.RuntimePermission "modifyThread"; permission java.lang.RuntimePermission "setFactory"; permission java.lang.RuntimePermission "getProtectionDomain"; @@ -280,20 +234,21 @@ grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/spring-conte grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/jaxws-rt-2.1.5.jar" { // need write access to set disableCaptureStackTrace and HttpAdapter.dump permission java.util.PropertyPermission "com.sun.xml.ws.*", "read, write"; - permission java.util.PropertyPermission "com.sun.xml.bind.*", "read"; - permission java.util.PropertyPermission "javax.xml.soap.*", "read"; - permission java.util.PropertyPermission "javax.activation.*", "read"; - permission java.util.PropertyPermission "xml.catalog.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "user.home", "read"; + //permission java.util.PropertyPermission "com.sun.xml.bind.*", "read"; + //permission java.util.PropertyPermission "javax.xml.soap.*", "read"; + //permission java.util.PropertyPermission "javax.activation.*", "read"; + //permission java.util.PropertyPermission "xml.catalog.*", "read"; + //permission java.util.PropertyPermission "user.dir", "read"; + //permission java.util.PropertyPermission "user.home", "read"; permission java.io.FilePermission "${java.home}/lib/jaxm.properties", "read"; permission java.io.FilePermission "${java.home}/lib/mailcap", "read"; permission java.io.FilePermission "${user.home}/.mailcap", "read"; permission java.io.FilePermission "basename", "read"; permission java.io.FilePermission "${catalina.home}/bin/xcatalog", "read"; - permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; - permission java.lang.RuntimePermission "accessDeclaredMembers"; - permission java.lang.RuntimePermission "accessClassInPackage.sun.util.logging.resources"; + permission java.io.FilePermission "${catalina.home}/temp/xcatalog", "read"; + permission java.io.FilePermission "/WEB-INF/classes/-", "read"; + //permission java.lang.RuntimePermission "accessDeclaredMembers"; + //permission java.lang.RuntimePermission "accessClassInPackage.sun.util.logging.resources"; permission java.lang.RuntimePermission "setContextClassLoader"; permission javax.management.MBeanServerPermission "createMBeanServer"; permission javax.management.MBeanPermission "com.sun.xml.ws.*", "registerMBean"; @@ -302,18 +257,16 @@ grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/jaxws-rt-2.1 }; grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/jaxb-impl-2.1.9.jar" { + //permission java.lang.RuntimePermission "accessClassInPackage.sun.util.logging.resources"; permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; - permission java.lang.RuntimePermission "accessDeclaredMembers"; - permission java.util.PropertyPermission "com.sun.xml.bind.v2.*", "read"; - permission java.util.PropertyPermission "user.dir", "read"; -}; - -grant codeBase "file:${catalina.base}/webapps/bkuonline/WEB-INF/lib/commons-httpclient-3.1.jar" { - permission java.util.PropertyPermission "*", "read"; +// permission java.lang.RuntimePermission "accessDeclaredMembers"; +// permission java.util.PropertyPermission "com.sun.xml.bind.v2.*", "read"; +// permission java.util.PropertyPermission "user.dir", "read"; + permission java.io.FilePermission "/WEB-INF/classes/-", "read"; }; // ======== NETBEANS -//grant codeBase "file:${catalina.base}/nblib/-" { -// permission java.security.AllPermission; -//};
\ No newline at end of file +grant codeBase "file:${catalina.base}/nblib/-" { + permission java.security.AllPermission; +};
\ No newline at end of file diff --git a/BKUOnline/src/main/policy/catalina.policy b/BKUOnline/src/main/policy/catalina.policy new file mode 100644 index 00000000..2dfb198f --- /dev/null +++ b/BKUOnline/src/main/policy/catalina.policy @@ -0,0 +1,411 @@ +// 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. +// +// +// ========================================================================= +// || IMPORTANT: REVIEW AND ADAPT TO YOUR NEEDS PRIOR TO INSTALLATION +// ========================================================================= +// +// ========================================================================= +// || This file contains all default permissions from $CATALINA_HOME/conf/catalina.policy +// || and codebase paths to development dirs (for in-place deployment of IDEs) +// ========================================================================= +// +// (set -Djava.security.debug=access,failure and search for "denied" (failed)) +// (-Djava.net.preferIPv4Stack=true) +// +// ========== MOCCA CODE PERMISSIONS ======================================= +// +// replace ${catalina.base}/webapps/bkuonline +// with ${catalina.base}/webapps/<mocca_context> +// replace ${catalina.base}/work/Catalina/localhost/bkuonline +// with ${catalina.base}/work/Catalina/localhost/<mocca_context> (the path to the compiled JSPs, excl. package dir: org/apache/jsp/) +// replace version info in +// ${catalina.base}/webapps/bkuonline/WEB-INF/lib/BKUViewer-1.2.12.jar" { +// ${catalina.base}/webapps/bkuonline/WEB-INF/lib/utils-1.2.12.jar and +// ${catalina.base}/webapps/bkuonline/WEB-INF/lib/bkucommon-1.2.12.jar +// with current version +// replace www.sozialversicherung.gv.at:443 +// with <DataURL_host:DataURL_port> +// replace localhost:8080 +// with <StylesheetURL_host:StylesheetURL_port> +// replace www.xslt-stylesheet-include-url.org:80 +// with <XSL_include_URL> +// replace ../conf/secret.xml +// with <any_resource_you_would_like_to_grant_XSLTs_document()_function_access_to> +// +// replace www.a-trust.at and ksp.ecard.sozialversicherung.gv.at +// with <idLink_template_download_URL> +// replace ldap.a-trust.at:389, ocsp.a-trust.at:80 and ocsp.ecard.sozialversicherung.at:80 +// with <certificate_revocation_authority_endpoint> (OCSP, CRLs) +// + +// ========== SYSTEM CODE PERMISSIONS ========================================= + + +// These permissions apply to javac +grant codeBase "file:${java.home}/lib/-" { + permission java.security.AllPermission; +}; + +// These permissions apply to all shared system extensions +grant codeBase "file:${java.home}/jre/lib/ext/-" { + permission java.security.AllPermission; +}; + +// These permissions apply to javac when ${java.home] points at $JAVA_HOME/jre +grant codeBase "file:${java.home}/../lib/-" { + permission java.security.AllPermission; +}; + +// These permissions apply to all shared system extensions when +// ${java.home} points at $JAVA_HOME/jre +grant codeBase "file:${java.home}/lib/ext/-" { + permission java.security.AllPermission; +}; + + +// ========== CATALINA CODE PERMISSIONS ======================================= + + +// These permissions apply to the daemon code +grant codeBase "file:${catalina.home}/bin/commons-daemon.jar" { + permission java.security.AllPermission; +}; + +// These permissions apply to the logging API +grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" { + permission java.util.PropertyPermission "java.util.logging.config.class", "read"; + permission java.util.PropertyPermission "java.util.logging.config.file", "read"; + permission java.io.FilePermission "${java.home}${file.separator}lib${file.separator}logging.properties", "read"; + permission java.lang.RuntimePermission "shutdownHooks"; + permission java.io.FilePermission "${catalina.base}${file.separator}conf${file.separator}logging.properties", "read"; + permission java.util.PropertyPermission "catalina.base", "read"; + permission java.util.logging.LoggingPermission "control"; + permission java.io.FilePermission "${catalina.base}${file.separator}logs", "read, write"; + permission java.io.FilePermission "${catalina.base}${file.separator}logs${file.separator}*", "read, write"; + permission java.lang.RuntimePermission "getClassLoader"; + + // added by clemenso (for manager webapp) + permission java.lang.RuntimePermission "setContextClassLoader"; + permission java.lang.RuntimePermission "accessClassInPackage.sun.util.logging.resources"; + + // To enable per context logging configuration, permit read access to the appropriate file. + // Be sure that the logging configuration is secure before enabling such access + // eg for the examples web application: + // permission java.io.FilePermission "${catalina.base}${file.separator}webapps${file.separator}examples${file.separator}WEB-INF${file.separator}classes${file.separator}logging.properties", "read"; +}; + +// These permissions apply to the server startup code +grant codeBase "file:${catalina.home}/bin/bootstrap.jar" { + permission java.security.AllPermission; +}; + +// These permissions apply to the servlet API classes +// and those that are shared across all class loaders +// located in the "lib" directory +grant codeBase "file:${catalina.home}/lib/-" { + permission java.security.AllPermission; +}; + + +// ========== WEB APPLICATION PERMISSIONS ===================================== + + +// These permissions are granted by default to all web applications +// In addition, a web application will be given a read FilePermission +// and JndiPermission for all files and directories in its document root. +grant { + // Required for JNDI lookup of named JDBC DataSource's and + // javamail named MimePart DataSource used to send mail + permission java.util.PropertyPermission "java.home", "read"; + permission java.util.PropertyPermission "java.naming.*", "read"; + permission java.util.PropertyPermission "javax.sql.*", "read"; + + // OS Specific properties to allow read access + permission java.util.PropertyPermission "os.name", "read"; + permission java.util.PropertyPermission "os.version", "read"; + permission java.util.PropertyPermission "os.arch", "read"; + permission java.util.PropertyPermission "file.separator", "read"; + permission java.util.PropertyPermission "path.separator", "read"; + permission java.util.PropertyPermission "line.separator", "read"; + + // JVM properties to allow read access + permission java.util.PropertyPermission "java.version", "read"; + permission java.util.PropertyPermission "java.vendor", "read"; + permission java.util.PropertyPermission "java.vendor.url", "read"; + permission java.util.PropertyPermission "java.class.version", "read"; + permission java.util.PropertyPermission "java.specification.version", "read"; + permission java.util.PropertyPermission "java.specification.vendor", "read"; + permission java.util.PropertyPermission "java.specification.name", "read"; + + permission java.util.PropertyPermission "java.vm.specification.version", "read"; + permission java.util.PropertyPermission "java.vm.specification.vendor", "read"; + permission java.util.PropertyPermission "java.vm.specification.name", "read"; + permission java.util.PropertyPermission "java.vm.version", "read"; + permission java.util.PropertyPermission "java.vm.vendor", "read"; + permission java.util.PropertyPermission "java.vm.name", "read"; + + // Required for OpenJMX + permission java.lang.RuntimePermission "getAttribute"; + + // Allow read of JAXP compliant XML parser debug + permission java.util.PropertyPermission "jaxp.debug", "read"; + + // Precompiled JSPs need access to this package. + permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime"; + permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime.*"; + + // Precompiled JSPs need access to this system property. + permission java.util.PropertyPermission "org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER", "read"; + +}; + + + + + + + + +// =========== container grants required by MOCCA +// +grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" { + permission java.lang.RuntimePermission "accessClassInPackage.sun.util.logging.resources"; + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/logging.properties", "read"; + // (for manager webapp) + permission java.lang.RuntimePermission "setContextClassLoader"; +}; + +grant codeBase "file:${catalina.base}/work/Catalina/localhost/bkuonline" { + permission java.io.FilePermission "/helpfiles/-", "read"; + permission java.lang.RuntimePermission "defineClassInPackage.org.apache.jasper.runtime"; +}; + +// =========== MOCCA grants +// +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/-" { + permission java.io.FilePermission "${catalina.base}/logs", "read, write"; + permission java.io.FilePermission "${catalina.base}/logs/*", "read, write"; + permission java.io.FilePermission "${catalina.base}/logs/*", "delete"; + + // DataURLs + permission java.net.SocketPermission "apps.egiz.gv.at:443", "connect, resolve"; + permission java.net.SocketPermission "www.buergerkarte.at:443", "connect, resolve"; + permission java.net.SocketPermission "www.sozialversicherung.gv.at:443", "connect, resolve"; + + // other resources (crls, persb.xsl, ...) + permission java.net.SocketPermission "www.a-trust.at:80", "connect, resolve"; + permission java.net.SocketPermission "ksp.ecard.sozialversicherung.gv.at:80", "connect,resolve"; + permission java.net.SocketPermission "ldap.a-trust.at:389", "connect, resolve"; + permission java.net.SocketPermission "ocsp.a-trust.at:80", "connect, resolve"; + permission java.net.SocketPermission "ocsp.ecard.sozialversicherung.at:80", "connect, resolve"; +// permission java.net.SocketPermission "localhost:8080", "connect, resolve"; +// permission java.net.SocketPermission "www.xslt-stylesheet-include-url.org:80", "connect, resolve"; + + permission java.security.SecurityPermission "insertProvider.IAIK"; + permission java.security.SecurityPermission "putProviderProperty.IAIK"; + permission java.security.SecurityPermission "removeProvider.IAIK"; + permission java.security.SecurityPermission "insertProvider.IAIK_ECC"; + permission java.security.SecurityPermission "putProviderProperty.IAIK_ECC"; + permission java.security.SecurityPermission "insertProvider.XSECT"; + permission java.security.SecurityPermission "putProviderProperty.XSECT"; + permission java.security.SecurityPermission "insertProvider.STAL"; + permission java.security.SecurityPermission "putProviderProperty.STAL"; + // XMLDSig is moved backwards by XSECT + permission java.security.SecurityPermission "insertProvider.XMLDSig"; + permission java.security.SecurityPermission "removeProvider.XMLDSig"; + + permission java.util.PropertyPermission "*", "read"; + permission java.lang.RuntimePermission "accessDeclaredMembers"; + permission java.lang.RuntimePermission "getClassLoader"; + permission java.lang.RuntimePermission "getProtectionDomain"; + //bkucommon,pki + permission java.lang.RuntimePermission "accessClassInPackage.sun.net.www.protocol.ldap"; + //jax-ws jaxb + permission java.lang.RuntimePermission "accessClassInPackage.sun.util.logging.resources"; + //permission java.lang.RuntimePermission "modifyThread"; + //permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; + permission java.net.NetPermission "specifyStreamHandler"; + + //jaxb + //permission java.io.FilePermission "/WEB-INF/classes/-", "read"; + +}; + +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/-" { +// permission java.util.PropertyPermission "com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace", "write"; +// permission java.util.PropertyPermission "com.sun.xml.ws.transport.http.HttpAdapter.dump", "write"; + + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore", "write"; + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/-", "write"; + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/toBeAdded/-", "delete"; + + permission java.lang.RuntimePermission "defineClassInPackage.java.lang"; + permission java.util.PropertyPermission "*", "read, write"; + permission java.lang.RuntimePermission "modifyThread"; + permission java.lang.RuntimePermission "setFactory"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; +}; + +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/utils-1.2.12-pinguin-1-SNAPSHOT.jar" { +// permission java.lang.RuntimePermission "accessDeclaredMembers"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; +}; + +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/bkucommon-1.2.12-pinguin-1-SNAPSHOT.jar" { + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore", "write"; + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/-", "write"; + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/toBeAdded/-", "delete"; + permission java.io.FilePermission "${catalina.base}/temp/*", "read, write"; +// permission java.io.FilePermission "../conf/secret.xml", "read"; + permission java.util.PropertyPermission "*", "read, write"; + permission java.lang.RuntimePermission "modifyThread"; + permission java.lang.RuntimePermission "setFactory"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; +}; + +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/iaik_jce_full_signed-3.16.jar" { + permission java.util.PropertyPermission "*", "read, write"; +}; + +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/iaik_xsect-1.14.jar" { + permission java.util.PropertyPermission "*", "read, write"; +}; + +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/iaik_pki-1.0-MOCCA.jar" { + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore", "write"; + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/-", "write"; + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/toBeAdded/-", "delete"; + //permission java.net.NetPermission "specifyStreamHandler"; + //permission java.lang.RuntimePermission "accessClassInPackage.sun.net.www.protocol.ldap"; +}; + +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/xalan-2.7.1.jar" { + permission java.io.FilePermission "${java.home}/lib/xalan.properties", "read"; + //permission java.lang.RuntimePermission "getClassLoader"; +}; + +// allow xsl:include from the specified URL +//grant codeBase "jar:file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/xalan-2.7.1.jar!/org/apache/xalan/processor/-" { +// permission java.net.SocketPermission "www.xslt-stylesheet-include-url.org:80", "connect, resolve"; +//}; + +// allow XSLT document function to reference the specified URL +//grant codeBase "jar:file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/xalan-2.7.1.jar!/org/apache/xalan/xsltc/dom/LoadDocument.class" { +// permission java.io.FilePermission "../conf/secret.xml", "read"; +//}; + +// use tomcat/jre endorsed xerces instead +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/xercesImpl-2.9.1.jar" { + permission java.io.FilePermission "${java.home}/lib/xerces.properties", "read"; +// permission java.io.FilePermission "../conf/secret.xml", "read"; +// permission java.net.SocketPermission "www.xslt-stylesheet-include-url.org:80", "connect, resolve"; + permission java.io.FilePermission "/WEB-INF/classes/-", "read"; + permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina"; + permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.*"; + //permission java.lang.RuntimePermission "accessDeclaredMembers"; +}; + +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/commons-logging-1.1.1.jar" { + permission java.lang.RuntimePermission "defineClassInPackage.java.lang"; +}; + +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/log4j-1.2.12.jar" { + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/log4j.properties", "read"; + permission java.lang.RuntimePermission "defineClassInPackage.java.lang"; +}; + +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/spring-core-2.5.5.jar" { + //permission java.lang.RuntimePermission "accessDeclaredMembers"; + permission java.lang.RuntimePermission "modifyThread"; +}; + +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/spring-web-2.5.5.jar" { + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore", "write"; + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/-", "write"; + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/toBeAdded/-", "delete"; + permission java.util.PropertyPermission "*", "read, write"; + //permission java.lang.RuntimePermission "accessDeclaredMembers"; + permission java.lang.RuntimePermission "modifyThread"; + permission java.lang.RuntimePermission "setFactory"; + //permission java.lang.RuntimePermission "getProtectionDomain"; + permission java.lang.RuntimePermission "defineClassInPackage.java.lang"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; +}; + +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/spring-beans-2.5.5.jar" { + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore", "write"; + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/-", "write"; + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/toBeAdded/-", "delete"; + permission java.util.PropertyPermission "*", "read, write"; + //permission java.lang.RuntimePermission "accessDeclaredMembers"; + permission java.lang.RuntimePermission "setFactory"; + permission java.lang.RuntimePermission "getProtectionDomain"; + permission java.lang.RuntimePermission "defineClassInPackage.java.lang"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; +}; +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/spring-context-2.5.5.jar" { + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore", "write"; + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/-", "write"; + permission java.io.FilePermission "/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/classes/at/gv/egiz/bku/certs/certStore/toBeAdded/-", "delete"; + permission java.util.PropertyPermission "*", "read, write"; + //permission java.lang.RuntimePermission "accessDeclaredMembers"; + permission java.lang.RuntimePermission "modifyThread"; + permission java.lang.RuntimePermission "setFactory"; + permission java.lang.RuntimePermission "getProtectionDomain"; + permission java.lang.RuntimePermission "defineClassInPackage.java.lang"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; +}; + +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/jaxws-rt-2.1.5.jar" { + // need write access to set disableCaptureStackTrace and HttpAdapter.dump + permission java.util.PropertyPermission "com.sun.xml.ws.*", "read, write"; + //permission java.util.PropertyPermission "com.sun.xml.bind.*", "read"; + //permission java.util.PropertyPermission "javax.xml.soap.*", "read"; + //permission java.util.PropertyPermission "javax.activation.*", "read"; + //permission java.util.PropertyPermission "xml.catalog.*", "read"; + //permission java.util.PropertyPermission "user.dir", "read"; + //permission java.util.PropertyPermission "user.home", "read"; + permission java.io.FilePermission "${java.home}/lib/jaxm.properties", "read"; + permission java.io.FilePermission "${java.home}/lib/mailcap", "read"; + permission java.io.FilePermission "${user.home}/.mailcap", "read"; + permission java.io.FilePermission "basename", "read"; + permission java.io.FilePermission "${catalina.home}/bin/xcatalog", "read"; + permission java.io.FilePermission "${catalina.home}/temp/xcatalog", "read"; + permission java.io.FilePermission "/WEB-INF/classes/-", "read"; + //permission java.lang.RuntimePermission "accessDeclaredMembers"; + //permission java.lang.RuntimePermission "accessClassInPackage.sun.util.logging.resources"; + permission java.lang.RuntimePermission "setContextClassLoader"; + permission javax.management.MBeanServerPermission "createMBeanServer"; + permission javax.management.MBeanPermission "com.sun.xml.ws.*", "registerMBean"; + permission javax.management.MBeanTrustPermission "register"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; +}; + +grant codeBase "file:/home/clemens/workspace/bku/BKUOnline/target/BKUOnline-1.2.12-pinguin-1-SNAPSHOT/WEB-INF/lib/jaxb-impl-2.1.9.jar" { + //permission java.lang.RuntimePermission "accessClassInPackage.sun.util.logging.resources"; + permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; +// permission java.lang.RuntimePermission "accessDeclaredMembers"; +// permission java.util.PropertyPermission "com.sun.xml.bind.v2.*", "read"; +// permission java.util.PropertyPermission "user.dir", "read"; + permission java.io.FilePermission "/WEB-INF/classes/-", "read"; +}; + +// ======== NETBEANS + +grant codeBase "file:${catalina.base}/nblib/-" { + permission java.security.AllPermission; +};
\ No newline at end of file diff --git a/BKUOnline/src/main/resources/at/gv/egiz/mocca/id/idlschema/PersonData.xsd b/BKUOnline/src/main/resources/at/gv/egiz/mocca/id/idlschema/PersonData.xsd new file mode 100644 index 00000000..3d59a2b1 --- /dev/null +++ b/BKUOnline/src/main/resources/at/gv/egiz/mocca/id/idlschema/PersonData.xsd @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- NOTE: This is not the official person data schema! --> +<!-- This is a special version of the person data schema to validate identity links. --> +<xs:schema targetNamespace="http://reference.e-government.gv.at/namespace/persondata/20020228#" + xmlns="http://reference.e-government.gv.at/namespace/persondata/20020228#" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0.0"> + <xs:element name="Person" type="AbstractPersonType"/> + <xs:complexType name="AbstractPersonType" abstract="true"> + <xs:sequence> + <xs:element name="Identification" type="IdentificationType" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:element name="PhysicalPerson" type="PhysicalPersonType"/> + <xs:complexType name="PhysicalPersonType"> + <xs:complexContent> + <xs:extension base="AbstractPersonType"> + <xs:sequence> + <xs:element name="Name" type="PersonNameType"/> + <xs:element name="DateOfBirth" type="DateOfBirthType"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="IdentificationType"> + <xs:sequence> + <xs:element name="Value" type="xs:string"/> + <xs:element name="Type" type="xs:anyURI"/> + </xs:sequence> + </xs:complexType> + <xs:simpleType name="DateOfBirthType"> + <xs:union memberTypes="xs:date xs:gYearMonth xs:gYear"/> + </xs:simpleType> + <xs:complexType name="PersonNameType"> + <xs:sequence> + <xs:element name="GivenName" type="xs:string"/> + <xs:element name="FamilyName"> + <xs:complexType> + <xs:simpleContent> + <xs:extension base="xs:string"> + <xs:attribute name="primary" default="undefined"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="true"/> + <xs:enumeration value="false"/> + <xs:enumeration value="undefined"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="prefix" type="xs:string"/> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> +</xs:schema>
\ No newline at end of file diff --git a/BKUOnline/src/main/resources/at/gv/egiz/mocca/id/idlschema/oasis-sstc-saml-schema-assertion-1.0.xsd b/BKUOnline/src/main/resources/at/gv/egiz/mocca/id/idlschema/oasis-sstc-saml-schema-assertion-1.0.xsd new file mode 100644 index 00000000..5518db2f --- /dev/null +++ b/BKUOnline/src/main/resources/at/gv/egiz/mocca/id/idlschema/oasis-sstc-saml-schema-assertion-1.0.xsd @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!-- edited with XML Spy v3.5 NT (http://www.xmlspy.com) by Phill Hallam-Baker (VeriSign Inc.) -->
+<schema targetNamespace="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:pr="http://reference.e-government.gv.at/namespace/persondata/20020228#" xmlns:ecdsa="http://www.w3.org/2001/04/xmldsig-more#" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified">
+ <import namespace="http://reference.e-government.gv.at/namespace/persondata/20020228#" schemaLocation="PersonData.xsd"/>
+ <import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>
+ <import namespace="http://www.w3.org/2001/04/xmldsig-more#" schemaLocation="xmldsig-more.xsd"/>
+ <element name="Assertion" type="saml:AssertionType"/>
+ <complexType name="AssertionType">
+ <sequence>
+ <element ref="saml:AttributeStatement"/>
+ <element ref="ds:Signature" minOccurs="0"/>
+ </sequence>
+ <attribute name="MajorVersion" type="integer" use="required" fixed="1"/>
+ <attribute name="MinorVersion" type="integer" use="required" fixed="0"/>
+ <attribute name="AssertionID" type="saml:IDType" use="required"/>
+ <attribute name="Issuer" type="string" use="required"/>
+ <attribute name="IssueInstant" type="dateTime" use="required"/>
+ </complexType>
+ <simpleType name="IDType">
+ <restriction base="string"/>
+ </simpleType>
+ <element name="AttributeStatement" type="saml:AttributeStatementType"/>
+ <complexType name="AttributeStatementType">
+ <complexContent>
+ <extension base="saml:SubjectStatementAbstractType1">
+ <sequence>
+ <element ref="saml:Attribute" maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <complexType name="SubjectStatementAbstractType1" abstract="true">
+ <complexContent>
+ <extension base="saml:StatementAbstractType">
+ <sequence>
+ <element ref="saml:Subject"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <complexType name="StatementAbstractType" abstract="true"/>
+ <element name="Subject" type="saml:SubjectType"/>
+ <complexType name="SubjectType">
+ <choice>
+ <sequence>
+ <element ref="saml:NameIdentifier"/>
+ <element ref="saml:SubjectConfirmation"/>
+ </sequence>
+ <element ref="saml:SubjectConfirmation"/>
+ </choice>
+ </complexType>
+ <element name="NameIdentifier" type="saml:NameIdentifierType"/>
+ <complexType name="NameIdentifierType">
+ <simpleContent>
+ <extension base="string">
+ <attribute name="NameQualifier" type="string" use="optional"/>
+ <attribute name="Format" type="anyURI" use="optional"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+ <element name="SubjectConfirmation" type="saml:SubjectConfirmationType"/>
+ <complexType name="SubjectConfirmationType">
+ <sequence>
+ <element ref="saml:ConfirmationMethod"/>
+ <element ref="saml:SubjectConfirmationData"/>
+ </sequence>
+ </complexType>
+ <element name="SubjectConfirmationData">
+ <complexType>
+ <sequence>
+ <element ref="pr:Person"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="ConfirmationMethod">
+ <simpleType>
+ <restriction base="anyURI">
+ <enumeration value="urn:oasis:names:tc:SAML:1.0:cm:sender-vouches"/>
+ </restriction>
+ </simpleType>
+ </element>
+ <element name="Attribute" type="saml:AttributeType"/>
+ <complexType name="AttributeType">
+ <complexContent>
+ <extension base="saml:AttributeDesignatorType">
+ <sequence>
+ <element ref="saml:AttributeValue" maxOccurs="unbounded"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+ <complexType name="AttributeDesignatorType">
+ <attribute name="AttributeName" type="string" use="required" fixed="CitizenPublicKey"/>
+ <attribute name="AttributeNamespace" type="anyURI" use="required" fixed="urn:publicid:gv.at:namespaces:identitylink:1.2"/>
+ </complexType>
+ <element name="AttributeValue">
+ <complexType>
+ <choice>
+ <element ref="ds:DSAKeyValue"/>
+ <element ref="ds:RSAKeyValue"/>
+ <element ref="ecdsa:ECDSAKeyValue"/>
+ </choice>
+ </complexType>
+ </element>
+</schema>
diff --git a/bkucommon/src/main/resources/at/gv/egiz/bku/slcommands/schema/xmldsig-core-schema.xsd b/BKUOnline/src/main/resources/at/gv/egiz/mocca/id/idlschema/xmldsig-core-schema.xsd index 8422fdfa..8422fdfa 100644 --- a/bkucommon/src/main/resources/at/gv/egiz/bku/slcommands/schema/xmldsig-core-schema.xsd +++ b/BKUOnline/src/main/resources/at/gv/egiz/mocca/id/idlschema/xmldsig-core-schema.xsd diff --git a/BKUOnline/src/main/resources/at/gv/egiz/mocca/id/idlschema/xmldsig-more.xsd b/BKUOnline/src/main/resources/at/gv/egiz/mocca/id/idlschema/xmldsig-more.xsd new file mode 100644 index 00000000..52856ae6 --- /dev/null +++ b/BKUOnline/src/main/resources/at/gv/egiz/mocca/id/idlschema/xmldsig-more.xsd @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8"?> + + <xs:schema + targetNamespace="http://www.w3.org/2001/04/xmldsig-more#" + xmlns:ecdsa="http://www.w3.org/2001/04/xmldsig-more#" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified" attributeFormDefault="unqualified" + version="0.2"> + + <!--ECDSA key value root element--> + + <xs:element name="ECDSAKeyValue" type="ecdsa:ECDSAKeyValueType"/> + <xs:complexType name="ECDSAKeyValueType"> + <xs:sequence> + <xs:element name="DomainParameters" + type="ecdsa:DomainParamsType" minOccurs="0"/> + <xs:element name="PublicKey" type="ecdsa:ECPointType"/> + </xs:sequence> + </xs:complexType> + + <!--EC domain parameters--> + + <xs:complexType name="DomainParamsType"> + <xs:choice> + <xs:element name="ExplicitParams" + type="ecdsa:ExplicitParamsType"/> + <xs:element name="NamedCurve"> + <xs:complexType> + <xs:attribute name="URN" type="xs:anyURI" use="required"/> + </xs:complexType> + </xs:element> + </xs:choice> + </xs:complexType> + <xs:complexType name="FieldParamsType" abstract="true"/> + + <xs:complexType name="PrimeFieldParamsType"> + <xs:complexContent> + <xs:extension base="ecdsa:FieldParamsType"> + <xs:sequence> + <xs:element name="P" type="xs:positiveInteger"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="CharTwoFieldParamsType" abstract="true"> + <xs:complexContent> + <xs:extension base="ecdsa:FieldParamsType"> + <xs:sequence> + <xs:element name="M" type="xs:positiveInteger"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="OddCharExtensionFieldParamsType"> + <xs:complexContent> + <xs:extension base="ecdsa:FieldParamsType"> + <xs:sequence> + <xs:element name="M" type="xs:positiveInteger"/> + <xs:element name="W" type="xs:positiveInteger"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="TnBFieldParamsType"> + <xs:complexContent> + <xs:extension base="ecdsa:CharTwoFieldParamsType"> + <xs:sequence> + <xs:element name="K" type="xs:positiveInteger"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="PnBFieldParamsType"> + <xs:complexContent> + <xs:extension base="ecdsa:CharTwoFieldParamsType"> + <xs:sequence> + <xs:element name="K1" type="xs:positiveInteger"/> + <xs:element name="K2" type="xs:positiveInteger"/> + <xs:element name="K3" type="xs:positiveInteger"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="ExplicitParamsType"> + <xs:sequence> + <xs:element name="FieldParams" type="ecdsa:FieldParamsType"/> + <xs:element name="CurveParams" type="ecdsa:CurveParamsType"/> + <xs:element name="BasePointParams" + type="ecdsa:BasePointParamsType"/> + </xs:sequence> + </xs:complexType> + <xs:complexType name="CurveParamsType"> + <xs:sequence> + <xs:element name="A" type="ecdsa:FieldElemType"/> + <xs:element name="B" type="ecdsa:FieldElemType"/> + <xs:element name="Seed" type="xs:hexBinary" minOccurs="0"/> + </xs:sequence> + </xs:complexType> + <xs:complexType name="BasePointParamsType"> + <xs:sequence> + <xs:element name="BasePoint" type="ecdsa:ECPointType"/> + <xs:element name="Order" type="xs:positiveInteger"/> + <xs:element name="Cofactor" type="xs:positiveInteger" + minOccurs="0"/> + </xs:sequence> + </xs:complexType> + + <!--EC point--> + + <xs:complexType name="ECPointType"> + <xs:sequence minOccurs="0"> + <xs:element name="X" type="ecdsa:FieldElemType"/> + <xs:element name="Y" type="ecdsa:FieldElemType"/> + </xs:sequence> + </xs:complexType> + + <!--Field element--> + + <xs:complexType name="FieldElemType" abstract="true"/> + <xs:complexType name="PrimeFieldElemType"> + <xs:complexContent> + <xs:extension base="ecdsa:FieldElemType"> + <xs:attribute name="Value" type="xs:nonNegativeInteger" + use="required"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + + <xs:complexType name="CharTwoFieldElemType"> + <xs:complexContent> + <xs:extension base="ecdsa:FieldElemType"> + <xs:attribute name="Value" type="xs:hexBinary" + use="required"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="OddCharExtensionFieldElemType"> + <xs:complexContent> + <xs:extension base="ecdsa:FieldElemType"> + <xs:attribute name="Value" type="xs:nonNegativeInteger" + use="required"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:schema>
\ No newline at end of file diff --git a/BKUOnline/src/main/resources/commons-logging.properties b/BKUOnline/src/main/resources/commons-logging.properties deleted file mode 100644 index 0d497b1b..00000000 --- a/BKUOnline/src/main/resources/commons-logging.properties +++ /dev/null @@ -1,16 +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. - -org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger diff --git a/BKUOnline/src/main/resources/log4j.properties b/BKUOnline/src/main/resources/log4j.properties index d4a03fe7..e3012f35 100644 --- a/BKUOnline/src/main/resources/log4j.properties +++ b/BKUOnline/src/main/resources/log4j.properties @@ -14,9 +14,10 @@ # limitations under the License. -#log4j.rootLogger=DEBUG, STDOUT, file -log4j.rootLogger=INFO, file +log4j.rootLogger=INFO, STDOUT, file +#log4j.rootLogger=DEBUG, file #log4j.logger.at.gv=TRACE +log4j.logger.org.springframework=INFO # STDOUT appender @@ -24,7 +25,7 @@ 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 | %t | %c %x - %m%n +log4j.appender.STDOUT.layout.ConversionPattern=...%-0.6X{id} %-5p | %t | %c - %m%n # FILE appender log4j.appender.file=org.apache.log4j.RollingFileAppender diff --git a/BKUOnline/src/main/webapp/IDRequestForm.html b/BKUOnline/src/main/webapp/IDRequestForm.html new file mode 100644 index 00000000..2682df4d --- /dev/null +++ b/BKUOnline/src/main/webapp/IDRequestForm.html @@ -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. +--> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> + <head> + <title>ID Request Form</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <link rel="shortcut icon" href="img/chip16.ico" type="image/x-icon"> + <style type="text/css" media="all">@import "css/main.css";</style> + <style type="text/css"> + fieldset { + padding: 1em; + margin: 1em; + font: 80%/ 1 sans-serif; + background-color: #F2EFE9; + padding-left: 5em; + } + + fieldset.submit { + float: none; + width: auto; + border: 0 none #FFF; + padding-left: 14em; + border-style: none; + background-color: transparent; + } + + label { + float: left; + width: 8em; + margin-right: 0.5em; + padding-top: 0.2em; + text-align: right; + font-weight: bold; + color: #000; + padding-top: 0.2em; + } + + legend { + border: 1px solid; + padding: 2px 6px + } + </style> + </head> +<body> +<h1>ID Request Form</h1> +<form action="./moccaid" method="post" + enctype="application/x-www-form-urlencoded" name="idform"> +<fieldset><legend>ID Request</legend> +<p><label for="BKUUrl">BKUUrl</label><input + value="http://localhost:3495/http-security-layer-request" /></p> +</fieldset> +<fieldset class="submit"><input type="submit" class="submit"/></fieldset> +</form> + +</body> +</html> diff --git a/BKUOnline/src/main/webapp/PINManagement.jsp b/BKUOnline/src/main/webapp/PINManagement.jsp index 3555f99e..d5f71862 100644 --- a/BKUOnline/src/main/webapp/PINManagement.jsp +++ b/BKUOnline/src/main/webapp/PINManagement.jsp @@ -49,11 +49,43 @@ } String backgroundImg = request.getParameter("appletBackground"); %> - <body id="appletpage" style="width:<%=width%>" onFocus="focusToApplet()"> + <body id="appletpage" style="width:<%=width%>"> + + <div id="container" style="float: left; width: <%= width %>"> + + + <form name="increaseform" action="javascript:increaseSize()" method="get"> + + <!-- increase font size image --> + <input type="image" src="img/inc.png" alt="Text vergrößern" width="13px" height="18px" style="float: left;" id="increase_image"/> + + </form> + + + <form name="decreaseform" action="javascript:decreaseSize()" method="get"> + + <!-- decrease font size image --> + <input type="image" src="img/dec.png" alt="Text verkleinern" width="13px" height="18px" style="float: left;" id="decrease_image"/> + + </form> + + <form name="helpform" action="help/index.html" method="get" target="_new" + onsubmit="this.action=document.moccaapplet.getHelpURL(); this.submit(); return false;"> + + <!-- invisible input --> + <input type="image" src="img/help.png" alt=" " width="0px" height="0px" style="float: left;" onFocus="focusToApplet()"/> + + <!-- help image --> + <input type="image" src="img/help.png" alt="Hilfe" width="13px" height="18px" style="float: right;" id="helpimage"/> + + + </form> + <script> // avoid selection of applet before it is completely loaded - var allowSelectionByJS = false; + // TODO: Is this necessary? + var allowSelectionByJS = true; if (!deployJava.versionCheck('1.6.0_04+')) { document @@ -81,6 +113,8 @@ deployJava.runApplet(attributes, parameters, version); } </script> + + </div> </body> <script> @@ -90,7 +124,6 @@ //alert('try to set focus to applet'); if (document != null && document.moccaapplet != null && allowSelectionByJS) { - //alert('set focus to applet.'); document.moccaapplet.getFocusFromBrowser(); return true; } @@ -101,10 +134,49 @@ // put focus to window // focus can be assigned to an arbitrary focusable field on the embedding website as well - self.focus(); + document.getElementById("helpimage").focus(); } - + + function increaseSize() { + + var appwidth = document.moccaapplet.width; + var appheight = document.moccaapplet.height; + + document.moccaapplet.width = (appwidth * 1.2); + document.moccaapplet.height = (appheight * 1.2); + + document.getElementById("container").style.width = (appwidth * 1.2); + + // TODO: This does not work, seems that width and height attributes cannot be read + // and set from input of type image + var image_width = document.getElementById("increase_image").width; + var image_height = document.getElementById("increase_image").height; + + + document.getElementById("helpimage").width = (image_width * 1.2); + document.getElementById("helpimage").height = (image_height * 1.2); + + document.getElementById("increase_image").width = (image_width * 1.2); + document.getElementById("increase_image").height = (image_height * 1.2); + + document.getElementById("decrease_image").width = (image_width * 1.2); + document.getElementById("decrease_image").height = (image_height * 1.2); + + + } + + function decreaseSize() { + + var appwidth = document.moccaapplet.width; + var appheight = document.moccaapplet.height; + + document.moccaapplet.width = (appwidth * 0.8333333333333); + document.moccaapplet.height = (appheight * 0.8333333333333); + + document.getElementById("container").style.width = (appwidth * 0.8333333333333); + } + </script> </html> diff --git a/BKUOnline/src/main/webapp/SLRequestForm.html b/BKUOnline/src/main/webapp/SLRequestForm.html index 2de652a7..2a372d83 100644 --- a/BKUOnline/src/main/webapp/SLRequestForm.html +++ b/BKUOnline/src/main/webapp/SLRequestForm.html @@ -73,7 +73,7 @@ <body> <h1>Security-Layer v1.2 Request Formular</h1> <p> - <form action="./http-security-layer-request" method="Post" + <form action="./http-security-layer-request" method="Get" enctype="application/x-www-form-urlencoded" name="slform"> <!--input name="locale" value="es_MX" type="hidden" /--> <fieldset><legend>Enter XML Request</legend> @@ -186,8 +186,8 @@ <p> <label for="appletPage">Applet Page</label> - <input type="radio" name="appletPage" value="BKUApplet" checked="checked">Default - <input type="radio" name="appletPage" value="BKUAppletAlternative">Alternative + <input type="radio" name="applet.jsp" value="BKUApplet" checked="checked">Default + <input type="radio" name="applet.jsp" value="BKUAppletAlternative">Alternative </p> <!-- <p> diff --git a/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml b/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml index 0324030e..ab8be2b6 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml +++ b/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml @@ -12,106 +12,252 @@ License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
- <bean id="STALFactory" class="at.gv.egiz.stal.service.impl.RequestBrokerSTALFactory"
- scope="singleton" />
+ <!-- configuration -->
+ <bean id="configurationResource"
+ class="org.springframework.web.context.support.ServletContextParameterFactoryBean">
+ <property name="initParamName" value="configurationResource" />
+ </bean>
+
+ <bean id="configuration" class="at.gv.egiz.bku.spring.ConfigurationFactoryBean">
+ <property name="configurationResource" ref="configurationResource" />
+ </bean>
+
+ <bean id="sslPKIProfile" class="at.gv.egiz.bku.spring.PKIProfileFactoryBean">
+ <property name="configuration" ref="configuration"/>
+ <property name="trustProfileId" value="SSL"/>
+ </bean>
+
+ <bean id="sslSocketFactory" class="at.gv.egiz.bku.spring.SSLSocketFactoryBean">
+ <property name="configuration" ref="configuration"/>
+ <property name="pkiProfile" ref="sslPKIProfile"/>
+ </bean>
+
+ <bean id="hostnameVerifier" class="at.gv.egiz.bku.spring.ConfigurableHostnameVerifier">
+ <property name="configuration" ref="configuration"/>
+ </bean>
- <bean id="accessController"
- class="at.gv.egiz.bku.online.accesscontroller.SpringSecurityManager"
- scope="singleton" init-method="init">
- <property name="config" ref="configurator" />
+ <bean id="urlDereferencer" class="at.gv.egiz.bku.utils.urldereferencer.URLDereferencerImpl"
+ factory-method="getInstance">
+ <property name="SSLSocketFactory" ref="sslSocketFactory"/>
+ <property name="hostnameVerifier" ref="hostnameVerifier"/>
+ </bean>
+
+ <!-- security manager for the command invoker -->
+ <bean id="securityManager" class="at.gv.egiz.bku.spring.SecurityManagerFactoryBean">
+ <property name="configuration" ref="configuration" />
</bean>
- <bean id="commandInvoker" class="at.gv.egiz.bku.binding.SLCommandInvokerImpl">
- <property name="securityManager" ref="accessController" />
+ <!-- command invoker -->
+ <bean id="slCommandInvoker" class="at.gv.egiz.bku.binding.SLCommandInvokerImpl">
+ <property name="securityManager" ref="securityManager" />
+ </bean>
+
+ <!-- Security Layer command factory -->
+
+ <bean id="abstractCommandFactory" class="at.gv.egiz.bku.slcommands.AbstractSLCommandFactory"
+ abstract="true">
+ <property name="configuration" ref="configuration"/>
+ </bean>
+
+ <bean id="certificatesInfoboxFactory"
+ class="at.gv.egiz.bku.slcommands.impl.CertificatesInfoboxFactory" />
+ <bean id="identityLinkInfoboxFactory"
+ class="at.gv.egiz.bku.slcommands.impl.IdentityLinkInfoboxFactory">
+ <property name="identityLinkTransformer">
+ <bean class="at.gv.egiz.idlink.IdentityLinkTransformer">
+ <property name="urlDereferencer" ref="urlDereferencer"/>
+ </bean>
+ </property>
+ </bean>
+ <bean id="cardChannelInfoboxFactory"
+ class="at.gv.egiz.bku.slcommands.impl.CardChannelInfoboxFactory" />
+ <bean id="svPersonendatenInfoboxFactory"
+ class="at.gv.egiz.bku.slcommands.impl.SVPersonendatenInfoboxFactory" />
+
+ <bean id="infoboxFactory" class="at.gv.egiz.bku.slcommands.impl.InfoboxFactory">
+ <property name="infoboxFactories">
+ <map>
+ <entry key="Certificates" value-ref="certificatesInfoboxFactory" />
+ <entry key="IdentityLink" value-ref="identityLinkInfoboxFactory" />
+ <entry key="CardChannel" value-ref="cardChannelInfoboxFactory" />
+ <entry key="SV-Personendaten" value-ref="svPersonendatenInfoboxFactory" />
+ </map>
+ </property>
+ </bean>
+
+ <bean id="nullOperationCommandFactory"
+ class="at.gv.egiz.bku.slcommands.impl.NullOperationCommandFactory"
+ parent="abstractCommandFactory" />
+ <bean id="nullOperationRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="NullOperationRequest" />
+ </bean>
+ <bean id="infoboxReadCommandFactory"
+ class="at.gv.egiz.bku.slcommands.impl.InfoboxReadCommandFactory"
+ parent="abstractCommandFactory">
+ <property name="infoboxFactory" ref="infoboxFactory" />
+ </bean>
+ <bean id="infoboxReadRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="InfoboxReadRequest" />
+ </bean>
+ <bean id="infoboxUpdateCommandFactory"
+ class="at.gv.egiz.bku.slcommands.impl.InfoboxUpdateCommandFactory"
+ parent="abstractCommandFactory">
+ <property name="infoboxFactory" ref="infoboxFactory" />
+ </bean>
+ <bean id="infoboxUpdateRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="InfoboxUpdateRequest" />
+ </bean>
+ <bean id="createXMLSignatureCommandFactory"
+ class="at.gv.egiz.bku.slcommands.impl.CreateXMLSignatureCommandFactory"
+ parent="abstractCommandFactory" />
+ <bean id="createXMLSignatureRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="CreateXMLSignatureRequest" />
+ </bean>
+ <bean id="getStatusCommandFactory" class="at.gv.egiz.bku.slcommands.impl.GetStatusCommandFactory"
+ parent="abstractCommandFactory" />
+ <bean id="getStatusRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="GetStatusRequest" />
</bean>
<bean id="slCommandFactory" class="at.gv.egiz.bku.slcommands.SLCommandFactory"
factory-method="getInstance">
- <property name="commandImpl">
+ <property name="concreteFactories">
<map>
- <entry
- key="http://www.buergerkarte.at/namespaces/securitylayer/1.2#:NullOperationRequest"
- value="at.gv.egiz.bku.slcommands.impl.NullOperationCommandImpl" />
- <entry
- key="http://www.buergerkarte.at/namespaces/securitylayer/1.2#:InfoboxReadRequest"
- value="at.gv.egiz.bku.slcommands.impl.InfoboxReadCommandImpl" />
- <entry
- key="http://www.buergerkarte.at/namespaces/securitylayer/1.2#:InfoboxUpdateRequest"
- value="at.gv.egiz.bku.slcommands.impl.InfoboxUpdateCommandImpl" />
- <entry
- key="http://www.buergerkarte.at/namespaces/securitylayer/1.2#:CreateXMLSignatureRequest"
- value="at.gv.egiz.bku.slcommands.impl.CreateXMLSignatureCommandImpl" />
- <entry
- key="http://www.buergerkarte.at/namespaces/securitylayer/1.2#:GetStatusRequest"
- value="at.gv.egiz.bku.slcommands.impl.GetStatusCommandImpl" />
+ <entry key-ref="nullOperationRequest" value-ref="nullOperationCommandFactory" />
+ <entry key-ref="infoboxReadRequest" value-ref="infoboxReadCommandFactory" />
+ <entry key-ref="infoboxUpdateRequest" value-ref="infoboxUpdateCommandFactory" />
+ <entry key-ref="createXMLSignatureRequest" value-ref="createXMLSignatureCommandFactory" />
+ <entry key-ref="getStatusRequest" value-ref="getStatusCommandFactory" />
</map>
</property>
+ <!--
+ The following properties may be used to introduce additional XML
+ schemas and binding classes to the command factory.
+ -->
+ <!--
+ If property jaxbContextPackageNames is not set the default JAXBContext
+ is created with the package names given below.
+ -->
+ <!--
+ <property name="jaxbContextPackageNames">
+ <list>
+ <value>at.buergerkarte.namespaces.securitylayer._1</value>
+ <value>org.w3._2000._09.xmldsig_</value>
+ <value>at.buergerkarte.namespaces.cardchannel</value>
+ <value>at.buergerkarte.namespaces.securitylayer._20020225_</value>
+ <value>at.buergerkarte.namespaces.securitylayer._20020831_</value>
+ </list>
+ </property>
+ -->
+ <!--
+ If property schemaUrls is not set the default schema is created from
+ the URLs listed below.
+ -->
+ <!--
+ <property name="schemaUrls">
+ <list>
+ <value>classpath:at/gv/egiz/bku/slschema/xml.xsd</value>
+ <value>classpath:at/gv/egiz/bku/slschema/xmldsig-core-schema.xsd</value>
+ <value>classpath:at/gv/egiz/bku/slschema/Core-1.2.xsd</value>
+ <value>classpath:at/gv/egiz/bku/slschema/Core.20020225.xsd</value>
+ <value>classpath:at/gv/egiz/bku/slschema/Core.20020831.xsd</value>
+ </list>
+ </property>
+ -->
</bean>
- <bean id="infoboxFactory" class="at.gv.egiz.bku.slcommands.impl.InfoboxFactory"
- factory-method="getInstance">
- <property name="infoboxImpl">
- <map>
- <entry
- key="Certificates"
- value="at.gv.egiz.bku.slcommands.impl.CertificatesInfoboxImpl" />
- <entry
- key="IdentityLink"
- value="at.gv.egiz.bku.slcommands.impl.IdentityLinkInfoboxImpl" />
- <entry
- key="CardChannel"
- value="at.gv.egiz.bku.slcommands.impl.CardChannelInfoboxImpl" />
- <entry
- key="SV-Personendaten"
- value="at.gv.egiz.bku.slcommands.impl.SVPersonendatenInfoboxImpl" />
- </map>
- </property>
+ <!-- STAL factory -->
+ <bean id="stalFactory" class="at.gv.egiz.stal.service.impl.RequestBrokerSTALFactory"
+ scope="singleton">
+ <property name="configuration" ref="configuration" />
+ </bean>
+
+ <!-- binding processor factories -->
+ <bean id="httpBindingProcessorFactory" class="at.gv.egiz.bku.binding.HTTPBindingProcessorFactory">
+ <property name="configuration" ref="configuration" />
+ <property name="urlDereferencer" ref="urlDereferencer" />
+ <property name="sslSocketFactory" ref="sslSocketFactory" />
+ <property name="hostnameVerifier" ref="hostnameVerifier" />
+ <property name="slCommandFactory" ref="slCommandFactory" />
+ </bean>
+ <bean id="samlBindingProcessorFactory" class="at.gv.egiz.mocca.id.SAMLBindingProcessorFactory">
+ <property name="configuration" ref="configuration" />
+ <property name="slCommandFactory" ref="slCommandFactory" />
+ <property name="urlDereferencer" ref="urlDereferencer" />
</bean>
+ <!-- binding processor manager -->
<bean id="bindingProcessorManager" class="at.gv.egiz.bku.binding.BindingProcessorManagerImpl"
scope="singleton">
- <constructor-arg ref="STALFactory"></constructor-arg>
- <constructor-arg ref="commandInvoker"></constructor-arg>
- <constructor-arg ref="configuration"></constructor-arg>
+ <property name="stalFactory" ref="stalFactory" />
+ <property name="slCommandInvoker" ref="slCommandInvoker" />
+ <property name="factories">
+ <list>
+ <ref bean="httpBindingProcessorFactory"/>
+ <ref bean="samlBindingProcessorFactory"/>
+ </list>
+ </property>
</bean>
- <!-- TODO DataURL bean with configuration injected -->
-
- <bean
+ <bean id="attributeExporter"
class="org.springframework.web.context.support.ServletContextAttributeExporter">
<property name="attributes">
<map>
- <entry key="bindingProcessorManager">
- <ref bean="bindingProcessorManager" />
- </entry>
+ <entry key="bindingProcessorManager" value-ref="bindingProcessorManager"/>
</map>
</property>
</bean>
- <!-- Configure Configuration -->
- <bean id="certValidator" class="at.gv.egiz.bku.conf.CertValidatorImpl"></bean>
-
-
- <bean id="configurator" class="at.gv.egiz.bku.online.conf.SpringConfigurator"
- init-method="configure" scope="singleton">
- <property name="resource"
- value="classpath:at/gv/egiz/bku/online/conf/defaultConf.properties" />
- <property name="certValidator" ref="certValidator"></property>
- </bean>
-
<!-- Shutdown Event handler -->
- <bean id="shutdown" class="at.gv.egiz.bku.online.webapp.ShutdownHandler">
- <property name="bindingProcessorManager" ref="bindingProcessorManager"></property>
+ <bean id="shutdownHandler" class="at.gv.egiz.bku.online.webapp.ShutdownHandler">
+ <property name="bindingProcessorManager" ref="bindingProcessorManager" />
</bean>
+
+ <!-- JMX -->
+ <bean
+ class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="properties">
+ <map>
+ <entry key="contextPath">
+ <bean class="at.gv.egiz.bku.online.spring.ServletContextPathFactoryBean"/>
+ </entry>
+ </map>
+ </property>
+ </bean>
- <!-- Begin MOCCA Configuration [REFACTORED]
- | Configuration beans (no conf properties file) should be injected directly
- | to module configurators (at.gv.egiz.bku.X.conf.Configuration).
- | Currently, only configuration items are considered.
- |-->
- <import resource="mocca-conf.xml"/>
+ <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
+ <property name="locateExistingServerIfPossible" value="true" />
+ </bean>
+
+ <bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
+ <property name="server" ref="mbeanServer"/>
+ <property name="beans">
+ <map>
+ <entry
+ key="at.gv.egiz.mocca:type=bindingProcessorManager,contextPath=${contextPath},name=HTTP"
+ value-ref="bindingProcessorManager" />
+ <entry
+ key="at.gv.egiz.mocca:type=stalFactory,contextPath=${contextPath},name=RequestBrocker"
+ value-ref="stalFactory" />
+ <entry
+ key="at.gv.egiz.mocca:type=slCommandInvoker,contextPath=${contextPath},name=CommandInvoker"
+ value-ref="slCommandInvoker" />
+ </map>
+ </property>
+ </bean>
+
</beans>
\ No newline at end of file diff --git a/BKUOnline/src/main/webapp/WEB-INF/conf/configuration.xml b/BKUOnline/src/main/webapp/WEB-INF/conf/configuration.xml new file mode 100644 index 00000000..20d27bb0 --- /dev/null +++ b/BKUOnline/src/main/webapp/WEB-INF/conf/configuration.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<MoccaConfiguration version="1.0"> + <DataURLConnection> + <!-- + The maximum number of consecutive Security Layer requests received + from DataURL server before execution is aborted. + --> + <MaxHops>50</MaxHops> + </DataURLConnection> +</MoccaConfiguration>
\ 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 deleted file mode 100644 index 5c96dc58..00000000 --- a/BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<!-- - | User configuration file. (defaultConf.properties is migrated to this file) ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd - http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> - - <!-- BKU Common (ie. main) Configuration --> - <bean id="configuration" class="at.gv.egiz.bku.conf.Configuration"> - <property name="maxDataUrlHops" value="50"/> - - <!-- TODO refactor DataURL and inject this bkuCommonConfig to DataURL --> - <!-- TODO inject bkuCommonConfig to SpringBKUServlet and SpringSecurityManager - | and replace SpringConfigurator --> - <!-- used to construct the User-Agent HTTP header - <property name="implementationName" value="MOCCA"/> - <property name="implementationVersion" value="1.0"/--> - </bean> - - <!-- - | ReaderFactory configuration not available in Applet - | - <bean id="smccConfiguration" class="at.gv.egiz.smcc.conf.SMCCConfiguration"> - <property name="disablePinpad" value="true"/> - </bean> - - <bean id="readerFactory" class="at.gv.egiz.smcc.reader.ReaderFactory"> - <property name="configuration" ref="smccConfiguration"/> - </bean> - |--> - -</beans> diff --git a/BKUOnline/src/main/webapp/WEB-INF/web.xml b/BKUOnline/src/main/webapp/WEB-INF/web.xml index 41cd400f..13ed30ee 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/web.xml +++ b/BKUOnline/src/main/webapp/WEB-INF/web.xml @@ -15,19 +15,23 @@ <web-app id="bkuonline" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name>http-security-layer-request</display-name> - <!-- Begin Spring Config --> - <context-param> - <param-name>contextConfigLocation</param-name> - <param-value>/WEB-INF/applicationContext.xml</param-value> - </context-param> <listener> - <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> + <listener-class>at.gv.egiz.bku.online.webapp.MoccaContextListener</listener-class> </listener> + + <!-- Begin Spring Config --> + <listener> + <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> + </listener> + <context-param> + <param-name>configurationResource</param-name> + <param-value></param-value> + </context-param> <!-- End Spring Config --> <!-- Begin BKU Config --> <listener> - <listener-class>at.gv.egiz.bku.online.webapp.SessionTimeout</listener-class> + <listener-class>at.gv.egiz.bku.online.webapp.SessionListener</listener-class> </listener> <listener> <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class> @@ -37,6 +41,14 @@ <servlet-class>at.gv.egiz.bku.online.webapp.BKURequestHandler</servlet-class> </servlet> <servlet> + <servlet-name>SAMLServlet</servlet-name> + <servlet-class>at.gv.egiz.mocca.id.SAMLRequestHandler</servlet-class> + </servlet> + <servlet> + <servlet-name>DataURLServlet</servlet-name> + <servlet-class>at.gv.egiz.mocca.id.DataURLServerServlet</servlet-class> + </servlet> + <servlet> <servlet-name>ResultServlet</servlet-name> <servlet-class>at.gv.egiz.bku.online.webapp.ResultServlet</servlet-class> <init-param> @@ -45,31 +57,39 @@ </init-param> <init-param> <param-name>expiredPage</param-name> - <!-- FIXME --> <param-value>expired.html</param-value> </init-param> </servlet> - <servlet> - <servlet-name>BKUApplet</servlet-name> - <jsp-file>/applet.jsp</jsp-file> - </servlet> - <servlet> - <servlet-name>STALService</servlet-name> - <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class> - <load-on-startup>1</load-on-startup> - </servlet> - <servlet-mapping> - <servlet-name>BKUServlet</servlet-name> - <url-pattern>/http-security-layer-request</url-pattern> - </servlet-mapping> + <servlet> + <servlet-name>STALService</servlet-name> + <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class> + <load-on-startup>1</load-on-startup> + </servlet> + <servlet-mapping> + <servlet-name>BKUServlet</servlet-name> + <url-pattern>/http-security-layer-request</url-pattern> + </servlet-mapping> <servlet-mapping> <servlet-name>BKUServlet</servlet-name> <url-pattern>/https-security-layer-request</url-pattern> </servlet-mapping> <servlet-mapping> + <servlet-name>DataURLServlet</servlet-name> + <url-pattern>/DataURLServer</url-pattern> + </servlet-mapping> + <servlet-mapping> <servlet-name>ResultServlet</servlet-name> <url-pattern>/bkuResult</url-pattern> </servlet-mapping> + <servlet-mapping> + <servlet-name>SAMLServlet</servlet-name> + <url-pattern>/moccaid</url-pattern> + </servlet-mapping> + <servlet-mapping> + <servlet-name>DataURLServlet</servlet-name> + <url-pattern>/DataURLServer</url-pattern> + </servlet-mapping> + <!-- | Configure alternative applet pages that may be requested diff --git a/BKUOnline/src/main/webapp/applet.jsp b/BKUOnline/src/main/webapp/applet.jsp index 582bee7e..3b284496 100644 --- a/BKUOnline/src/main/webapp/applet.jsp +++ b/BKUOnline/src/main/webapp/applet.jsp @@ -79,14 +79,50 @@ %> <body id="appletpage" style="width:<%=width%>px"> + + + <div id="container" style="float: left; width: <%= width %>"> + + <form name="increaseform" action="javascript:increaseSize()" method="get"> + + <!-- increase font size image --> + <input type="image" src="img/inc.png" alt="Text vergrößern" width="13px" height="18px" style="float: left;" id="increase_image"/> + + </form> + + + <form name="decreaseform" action="javascript:decreaseSize()" method="get"> + + <!-- decrease font size image --> + <input type="image" src="img/dec.png" alt="Text verkleinern" width="13px" height="18px" style="float: left;" id="decrease_image"/> + + </form> + + + + <form name="helpform" action="help/index.html" method="get" target="_new" + onsubmit="this.action=document.moccaapplet.getHelpURL(); this.submit(); return false;"> + + <!-- invisible input --> + <input type="image" src="img/help.png" alt=" " width="0px" height="0px" style="float: left;" onFocus="focusToApplet()"/> + + <!-- help image --> + <input type="image" src="img/help.png" alt="Hilfe" width="13px" height="18px" style="float: right;" id="helpimage"/> + + + </form> + + + <script type="text/javascript"> + if (!deployJava.versionCheck('1.6.0_04+')) { - document.write('<p>Diese Anwendung benötigt Version 6 Update 4 oder höher der <a href="" onclick="deployJava.installLatestJRE();">Java™ Laufzeitumgebung</a>.</p>'); + document.write('<p>Diese Anwendung benötigt Version 6 Update 4 oder höher der <a href="" onclick="deployJava.installLatestJRE();">Java™ Laufzeitumgebung</a>.</p>'); } else { var attributes = { codebase :'<%=codebase%>', code : '<%=appletClass%>', - archive : '<%=appletArchive +".jar, commons-logging.jar, iaik_jce_me4se.jar"%>', + archive : '<%=appletArchive +".jar"%>', width : <%=width%>, height :<%=height%>, name : 'moccaapplet', @@ -106,6 +142,98 @@ }; deployJava.runApplet(attributes, parameters, '1.6.0_04'); } + </script> + + + + </div> + </body> + + <script> + + + + function focusToBrowser() { + + // put focus to window + // focus can be assigned to any focusable field on the embedding website + + //alert("Put focus to browser.."); + //self.focus(); + document.getElementById("helpimage").focus(); + + } + + function focusToApplet() { + + //alert('try to set focus to applet'); + if (document != null && document.moccaapplet != null) { + + //alert('set focus to applet.'); + document.moccaapplet.getFocusFromBrowser(); + return true; + } + } + + + function increaseSize() { + + var appwidth = document.moccaapplet.width; + var appheight = document.moccaapplet.height; + + document.moccaapplet.width = (appwidth * 1.2); + document.moccaapplet.height = (appheight * 1.2); + + document.getElementById("container").style.width = (appwidth * 1.2); + + // TODO: This does not work in firefox, seems that width and height attributes cannot be read + // and set from input of type image + var image_width = document.getElementById("increase_image").width; + var image_height = document.getElementById("increase_image").height; + + + document.getElementById("helpimage").width = (image_width * 1.2); + document.getElementById("helpimage").height = (image_height * 1.2); + + document.getElementById("increase_image").width = (image_width * 1.2); + document.getElementById("increase_image").height = (image_height * 1.2); + + document.getElementById("decrease_image").width = (image_width * 1.2); + document.getElementById("decrease_image").height = (image_height * 1.2); + + + } + + function decreaseSize() { + + var appwidth = document.moccaapplet.width; + var appheight = document.moccaapplet.height; + + document.moccaapplet.width = (appwidth * 0.8333333333333); + document.moccaapplet.height = (appheight * 0.8333333333333); + + document.getElementById("container").style.width = (appwidth * 0.8333333333333); + + // TODO: This does not work in firefox, seems that width and height attributes cannot be read + // and set from input of type image + var image_width = document.getElementById("increase_image").width; + var image_height = document.getElementById("increase_image").height; + + + document.getElementById("helpimage").width = (image_width * 0.8333333333333); + document.getElementById("helpimage").height = (image_height * 0.8333333333333); + + document.getElementById("increase_image").width = (image_width * 0.8333333333333); + document.getElementById("increase_image").height = (image_height * 0.8333333333333); + + document.getElementById("decrease_image").width = (image_width * 0.8333333333333); + document.getElementById("decrease_image").height = (image_height * 0.8333333333333); + + + } + + </script> + </html> diff --git a/BKUOnline/src/main/webapp/img/dec.png b/BKUOnline/src/main/webapp/img/dec.png Binary files differnew file mode 100644 index 00000000..87693cf4 --- /dev/null +++ b/BKUOnline/src/main/webapp/img/dec.png diff --git a/BKUOnline/src/main/webapp/img/help.png b/BKUOnline/src/main/webapp/img/help.png Binary files differnew file mode 100644 index 00000000..5d6da3bf --- /dev/null +++ b/BKUOnline/src/main/webapp/img/help.png diff --git a/BKUOnline/src/main/webapp/img/inc.png b/BKUOnline/src/main/webapp/img/inc.png Binary files differnew file mode 100644 index 00000000..26e58b80 --- /dev/null +++ b/BKUOnline/src/main/webapp/img/inc.png diff --git a/BKUOnline/src/main/webapp/local.jsp b/BKUOnline/src/main/webapp/local.jsp new file mode 100644 index 00000000..48d62674 --- /dev/null +++ b/BKUOnline/src/main/webapp/local.jsp @@ -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. +--> +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" + import="at.gv.egiz.bku.online.webapp.AppletDispatcher,org.apache.commons.lang.RandomStringUtils,org.apache.commons.lang.StringEscapeUtils" %> + +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>MOCCA</title> + <link rel="shortcut icon" href="img/chip16.ico" type="image/x-icon"> + <style type="text/css" media="all">@import "css/applet.css";</style> + + <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> + <META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT"> + <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> + </head> + <% + int width = session.getAttribute("appletWidth") == null ? 190 + : (Integer) session.getAttribute("appletWidth"); + int height = session.getAttribute("appletHeight") == null ? 130 + : (Integer) session.getAttribute("appletHeight"); + String backgroundImg = StringEscapeUtils.escapeJavaScript(session + .getAttribute("appletBackground") == null ? "../img/chip32.png" + : (String) session.getAttribute("appletBackground")); + String backgroundColor = StringEscapeUtils + .escapeJavaScript((String) session + .getAttribute("appletBackgroundColor")); + + String sessionId = StringEscapeUtils.escapeJavaScript(session.getId()); + + String dataURL = request.getRequestURL().toString(); + dataURL = dataURL.substring(0, dataURL.lastIndexOf('/')) + "/DataURLServer"; + %> + <body id="appletpage" style="width:<%=width%>px;height:<%=height%>px"> + <div style="width:<%=width%>px;height:<%=height%>px"> + <form action="http://127.0.0.1:3495/http-security-layer-request" method="post" enctype="application/x-www-form-urlencoded"> + <input name="SessionID_" value="<%=sessionId%>" type="hidden"/> + <input name="DataURL" value="<%=dataURL%>" id="DataURL" type="hidden"/> + <input name="XMLRequest" value="<NullOperationRequest xmlns='http://www.buergerkarte.at/namespaces/securitylayer/1.2#'/>" type="hidden"/> + <p>Anfrage wird an lokale BKU gesendet</p> + <div style="text-align: center;"> + <input type="submit" style="vertical-align: middle"/> + </div> + </form> + </div> + </body> +</html> diff --git a/BKUOnline/src/test/java/at/gv/egiz/bku/online/conf/SSLConfigTest.java b/BKUOnline/src/test/java/at/gv/egiz/bku/online/conf/SSLConfigTest.java deleted file mode 100644 index eefaf5b6..00000000 --- a/BKUOnline/src/test/java/at/gv/egiz/bku/online/conf/SSLConfigTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package at.gv.egiz.bku.online.conf;
-
-import java.net.URL;
-
-import javax.net.ssl.HttpsURLConnection;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-@Ignore
-public class SSLConfigTest {
-
- private SpringConfigurator cfg;
- private ApplicationContext ctx;
-
- @Before
- public void setUp() throws Exception {
- ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
-
- }
-
- @Ignore
- @Test
- public void testConnect() throws Exception {
- String url = "https://apps.egiz.gv.at/exchange-moa-id-auth/VerifyIdentityLink?MOASessionID=8151862969943601574";
- URL u = new URL(url);
- HttpsURLConnection uc = (HttpsURLConnection) u.openConnection();
- uc.connect();
- System.out.println(uc.getCipherSuite());
- }
-
- @After
- public void shutDown() {
-
- }
-}
diff --git a/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java b/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java index 741974eb..da816d48 100644 --- a/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java +++ b/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java @@ -47,11 +47,11 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.xml.bind.JAXBElement; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.junit.Assert.*; @@ -62,11 +62,12 @@ import static org.junit.Assert.*; @Ignore public class STALRequestBrokerTest { - private static final Log log = LogFactory.getLog(STALRequestBrokerTest.class); + private final Logger log = LoggerFactory.getLogger(STALRequestBrokerTest.class); protected static STALRequestBroker stal; @BeforeClass public static void setUp() { + Logger log = LoggerFactory.getLogger(STALRequestBrokerTest.class); RequestBrokerSTALFactory fac = new RequestBrokerSTALFactory(); stal = (STALRequestBrokerImpl) fac.createSTAL(); log.debug("Created STAL " + stal.getClass().getName()); diff --git a/BKUOnline/src/test/resources/commons-logging.properties b/BKUOnline/src/test/resources/commons-logging.properties deleted file mode 100644 index 0d497b1b..00000000 --- a/BKUOnline/src/test/resources/commons-logging.properties +++ /dev/null @@ -1,16 +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. - -org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger diff --git a/BKUOnline/src/test/resources/templates/empty.xml b/BKUOnline/src/test/resources/templates/empty.xml new file mode 100644 index 00000000..5381ac6c --- /dev/null +++ b/BKUOnline/src/test/resources/templates/empty.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<test/>
\ No newline at end of file diff --git a/BKUOnline/src/test/resources/templates/template.xsl b/BKUOnline/src/test/resources/templates/template.xsl new file mode 100644 index 00000000..6ec73a42 --- /dev/null +++ b/BKUOnline/src/test/resources/templates/template.xsl @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:pr="http://reference.e-government.gv.at/namespace/persondata/20020228#" exclude-result-prefixes="pr saml"> + <xsl:output method="xml" xml:space="default" omit-xml-declaration="yes"/> + <xsl:param name="givenName"/> + <xsl:param name="familyName"/> + <xsl:param name="dateOfBirth"/> + <xsl:param name="url"/> + <xsl:param name="identifierType"/> + <xsl:param name="identifierValue"/> + <xsl:param name="date"/> + <xsl:param name="time"/> + <xsl:template match="/" xmlns="http://www.w3.org/1999/xhtml"> + <html> + <head> + <title>Signatur der Anmeldedaten</title> + <style type="text/css" media="screen">.boldstyle { font-weight: bold; } .italicstyle { font-style: italic; } .annotationstyle { font-size: small; } .graybground {background-color: #E0E0E0;} + .titlestyle{ text-decoration:underline; font-weight:bold; font-family: Verdana; font-size: x-small; } + .h4style{ font-family: Verdana; } + table.parameters { font-size: x-small; } + </style> + </head> + <body> + <h4 class="h4style">Anmeldedaten:</h4> + + <p class="titlestyle">Daten zur Person</p> + <table class="parameters"> + <xsl:if test="$familyName"> + <tr> + <td class="italicstyle">Name:</td> + <td> + <xsl:value-of select="$givenName"/> + <xsl:text> </xsl:text> + <xsl:value-of select="$familyName"/> + </td> + </tr> + </xsl:if> + <xsl:if test="$dateOfBirth"> + <tr> + <td class="italicstyle">Geburtsdatum:</td> + <td> + <xsl:value-of select="$dateOfBirth"/> + </td> + </tr> + </xsl:if> + </table> + + <p class="titlestyle">Technische Parameter</p> + <table class="parameters"> + <tr> + <td class="italicstyle">URL:</td> + <td><xsl:value-of select="$url"/></td> + </tr> + <xsl:if test="starts-with($identifierType,'urn:publicid:gv.at:cdid+')"> + <tr> + <td class="italicstyle">Bereich:</td> + <td><xsl:value-of select="substring-after($identifierType, 'urn:publicid:gv.at:cdid+')"/></td> + </tr> + </xsl:if> + <xsl:if test="starts-with($identifierType, 'urn:publicid:gv.at:wbpk+')"> + <tr> + <td class="italicstyle"><xsl:value-of select="substring-before(substring-after($identifierType, 'urn:publicid:gv.at:wbpk+'), '+')"/></td> + <td><xsl:value-of select="substring-after(substring-after($identifierType, 'urn:publicid:gv.at:wbpk+'), '+')"/></td> + </tr> + </xsl:if> + <xsl:if test="$identifierValue"> + <tr> + <td class="italicstyle">Identifikator:</td> + <td><xsl:value-of select="$identifierValue"/> + </td> + </tr> + </xsl:if> + <tr> + <td class="italicstyle">Datum</td> + <td> + <xsl:value-of select="$date"/> + </td> + </tr> + <tr> + <td class="italicstyle">Uhrzeit</td> + <td> + <xsl:value-of select="$time"/> + </td> + </tr> + </table> + </body> + </html> + </xsl:template> +</xsl:stylesheet> diff --git a/BKUViewer/pom.xml b/BKUViewer/pom.xml index ce39dc94..69367c54 100644 --- a/BKUViewer/pom.xml +++ b/BKUViewer/pom.xml @@ -1,24 +1,20 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>BKUViewer</artifactId> <name>BKU Viewer</name> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <description /> <dependencies> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>bkucommon</artifactId> - <version>1.2.14-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> + <version>${project.parent.version}</version> </dependency> <dependency> <groupId>xerces</groupId> @@ -40,9 +36,8 @@ </exclusions> </dependency> <dependency> - <groupId>at.gv.egiz</groupId> - <artifactId>BKUFonts</artifactId> - <version>1.2</version> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> </dependency> </dependencies> </project> diff --git a/BKUViewer/src/main/java/at/gv/egiz/bku/slxhtml/SLXHTMLValidator.java b/BKUViewer/src/main/java/at/gv/egiz/bku/slxhtml/SLXHTMLValidator.java index a230afa6..0ed34d07 100644 --- a/BKUViewer/src/main/java/at/gv/egiz/bku/slxhtml/SLXHTMLValidator.java +++ b/BKUViewer/src/main/java/at/gv/egiz/bku/slxhtml/SLXHTMLValidator.java @@ -34,8 +34,8 @@ import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.ValidatorHandler; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.InputSource; @@ -78,7 +78,7 @@ public class SLXHTMLValidator implements at.gv.egiz.bku.viewer.Validator { /** * Logging facility. */ - private static Log log = LogFactory.getLog(SLXHTMLValidator.class); + private static Logger log = LoggerFactory.getLogger(SLXHTMLValidator.class); private static Schema slSchema; @@ -91,11 +91,11 @@ public class SLXHTMLValidator implements at.gv.egiz.bku.viewer.Validator { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); ClassLoader cl = SLXHTMLValidator.class.getClassLoader(); URL schemaURL = cl.getResource(SLXHTML_SCHEMA_FILE); - log.debug("Trying to create SLXHTML schema from URL '" + schemaURL + "'."); + log.debug("Trying to create SLXHTML schema from URL '{}'.", schemaURL); long t0 = System.currentTimeMillis(); slSchema = schemaFactory.newSchema(schemaURL); long t1 = System.currentTimeMillis(); - log.debug("SLXHTML schema successfully created in " + (t1 - t0) + "ms."); + log.debug("SLXHTML schema successfully created in {}ms.", (t1 - t0)); } catch (SAXException e) { log.error("Failed to load security layer XHTML schema.", e); throw new RuntimeException("Failed to load security layer XHTML schema.", e); diff --git a/BKUViewer/src/main/java/at/gv/egiz/bku/text/TextValidator.java b/BKUViewer/src/main/java/at/gv/egiz/bku/text/TextValidator.java index dee8ff2e..5abaed11 100644 --- a/BKUViewer/src/main/java/at/gv/egiz/bku/text/TextValidator.java +++ b/BKUViewer/src/main/java/at/gv/egiz/bku/text/TextValidator.java @@ -25,8 +25,8 @@ import java.io.UnsupportedEncodingException; import java.nio.CharBuffer; import java.nio.charset.Charset; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.viewer.ValidationException; import at.gv.egiz.bku.viewer.Validator; @@ -37,7 +37,7 @@ public class TextValidator implements Validator { /** * Logging facility. */ - protected static Log log = LogFactory.getLog(TextValidator.class); + protected static Logger log = LoggerFactory.getLogger(TextValidator.class); protected Font viewerFont; @@ -46,7 +46,7 @@ public class TextValidator implements Validator { } private void invalid(char c) throws ValidationException { - log.info("Invalid character (0x" + Integer.toHexString(c) + ") found."); + log.info("Invalid character (0x{}) found.", Integer.toHexString(c)); // TODO: localize throw new ValidationException(); } @@ -60,7 +60,7 @@ public class TextValidator implements Validator { try { reader = new InputStreamReader(is, charset); } catch (UnsupportedEncodingException e) { - log.info("Charset '" + charset + "' not supported.", e); + log.info("Charset '{}' not supported.", charset, e); // TODO: localize throw new ValidationException(e); } diff --git a/BKUViewer/src/test/java/at/gv/egiz/bku/slxhtml/ValidatorTest.java b/BKUViewer/src/test/java/at/gv/egiz/bku/slxhtml/ValidatorTest.java index c5b54a56..daf662dc 100644 --- a/BKUViewer/src/test/java/at/gv/egiz/bku/slxhtml/ValidatorTest.java +++ b/BKUViewer/src/test/java/at/gv/egiz/bku/slxhtml/ValidatorTest.java @@ -20,9 +20,8 @@ import static org.junit.Assert.assertNotNull; import java.io.InputStream; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.Ignore; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.Test; import at.gv.egiz.bku.viewer.ValidationException; @@ -32,7 +31,7 @@ import at.gv.egiz.bku.viewer.ValidatorFactory; //@Ignore public class ValidatorTest { - private static Log log = LogFactory.getLog(ValidatorTest.class); + private static Logger log = LoggerFactory.getLogger(ValidatorTest.class); @Test public void testGetInstance() { @@ -60,7 +59,7 @@ public class ValidatorTest { throw e; } long t1 = System.currentTimeMillis(); - log.info("Validated SLXHTML file '" + slxhtmlFile + "' in " + (t1 - t0) + "ms."); + log.info("Validated SLXHTML file '{}' in {}ms.", slxhtmlFile, t1 - t0); } diff --git a/BKUViewer/src/test/resources/commons-logging.properties b/BKUViewer/src/test/resources/commons-logging.properties deleted file mode 100644 index 29292562..00000000 --- a/BKUViewer/src/test/resources/commons-logging.properties +++ /dev/null @@ -1 +0,0 @@ -org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger diff --git a/BKUWebStart/pom.xml b/BKUWebStart/pom.xml index d40af243..c4a97f93 100644 --- a/BKUWebStart/pom.xml +++ b/BKUWebStart/pom.xml @@ -1,15 +1,15 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>BKUWebStart</artifactId> <packaging>jar</packaging> <name>BKU Web Start</name> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <url>http://mocca.egovlabs.gv.at/</url> <description>Bürgerkartenumgebung</description> @@ -230,30 +230,13 @@ <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUCertificates</artifactId> - <version>1.2</version> + <version>${mocca.certificates.version}</version> </dependency> <dependency> <groupId>iaik</groupId> <artifactId>iaik_jce_full_signed</artifactId> <scope>compile</scope> </dependency> - <!-- - <dependency> - <artifactId>utils</artifactId> - <groupId>at.gv.egiz</groupId> - <version>1.2.7-SNAPSHOT</version> - <exclusions> - <exclusion> - <artifactId>iaik_ecc_signed</artifactId> - <groupId>iaik</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - --> <!-- Jetty 6.1.15+ required, see | http://jira.codehaus.org/browse/JETTY-843 @@ -275,12 +258,10 @@ <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> - <version>1.5.8</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> - <version>1.5.8</version> </dependency> <dependency> <groupId>log4j</groupId> @@ -288,7 +269,8 @@ <scope>compile</scope> </dependency> - <!-- javax.jnlp.* --> + <!-- javax.jnlp.* not included in SUN JDK's rt.jar, + | don't declare here if using OpenJDK --> <dependency> <groupId>jre</groupId> <artifactId>javaws</artifactId> 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 37638510..30662ee0 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 @@ -225,6 +225,12 @@ public class Configurator { /** * if unknown old, update in any case * if known old and unknown min, don't update + * + * VERSION := MAJOR[-SNAPSHOT]-rREV + * MAJOR := [0-9\.]*[-BRANCH[-BRANCHVERSION]] + * + * assume dots '.' appear in major version only (not after "-SNAPSHOT") + * * @param oldVersion * @param minVersion * @return @@ -257,10 +263,10 @@ public class Configurator { // compare last digit of major boolean preRelease = true; - int majorEndOld = oldVersion.indexOf("-SNAPSHOT"); + int majorEndOld = oldVersion.indexOf("-SNAPSHOT"); // 1.0.10-SNAPSHOT-r438, 1.2.12-pinguin-1-SNAPSHOT-r635 if (majorEndOld < 0) { preRelease = false; - majorEndOld = oldVersion.indexOf('-'); // 1.0.10-r439 + majorEndOld = oldVersion.lastIndexOf('-'); // 1.0.10-r439, 1.2.12-pinguin-1-r635 if (majorEndOld < 0) { majorEndOld = oldVersion.length(); } @@ -270,7 +276,7 @@ public class Configurator { int majorEndMin = minVersion.indexOf("-SNAPSHOT"); if (majorEndMin < 0) { releaseRequired = true; - majorEndMin = minVersion.indexOf('-'); + majorEndMin = minVersion.lastIndexOf('-'); if (majorEndMin < 0) { majorEndMin = minVersion.length(); } 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 4d1fe658..3dcae497 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,7 +2,6 @@ package at.gv.egiz.bku.webstart; import iaik.utils.StreamCopier;
-import java.awt.AWTPermission;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
@@ -10,21 +9,14 @@ import java.io.File; import java.io.FileInputStream;
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.AllPermission;
import java.security.KeyStore;
import java.security.Permissions;
-import java.security.SecurityPermission;
import java.security.cert.Certificate;
-import java.util.PropertyPermission;
-import javax.smartcardio.CardPermission;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.nio.SelectChannelConnector;
@@ -37,7 +29,7 @@ import org.slf4j.LoggerFactory; 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 HTTPS_PORT_PROPERTY = "mocca.https.port";
private static Logger log = LoggerFactory.getLogger(Container.class);
static {
@@ -126,7 +118,7 @@ public class Container { webapp.setParentLoaderPriority(false);
webapp.setWar(copyWebapp(webapp.getTempDirectory()));
- webapp.setPermissions(getPermissions(webapp.getTempDirectory()));
+// webapp.setPermissions(getPermissions(webapp.getTempDirectory()));
server.setHandler(webapp);
server.setGracefulShutdown(1000 * 3);
@@ -172,50 +164,22 @@ public class Container { return webapp.getPath();
}
+ /**
+ * grant all permissions, since we need read/write access to save signature data files anywhere (JFileChooser) in the local filesystem
+ * and Jetty does not allow declare (webapp) permissions on a codeBase basis.
+ * @param webappDir
+ * @return
+ */
private Permissions getPermissions(File webappDir) {
Permissions perms = new Permissions();
perms.add(new AllPermission());
+// 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"));
-
- 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("<<ALL FILES>>", "read, write"));
- }
return perms;
}
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 ef7edef1..e1cdb657 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 @@ -11,7 +11,7 @@ import java.util.ResourceBundle; import javax.jnlp.UnavailableServiceException;
-import com.sun.javaws.security.JavaWebStartSecurity;
+//import com.sun.javaws.security.JavaWebStartSecurity;
import java.awt.AWTException;
import java.awt.Desktop;
import java.awt.Image;
@@ -88,11 +88,11 @@ public class Launcher implements BKUControllerInterface, ActionListener { 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());
+ 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");
+ cert = new URL(http, "/ca.crt");
+ help = new URL(http, "/help/");
} catch (MalformedURLException ex) {
log.error("Failed to create URL.", ex);
} finally {
@@ -134,13 +134,15 @@ public class Launcher implements BKUControllerInterface, ActionListener { public Launcher() {
log.info("Initializing Launcher");
- if (log.isTraceEnabled()) {
- SecurityManager sm = System.getSecurityManager();
- if (sm instanceof JavaWebStartSecurity) {
- System.setSecurityManager(new LogSecurityManager((JavaWebStartSecurity) sm));
- }
- }
+
+ // SocketPerm * required (DataURL), FilePermission * write (JFileChooser) required,
+ // jetty does not allow fine-grained permission config (codeBase?)
+ // ie. we don't need a security manager
+ log.trace("disabling (JNLP) security manager");
+ System.setSecurityManager(null);
+
messages = ResourceBundle.getBundle(MESSAGES_RESOURCE, Locale.getDefault());
+ //TODO replace with statusNotifier
trayIcon = initTrayIcon();
}
@@ -213,7 +215,7 @@ public class Launcher implements BKUControllerInterface, ActionListener { Image image = ImageIO.read(getClass().getResourceAsStream(iconResource));
PopupMenu popup = new PopupMenu();
-
+
MenuItem helpItem = new MenuItem(messages.getString(LABEL_HELP));
helpItem.addActionListener(this);
helpItem.setActionCommand(HELP_COMMAND);
@@ -237,6 +239,7 @@ public class Launcher implements BKUControllerInterface, ActionListener { popup.add(aboutItem);
TrayIcon ti = new TrayIcon(image, messages.getString(TOOLTIP_DEFAULT), popup);
+ ti.setImageAutoSize(true);
ti.addActionListener(this);
tray.add(ti);
return ti;
@@ -301,7 +304,11 @@ public class Launcher implements BKUControllerInterface, ActionListener { }
if (config.isCertRenewed()) {
try {
- browse(HTTP_SECURITY_LAYER_URL);
+ if ("".equals(messages.getLocale().getLanguage())) {
+ browse(HTTP_SECURITY_LAYER_URL);
+ } else {
+ browse(new URL(HTTP_SECURITY_LAYER_URL, messages.getLocale().getLanguage()));
+ }
} catch (Exception ex) {
log.error("failed to open system browser, install TLS certificate manually: " + HTTPS_SECURITY_LAYER_URL, ex);
}
@@ -364,7 +371,11 @@ public class Launcher implements BKUControllerInterface, ActionListener { } else if (HELP_COMMAND.equals(e.getActionCommand())) {
log.debug("help page requested via tray menu");
try {
- browse(HELP_URL);
+ if ("".equals(messages.getLocale().getLanguage())) {
+ browse(HELP_URL);
+ } else {
+ browse(new URL(HELP_URL, messages.getLocale().getLanguage()));
+ }
} catch (Exception ex) {
log.error("Failed to open " + HELP_URL, ex);
String msg = MessageFormat.format(messages.getString(ERROR_OPEN_URL), HELP_URL);
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 deleted file mode 100644 index d589812e..00000000 --- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/LogSecurityManager.java +++ /dev/null @@ -1,443 +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; - -import com.sun.javaws.security.JavaWebStartSecurity; -import java.io.FileDescriptor; -import java.net.InetAddress; -import java.security.Permission; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * JVM argument -Djava.security.debug=access,failure - * (passed as attribute to java element in jnlp) is ignored. - * - * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> - */ -public class LogSecurityManager extends SecurityManager { - - protected static final Logger log = LoggerFactory.getLogger(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; - } - } - - @SuppressWarnings("deprecation") - @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(); -// } - @SuppressWarnings("deprecation") - @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/jnlp/keystore.ks b/BKUWebStart/src/main/jnlp/keystore.ks Binary files differindex 824c3a40..ba0b4652 100644 --- a/BKUWebStart/src/main/jnlp/keystore.ks +++ b/BKUWebStart/src/main/jnlp/keystore.ks diff --git a/BKUWebStart/src/main/jnlp/template-local.xml b/BKUWebStart/src/main/jnlp/template-local.xml index f9a7d917..2e89f2ed 100644 --- a/BKUWebStart/src/main/jnlp/template-local.xml +++ b/BKUWebStart/src/main/jnlp/template-local.xml @@ -5,16 +5,18 @@ <title>MOCCA Developement</title> <vendor>E-Government Innovationszentrum (EGIZ)</vendor> <homepage href="${project.Url}"/> - <description>${project.Description} (BKU) MOCCA Web Start - Developement Version</description> - <description kind="short">${project.Description}</description> - <icon kind="shortcut" href="img/chip16.png" width="16" height="16"/> - <icon kind="shortcut" href="img/chip24.png" width="24" height="24"/> - <icon kind="shortcut" href="img/chip32.png" width="32" height="32"/> + <description>MOCCA Web Start - Developement Version</description> + <description kind="short">MOCCA Development</description> <icon kind="shortcut" href="img/chip48.png" width="48" height="48"/> - <icon kind="default" href="img/chip16.png" width="16" height="16"/> - <icon kind="default" href="img/chip24.png" width="24" height="24"/> - <icon kind="default" href="img/chip32.png" width="32" height="32"/> + <icon kind="shortcut" href="img/chip32.png" width="32" height="32"/> + <icon kind="shortcut" href="img/chip24.png" width="24" height="24"/> + <icon kind="shortcut" href="img/chip16.png" width="16" height="16"/> <icon kind="default" href="img/chip48.png" width="48" height="48"/> + <icon kind="default" href="img/chip32.png" width="32" height="32"/> + <icon kind="default" href="img/chip24.png" width="24" height="24"/> + <icon kind="default" href="img/chip16.png" width="16" height="16"/> + <!-- MacOS X (dock, programmumschalter) icon (unfortunately also iconf for trayIcon INFO message) --> + <icon kind="default" href="img/chip128.png" width="128" height="128"/> <icon kind="splash" href="img/splash.png"/> <shortcut online="true"> <desktop/> diff --git a/BKUWebStart/src/main/jnlp/template-unstable.xml b/BKUWebStart/src/main/jnlp/template-unstable.xml index 7d0f474a..d562d4ed 100644 --- a/BKUWebStart/src/main/jnlp/template-unstable.xml +++ b/BKUWebStart/src/main/jnlp/template-unstable.xml @@ -11,10 +11,12 @@ <icon kind="shortcut" href="img/chip24.png" width="24" height="24"/> <icon kind="shortcut" href="img/chip32.png" width="32" height="32"/> <icon kind="shortcut" href="img/chip48.png" width="48" height="48"/> + <icon kind="shortcut" href="img/chip128.png" width="128" height="128"/> <icon kind="default" href="img/chip16.png" width="16" height="16"/> <icon kind="default" href="img/chip24.png" width="24" height="24"/> <icon kind="default" href="img/chip32.png" width="32" height="32"/> <icon kind="default" href="img/chip48.png" width="48" height="48"/> + <icon kind="default" href="img/chip128.png" width="128" height="128"/> <icon kind="splash" href="img/splash.png"/> <shortcut online="true"> <desktop/> diff --git a/BKUWebStart/src/main/jnlp/template.xml b/BKUWebStart/src/main/jnlp/template.xml index b56f88b7..83130493 100644 --- a/BKUWebStart/src/main/jnlp/template.xml +++ b/BKUWebStart/src/main/jnlp/template.xml @@ -11,10 +11,12 @@ <icon kind="shortcut" href="img/chip24.png" width="24" height="24"/> <icon kind="shortcut" href="img/chip32.png" width="32" height="32"/> <icon kind="shortcut" href="img/chip48.png" width="48" height="48"/> + <icon kind="shortcut" href="img/chip128.png" width="128" height="128"/> <icon kind="default" href="img/chip16.png" width="16" height="16"/> <icon kind="default" href="img/chip24.png" width="24" height="24"/> <icon kind="default" href="img/chip32.png" width="32" height="32"/> <icon kind="default" href="img/chip48.png" width="48" height="48"/> + <icon kind="default" href="img/chip128.png" width="128" height="128"/> <icon kind="splash" href="img/splash.png"/> <shortcut online="true"> <desktop/> 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 9ba359be..8b27b6e3 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 @@ -15,12 +15,12 @@ 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.message.start=wird gestartet... +tray.message.start.offline=wird offline gestartet... +tray.message.config=lade Konfiguration +tray.message.certs=lade Zertifikate +tray.message.finished=erfolgreich gestartet +tray.message.shutdown=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 diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages_en.properties b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages_en.properties new file mode 100644 index 00000000..ee11f2a8 --- /dev/null +++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages_en.properties @@ -0,0 +1,38 @@ +# 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=CitizenCard +tray.caption.error=Error +tray.message.start=starting... +tray.message.start.offline=starting offline... +tray.message.config=loading configuration +tray.message.certs=loading certificates +tray.message.finished=successfully started +tray.message.shutdown=shutting down CitizenCard environment +tray.error.start=failed to start CitizenCard environment +tray.error.config=failed to initialize configuration, CitizenCard environment not started +tray.error.bind=another service is using the address reserved for the CitizenCard environment +tray.error.pin.connect=failed to connect to PIN management +tray.error.open.url=failed to open {0} +tray.label.shutdown=Close +tray.label.pin=PIN management +tray.label.help=Help +tray.label.about=About... +tray.tooltip.default=CitizenCard +about.frame.title=CitizenCard +about.title=<html>CitizenCard Environment +about.version=<html>Version: {0} +button.ok=Confirm +button.close=Close 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 4f5798d5..3700212d 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 @@ -158,6 +158,18 @@ public class ConfiguratorTest { result = Configurator.updateRequired(oldVersion, minVersion); assertEquals(expResult, result); + oldVersion = "1.2.3-r123"; + minVersion = "1.2.4-r124"; + expResult = true; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + + oldVersion = "1.2.3-SNAPSHOT-r123"; + minVersion = "1.2.4-SNAPSHOT"; + expResult = true; + result = Configurator.updateRequired(oldVersion, minVersion); + assertEquals(expResult, result); + oldVersion = "1"; minVersion = "2"; expResult = true; diff --git a/BKUWebStart/src/test/resources/commons-logging.properties b/BKUWebStart/src/test/resources/commons-logging.properties deleted file mode 100644 index 29292562..00000000 --- a/BKUWebStart/src/test/resources/commons-logging.properties +++ /dev/null @@ -1 +0,0 @@ -org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger diff --git a/BKUWebStartPackage/nbactions.xml b/BKUWebStartPackage/nbactions.xml deleted file mode 100644 index b3a586c0..00000000 --- a/BKUWebStartPackage/nbactions.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<actions> - <action> - <actionName>CUSTOM-assembly</actionName> - <displayName>assembly</displayName> - <goals> - <goal>assembly:assembly</goal> - </goals> - </action> - </actions> diff --git a/BKUWebStartPackage/pom.xml b/BKUWebStartPackage/pom.xml deleted file mode 100644 index 0b226785..00000000 --- a/BKUWebStartPackage/pom.xml +++ /dev/null @@ -1,160 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <artifactId>bku</artifactId> - <groupId>at.gv.egiz</groupId> - <version>1.2.7-SNAPSHOT</version> - </parent> - <groupId>at.gv.egiz</groupId> - <artifactId>BKUWebStartPackage</artifactId> - <version>1.2.7-SNAPSHOT</version> - <packaging>pom</packaging> - <name>BKU Web Start Package</name> - <description>Bürgerkartenumgebung</description> - <url>http://mocca.egovlabs.gv.at/</url> - - <build> - <plugins> - <plugin> - <artifactId>webstart-maven-plugin</artifactId> - <groupId>org.codehaus.mojo.webstart</groupId> - <executions> - <execution> - <phase>process-resources</phase> - <goals> - <goal>jnlp-single</goal> - </goals> - </execution> - </executions> - <configuration> - <outputDirectoryName>webstart</outputDirectoryName> - - <excludeTransitive>false</excludeTransitive> - - <jnlpFiles> - <jnlpFile> - <templateFilename>template.xml</templateFilename> - <outputFilename>mocca.jnlp</outputFilename> - <jarResources> - <jarResource> - <groupId>at.gv.egiz</groupId> - <artifactId>BKUWebStart</artifactId> - <version>${project.version}</version> - <mainClass>at.gv.egiz.bku.webstart.Launcher</mainClass> - </jarResource> - </jarResources> - </jnlpFile> - </jnlpFiles> - - <sign> - <alias>test-applet signer</alias> - <keystore>${project.basedir}/src/main/jnlp/keystore.ks</keystore> - <storepass>storepass</storepass> - <keypass>keypass</keypass> - <verify>true</verify> - <keystoreConfig> - <delete>false</delete> - <gen>false</gen> - </keystoreConfig> - </sign> - - <unsign>true</unsign> - <verifyjar>false</verifyjar> - - <pack200>false</pack200> - <gzip>false</gzip> - <outputJarVersions>false</outputJarVersions> - <verbose>true</verbose> - - </configuration> - </plugin> - - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - <configuration> - <descriptors> - <descriptor>${basedir}/src/main/assemblies/zip-webstart.xml</descriptor> - </descriptors> - </configuration> - </plugin> - - </plugins> - </build> - - <dependencies> - <dependency> - <artifactId>BKUWebStart</artifactId> - <groupId>at.gv.egiz</groupId> - <version>${project.version}</version> - </dependency> - </dependencies> - - <profiles> - <profile> - <id>pkcs11-sign</id> - <build> - <plugins> - <plugin> - <artifactId>webstart-maven-plugin</artifactId> - <groupId>org.codehaus.mojo.webstart</groupId> - <!-- use pkcs11-patched webstart-maven-plugin--> - <version>1.0-beta-1-mocca</version> - <configuration> - <sign> - <keystore>NONE</keystore> - <storetype>PKCS11</storetype> - <providerClass>iaik.pkcs.pkcs11.provider.IAIKPkcs11</providerClass> - <alias>a-sit</alias> - <storepass>${pkcs11-pass}</storepass> - <verify>true</verify> - <keystoreConfig> - <delete>false</delete> - <gen>false</gen> - </keystoreConfig> - </sign> - </configuration> - </plugin> - </plugins> - </build> - </profile> - - <profile> - <!-- development profile --> - <id>local-webstart</id> - <build> - <plugins> - <plugin> - <artifactId>webstart-maven-plugin</artifactId> - <groupId>org.codehaus.mojo.webstart</groupId> - <configuration> - <jnlpFiles> - <jnlpFile> - <templateFilename>template-local.xml</templateFilename> - <outputFilename>mocca-local.jnlp</outputFilename> - <jarResources> - <jarResource> - <groupId>at.gv.egiz</groupId> - <artifactId>BKUWebStart</artifactId> - <version>${project.version}</version> - <mainClass>at.gv.egiz.bku.webstart.Launcher</mainClass> - </jarResource> - </jarResources> - </jnlpFile> - </jnlpFiles> - </configuration> - </plugin> - </plugins> - </build> - </profile> - - </profiles> -</project>
\ No newline at end of file diff --git a/BKUWebStartPackage/src/main/assemblies/zip-webstart.xml b/BKUWebStartPackage/src/main/assemblies/zip-webstart.xml deleted file mode 100644 index fa39bdf0..00000000 --- a/BKUWebStartPackage/src/main/assemblies/zip-webstart.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> - -<assembly> - <formats> - <format>zip</format> - </formats> - <includeBaseDirectory>false</includeBaseDirectory> - <fileSets> - <fileSet> - <directory>${project.build.directory}/${project.build.finalName}/</directory> - <includes> - <include>webstart/**</include> - </includes> - <outputDirectory>/</outputDirectory> - </fileSet> - </fileSets> -</assembly> - - diff --git a/BKUWebStartPackage/src/main/jnlp/keystore.ks b/BKUWebStartPackage/src/main/jnlp/keystore.ks Binary files differdeleted file mode 100644 index 824c3a40..00000000 --- a/BKUWebStartPackage/src/main/jnlp/keystore.ks +++ /dev/null diff --git a/BKUWebStartPackage/src/main/jnlp/resources/img/chip128.png b/BKUWebStartPackage/src/main/jnlp/resources/img/chip128.png Binary files differdeleted file mode 100644 index c36d8079..00000000 --- a/BKUWebStartPackage/src/main/jnlp/resources/img/chip128.png +++ /dev/null diff --git a/BKUWebStartPackage/src/main/jnlp/resources/img/chip16.png b/BKUWebStartPackage/src/main/jnlp/resources/img/chip16.png Binary files differdeleted file mode 100644 index 96b580e9..00000000 --- a/BKUWebStartPackage/src/main/jnlp/resources/img/chip16.png +++ /dev/null diff --git a/BKUWebStartPackage/src/main/jnlp/resources/img/chip24.png b/BKUWebStartPackage/src/main/jnlp/resources/img/chip24.png Binary files differdeleted file mode 100644 index efd6dbeb..00000000 --- a/BKUWebStartPackage/src/main/jnlp/resources/img/chip24.png +++ /dev/null diff --git a/BKUWebStartPackage/src/main/jnlp/resources/img/chip32.png b/BKUWebStartPackage/src/main/jnlp/resources/img/chip32.png Binary files differdeleted file mode 100644 index e7efb020..00000000 --- a/BKUWebStartPackage/src/main/jnlp/resources/img/chip32.png +++ /dev/null diff --git a/BKUWebStartPackage/src/main/jnlp/resources/img/chip48.png b/BKUWebStartPackage/src/main/jnlp/resources/img/chip48.png Binary files differdeleted file mode 100644 index 491fbcac..00000000 --- a/BKUWebStartPackage/src/main/jnlp/resources/img/chip48.png +++ /dev/null diff --git a/BKUWebStartPackage/src/main/jnlp/resources/img/splash.png b/BKUWebStartPackage/src/main/jnlp/resources/img/splash.png Binary files differdeleted file mode 100644 index 597fbc60..00000000 --- a/BKUWebStartPackage/src/main/jnlp/resources/img/splash.png +++ /dev/null diff --git a/BKUWebStartPackage/src/main/jnlp/resources/img/version.xml b/BKUWebStartPackage/src/main/jnlp/resources/img/version.xml deleted file mode 100644 index 5e160beb..00000000 --- a/BKUWebStartPackage/src/main/jnlp/resources/img/version.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<jnlp-versions> - <resource> - <pattern> - <name>chip16.png</name> - <version-id>2.0</version-id> - </pattern> - <file>chip16.png</file> - </resource> - <resource> - <pattern> - <name>chip24.png</name> - <version-id>2.0</version-id> - </pattern> - <file>chip24.png</file> - </resource> - <resource> - <pattern> - <name>chip32.png</name> - <version-id>2.0</version-id> - </pattern> - <file>chip32.png</file> - </resource> - <resource> - <pattern> - <name>chip48.png</name> - <version-id>2.0</version-id> - </pattern> - <file>chip48.png</file> - </resource> - <resource> - <pattern> - <name>chip64.png</name> - <version-id>2.0</version-id> - </pattern> - <file>chip64.png</file> - </resource> - <resource> - <pattern> - <name>chip128.png</name> - <version-id>2.0</version-id> - </pattern> - <file>chip128.png</file> - </resource> - <resource> - <pattern> - <name>splash.png</name> - <version-id>2.0</version-id> - </pattern> - <file>splash.png</file> - </resource> -</jnlp-versions> diff --git a/BKUWebStartPackage/src/main/jnlp/resources/player.jnlp b/BKUWebStartPackage/src/main/jnlp/resources/player.jnlp deleted file mode 100644 index da08ebc2..00000000 --- a/BKUWebStartPackage/src/main/jnlp/resources/player.jnlp +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Jump specific JNL file for launching the player --> -<player/>
\ No newline at end of file diff --git a/BKUWebStartPackage/src/main/jnlp/template-local.xml b/BKUWebStartPackage/src/main/jnlp/template-local.xml deleted file mode 100644 index d17c2782..00000000 --- a/BKUWebStartPackage/src/main/jnlp/template-local.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<jnlp spec="$jnlpspec" codebase="file:/home/clemens/workspace/bku/BKUWebStart/target/jnlp" href="$outputFile"> - - <information> - <title>${project.Description}</title> - <vendor>E-Government Innovationszentrum (EGIZ)</vendor> - <homepage href="${project.Url}"/> - <description>${project.Description} (BKU) MOCCA Web Start</description> - <description kind="short">${project.Description}</description> - <icon kind="shortcut" href="img/chip16.png" width="16" height="16"/> - <icon kind="shortcut" href="img/chip24.png" width="24" height="24"/> - <icon kind="shortcut" href="img/chip32.png" width="32" height="32"/> - <icon kind="shortcut" href="img/chip48.png" width="48" height="48"/> - <icon kind="default" href="img/chip16.png" width="16" height="16"/> - <icon kind="default" href="img/chip24.png" width="24" height="24"/> - <icon kind="default" href="img/chip32.png" width="32" height="32"/> - <icon kind="default" href="img/chip48.png" width="48" height="48"/> - <icon kind="splash" href="img/splash.png"/> - <shortcut online="true"> - <desktop/> - <menu submenu="e-Government"/> - </shortcut> - - <offline-allowed/> - - </information> - - <security> - <all-permissions/> - </security> - - <update check="timeout" policy="prompt-update"/> - - <resources> - <java version="1.6+" java-vm-args="-Djava.security.debug=access,failure"/> - <property name="jnlp.versionEnabled" value="false"/> - $dependencies - </resources> - - <application-desc main-class="$mainClass"/> -</jnlp>
\ No newline at end of file diff --git a/BKUWebStartPackage/src/main/jnlp/template.xml b/BKUWebStartPackage/src/main/jnlp/template.xml deleted file mode 100644 index 06b024ec..00000000 --- a/BKUWebStartPackage/src/main/jnlp/template.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - | To strip versions from jar filenames do - | for JAR in *jar; do mv JAR {JAR/-[0-9]*/.jar}; done - |--> -<jnlp spec="$jnlpspec" codebase="$$codebase" context="$$context" href="$$name"> - - <information> - <title>${project.Description}</title> - <vendor>E-Government Innovationszentrum (EGIZ)</vendor> - <homepage href="${project.Url}"/> - <description>${project.Description} (BKU) MOCCA Web Start</description> - <description kind="short">${project.Description}</description> - <icon kind="shortcut" href="img/chip16.png" width="16" height="16"/> - <icon kind="shortcut" href="img/chip24.png" width="24" height="24"/> - <icon kind="shortcut" href="img/chip32.png" width="32" height="32"/> - <icon kind="shortcut" href="img/chip48.png" width="48" height="48"/> - <icon kind="default" href="img/chip16.png" width="16" height="16"/> - <icon kind="default" href="img/chip24.png" width="24" height="24"/> - <icon kind="default" href="img/chip32.png" width="32" height="32"/> - <icon kind="default" href="img/chip48.png" width="48" height="48"/> - <icon kind="splash" href="img/splash.png"/> - <shortcut online="true"> - <desktop/> - <menu submenu="e-Government"/> - </shortcut> - - <offline-allowed/> - - </information> - - <security> - <all-permissions/> - </security> - - <update check="timeout" policy="prompt-update"/> - - <resources os="Mac OS X"> - <java version="1.6+" java-vm-args="-d32"/> - $dependencies - </resources> - - <resources> - <java version="1.6+"/> - $dependencies - </resources> - - <application-desc main-class="$mainClass"/> -</jnlp>
\ No newline at end of file diff --git a/STAL/pom.xml b/STAL/pom.xml index c068589c..c4851c3d 100644 --- a/STAL/pom.xml +++ b/STAL/pom.xml @@ -1,20 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>STAL</artifactId> <name>STAL</name> - <version>1.2.14-SNAPSHOT</version> + <version>${parent.version}</version> <dependencies> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> </dependencies> <build> <plugins> diff --git a/STALExt/pom.xml b/STALExt/pom.xml index c4ef99c0..0d4dcc4c 100644 --- a/STALExt/pom.xml +++ b/STALExt/pom.xml @@ -1,20 +1,20 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>STALExt</artifactId> <name>STAL Extension</name> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <description /> <dependencies> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>STAL</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> </dependencies> </project>
\ No newline at end of file diff --git a/STALService/pom.xml b/STALService/pom.xml index 7c3ff682..2f1e3ed4 100644 --- a/STALService/pom.xml +++ b/STALService/pom.xml @@ -1,26 +1,25 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>STALService</artifactId> <name>STAL Service</name> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <description /> <dependencies> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>STAL</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> </dependency> - <!--dependency> - <groupId>at.gv.egiz</groupId> - <artifactId>utils</artifactId> - <version>1.0.0-SNAPSHOTOT</version> - </dependency--> </dependencies> </project>
\ No newline at end of file diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/STALService.java b/STALService/src/main/java/at/gv/egiz/stal/service/STALService.java index ba4b541e..ae0e77d3 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/STALService.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/STALService.java @@ -3,7 +3,6 @@ package at.gv.egiz.stal.service; import java.net.MalformedURLException; import java.net.URL; -import java.util.logging.Logger; import javax.xml.namespace.QName; import javax.xml.ws.Service; import javax.xml.ws.WebEndpoint; @@ -24,7 +23,6 @@ public class STALService { // private final static URL STALSERVICE_WSDL_LOCATION; - private final static Logger logger = Logger.getLogger(at.gv.egiz.stal.service.STALService.class.getName()); // static { // URL url = null; diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java b/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java index 1e6f4133..88a6fa4c 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java @@ -16,6 +16,16 @@ */ package at.gv.egiz.stal.service.translator; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.bind.JAXBElement; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import at.gv.egiz.stal.ErrorResponse; import at.gv.egiz.stal.InfoboxReadRequest; import at.gv.egiz.stal.InfoboxReadResponse; @@ -37,13 +47,6 @@ import at.gv.egiz.stal.service.types.SignRequestType; import at.gv.egiz.stal.service.types.SignResponseType; import at.gv.egiz.stal.service.types.StatusRequestType; import at.gv.egiz.stal.service.types.StatusResponseType; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.xml.bind.JAXBElement; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * @@ -51,8 +54,8 @@ import org.apache.commons.logging.LogFactory; */ public class STALTranslator { - private static final Log log = LogFactory.getLog(STALTranslator.class); - protected Map<Class, TranslationHandler> handlerMap = new HashMap<Class, TranslationHandler>(); + private final Logger log = LoggerFactory.getLogger(STALTranslator.class); + protected Map<Class<?>, TranslationHandler> handlerMap = new HashMap<Class<?>, TranslationHandler>(); public STALTranslator() { registerTranslationHandler(new DefaultTranslationHandler()); @@ -63,9 +66,9 @@ public class STALTranslator { * @param handler */ public void registerTranslationHandler(TranslationHandler handler) { - for (Class t : handler.getSupportedTypes()) { - if (log.isDebugEnabled()) { - log.debug("register " + t + " with translation handler " + handler.getClass()); + for (Class<?> t : handler.getSupportedTypes()) { + if (log.isTraceEnabled()) { + log.trace("Register {} with translation handler {}.", t, handler.getClass()); } handlerMap.put(t, handler); } @@ -85,7 +88,7 @@ public class STALTranslator { return r; } } - log.error("unknown STAL request type " + request.getClass()); + log.error("Unknown STAL request type {}.", request.getClass()); throw new TranslationException(request.getClass()); } @@ -107,7 +110,7 @@ public class STALTranslator { return stalRequest; } } - log.error("unknown request type " + req.getClass()); + log.error("Unknown request type {}.", req.getClass()); throw new TranslationException(req.getClass()); } @@ -125,7 +128,7 @@ public class STALTranslator { return r; } } - log.error("unknown STAL response type " + response.getClass()); + log.error("Unknown STAL response type {}.", response.getClass()); throw new TranslationException(response.getClass()); } @@ -147,7 +150,7 @@ public class STALTranslator { return stalResponse; } } - log.error("unknown response type " + resp.getClass()); + log.error("Unknown response type {}.", resp.getClass()); throw new TranslationException(resp.getClass()); } @@ -156,7 +159,7 @@ public class STALTranslator { */ public static interface TranslationHandler { - List<Class> getSupportedTypes(); + List<Class<?>> getSupportedTypes(); JAXBElement<? extends RequestType> translate(STALRequest request) throws TranslationException; @@ -173,7 +176,7 @@ public class STALTranslator { */ protected static class DefaultTranslationHandler implements TranslationHandler { - private static final Log log = LogFactory.getLog(DefaultTranslationHandler.class); + private final Logger log = LoggerFactory.getLogger(DefaultTranslationHandler.class); private ObjectFactory of; public DefaultTranslationHandler() { @@ -181,8 +184,8 @@ public class STALTranslator { } @Override - public List<Class> getSupportedTypes() { - return Arrays.asList(new Class[]{InfoboxReadRequest.class, + public List<Class<?>> getSupportedTypes() { + return Arrays.asList(new Class<?>[]{InfoboxReadRequest.class, SignRequest.class, QuitRequest.class, StatusRequest.class, diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/translator/TranslationException.java b/STALService/src/main/java/at/gv/egiz/stal/service/translator/TranslationException.java index fd9da988..5fe3735b 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/translator/TranslationException.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/translator/TranslationException.java @@ -22,13 +22,18 @@ package at.gv.egiz.stal.service.translator; */ public class TranslationException extends Exception { - private Class unknownClass; + /** + * + */ + private static final long serialVersionUID = 1L; + + private Class<?> unknownClass; /** * Creates a new instance of <code>TranslationException</code> without detail message. * @param unknownClass the class that could not be translated */ - public TranslationException(Class unkownClass) { + public TranslationException(Class<?> unkownClass) { this.unknownClass = unkownClass; } diff --git a/STALXService/pom.xml b/STALXService/pom.xml index 0b87c6c2..56da1bd4 100644 --- a/STALXService/pom.xml +++ b/STALXService/pom.xml @@ -1,25 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>STALXService</artifactId> <name>STAL-X Service</name> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <url>http://maven.apache.org</url> <dependencies> <dependency> <artifactId>STALService</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> <dependency> <artifactId>STALExt</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> </dependency> </dependencies> </project>
\ No newline at end of file diff --git a/STALXService/src/main/java/at/gv/egiz/stalx/service/STALService.java b/STALXService/src/main/java/at/gv/egiz/stalx/service/STALService.java index eccd2c4f..6b55d2e5 100644 --- a/STALXService/src/main/java/at/gv/egiz/stalx/service/STALService.java +++ b/STALXService/src/main/java/at/gv/egiz/stalx/service/STALService.java @@ -3,7 +3,6 @@ package at.gv.egiz.stalx.service; import java.net.MalformedURLException; import java.net.URL; -import java.util.logging.Logger; import javax.xml.namespace.QName; import javax.xml.ws.Service; import javax.xml.ws.WebEndpoint; @@ -24,7 +23,6 @@ public class STALService { // private final static URL STALSERVICE_WSDL_LOCATION; - private final static Logger logger = Logger.getLogger(at.gv.egiz.stalx.service.STALService.class.getName()); // static { // URL url = null; diff --git a/STALXService/src/main/java/at/gv/egiz/stalx/service/translator/STALXTranslationHandler.java b/STALXService/src/main/java/at/gv/egiz/stalx/service/translator/STALXTranslationHandler.java index d432b170..d9f4163c 100644 --- a/STALXService/src/main/java/at/gv/egiz/stalx/service/translator/STALXTranslationHandler.java +++ b/STALXService/src/main/java/at/gv/egiz/stalx/service/translator/STALXTranslationHandler.java @@ -37,8 +37,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.xml.bind.JAXBElement; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -46,7 +46,7 @@ import org.apache.commons.logging.LogFactory; */ public class STALXTranslationHandler implements STALTranslator.TranslationHandler { - private static final Log log = LogFactory.getLog(STALXTranslationHandler.class); + private final Logger log = LoggerFactory.getLogger(STALXTranslationHandler.class); ObjectFactory of; public STALXTranslationHandler() { @@ -54,8 +54,8 @@ public class STALXTranslationHandler implements STALTranslator.TranslationHandle } @Override - public List<Class> getSupportedTypes() { - return Arrays.asList(new Class[]{ScriptType.class, + public List<Class<?>> getSupportedTypes() { + return Arrays.asList(new Class<?>[]{ScriptType.class, at.buergerkarte.namespaces.cardchannel.service.ResponseType.class, APDUScriptRequest.class, APDUScriptResponse.class}); @@ -64,7 +64,7 @@ public class STALXTranslationHandler implements STALTranslator.TranslationHandle @Override public JAXBElement<? extends RequestType> translate(STALRequest request) throws TranslationException { if (request instanceof APDUScriptRequest) { - log.trace("translate at.gv.egiz.stal.ext.APDUScriptRequest -> at.buergerkarte.namespaces.cardchannel.service.ScriptType"); + log.trace("Translate at.gv.egiz.stal.ext.APDUScriptRequest -> at.buergerkarte.namespaces.cardchannel.service.ScriptType."); ScriptType scriptT = of.createScriptType(); @@ -80,14 +80,14 @@ public class STALXTranslationHandler implements STALTranslator.TranslationHandle commandAPDUType.setExpectedSW(cmd.getExpectedSW()); scriptT.getResetOrCommandAPDUOrVerifyAPDU().add(commandAPDUType); } else { - log.error("invalid requestScriptElement " + requestScriptElement.getClass()); + log.error("Invalid requestScriptElement {}.", requestScriptElement.getClass()); throw new TranslationException(requestScriptElement.getClass()); } } return of.createScript(scriptT); } else { - log.error("cannot translate " + request.getClass()); + log.error("Cannot translate {}.", request.getClass()); throw new TranslationException(request.getClass()); } } @@ -96,7 +96,7 @@ public class STALXTranslationHandler implements STALTranslator.TranslationHandle public STALRequest translate(RequestType request) throws TranslationException { if (request instanceof ScriptType) { - log.trace("translate at.buergerkarte.namespaces.cardchannel.service.ScriptType -> at.gv.egiz.stal.ext.APDUScriptRequest"); + log.trace("Translate at.buergerkarte.namespaces.cardchannel.service.ScriptType -> at.gv.egiz.stal.ext.APDUScriptRequest."); List<Object> resetOrCommandAPDUOrVerifyAPDU = ((ScriptType) request).getResetOrCommandAPDUOrVerifyAPDU(); List<APDUScriptRequest.RequestScriptElement> requestScript = new ArrayList<APDUScriptRequest.RequestScriptElement>(); @@ -124,7 +124,7 @@ public class STALXTranslationHandler implements STALTranslator.TranslationHandle log.error("CardChannel script command 'VerifyAPDU' not implemented."); throw new TranslationException(VerifyAPDUType.class); } else { - log.error("invalid requestScriptElement element " + element.getClass()); + log.error("Invalid requestScriptElement element {}.", element.getClass()); throw new TranslationException(element.getClass()); } } @@ -132,7 +132,7 @@ public class STALXTranslationHandler implements STALTranslator.TranslationHandle return new APDUScriptRequest(requestScript); } else { - log.error("cannot translate " + request.getClass()); + log.error("Cannot translate {}.", request.getClass()); throw new TranslationException(request.getClass()); } } @@ -140,7 +140,7 @@ public class STALXTranslationHandler implements STALTranslator.TranslationHandle @Override public JAXBElement<? extends ResponseType> translate(STALResponse response) throws TranslationException { if (response instanceof APDUScriptResponse) { - log.trace("translate at.gv.egiz.stal.ext.APDUScriptResponse -> at.buergerkarte.namespaces.cardchannel.service.ResponseType"); + log.trace("Translate at.gv.egiz.stal.ext.APDUScriptResponse -> at.buergerkarte.namespaces.cardchannel.service.ResponseType."); at.buergerkarte.namespaces.cardchannel.service.ResponseType responseT = of.createResponseType(); List<APDUScriptResponse.ResponseScriptElement> responseScript = ((APDUScriptResponse) response).getScript(); @@ -167,13 +167,13 @@ public class STALXTranslationHandler implements STALTranslator.TranslationHandle responseT.getATROrResponseAPDU().add(responseAPDUType); } else { - log.error("invalid responseScriptElement " + element.getClass()); + log.error("Invalid responseScriptElement {}.", element.getClass()); throw new TranslationException(element.getClass()); } } return of.createResponse(responseT); } else { - log.error("cannot translate " + response.getClass()); + log.error("Cannot translate {}." + response.getClass()); throw new TranslationException(response.getClass()); } } @@ -181,7 +181,7 @@ public class STALXTranslationHandler implements STALTranslator.TranslationHandle @Override public STALResponse translate(ResponseType response) throws TranslationException { if (response instanceof at.buergerkarte.namespaces.cardchannel.service.ResponseType) { - log.trace("translate at.buergerkarte.namespaces.cardchannel.service.ResponseType -> at.gv.egiz.stal.ext.APDUScriptResponse"); + log.trace("Translate at.buergerkarte.namespaces.cardchannel.service.ResponseType -> at.gv.egiz.stal.ext.APDUScriptResponse."); List<Object> atrOrResponseAPDU = ((at.buergerkarte.namespaces.cardchannel.service.ResponseType) response).getATROrResponseAPDU(); List<APDUScriptResponse.ResponseScriptElement> responseScript = new ArrayList<APDUScriptResponse.ResponseScriptElement>(); @@ -203,14 +203,14 @@ public class STALXTranslationHandler implements STALTranslator.TranslationHandle respAPDU.getSW(), rc)); } else { - log.error("invalid responseScriptElement " + object.getClass()); + log.error("Invalid responseScriptElement {}.", object.getClass()); throw new TranslationException(object.getClass()); } } return new APDUScriptResponse(responseScript); } else { - log.error("cannot translate " + response.getClass()); + log.error("Cannot translate {}.", response.getClass()); throw new TranslationException(response.getClass()); } } diff --git a/bkucommon/pom.xml b/bkucommon/pom.xml index ae7ca4bb..1dbc8078 100644 --- a/bkucommon/pom.xml +++ b/bkucommon/pom.xml @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>bkucommon</artifactId> <name>BKU Common</name> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <build> <plugins> @@ -44,26 +44,39 @@ <dependency> <groupId>at.gv.egiz</groupId> <artifactId>utils</artifactId> - <version>${version}</version> + <version>${project.parent.version}</version> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>STALExt</artifactId> - <version>${version}</version> + <version>${project.parent.version}</version> </dependency> <!-- bkucommon implements default FontProvider (ResourceFontLoader) --> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUCommonGUI</artifactId> - <version>${version}</version> + <version>${project.parent.version}</version> </dependency> + + <!-- + | ResourceFontLoader needs font resources on runtime classpath. + | Runtime dependency on BKUFonts ensures that transitive dependency + | remains (not true for provided), see BKUViewer, BKULocal and + | BKUOnline --> + <dependency> + <groupId>at.gv.egiz</groupId> + <artifactId>BKUFonts</artifactId> + <version>${mocca.fonts.version}</version> + <scope>runtime</scope> + </dependency> + <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> + <groupId>iaik</groupId> + <artifactId>iaik_jce_full_signed</artifactId> </dependency> <dependency> <groupId>iaik</groupId> - <artifactId>iaik_jce_full_signed</artifactId> + <artifactId>iaik_ecc_signed</artifactId> </dependency> <dependency> <groupId>commons-fileupload</groupId> @@ -95,7 +108,8 @@ <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> - <scope>test</scope> + <scope>compile</scope> + <optional>true</optional> </dependency> <dependency> <groupId>com.sun.xml.ws</groupId> @@ -108,5 +122,17 @@ <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> </dependency> + <dependency> + <groupId>commons-configuration</groupId> + <artifactId>commons-configuration</artifactId> + <type>jar</type> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <type>jar</type> + <scope>compile</scope> + </dependency> </dependencies> </project>
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AccessControllerFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AccessControllerFactory.java index 19fec084..eb708739 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AccessControllerFactory.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AccessControllerFactory.java @@ -1,153 +1,152 @@ -/*
-* 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.accesscontroller;
-
-import java.io.InputStream;
-import java.util.Hashtable;
-import java.util.List;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.accesscontrol.config.AccessControl;
-import at.gv.egiz.bku.accesscontrol.config.Chain;
-import at.gv.egiz.bku.accesscontrol.config.Command;
-import at.gv.egiz.bku.accesscontrol.config.ObjectFactory;
-import at.gv.egiz.bku.accesscontrol.config.Param;
-import at.gv.egiz.bku.accesscontrol.config.Rule;
-import at.gv.egiz.bku.accesscontroller.RuleChecker.PEER_TYPE;
-import at.gv.egiz.bku.slexceptions.SLRuntimeException;
-
-public class AccessControllerFactory {
-
- private static AccessControllerFactory instance = new AccessControllerFactory();
- private static Log log = LogFactory.getLog(AccessControllerFactory.class);
- private static JAXBContext jaxbContext;
- public static String INPUT_CHAIN = "InputChain";
- public static String OUTPUT_CHAIN = "OutputChain";
-
- static {
- try {
- jaxbContext = JAXBContext.newInstance(ObjectFactory.class.getPackage()
- .getName());
- } catch (JAXBException e) {
- log.fatal("Cannot init jaxbContext", e);
- }
- }
-
- private Hashtable<String, ChainChecker> chainTable = new Hashtable<String, ChainChecker>();
-
- private AccessControllerFactory() {
- }
-
- public static AccessControllerFactory getInstance() {
- return instance;
- }
-
- /**
- *
- * @param id
- * @return null if there is no chain with this id.
- */
- public ChainChecker getChainChecker(String id) {
- return chainTable.get(id);
- }
-
- public ChainChecker createChainChecker(String id, boolean register) {
- ChainChecker cc = new ChainChecker(id);
- if (register) {
- chainTable.put(id, cc);
- }
- return cc;
- }
-
- public void registerChainChecker(ChainChecker cc) {
- chainTable.put(cc.getId(), cc);
- }
-
- public CommandParamChecker createParamChecker(String cmd) {
- if ((cmd != null) && (cmd.startsWith("Infobox"))) {
- return new InfoboxParamChecker();
- } else {
- return null;
- }
- }
-
- public RuleChecker createRuleChecker(Rule rule) {
- RuleChecker rc;
- rc = new RuleChecker(rule.getId());
- Command cmd = rule.getCommand();
- if (cmd != null) {
- rc.setCommandName(cmd.getName());
- for (Param p : cmd.getParam()) {
- rc.addParameter(p.getName(), p.getValue());
- }
- }
- rc.setAuthenticationClass(rule.getAuthClass());
- if (rule.getIPv4Address() != null) {
- rc.setPeerId(rule.getIPv4Address(), PEER_TYPE.IP);
- } else if (rule.getDomainName() != null) {
- rc.setPeerId(rule.getDomainName(), PEER_TYPE.HOST);
- } else if (rule.getURL() != null) {
- rc.setPeerId(rule.getURL(), PEER_TYPE.URL);
- }
- rc.setAction(rule.getAction().getRuleAction());
- rc.setChainId(rule.getAction().getChainRef());
- rc.setUserAction(rule.getUserInteraction());
- return rc;
- }
-
- public void init(InputStream is) throws JAXBException {
- chainTable.clear();
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- AccessControl ac = (AccessControl) unmarshaller.unmarshal(is);
- List<Chain> chainList = ac.getChains().getChain();
- log.debug("Found " + chainList.size() + " chains in config");
- for (Chain chain : chainList) {
- log.trace("Creating chain: " + chain.getId());
- ChainChecker cc = createChainChecker(chain.getId(), false);
- List<Rule> ruleList = chain.getRules().getRule();
- log
- .debug("Found " + ruleList.size() + " rules in chain "
- + chain.getId());
- for (Rule rule : ruleList) {
- log.trace("Creating rule: " + rule.getId());
- cc.addRule(createRuleChecker(rule));
- }
- registerChainChecker(cc);
- }
- validate();
- }
-
- private void validate() {
- for (ChainChecker chain : chainTable.values()) {
- for (RuleChecker rule : chain.getRules()) {
- if (rule.getChainId() != null) {
- log.trace("Checking reference to chain: "+rule.getChainId());
- if (getChainChecker(rule.getChainId()) == null) {
- throw new SLRuntimeException("Invalid reference to unknown chain: "+rule.getChainId());
- }
- }
- }
- }
- }
-
-}
+/* +* 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.accesscontroller; + +import java.io.InputStream; +import java.util.Hashtable; +import java.util.List; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.accesscontrol.config.AccessControl; +import at.gv.egiz.bku.accesscontrol.config.Chain; +import at.gv.egiz.bku.accesscontrol.config.Command; +import at.gv.egiz.bku.accesscontrol.config.ObjectFactory; +import at.gv.egiz.bku.accesscontrol.config.Param; +import at.gv.egiz.bku.accesscontrol.config.Rule; +import at.gv.egiz.bku.accesscontroller.RuleChecker.PEER_TYPE; +import at.gv.egiz.bku.slexceptions.SLRuntimeException; + +public class AccessControllerFactory { + + private static AccessControllerFactory instance = new AccessControllerFactory(); + private static JAXBContext jaxbContext; + private final Logger log = LoggerFactory.getLogger(AccessControllerFactory.class); + public static String INPUT_CHAIN = "InputChain"; + public static String OUTPUT_CHAIN = "OutputChain"; + + static { + try { + jaxbContext = JAXBContext.newInstance(ObjectFactory.class.getPackage() + .getName()); + } catch (JAXBException e) { + Logger log = LoggerFactory.getLogger(AccessControllerFactory.class); + log.error("Cannot init jaxbContext.", e); + } + } + + private Hashtable<String, ChainChecker> chainTable = new Hashtable<String, ChainChecker>(); + + private AccessControllerFactory() { + } + + public static AccessControllerFactory getInstance() { + return instance; + } + + /** + * + * @param id + * @return null if there is no chain with this id. + */ + public ChainChecker getChainChecker(String id) { + return chainTable.get(id); + } + + public ChainChecker createChainChecker(String id, boolean register) { + ChainChecker cc = new ChainChecker(id); + if (register) { + chainTable.put(id, cc); + } + return cc; + } + + public void registerChainChecker(ChainChecker cc) { + chainTable.put(cc.getId(), cc); + } + + public CommandParamChecker createParamChecker(String cmd) { + if ((cmd != null) && (cmd.startsWith("Infobox"))) { + return new InfoboxParamChecker(); + } else { + return null; + } + } + + public RuleChecker createRuleChecker(Rule rule) { + RuleChecker rc; + rc = new RuleChecker(rule.getId()); + Command cmd = rule.getCommand(); + if (cmd != null) { + rc.setCommandName(cmd.getName()); + for (Param p : cmd.getParam()) { + rc.addParameter(p.getName(), p.getValue()); + } + } + rc.setAuthenticationClass(rule.getAuthClass()); + if (rule.getIPv4Address() != null) { + rc.setPeerId(rule.getIPv4Address(), PEER_TYPE.IP); + } else if (rule.getDomainName() != null) { + rc.setPeerId(rule.getDomainName(), PEER_TYPE.HOST); + } else if (rule.getURL() != null) { + rc.setPeerId(rule.getURL(), PEER_TYPE.URL); + } + rc.setAction(rule.getAction().getRuleAction()); + rc.setChainId(rule.getAction().getChainRef()); + rc.setUserAction(rule.getUserInteraction()); + return rc; + } + + public void init(InputStream is) throws JAXBException { + chainTable.clear(); + Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); + AccessControl ac = (AccessControl) unmarshaller.unmarshal(is); + List<Chain> chainList = ac.getChains().getChain(); + log.debug("Found {} chains in config.", chainList.size()); + for (Chain chain : chainList) { + log.trace("Creating chain: {}.", chain.getId()); + ChainChecker cc = createChainChecker(chain.getId(), false); + List<Rule> ruleList = chain.getRules().getRule(); + log.debug("Found {} rules in chain {}.", ruleList.size(), chain.getId()); + for (Rule rule : ruleList) { + log.trace("Creating rule: {}.", rule.getId()); + cc.addRule(createRuleChecker(rule)); + } + registerChainChecker(cc); + } + validate(); + } + + private void validate() { + for (ChainChecker chain : chainTable.values()) { + for (RuleChecker rule : chain.getRules()) { + if (rule.getChainId() != null) { + log.trace("Checking reference to chain: {}.", rule.getChainId()); + if (getChainChecker(rule.getChainId()) == null) { + throw new SLRuntimeException("Invalid reference to unknown chain: "+rule.getChainId()); + } + } + } + } + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifier.java b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifier.java index 61d3d7a5..204513e0 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifier.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifier.java @@ -1,110 +1,110 @@ -/*
- * 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.accesscontroller;
-
-import static at.gv.egiz.bku.accesscontroller.AuthenticationClass.ANONYMOUS;
-import static at.gv.egiz.bku.accesscontroller.AuthenticationClass.CERTIFIED;
-import static at.gv.egiz.bku.accesscontroller.AuthenticationClass.CERTIFIED_GOV_AGENCY;
-import static at.gv.egiz.bku.accesscontroller.AuthenticationClass.PSEUDO_ANONYMOUS;
-
-import java.net.URL;
-import java.security.cert.CertificateParsingException;
-import java.security.cert.X509Certificate;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class AuthenticationClassifier {
- private static AuthenticationClassifier instance = new AuthenticationClassifier();
- private static Log log = LogFactory.getLog(AuthenticationClassifier.class);
- private final static String GOV_DOMAIN = ".gv.at";
-
- private AuthenticationClassifier() {
- }
-
- public static boolean isGovAgency(X509Certificate cert) {
- String[] rdns = (cert.getSubjectX500Principal().getName()).split(",");
- for (String rdn : rdns) {
- if (rdn.startsWith("CN=")) {
- String dns = rdn.split("=")[1];
- log.trace("Analyzing cn dn: " + dns);
- if (dns.endsWith(GOV_DOMAIN)) {
- return true;
- }
- }
- }
- try {
- Collection<List<?>> sanList = cert.getSubjectAlternativeNames();
- if (sanList != null) {
- for (List<?> san : sanList) {
- log.trace("Analyzing subj. alt name: " + san);
- if ((Integer) san.get(0) == 2) {
- String dns = (String) san.get(1);
- if (dns.endsWith(GOV_DOMAIN)) {
- return true;
- }
- }
- }
- }
- } catch (CertificateParsingException e) {
- log.error(e);
- }
- if ((cert.getExtensionValue("1.2.40.0.10.1.1.1") != null)
- || (cert.getExtensionValue("1.2.40.0.10.1.1.2") != null)) {
- return true;
- }
- return false;
- }
-
- /**
- * Client Certificates are currently not supported
- *
- */
- protected AuthenticationClass getMyAuthenticationClass(boolean isDataUrl,
- URL url, X509Certificate cert) {
- if (isDataUrl) {
- if (url.getProtocol().equalsIgnoreCase("https")) {
- if (isGovAgency(cert)) {
- return CERTIFIED_GOV_AGENCY;
- }
- if (cert.getExtensionValue("1.2.40.0.10.1.1.1") != null) {
- return CERTIFIED_GOV_AGENCY;
- }
- return CERTIFIED;
- } else {
- return PSEUDO_ANONYMOUS;
- }
- } else {
- return ANONYMOUS;
- }
- }
-
- /**
- *
- * @param isDataUrl
- * @param url
- * if the url's protocol is https a cert parameter must be provided.
- * @param cert
- * @return
- */
- public static AuthenticationClass getAuthenticationClass(boolean isDataUrl,
- URL url, X509Certificate cert) {
- return instance.getMyAuthenticationClass(isDataUrl, url, cert);
- }
-}
+/* + * 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.accesscontroller; + +import static at.gv.egiz.bku.accesscontroller.AuthenticationClass.ANONYMOUS; +import static at.gv.egiz.bku.accesscontroller.AuthenticationClass.CERTIFIED; +import static at.gv.egiz.bku.accesscontroller.AuthenticationClass.CERTIFIED_GOV_AGENCY; +import static at.gv.egiz.bku.accesscontroller.AuthenticationClass.PSEUDO_ANONYMOUS; + +import java.net.URL; +import java.security.cert.CertificateParsingException; +import java.security.cert.X509Certificate; +import java.util.Collection; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AuthenticationClassifier { + private static AuthenticationClassifier instance = new AuthenticationClassifier(); + private final static String GOV_DOMAIN = ".gv.at"; + + private AuthenticationClassifier() { + } + + public static boolean isGovAgency(X509Certificate cert) { + Logger log = LoggerFactory.getLogger(AuthenticationClassifier.class); + String[] rdns = (cert.getSubjectX500Principal().getName()).split(","); + for (String rdn : rdns) { + if (rdn.startsWith("CN=")) { + String dns = rdn.split("=")[1]; + log.trace("Analyzing cn dn: " + dns); + if (dns.endsWith(GOV_DOMAIN)) { + return true; + } + } + } + try { + Collection<List<?>> sanList = cert.getSubjectAlternativeNames(); + if (sanList != null) { + for (List<?> san : sanList) { + log.trace("Analyzing subj. alt name: " + san); + if ((Integer) san.get(0) == 2) { + String dns = (String) san.get(1); + if (dns.endsWith(GOV_DOMAIN)) { + return true; + } + } + } + } + } catch (CertificateParsingException e) { + log.error("Failed to parse certificate.", e); + } + if ((cert.getExtensionValue("1.2.40.0.10.1.1.1") != null) + || (cert.getExtensionValue("1.2.40.0.10.1.1.2") != null)) { + return true; + } + return false; + } + + /** + * Client Certificates are currently not supported + * + */ + protected AuthenticationClass getMyAuthenticationClass(boolean isDataUrl, + URL url, X509Certificate cert) { + if (isDataUrl) { + if (url.getProtocol().equalsIgnoreCase("https")) { + if (isGovAgency(cert)) { + return CERTIFIED_GOV_AGENCY; + } + if (cert.getExtensionValue("1.2.40.0.10.1.1.1") != null) { + return CERTIFIED_GOV_AGENCY; + } + return CERTIFIED; + } else { + return PSEUDO_ANONYMOUS; + } + } else { + return ANONYMOUS; + } + } + + /** + * + * @param isDataUrl + * @param url + * if the url's protocol is https a cert parameter must be provided. + * @param cert + * @return + */ + public static AuthenticationClass getAuthenticationClass(boolean isDataUrl, + URL url, X509Certificate cert) { + return instance.getMyAuthenticationClass(isDataUrl, url, cert); + } +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/ChainChecker.java b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/ChainChecker.java index 716f81e4..6b24dcac 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/ChainChecker.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/ChainChecker.java @@ -1,91 +1,92 @@ -/*
-* 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.accesscontroller;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.slexceptions.SLException;
-
-public class ChainChecker implements AccessChecker {
- private static Log log = LogFactory.getLog(ChainChecker.class);
-
- private String id;
- private List<RuleChecker> rules = new LinkedList<RuleChecker>();
-
- /**
- *
- * @param id must not be null
- */
- public ChainChecker(String id) {
- if (id == null) {
- throw new NullPointerException("Id argument must not be null");
- }
- this.id = id;
- }
-
-
- public String getId() {
- return id;
- }
-
- public void addRule(RuleChecker rule) {
- if (rule != null) {
- rules.add(rule);
- }
- }
-
- public List<RuleChecker> getRules() {
- return Collections.unmodifiableList(rules);
- }
-
- @Override
- public ChainResult check(AccessCheckerContext checkCtx) throws SLException {
- log.debug("Processing chain: "+id);
- for (RuleChecker rule : rules) {
- log.trace("Checking rule: "+rule.getId());
- RuleResult result = rule.check(checkCtx);
- if (result.matchFound()) {
- if (result.getDelegateChainId() != null) {
- // process chain
- ChainChecker cc = AccessControllerFactory.getInstance().getChainChecker(result.getDelegateChainId());
- if (cc == null) {
- log.error("Cannot delegate to chain. Unknown chain id: "+result.getDelegateChainId());
- throw new SLException(4000);
- }
- ChainResult cr = cc.check(checkCtx);
- if (cr.matchFound()) {
- return cr;
- }
- // if chain does not contain matching rule
- // cont. here.
- } else {
- return result;
- }
- }
- }
- log.debug("Did not find a matching rule here");
- return new ChainResult(null, null, false);
- }
-
-
-
-}
+/* +* 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.accesscontroller; + +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.slexceptions.SLException; + +public class ChainChecker implements AccessChecker { + + private final Logger log = LoggerFactory.getLogger(ChainChecker.class); + + private String id; + private List<RuleChecker> rules = new LinkedList<RuleChecker>(); + + /** + * + * @param id must not be null + */ + public ChainChecker(String id) { + if (id == null) { + throw new NullPointerException("Id argument must not be null"); + } + this.id = id; + } + + + public String getId() { + return id; + } + + public void addRule(RuleChecker rule) { + if (rule != null) { + rules.add(rule); + } + } + + public List<RuleChecker> getRules() { + return Collections.unmodifiableList(rules); + } + + @Override + public ChainResult check(AccessCheckerContext checkCtx) throws SLException { + log.debug("Processing chain: {}.", id); + for (RuleChecker rule : rules) { + log.trace("Checking rule: {}.", rule.getId()); + RuleResult result = rule.check(checkCtx); + if (result.matchFound()) { + if (result.getDelegateChainId() != null) { + // process chain + ChainChecker cc = AccessControllerFactory.getInstance().getChainChecker(result.getDelegateChainId()); + if (cc == null) { + log.error("Cannot delegate to chain. Unknown chain id: {}.", result.getDelegateChainId()); + throw new SLException(4000); + } + ChainResult cr = cc.check(checkCtx); + if (cr.matchFound()) { + return cr; + } + // if chain does not contain matching rule + // cont. here. + } else { + return result; + } + } + } + log.debug("Did not find a matching rule here."); + return new ChainResult(null, null, false); + } + + + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/InfoboxParamChecker.java b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/InfoboxParamChecker.java index 8fa328de..e7535e81 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/InfoboxParamChecker.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/InfoboxParamChecker.java @@ -1,74 +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.accesscontroller;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.slcommands.InfoboxReadCommand;
-import at.gv.egiz.bku.slcommands.SLCommand;
-import at.gv.egiz.bku.slexceptions.SLRuntimeException;
-
-public class InfoboxParamChecker extends CommandParamChecker {
- private static Log log = LogFactory.getLog(InfoboxParamChecker.class);
-
- public final static String INFOBOX_ID = "InfoboxIdentifier";
- public final static String PERSON_ID = "PersonIdentifier";
- public final static String DERIVED = "derived";
-
- @Override
- public boolean checkParameter(SLCommand cmd) {
- if (paramList.size() == 0) {
- return true;
- }
-
- if (cmd instanceof InfoboxReadCommand) {
- InfoboxReadCommand irc = (InfoboxReadCommand) cmd;
- for (Tupel<String, String> param : paramList) {
- if (param.getKey().equals(INFOBOX_ID)) {
- if (!param.getVal().equals(irc.getInfoboxIdentifier())) {
- return false;
- }
- } else if (param.getKey().equals(PERSON_ID)) {
- if (param.getVal().equals(DERIVED)) {
- if (irc.getIdentityLinkDomainId() == null) {
- return false;
- }
- } else {
- Pattern p = Pattern.compile(param.getVal());
- Matcher m = p.matcher(irc.getIdentityLinkDomainId());
- if (!m.matches()) {
- return false;
- }
- }
-
- } else {
- throw new SLRuntimeException("Cannot handle parameter "
- + param.getKey());
- }
- }
- return true;
- } else {
- log.error("Cannot handle parameter for command: " + cmd.getName());
- throw new SLRuntimeException("Cannot handle parameters for command: "
- + cmd.getName());
- }
- }
-}
+/* +* 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.accesscontroller; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.slcommands.InfoboxReadCommand; +import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slexceptions.SLRuntimeException; + +public class InfoboxParamChecker extends CommandParamChecker { + + private final Logger log = LoggerFactory.getLogger(InfoboxParamChecker.class); + + public final static String INFOBOX_ID = "InfoboxIdentifier"; + public final static String PERSON_ID = "PersonIdentifier"; + public final static String DERIVED = "derived"; + + @Override + public boolean checkParameter(SLCommand cmd) { + if (paramList.size() == 0) { + return true; + } + + if (cmd instanceof InfoboxReadCommand) { + InfoboxReadCommand irc = (InfoboxReadCommand) cmd; + for (Tupel<String, String> param : paramList) { + if (param.getKey().equals(INFOBOX_ID)) { + if (!param.getVal().equals(irc.getInfoboxIdentifier())) { + return false; + } + } else if (param.getKey().equals(PERSON_ID)) { + if (param.getVal().equals(DERIVED)) { + if (irc.getIdentityLinkDomainId() == null) { + return false; + } + } else { + Pattern p = Pattern.compile(param.getVal()); + Matcher m = p.matcher(irc.getIdentityLinkDomainId()); + if (!m.matches()) { + return false; + } + } + + } else { + throw new SLRuntimeException("Cannot handle parameter " + + param.getKey()); + } + } + return true; + } else { + log.error("Cannot handle parameter for command: {}.", cmd.getName()); + throw new SLRuntimeException("Cannot handle parameters for command: " + + cmd.getName()); + } + } +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/RuleChecker.java b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/RuleChecker.java index 1cba89ef..33283eda 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/RuleChecker.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/RuleChecker.java @@ -1,203 +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.
-*/
-package at.gv.egiz.bku.accesscontroller;
-
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.slcommands.SLCommand;
-import at.gv.egiz.bku.slexceptions.SLRuntimeException;
-
-public class RuleChecker implements AccessChecker {
-
- private static Log log = LogFactory.getLog(RuleChecker.class);
-
- public static enum PEER_TYPE {
- HOST, IP, URL
- };
-
- protected String id;
- protected AuthenticationClass authenticationClass;
- protected String commandName;
- protected Pattern commandNamePattern;
- protected String peerId;
- protected Pattern peerIdPattern;
- protected PEER_TYPE peerType;
- protected Action action;
- protected UserAction userAction;
- protected String chainId;
- protected CommandParamChecker paramChecker;
-
- public RuleChecker(String id) {
- if (id == null) {
- throw new NullPointerException("Id argument must not be null");
- }
- this.id = id;
- }
-
- public void setAuthenticationClass(String ac) {
- if (ac != null) {
- AuthenticationClass tmp = AuthenticationClass.fromString(ac);
- if (tmp == null) {
- throw new SLRuntimeException("Unknown authentication class " + ac);
- }
- authenticationClass = tmp;
- }
- }
-
- public void setAction(String ac) {
- if (ac != null) {
- Action tmp = Action.fromString(ac);
- if (tmp == null) {
- throw new SLRuntimeException("Unknown action " + ac);
- }
- action = tmp;
- }
- }
-
- public void setUserAction(String uac) {
- if (uac != null) {
- UserAction tmp = UserAction.fromString(uac);
- if (tmp == null) {
- throw new SLRuntimeException("Unknown user action " + uac);
- }
- userAction = tmp;
- }
- }
-
- public void setChainId(String chainId) {
- this.chainId = chainId;
- }
-
- public void setPeerId(String peerId, PEER_TYPE type) {
- this.peerType = type;
- this.peerId = peerId;
- peerIdPattern = Pattern.compile(peerId);
- }
-
- public void setCommandName(String commandName) {
- this.commandName = commandName;
- commandNamePattern = Pattern.compile(commandName);
- paramChecker = AccessControllerFactory.getInstance().createParamChecker(
- commandName);
- }
-
- /**
- * Make sure to set the commandName first
- *
- * @param key
- * @param value
- */
- public void addParameter(String key, String value) {
- if (paramChecker == null) {
- throw new IllegalArgumentException("Cannot set parameters for command "
- + commandName);
- }
- paramChecker.addParameter(key, value);
- }
-
- public String getId() {
- return id;
- }
-
- protected boolean matchAuthenticationClass(AuthenticationClass cls) {
- if ((this.authenticationClass == null) || (cls == null)) {
- return true;
- }
- return this.authenticationClass.compareTo(cls) <= 0;
- }
-
- protected boolean matchCommandName(SLCommand cmd) {
- if ((commandName == null) || (cmd == null)) {
- return true;
- }
- Matcher matcher = commandNamePattern.matcher(cmd.getName());
- if (matcher.matches()) {
- if (paramChecker != null) {
- return paramChecker.checkParameter(cmd);
- } else {
- return true;
- }
- } else {
- return false;
- }
- }
-
- protected boolean matchPeerId(String peerUrl) {
- if ((peerId == null) || (peerUrl == null)) {
- return true;
- }
- if (peerType == PEER_TYPE.URL) {
- Matcher matcher = peerIdPattern.matcher(peerUrl);
- return matcher.matches();
- } else {
- try {
- URL url = new URL(peerUrl);
- if (peerType == PEER_TYPE.HOST) {
- try {
- String host = url.getHost();
- String hostName = InetAddress.getByName(host)
- .getCanonicalHostName();
- Matcher matcher = peerIdPattern.matcher(hostName);
- return matcher.matches();
- } catch (UnknownHostException e) {
- log.error("Cannot resolve hostname", e);
- return false;
- }
- } else {
- try {
- String hostAddr = InetAddress.getByName(url.getHost())
- .getHostAddress();
- Matcher matcher = peerIdPattern.matcher(hostAddr);
- return matcher.matches();
- } catch (UnknownHostException e) {
- log.error("Cannot resolve host address", e);
- return false;
- }
- }
- } catch (MalformedURLException e) {
- log.error("Cannot parse url", e);
- return false;
- }
- }
- }
-
- @Override
- public RuleResult check(AccessCheckerContext checkCtx) {
- log.debug("Processing rule: " + id);
- if (matchAuthenticationClass(checkCtx.getAuthenticationClass())
- && matchCommandName(checkCtx.getCommand())
- && matchPeerId(checkCtx.getPeerUrl())) {
- log.debug("Match found for rule: " + id);
- return new RuleResult(action, userAction, true, chainId);
- }
- log.debug("No match found for rule: " + id);
- return new RuleResult(action, userAction, false, chainId);
- }
-
- public String getChainId() {
- return chainId;
- }
-
-}
+/* +* 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.accesscontroller; + +import java.net.InetAddress; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.UnknownHostException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slexceptions.SLRuntimeException; + +public class RuleChecker implements AccessChecker { + + private final Logger log = LoggerFactory.getLogger(RuleChecker.class); + + public static enum PEER_TYPE { + HOST, IP, URL + }; + + protected String id; + protected AuthenticationClass authenticationClass; + protected String commandName; + protected Pattern commandNamePattern; + protected String peerId; + protected Pattern peerIdPattern; + protected PEER_TYPE peerType; + protected Action action; + protected UserAction userAction; + protected String chainId; + protected CommandParamChecker paramChecker; + + public RuleChecker(String id) { + if (id == null) { + throw new NullPointerException("Id argument must not be null"); + } + this.id = id; + } + + public void setAuthenticationClass(String ac) { + if (ac != null) { + AuthenticationClass tmp = AuthenticationClass.fromString(ac); + if (tmp == null) { + throw new SLRuntimeException("Unknown authentication class " + ac); + } + authenticationClass = tmp; + } + } + + public void setAction(String ac) { + if (ac != null) { + Action tmp = Action.fromString(ac); + if (tmp == null) { + throw new SLRuntimeException("Unknown action " + ac); + } + action = tmp; + } + } + + public void setUserAction(String uac) { + if (uac != null) { + UserAction tmp = UserAction.fromString(uac); + if (tmp == null) { + throw new SLRuntimeException("Unknown user action " + uac); + } + userAction = tmp; + } + } + + public void setChainId(String chainId) { + this.chainId = chainId; + } + + public void setPeerId(String peerId, PEER_TYPE type) { + this.peerType = type; + this.peerId = peerId; + peerIdPattern = Pattern.compile(peerId); + } + + public void setCommandName(String commandName) { + this.commandName = commandName; + commandNamePattern = Pattern.compile(commandName); + paramChecker = AccessControllerFactory.getInstance().createParamChecker( + commandName); + } + + /** + * Make sure to set the commandName first + * + * @param key + * @param value + */ + public void addParameter(String key, String value) { + if (paramChecker == null) { + throw new IllegalArgumentException("Cannot set parameters for command " + + commandName); + } + paramChecker.addParameter(key, value); + } + + public String getId() { + return id; + } + + protected boolean matchAuthenticationClass(AuthenticationClass cls) { + if ((this.authenticationClass == null) || (cls == null)) { + return true; + } + return this.authenticationClass.compareTo(cls) <= 0; + } + + protected boolean matchCommandName(SLCommand cmd) { + if ((commandName == null) || (cmd == null)) { + return true; + } + Matcher matcher = commandNamePattern.matcher(cmd.getName()); + if (matcher.matches()) { + if (paramChecker != null) { + return paramChecker.checkParameter(cmd); + } else { + return true; + } + } else { + return false; + } + } + + protected boolean matchPeerId(String peerUrl) { + if ((peerId == null) || (peerUrl == null)) { + return true; + } + if (peerType == PEER_TYPE.URL) { + Matcher matcher = peerIdPattern.matcher(peerUrl); + return matcher.matches(); + } else { + try { + URL url = new URL(peerUrl); + if (peerType == PEER_TYPE.HOST) { + try { + String host = url.getHost(); + String hostName = InetAddress.getByName(host) + .getCanonicalHostName(); + Matcher matcher = peerIdPattern.matcher(hostName); + return matcher.matches(); + } catch (UnknownHostException e) { + log.error("Cannot resolve hostname.", e); + return false; + } + } else { + try { + String hostAddr = InetAddress.getByName(url.getHost()) + .getHostAddress(); + Matcher matcher = peerIdPattern.matcher(hostAddr); + return matcher.matches(); + } catch (UnknownHostException e) { + log.error("Cannot resolve host address.", e); + return false; + } + } + } catch (MalformedURLException e) { + log.error("Cannot parse url.", e); + return false; + } + } + } + + @Override + public RuleResult check(AccessCheckerContext checkCtx) { + log.debug("Processing rule: {}.", id); + if (matchAuthenticationClass(checkCtx.getAuthenticationClass()) + && matchCommandName(checkCtx.getCommand()) + && matchPeerId(checkCtx.getPeerUrl())) { + log.debug("Match found for rule: {}.", id); + return new RuleResult(action, userAction, true, chainId); + } + log.debug("No match found for rule: {}", id); + return new RuleResult(action, userAction, false, chainId); + } + + public String getChainId() { + return chainId; + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/SecurityManagerFacade.java b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/SecurityManagerFacade.java index 482d3ecb..0596f0d0 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/SecurityManagerFacade.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/SecurityManagerFacade.java @@ -1,118 +1,119 @@ -/*
-* 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.accesscontroller;
-
-import java.io.InputStream;
-
-import javax.xml.bind.JAXBException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.slcommands.SLCommand;
-import at.gv.egiz.bku.slcommands.SLSourceContext;
-import at.gv.egiz.bku.slcommands.SLTargetContext;
-
-/**
- * Facade for the access controller
- */
-public class SecurityManagerFacade {
-
- private static Log log = LogFactory.getLog(SecurityManagerFacade.class);
-
- private boolean allowUnmatched = false;
- private ChainChecker inputFilter = null;
- private ChainChecker outputFilter = null;
-
- public boolean mayInvokeCommand(SLCommand cmd, SLSourceContext ctx) {
- if (inputFilter != null) {
- AuthenticationClass ac = AuthenticationClassifier.getAuthenticationClass(
- ctx.isSourceIsDataURL(), ctx.getSourceUrl(), ctx
- .getSourceCertificate());
- AccessCheckerContext acc = new AccessCheckerContext(cmd, ac, ctx
- .getSourceUrl().toString());
- try {
- ChainResult cr = inputFilter.check(acc);
- if (cr.matchFound()) {
- if (cr.getAction() == Action.ALLOW) {
- return true;
- } else {
- return false;
- }
- } else {
- return allowUnmatched;
- }
- } catch (Exception e) {
- log.error(e);
- return false;
- }
- } else {
- log.warn("No input chain defined");
- return allowUnmatched;
- }
- }
-
- public boolean maySendResult(SLCommand cmd, SLTargetContext ctx) {
- if (outputFilter != null) {
- AuthenticationClass ac = AuthenticationClassifier.getAuthenticationClass(
- ctx.isTargetIsDataURL(), ctx.getTargetUrl(), ctx
- .getTargetCertificate());
- AccessCheckerContext acc = new AccessCheckerContext(cmd, ac, ctx
- .getTargetUrl().toString());
- try {
- ChainResult cr = outputFilter.check(acc);
- if (cr.matchFound()) {
- if (cr.getAction() == Action.ALLOW) {
- return true;
- } else {
- return false;
- }
- } else {
- return allowUnmatched;
- }
- } catch (Exception e) {
- log.error(e);
- return false;
- }
- } else {
- log.warn("No output chain defined");
- return allowUnmatched;
- }
- }
-
- /**
- * Default policy if not match was found
- *
- * @param allow
- */
- public void setAllowUnmatched(boolean allow) {
- this.allowUnmatched = allow;
- }
-
- public void init(InputStream is) {
- inputFilter = null;
- outputFilter = null;
- AccessControllerFactory fab = AccessControllerFactory.getInstance();
- try {
- fab.init(is);
- } catch (JAXBException e) {
- log.error(e);
- }
- inputFilter = fab.getChainChecker(AccessControllerFactory.INPUT_CHAIN);
- outputFilter = fab.getChainChecker(AccessControllerFactory.OUTPUT_CHAIN);
- }
-}
+/* +* 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.accesscontroller; + +import java.io.InputStream; + +import javax.xml.bind.JAXBException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slcommands.SLSourceContext; +import at.gv.egiz.bku.slcommands.SLTargetContext; +import at.gv.egiz.bku.slexceptions.SLException; + +/** + * Facade for the access controller + */ +public class SecurityManagerFacade { + + private final Logger log = LoggerFactory.getLogger(SecurityManagerFacade.class); + + private boolean allowUnmatched = false; + private ChainChecker inputFilter = null; + private ChainChecker outputFilter = null; + + public boolean mayInvokeCommand(SLCommand cmd, SLSourceContext ctx) { + if (inputFilter != null) { + AuthenticationClass ac = AuthenticationClassifier.getAuthenticationClass( + ctx.isSourceIsDataURL(), ctx.getSourceUrl(), ctx + .getSourceCertificate()); + AccessCheckerContext acc = new AccessCheckerContext(cmd, ac, ctx + .getSourceUrl().toString()); + try { + ChainResult cr = inputFilter.check(acc); + if (cr.matchFound()) { + if (cr.getAction() == Action.ALLOW) { + return true; + } else { + return false; + } + } else { + return allowUnmatched; + } + } catch (SLException e) { + log.error("Check failed.", e); + return false; + } + } else { + log.warn("No input chain defined."); + return allowUnmatched; + } + } + + public boolean maySendResult(SLCommand cmd, SLTargetContext ctx) { + if (outputFilter != null) { + AuthenticationClass ac = AuthenticationClassifier.getAuthenticationClass( + ctx.isTargetIsDataURL(), ctx.getTargetUrl(), ctx + .getTargetCertificate()); + AccessCheckerContext acc = new AccessCheckerContext(cmd, ac, ctx + .getTargetUrl().toString()); + try { + ChainResult cr = outputFilter.check(acc); + if (cr.matchFound()) { + if (cr.getAction() == Action.ALLOW) { + return true; + } else { + return false; + } + } else { + return allowUnmatched; + } + } catch (SLException e) { + log.error("Check failed.", e); + return false; + } + } else { + log.warn("No output chain defined."); + return allowUnmatched; + } + } + + /** + * Default policy if not match was found + * + * @param allow + */ + public void setAllowUnmatched(boolean allow) { + this.allowUnmatched = allow; + } + + public void init(InputStream is) { + inputFilter = null; + outputFilter = null; + AccessControllerFactory fab = AccessControllerFactory.getInstance(); + try { + fab.init(is); + } catch (JAXBException e) { + log.error("Failed to initialize AccessControllerFactory.", e); + } + inputFilter = fab.getChainChecker(AccessControllerFactory.INPUT_CHAIN); + outputFilter = fab.getChainChecker(AccessControllerFactory.OUTPUT_CHAIN); + } +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/AbstractBindingProcessor.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/AbstractBindingProcessor.java index 23f62134..5201e817 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/AbstractBindingProcessor.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/AbstractBindingProcessor.java @@ -16,74 +16,119 @@ */ package at.gv.egiz.bku.binding; -import at.gv.egiz.bku.conf.Configuration; -import java.io.InputStream; import java.util.Date; +import java.util.Locale; +import org.apache.commons.configuration.Configuration; +import org.slf4j.MDC; + +import at.gv.egiz.bku.slcommands.SLCommandFactory; import at.gv.egiz.bku.slcommands.SLCommandInvoker; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; import at.gv.egiz.stal.STAL; public abstract class AbstractBindingProcessor implements BindingProcessor { + + protected Configuration configuration; + + protected SLCommandFactory slCommandFactory; + + protected Locale locale = Locale.getDefault(); + protected Id id; - protected Configuration config; protected STAL stal; protected SLCommandInvoker commandInvoker; + protected long lastAccessedTime = System.currentTimeMillis(); - public AbstractBindingProcessor(String idString) { - this.id = IdFactory.getInstance().createId(idString); + protected URLDereferencer urlDereferencer; + + public void setConfiguration(Configuration configuration) { + this.configuration = configuration; } - /** - * @see java.lang.Thread#run() - */ - public abstract void run(); + @Override + public void setSlCommandFactory(SLCommandFactory slCommandFactory) { + this.slCommandFactory = slCommandFactory; + } - /** - * The caller is advised to check the result in case an error occurred. - * - * @see #getResult() - */ - public abstract void consumeRequestStream(InputStream aIs); + @Override + public void setLocale(Locale locale) { + if (locale == null) { + throw new NullPointerException("Locale must not be set to null."); + } + this.locale = locale; + } + + @Override + public void init(String id, STAL stal, SLCommandInvoker commandInvoker) { + if (id == null) { + throw new NullPointerException("Id must not be null."); + } + if (stal == null) { + throw new NullPointerException("STAL must not null."); + } + if (commandInvoker == null) { + throw new NullPointerException("CommandInvoker must null."); + } + this.id = IdFactory.getInstance().createId(id); + this.stal = stal; + this.commandInvoker = commandInvoker; + } + @Override public Id getId() { return id; } + @Override public STAL getSTAL() { return stal; } + @Override public SLCommandInvoker getCommandInvoker() { return commandInvoker; } - + + @Override public void updateLastAccessTime() { lastAccessedTime = System.currentTimeMillis(); } + @Override public Date getLastAccessTime() { return new Date(lastAccessedTime); } - /** - * To be called after object creation. - * - * @param aStal - * must not be null - * @param aCommandInvoker - * must not be null - */ - public void init(STAL aStal, SLCommandInvoker aCommandInvoker, Configuration conf) { - if (aStal == null) { - throw new NullPointerException("STAL must not be set to null"); + @Override + public void run() { + + if (this.id != null) { + MDC.put("id", this.id.toString()); } - if (aCommandInvoker == null) { - throw new NullPointerException("Commandinvoker must not be set to null"); + try { + process(); + } finally { + MDC.remove("id"); } - config = conf; - stal = aStal; - commandInvoker = aCommandInvoker; - Thread.currentThread().setName("BPID#"+getId().toString()); + + } + + public abstract void process(); + + /** + * @return the urlDereferencer + */ + public URLDereferencer getUrlDereferencer() { + return urlDereferencer; + } + + /** + * @param urlDereferencer the urlDereferencer to set + */ + public void setUrlDereferencer(URLDereferencer urlDereferencer) { + this.urlDereferencer = urlDereferencer; } + }
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/AbstractBindingProcessorFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/AbstractBindingProcessorFactory.java new file mode 100644 index 00000000..8cf71260 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/AbstractBindingProcessorFactory.java @@ -0,0 +1,81 @@ +/* +* Copyright 2009 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.binding; + +import java.util.Set; + +import org.apache.commons.configuration.Configuration; + +import at.gv.egiz.bku.slcommands.SLCommandFactory; +import at.gv.egiz.bku.utils.binding.Protocol; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; + + +public abstract class AbstractBindingProcessorFactory implements BindingProcessorFactory { + + protected Set<Protocol> supportedProtocols; + protected SLCommandFactory slCommandFactory; + protected Configuration configuration; + protected URLDereferencer urlDereferencer; + + @Override + public Set<Protocol> getSupportedProtocols() { + return supportedProtocols; + } + + @Override + public SLCommandFactory getSlCommandFactory() { + return slCommandFactory; + } + + @Override + public void setSlCommandFactory(SLCommandFactory slCommandFactory) { + this.slCommandFactory = slCommandFactory; + } + + @Override + public Configuration getConfiguration() { + return configuration; + } + + @Override + public void setConfiguration(Configuration configuration) { + this.configuration = configuration; + } + + /** + * @return the urlDereferencer + */ + public URLDereferencer getUrlDereferencer() { + return urlDereferencer; + } + + /** + * @param urlDereferencer the urlDereferencer to set + */ + public void setUrlDereferencer(URLDereferencer urlDereferencer) { + this.urlDereferencer = urlDereferencer; + } + + protected void configureBindingProcessor(AbstractBindingProcessor bindingProcessor) { + bindingProcessor.setConfiguration(configuration); + bindingProcessor.setSlCommandFactory(slCommandFactory); + bindingProcessor.setUrlDereferencer(urlDereferencer); + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessor.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessor.java index 0d978992..148fe296 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessor.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessor.java @@ -1,78 +1,147 @@ /* -* 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. -*/ + * 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.binding; -import at.gv.egiz.bku.conf.Configuration; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Date; import java.util.Locale; +import at.gv.egiz.bku.slcommands.SLCommandFactory; import at.gv.egiz.bku.slcommands.SLCommandInvoker; import at.gv.egiz.stal.STAL; /** - * Represents an single instance of a SL HTTP binding. + * BindingProcessors implement the processing of a specific protocol binding + * (e.g. HTTP) for Security Layer requests. * - * @author wbauer - * + * @author wbauer, mcentner */ public interface BindingProcessor extends Runnable { /** - * The stream must be read completely within this method. + * Sets the command factory for creating Security Layer. Must be set before + * {@link #consumeRequestStream(String, InputStream)} is called. + * + * @param slCommandFactory + * the command factory for creating Security Layer commands. + */ + void setSlCommandFactory(SLCommandFactory slCommandFactory); + + /** + * Sets the preferred locale for user interaction. If the locale is not set + * the default locale will be used. Should be set before + * {@link #consumeRequestStream(String, InputStream)} is called to allow for a + * proper localization. + * + * @param locale + * must not be null. + */ + public void setLocale(Locale locale); + + /** + * Instructs this BindingProcessor to consume the request + * <code>inputStream</code>. + * <p> + * Implementing classes are assumed to read the entire provided + * <code>inputStream</code> + * </p> + * <p> + * Any errors are reported via the result produced by this BindingProcessor. + * </p> * - * The caller is advised to check the result in case an error occurred. + * @param url + * the URL request is associated with (e.g. has been received on). + * + * @see BindingProcessor#writeResultTo(OutputStream, String) + */ + public void consumeRequestStream(String url, InputStream aIs); + + /** + * Initialize this BindingProcessor for processing. This method must be called + * before {@link #run()} is called. * - * @see #getResult() + * @param id + * the (unique) processing id (usually a HTTP session id) + * @param stal + * the STAL + * @param commandInvoker + * the CommandInvoker + * @throws NullPointerException + * if one of the provided parameters is <code>null</code> */ - public void consumeRequestStream(InputStream aIs); + public void init(String id, STAL stal, SLCommandInvoker commandInvoker); /** - * The unique Id of this http binding instance. - * @return + * Returns the unique processing id. + * + * @return the unique processing id or <code>null</code> if not yet assigned. */ public Id getId(); /** - * The used underlying STAL instance - * @return + * Returns the STAL used for processing. + * + * @return the STAL used for processing or <code>null</code> if not yet + * assigned. */ public STAL getSTAL(); + /** + * Returns the CommandInvoker used for processing. + * + * @return the CommandInvoker used for processing or <code>null</code> if not + * yet assigned. + */ public SLCommandInvoker getCommandInvoker(); - public Date getLastAccessTime(); - - public void updateLastAccessTime(); - + /** + * Returns the <code>ContentType</code> of the processing result. + * + * @return the <code>ContentType</code> type of the processing result or + * <code>null</code> if a result is not yet available. + */ public String getResultContentType(); - - public void writeResultTo(OutputStream os, String encoding) throws IOException; - public void init(STAL aStal, SLCommandInvoker aCommandInvoker, Configuration config); - /** - * Sets the preferred locale for userinteraction. - * If the locale is not set the default locale will be used. - * @param locale must not be null. - */ - public void setLocale(Locale locale); - - public boolean isFinished(); + * Writes the processing result to the given <code>outputStream</code> using + * the given character <code>encoding</code>. + * + * @param outputStream + * the OutputStream to write the result to + * @param encoding + * the character encoding to be used + * @throws IOException + * if writing to <code>outputStream</code> fails for any reason + */ + public void writeResultTo(OutputStream outputStream, String encoding) + throws IOException; + + /** + * Returns the time of the last access to this BindingProcessor instance. + * + * @return the time of the last access to this BindingProcessor instance. + */ + public Date getLastAccessTime(); + + /** + * Updates the time this BindingProcessor was accessed last. + */ + public void updateLastAccessTime(); + }
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorFactory.java new file mode 100644 index 00000000..ac922974 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorFactory.java @@ -0,0 +1,42 @@ +/* +* Copyright 2009 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.binding; + +import java.util.Set; + +import org.apache.commons.configuration.Configuration; + +import at.gv.egiz.bku.slcommands.SLCommandFactory; +import at.gv.egiz.bku.utils.binding.Protocol; + + +public interface BindingProcessorFactory { + + public Set<Protocol> getSupportedProtocols(); + + public void setConfiguration(Configuration configuration); + + public Configuration getConfiguration(); + + public void setSlCommandFactory(SLCommandFactory commandFactory); + + public SLCommandFactory getSlCommandFactory(); + + public BindingProcessor createBindingProcessor(); + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorFuture.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorFuture.java new file mode 100644 index 00000000..f0c65323 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorFuture.java @@ -0,0 +1,73 @@ +/* +* Copyright 2009 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.binding; + +import java.util.concurrent.FutureTask; + +public class BindingProcessorFuture extends FutureTask<Object> { + + private BindingProcessor bindingProcessor; + + private long startTime; + + private long executionTime; + + public BindingProcessorFuture(BindingProcessor bindingProcessor) { + super(bindingProcessor, null); + this.bindingProcessor = bindingProcessor; + } + + /** + * @return the bindingProcessor + */ + public BindingProcessor getBindingProcessor() { + return bindingProcessor; + } + + /* (non-Javadoc) + * @see java.util.concurrent.FutureTask#run() + */ + @Override + public void run() { + startTime = System.currentTimeMillis(); + try { + super.run(); + } finally { + executionTime = System.currentTimeMillis() - startTime; + } + } + + /** + * @return the startTime + */ + public long getStartTime() { + return startTime; + } + + /** + * @return the executionTime + */ + public long getExecutionTime() { + return executionTime; + } + + public long getAge() { + return System.currentTimeMillis() - startTime; + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManager.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManager.java index 9cad95a4..f32d3c4b 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManager.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManager.java @@ -1,107 +1,103 @@ /* -* 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. -*/ + * 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.binding; -import java.net.MalformedURLException; import java.util.Locale; import java.util.Set; -import at.gv.egiz.bku.slcommands.SLCommandInvoker; -import at.gv.egiz.stal.STALFactory; - /** - * Central player that handles the protocol binding. - * - * @author wbauer + * A <code>BindingProcessorManager</code> provides factory methods for creating + * <code>BindingProcessor</code>s and allows for scheduling them for processing. * + * @author wbauer, mcentner */ public interface BindingProcessorManager { /** - * FactoryMethod creating a new BindingProcessor object. - * The created binding processor must be passed to the process method to execute. + * Creates a new BindingProcessor for the given <code>protocol</code>. * - * @param urlString - * the source url - * @param aSessionId - * optional an external sessionId (e.g. http session) could be - * provided. This parameter may be null. - * @param locale the locale used for user interaction, may be null + * @param protocol + * the name of the protocol binding the created BindingProcessor is + * required to implement + * @param locale + * the locale to be used by the binding processor, may be + * <code>null</code> */ - public BindingProcessor createBindingProcessor(String urlString, - String aSessionId, Locale locale) throws MalformedURLException; + public BindingProcessor createBindingProcessor(String protocol, Locale locale); /** - * FactoryMethod creating a new BindingProcessor object. - * The created binding processor must be passed to the process method to execute. + * Creates a new BindingProcessor for the given <code>protocol</code>. * - * @param protcol - * the source url - * @param aSessionId - * optional an external sessionId (e.g. http session) could be - * provided. This parameter may be null. + * @param protocol + * the name of the protocol binding the created BindingProcessor is + * required to implement */ - public BindingProcessor createBindingProcessor(String urlString, - String aSessionId) throws MalformedURLException; + public BindingProcessor createBindingProcessor(String protocol); - /** - * Gets the binding processor with a certain id. The binding processor must be passed to the - * process method before it is managed and thus returned by this method. - * @param aId must not be null - * @return null if the binding processor was not "processed" before. + * Returns the BindingProcessor which has been scheduled for processing with + * the given <code>id</code>. + * + * @param id + * the processing id of the requested BindingProcessor + * + * @return the BindingProcessor which has been scheduled for processing with + * the given <code>id</code>, or <code>null</code> if no + * BindingProcessor has been scheduled with the given <code>id</code>. */ - public BindingProcessor getBindingProcessor(Id aId); + public BindingProcessor getBindingProcessor(Id id); /** - * Sets the STAL factory that is used for creating STAL objects that are used by BindingProcessor objects. - * For each new BindingProcessor a new STAL object is created. - * @param aStalFactory the factory to be used. Must not be null. + * Schedules the given BindingProcessor for processing. + * <p> + * <ol> + * <li>Creates a processing context with the given <code>id</code>.</li> + * <li>Schedules the given BindingProcessor for processing, and</li> + * <li>Immediately returns the processing context.</li> + * </ol> + * </p> + * + * @param id + * @param bindingProcessor */ - public void setSTALFactory(STALFactory aStalFactory); - + public BindingProcessorFuture process(Id id, BindingProcessor bindingProcessor); + /** - * Sets the invoker to be used. - * @param invoker + * Removes the BindingProcessor with the given processing id. + * + * @param id + * the processing id of the BindingProcessor to be removed */ - public void setSLCommandInvoker(SLCommandInvoker invoker); + public void removeBindingProcessor(Id id); /** - * Creates a processing context, - * schedules the provided binding processor for processing and - * immediately returns the context. + * Returns the set of <code>Id</code>s of currently managed BindingProcessor. * - * @param aBindingProcessor + * @return the set of <code>Id</code>s of currently managed BindingProcessor. */ - public ProcessingContext process(BindingProcessor aBindingProcessor); - + public Set<Id> getManagedIds(); + /** - * Removes a formerly added (by calling the process method) binding processor. - * @param bindingProcessor must not be null + * Schedule shutdown of this BindingProcessorManager. */ - public void removeBindingProcessor(Id sessionId); - + public void shutdown(); + /** - * A set of all managed binding processors. - * @return + * Immediately shutdown this BindingProcessorManager. */ - public Set<Id> getManagedIds(); - - public void shutdown(); - public void shutdownNow(); }
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java index bf9a63e2..eee80b03 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java @@ -16,315 +16,283 @@ */ package at.gv.egiz.bku.binding; -import at.gv.egiz.bku.conf.Configuration; -import java.net.MalformedURLException; -import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.util.concurrent.Future; +import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.apache.commons.configuration.Configuration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import at.gv.egiz.bku.jmx.ComponentMXBean; +import at.gv.egiz.bku.jmx.ComponentState; import at.gv.egiz.bku.slcommands.SLCommandInvoker; import at.gv.egiz.bku.slexceptions.SLRuntimeException; import at.gv.egiz.bku.utils.binding.Protocol; -import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.STALFactory; /** * This class maintains all active BindingProcessor Objects. Currently, only * HTTPBinding is supported. */ -public class BindingProcessorManagerImpl implements BindingProcessorManager { +public class BindingProcessorManagerImpl implements BindingProcessorManager, ComponentMXBean { + + public static long DEFAULT_MAX_ACCEPTED_AGE = 2 * 60 * 1000; + + public static int DEFAULT_CLEAN_UP_INTERVAL = 60; - public final static Protocol[] SUPPORTED_PROTOCOLS = { Protocol.HTTP, - Protocol.HTTPS }; + private final Logger log = LoggerFactory.getLogger(BindingProcessorManagerImpl.class); - private static Log log = LogFactory.getLog(BindingProcessorManagerImpl.class); + private List<BindingProcessorFactory> factories = Collections.emptyList(); - /** spring injected config - * Passed to created bindingprocessors, to replace their configuration */ - protected Configuration config; + private Configuration configuration; - protected STALFactory stalFactory; - protected SLCommandInvoker commandInvokerClass; + private STALFactory stalFactory; + + private SLCommandInvoker commandInvoker; - private RemovalStrategy removalStrategy; - private ExecutorService executorService; - private Map<Id, ProcessingContext> contextMap = Collections.synchronizedMap(new HashMap<Id, ProcessingContext>()); -// private Map<Id, MapEntityWrapper> bindingProcessorMap = Collections -// .synchronizedMap(new HashMap<Id, MapEntityWrapper>()); + private ExecutorService executorService = Executors.newCachedThreadPool(); + private Map<Id, BindingProcessorFuture> submittedFutures = Collections + .synchronizedMap(new HashMap<Id, BindingProcessorFuture>()); + + private int cleanUpInterval = DEFAULT_CLEAN_UP_INTERVAL; + + private long maxAcceptedAge = DEFAULT_MAX_ACCEPTED_AGE; + + private ScheduledExecutorService cleanUpService = Executors + .newSingleThreadScheduledExecutor(); + + public BindingProcessorManagerImpl() { + cleanUpService.scheduleAtFixedRate(new CleanUpTask(), cleanUpInterval, + cleanUpInterval, TimeUnit.SECONDS); + } + /** - * Container to hold a Future and Bindingprocessor object as map value. - * - * @author wbauer - * @see BindingProcessorManagerImpl#bindingProcessorMap + * @return the configuration */ -// static class MapEntityWrapper { -// private Future<?> future; -// private BindingProcessor bindingProcessor; -// -// public MapEntityWrapper(Future<?> future, BindingProcessor bindingProcessor) { -// if ((bindingProcessor == null) || (future == null)) { -// throw new NullPointerException("Argument must not be null"); -// } -// this.bindingProcessor = bindingProcessor; -// this.future = future; -// } -// -// public Future<?> getFuture() { -// return future; -// } -// -// public BindingProcessor getBindingProcessor() { -// return bindingProcessor; -// } -// -// public int hashCode() { -// return bindingProcessor.getId().hashCode(); -// } -// -// public boolean equals(Object other) { -// if (other instanceof MapEntityWrapper) { -// MapEntityWrapper o = (MapEntityWrapper) other; -// return (o.bindingProcessor.getId().equals(bindingProcessor.getId())); -// } else { -// return false; -// } -// } -// } + public Configuration getConfiguration() { + return configuration; + } /** - * - * @param fab - * must not be null - * @param ci - * must not be null (prototype to generate new instances) + * @param configuration the configuration to set */ - public BindingProcessorManagerImpl(STALFactory fab, SLCommandInvoker ci, Configuration conf) { - if (fab == null) { - throw new NullPointerException("STALFactory must not be null"); - } - stalFactory = fab; - if (ci == null) { - throw new NullPointerException("SLCommandInvoker must not be null"); - } - commandInvokerClass = ci; - config = conf; - executorService = Executors.newCachedThreadPool(); + public void setConfiguration(Configuration configuration) { + this.configuration = configuration; } /** - * - * @return the STALFactory currently used. + * @return the factoryMap */ - public STALFactory getStalFactory() { - return stalFactory; + public List<BindingProcessorFactory> getFactories() { + return factories; } /** - * Sets the STALFactory to be used. - * - * @param stalFactory + * @param factoryMap the factoryMap to set */ - public void setStalFactory(STALFactory stalFactory) { - this.stalFactory = stalFactory; + public void setFactories(List<BindingProcessorFactory> factories) { + this.factories = factories; } /** - * Could be used to setup a new executor service during application stratup. + * Sets a SLCommandInvoker prototype used to create a SLCommandInvoker for + * initialization of a BindingProcessor. * - * @param executorService + * @param invoker + */ + public void setSlCommandInvoker(SLCommandInvoker invoker) { + commandInvoker = invoker; + } + + /** + * @return the SLCommandInvoker prototype used to create a SLCommandInvoker + * for initialization of a BindingProcessor. */ - public void setExecutorService(ExecutorService executorService) { - this.executorService = executorService; + public SLCommandInvoker getCommandInvoker() { + return commandInvoker; } - public void setRemovalStrategy(RemovalStrategy aStrategy) { - removalStrategy = aStrategy; + /** + * @return the STALFactory currently used. + */ + public STALFactory getStalFactory() { + return stalFactory; } - public RemovalStrategy getRemovlaStrategy() { - return removalStrategy; + /** + * Sets the STALFactory used to create a STAL implementation for initialization of + * a BindingProcessor. + * + * @param stalFactory + */ + public void setStalFactory(STALFactory stalFactory) { + this.stalFactory = stalFactory; } + /* (non-Javadoc) + * @see at.gv.egiz.bku.binding.BindingProcessorManager#shutdown() + */ + @Override public void shutdown() { - log.info("Shutting down the BindingProcessorManager"); + log.info("Shutting down the BindingProcessorManager."); executorService.shutdown(); + cleanUpService.shutdown(); } + /* (non-Javadoc) + * @see at.gv.egiz.bku.binding.BindingProcessorManager#shutdownNow() + */ + @Override public void shutdownNow() { log.info("Shutting down the BindingProcessorManager NOW!"); + cleanUpService.shutdownNow(); executorService.shutdownNow(); - log.debug("Number of binding contexts currently managed: " - + contextMap.size()); -// + bindingProcessorMap.size()); + log.debug("Number of binding contexts currently managed: {}.", submittedFutures.size()); if (log.isDebugEnabled()) { - for (ProcessingContext ctx : contextMap.values()) { - Id bpId = ctx.getBindingProcessor().getId(); - Future future = ctx.getFuture(); - log.debug(bpId + " cancelled: " + future.isCancelled()); - log.debug(bpId + " done: " + future.isDone()); + for (BindingProcessorFuture future : submittedFutures.values()) { + if (future.isCancelled()) { + log.debug("BindingProcessor {} is cancelled.", future.getBindingProcessor().getId()); + } else { + log.debug("BindingProcessor {} is done: {}.", future.getBindingProcessor().getId(), future.isDone()); + } } -// for (Iterator<MapEntityWrapper> it = bindingProcessorMap.values() -// .iterator(); it.hasNext();) { -// MapEntityWrapper entry = it.next(); -// log.debug(entry.getBindingProcessor().getId() + ": isDone: " -// + entry.getFuture().isDone()); -// log.debug(entry.getBindingProcessor().getId() + ": isCanceled: " -// + entry.getFuture().isCancelled()); -// } } } - /** - * Uses the default locale + /* (non-Javadoc) + * @see at.gv.egiz.bku.binding.BindingProcessorManager#createBindingProcessor(java.lang.String, java.lang.String) */ - public BindingProcessor createBindingProcessor(String srcUrl, - String aSessionId) throws MalformedURLException { - return createBindingProcessor(srcUrl, aSessionId, null); + @Override + public BindingProcessor createBindingProcessor(String protocol) { + Protocol p = Protocol.fromString(protocol); + for (BindingProcessorFactory factory : factories) { + if (factory.getSupportedProtocols().contains(p)) { + return factory.createBindingProcessor(); + } + } + throw new IllegalArgumentException(); } - /** - * FactoryMethod creating a new BindingProcessor object. - * - * @param protocol - * must not be null - * @throws MalformedURLException + /* (non-Javadoc) + * @see at.gv.egiz.bku.binding.BindingProcessorManager#createBindingProcessor(java.lang.String, java.lang.String, java.util.Locale) */ - public BindingProcessor createBindingProcessor(String srcUrl, - String aSessionId, Locale locale) throws MalformedURLException { - URL url = new URL(srcUrl); - String low = url.getProtocol().toLowerCase(); - Protocol proto = null; - for (int i = 0; i < SUPPORTED_PROTOCOLS.length; i++) { - if (SUPPORTED_PROTOCOLS[i].toString().equals(low)) { - proto = SUPPORTED_PROTOCOLS[i]; - break; - } - } - if (proto == null) { - throw new UnsupportedOperationException(); - } - BindingProcessor bindingProcessor = new HTTPBindingProcessor(aSessionId, - commandInvokerClass.newInstance(), url); - stalFactory.setLocale(locale); - STAL stal = stalFactory.createSTAL(); - bindingProcessor.init(stal, commandInvokerClass.newInstance(), config); - if (locale != null) { - bindingProcessor.setLocale(locale); -// stal.setLocale(locale); - } + @Override + public BindingProcessor createBindingProcessor(String protocol, Locale locale) { + BindingProcessor bindingProcessor = createBindingProcessor(protocol); + bindingProcessor.setLocale(locale); return bindingProcessor; } - /** - * @return the bindingprocessor object for this id or null if no - * bindingprocessor was found. + /* (non-Javadoc) + * @see at.gv.egiz.bku.binding.BindingProcessorManager#process(java.lang.String, at.gv.egiz.bku.binding.BindingProcessor) */ - @Override - public BindingProcessor getBindingProcessor(Id aId) { -// if (bindingProcessorMap.get(aId) != null) { -// return bindingProcessorMap.get(aId).getBindingProcessor(); - ProcessingContext ctx = contextMap.get(aId); - if (ctx != null) { - return ctx.getBindingProcessor(); - } else { - return null; + @Override + public BindingProcessorFuture process(Id id, BindingProcessor bindingProcessor) { + + log.trace("Initialize BindingProcessor for processing."); + bindingProcessor.init(id.toString(), stalFactory.createSTAL(), commandInvoker.newInstance()); + + BindingProcessorFuture future = new BindingProcessorFuture(bindingProcessor); + if (submittedFutures.containsKey(bindingProcessor.getId())) { + log.error("BindingProcessor with with id {} already submitted.", id); + throw new SLRuntimeException("BindingProcessor with with id " + id + + " already submitted."); } + + try { + log.debug("Submitting BindingProcessor {} for processing.", id); + executorService.execute(future); + submittedFutures.put(bindingProcessor.getId(), future); + } catch (RejectedExecutionException e) { + log.error("BindingProcessor {} processing rejected.", id, e); + throw new SLRuntimeException("BindingProcessor {} " + id + " processing rejected.", e); + } + + return future; + } - /** - * + /* (non-Javadoc) + * @see at.gv.egiz.bku.binding.BindingProcessorManager#getBindingProcessor(at.gv.egiz.bku.binding.Id) */ - @Override - public void setSTALFactory(STALFactory aStalFactory) { - if (aStalFactory == null) { - throw new NullPointerException("Cannot set STALFactory to null"); + @Override + public BindingProcessor getBindingProcessor(Id id) { + BindingProcessorFuture future = submittedFutures.get(id); + if (future != null) { + return future.getBindingProcessor(); + } else { + return null; } - stalFactory = aStalFactory; } - /** - * Causes the BindingProcessorManager to manage the provided BindingProcessor - * Creates a processing context, - * schedules the provided binding processor for processing and - * immediately returns the context. - * - * @param aBindingProcessor - * must not be null + /* (non-Javadoc) + * @see at.gv.egiz.bku.binding.BindingProcessorManager#removeBindingProcessor(at.gv.egiz.bku.binding.Id) */ @Override - public ProcessingContext process(BindingProcessor aBindingProcessor) { - if (contextMap.containsKey(aBindingProcessor.getId())) { -// if (bindingProcessorMap.containsKey(aBindingProcessor.getId())) { - log.fatal("Clashing ids, cannot process bindingprocessor with id:" - + aBindingProcessor.getId()); - throw new SLRuntimeException( - "Clashing ids, cannot process bindingprocessor with id:" - + aBindingProcessor.getId()); + public void removeBindingProcessor(Id id) { + BindingProcessorFuture future = submittedFutures.remove(id); + if (future != null) { + if (!future.isDone()) { + log.debug("Interrupting BindingProcessor {}.", id ); + future.cancel(true); + } + if (log.isInfoEnabled()) { + Object[] args = {id, future.getExecutionTime() / 1000.0, future.getAge() / 1000.0}; + log.info("Removing BindingProcessor {} (active:{}s/age:{}s).", args); + } } - log.debug("processing bindingprocessor: " + aBindingProcessor.getId()); - Future<?> f = executorService.submit(aBindingProcessor); - ProcessingContext ctx = new ProcessingContext(aBindingProcessor, f); - contextMap.put(aBindingProcessor.getId(), ctx); -// bindingProcessorMap.put(aBindingProcessor.getId(), new MapEntityWrapper(f, -// aBindingProcessor)); - return ctx; } + /* (non-Javadoc) + * @see at.gv.egiz.bku.binding.BindingProcessorManager#getManagedIds() + */ @Override - public void setSLCommandInvoker(SLCommandInvoker invoker) { - commandInvokerClass = invoker; + public Set<Id> getManagedIds() { + return Collections.unmodifiableSet(new HashSet<Id>(submittedFutures.keySet())); } + /* (non-Javadoc) + * @see at.gv.egiz.bku.jmx.ComponentMXBean#checkComponentState() + */ @Override - public void removeBindingProcessor(Id sessionId) { - log.debug("Removing binding processor: " + sessionId); - ProcessingContext ctx = contextMap.get(sessionId); - if (ctx == null) { - log.warn("no processing context to remove for session " + sessionId); - return; - } - Future f = ctx.getFuture(); - -// MapEntityWrapper wrapper = bindingProcessorMap.get(sessionId); -// if (wrapper == null) { -// return; -// } -// Future<?> f = wrapper.getFuture(); - - if (!f.isDone()) { - log.trace("canceling " + sessionId); - f.cancel(true); - } - contextMap.remove(sessionId); -// bindingProcessorMap.remove(sessionId); + public ComponentState checkComponentState() { + return new ComponentState(true); } - - @Override - public Set<Id> getManagedIds() { - Set<Id> result = new HashSet<Id>(); - synchronized (contextMap) { - for (Id id : contextMap.keySet()) { - result.add(id); + + public class CleanUpTask implements Runnable { + + @Override + public void run() { + Collection<BindingProcessorFuture> futures = submittedFutures.values(); + List<Id> toBeRemoved = new ArrayList<Id>(); + int active = 0; + for(BindingProcessorFuture future : futures) { + BindingProcessor bindingProcessor = future.getBindingProcessor(); + if (!future.isDone()) { + active++; + } + if ((bindingProcessor.getLastAccessTime().getTime() - System + .currentTimeMillis()) > maxAcceptedAge) { + toBeRemoved.add(bindingProcessor.getId()); + } + } + for (Id id : toBeRemoved) { + removeBindingProcessor(id); } } -// synchronized (bindingProcessorMap) { -// for (Iterator<Id> it = bindingProcessorMap.keySet().iterator(); it -// .hasNext();) { -// result.add(it.next()); -// } -// } - return result; + } -}
\ No newline at end of file +} diff --git a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URLDereferencerContext.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataURLConnectionFactory.java index 6befd5b3..d6e5c701 100644 --- a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URLDereferencerContext.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataURLConnectionFactory.java @@ -1,5 +1,5 @@ /* -* Copyright 2008 Federal Chancellery Austria and +* Copyright 2009 Federal Chancellery Austria and * Graz University of Technology * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,14 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.utils.urldereferencer;
-
-public interface URLDereferencerContext {
-
- /**
- *
- * @param key
- * @return may return null
- */
- public Object getProperty(Object key);
-}
\ No newline at end of file + +package at.gv.egiz.bku.binding; + +import java.net.URL; + +public abstract class DataURLConnectionFactory { + + public abstract DataUrlConnection openConnection(URL url); + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrl.java index d3945253..f267f9a9 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrl.java @@ -16,18 +16,9 @@ */ package at.gv.egiz.bku.binding; -import at.gv.egiz.bku.conf.Configurator; +import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; -import java.util.Properties; - -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.SSLSocketFactory; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.bku.slexceptions.SLRuntimeException; /** * Used to handle DataUrl connections as specified in the CCE's HTTP protocol binding. @@ -35,77 +26,37 @@ import at.gv.egiz.bku.slexceptions.SLRuntimeException; */ public class DataUrl { - private static Log log = LogFactory.getLog(DataUrl.class); - private static DataUrlConnectionSPI connection; - private static Properties configuration; - private static SSLSocketFactory sslSocketFactory; - private static HostnameVerifier hostNameVerifier; - private URL url; - - /** spring injected config, to replace configuration */ - //private Configuration config; - + private static DataURLConnectionFactory connectionFactory; + /** - * Sets the default DataUrlConnection implementation - * @param aClass must not be null + * @return the connectionFactory */ - static void setDataUrlConnectionImpl(DataUrlConnectionSPI conn) { - if (conn != null) { - connection = conn; - } - } - - public DataUrl(String aUrlString) throws MalformedURLException { - url = new URL(aUrlString); - if (connection == null) { - log.debug("Using default DataURLConnection class"); - connection = new DataUrlConnectionImpl(); - } - connection.setConfiguration(configuration); - connection.setSSLSocketFactory(sslSocketFactory); - connection.setHostnameVerifier(hostNameVerifier); + public static DataURLConnectionFactory getConnectionFactory() { + return connectionFactory; } - public DataUrlConnection openConnection() { - try { - log.debug("Opening dataurl connection"); - DataUrlConnectionSPI retVal = connection.newInstance(); - retVal.init(url); - return retVal; - } catch (Exception e) { - log.error(e); - throw new SLRuntimeException("Cannot instantiate a dataurlconnection:", e); - } - } - - /** - * set configuration for all subsequently instantiated DataURL objects - * @param props + * @param connectionFactory the connectionFactory to set */ - public static void setConfiguration(Properties props) { - configuration = props; - if (configuration != null) { - String className = configuration.getProperty(Configurator.DATAURLCONNECTION_CONFIG_P); - if (className != null) { - log.warn("Set DataURLConnection class not supported!"); - } - } + public static void setConnectionFactory( + DataURLConnectionFactory connectionFactory) { + DataUrl.connectionFactory = connectionFactory; } /** - * set SSLSocketFactory for all subsequently instantiated DataURL objects - * @param socketFactory + * The URL. */ - public static void setSSLSocketFactory(SSLSocketFactory socketFactory) { - sslSocketFactory = socketFactory; + private URL url; + + public DataUrl(String spec) throws MalformedURLException { + url = new URL(spec); } - /** - * set HostnameVerifier for all subsequently instantiated DataURL objects - * @param hostNameVerifier - */ - public static void setHostNameVerifier(HostnameVerifier hostNameVerifier) { - DataUrl.hostNameVerifier = hostNameVerifier; + public DataUrlConnection openConnection() throws IOException { + if (connectionFactory != null) { + return connectionFactory.openConnection(url); + } else { + return new DataUrlConnectionImpl(url); + } } }
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnection.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnection.java index 384cf71c..13b1e627 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnection.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnection.java @@ -1,82 +1,92 @@ /* -* 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. -*/ + * 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.binding; import java.io.IOException; -import java.io.InputStream; import java.net.SocketTimeoutException; import java.net.URL; -import java.security.cert.X509Certificate; +import java.net.URLConnection; import at.gv.egiz.bku.slcommands.SLResult; /** - * Transmit a security layer result to DataURL via HTTP POST, encoded as multipart/form-data. - * The HTTP header user-agent is set to <em>citizen-card-environment/1.2 BKU2 1.0</em>. - * The form-parameter ResponseType is set to <em>HTTP-Security-Layer-RESPONSE</em>. - * All other headers/parameters are set by the caller. + * Transmit a security layer result to DataURL via HTTP POST, encoded as + * multipart/form-data. The HTTP header user-agent is set to + * <em>citizen-card-environment/1.2 BKU2 1.0</em>. The form-parameter + * ResponseType is set to <em>HTTP-Security-Layer-RESPONSE</em>. All other + * headers/parameters are set by the caller. * * @author clemens */ -public interface DataUrlConnection { +public abstract class DataUrlConnection { + + public static final String FORMPARAM_RESPONSETYPE = "ResponseType"; + public static final String DEFAULT_RESPONSETYPE = "HTTP-Security-Layer-RESPONSE"; + public static final String FORMPARAM_XMLRESPONSE = "XMLResponse"; + public static final String FORMPARAM_BINARYRESPONSE = "BinaryResponse"; + + public static final String XML_RESPONSE_ENCODING = "UTF-8"; - public static final String FORMPARAM_RESPONSETYPE = "ResponseType"; - public static final String DEFAULT_RESPONSETYPE = "HTTP-Security-Layer-RESPONSE"; - public static final String FORMPARAM_XMLRESPONSE = "XMLResponse"; - public static final String FORMPARAM_BINARYRESPONSE = "BinaryResponse"; - - public static final String XML_RESPONSE_ENCODING = "UTF-8"; + /** + * The URL to send responses and retrieve any further requests. + */ + protected URL url; - - public String getProtocol(); - - public URL getUrl(); - - /** - * Set a HTTP Header. - * @param key - * @param value multiple values are assumed to have the correct formatting (comma-separated list) - */ - public void setHTTPHeader(String key, String value); + /** + * Constructs a DataURL connection to the specified URL. + * + * @param url + * the URL to send responses and retrieve any further requests + */ + protected DataUrlConnection(URL url) { + this.url = url; + } - /** - * Set a form-parameter. - * @param name - * @param data - * @param contentType may be null - * @param charSet may be null - * @param transferEncoding may be null - */ - public void setHTTPFormParameter(String name, InputStream data, String contentType, String charSet, String transferEncoding); - - /** - * @pre httpHeaders != null - * @throws java.net.SocketTimeoutException - * @throws java.io.IOException - */ - public void connect() throws SocketTimeoutException, IOException; + /** + * Returns the URL to send responses and retrieve any further requests. + * + * @return the URL + */ + public URL getURL() { + return url; + } - public X509Certificate getServerCertificate(); + /** + * @see URLConnection#connect() + */ + public abstract void connect() throws SocketTimeoutException, IOException; - /** - * @pre connection != null - * @throws java.io.IOException - */ - public void transmit(SLResult slResult) throws IOException; + /** + * Transmit the given <code>SLResult</code> to the resource identified by this + * URL. + * + * @param slResult the <code>SLResult</code> + * @throws IOException if an I/O exception occurs + */ + public abstract void transmit(SLResult slResult) throws IOException; - public DataUrlResponse getResponse() throws IOException; + /** + * Returns the <code>DataUrlResponse</code> received from the resource + * identified by this URL. + * + * @return the DataUrlResponse received + * + * @throws IOException if an I/O exception occurs + */ + public abstract DataUrlResponse getResponse() throws IOException; + }
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java index 93e5bb1c..1ce6d2cc 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java @@ -26,29 +26,27 @@ import java.net.SocketTimeoutException; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.Charset; -import java.security.cert.X509Certificate; +import java.security.cert.Certificate; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Properties; -import java.util.Set; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSocketFactory; import javax.xml.transform.stream.StreamResult; import org.apache.commons.httpclient.methods.multipart.FilePart; import org.apache.commons.httpclient.methods.multipart.Part; import org.apache.commons.httpclient.methods.multipart.StringPart; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.binding.multipart.InputStreamPartSource; import at.gv.egiz.bku.binding.multipart.SLResultPart; -import at.gv.egiz.bku.conf.Configurator; import at.gv.egiz.bku.slcommands.SLResult; import at.gv.egiz.bku.slcommands.SLResult.SLResultType; import at.gv.egiz.bku.slexceptions.SLRuntimeException; @@ -62,168 +60,144 @@ import at.gv.egiz.bku.utils.binding.Protocol; * systems. * */ -public class DataUrlConnectionImpl implements DataUrlConnectionSPI { +public class DataUrlConnectionImpl extends HttpsDataURLConnection { - private final static Log log = LogFactory.getLog(DataUrlConnectionImpl.class); - - public static final byte[] B_DEFAULT_RESPONSETYPE = DEFAULT_RESPONSETYPE.getBytes(Charset.forName("UTF-8")); + private final Logger log = LoggerFactory.getLogger(DataUrlConnectionImpl.class); + + public static final byte[] B_DEFAULT_RESPONSETYPE = DEFAULT_RESPONSETYPE + .getBytes(Charset.forName("UTF-8")); /** - * Supported protocols are HTTP and HTTPS. + * Supported protocols are HTTP and HTTPS. */ public final static Protocol[] SUPPORTED_PROTOCOLS = { Protocol.HTTP, Protocol.HTTPS }; /** - * The X509 certificate of the DataURL server. - */ - protected X509Certificate serverCertificate; - - /** - * The protocol of the DataURL. - */ - protected Protocol protocol; - - /** - * Use <code>application/x-www-form-urlencoded</code> instead of - * standard conform <code>application/x-www-form-urlencoded</code>. + * Use <code>application/x-www-form-urlencoded</code> instead of standard + * conform <code>application/x-www-form-urlencoded</code>. */ protected boolean urlEncoded = true; - - /** - * The value of the DataURL. - */ - protected URL url; - + /** * The URLConnection used for communication with the DataURL server. */ private HttpURLConnection connection; - - /** - * The HTTP request headers. - */ - protected Map<String, String> requestHttpHeaders; - + /** * The HTTP form parameters. */ - protected ArrayList<HTTPFormParameter> httpFormParameter; - + protected List<HTTPFormParameter> httpFormParameter = new ArrayList<HTTPFormParameter>(); + /** * The boundary for multipart/form-data requests. */ protected String boundary; - - /** - * The configuration properties. - */ - protected Properties config = null; - - /** - * The SSLSocketFactory for HTTPS connections. - */ - protected SSLSocketFactory sslSocketFactory; - - /** - * The HostnameVerifier for HTTPS connections. - */ - protected HostnameVerifier hostnameVerifier; /** * The response of the DataURL server. */ - protected DataUrlResponse result; + protected DataUrlResponse response; - /* (non-Javadoc) - * @see at.gv.egiz.bku.binding.DataUrlConnection#getProtocol() + /** + * Constructs a new instance of this DataUrlConnection implementation. + * + * @param url the URL + * + * @throws IOException if an I/O exception occurs */ - public String getProtocol() { + public DataUrlConnectionImpl(URL url) throws IOException { + super(url); + + Protocol protocol = null; + for (int i = 0; i < SUPPORTED_PROTOCOLS.length; i++) { + if (SUPPORTED_PROTOCOLS[i].toString().equalsIgnoreCase(url.getProtocol())) { + protocol = SUPPORTED_PROTOCOLS[i]; + break; + } + } if (protocol == null) { - return null; + throw new SLRuntimeException("Protocol " + url.getProtocol() + + " not supported for data url."); } - return protocol.toString(); + connection = (HttpURLConnection) url.openConnection(); + connection.setInstanceFollowRedirects(false); + + connection.setDoOutput(true); + + + boundary = "--" + IdFactory.getInstance().createId().toString(); } - /* (non-Javadoc) + @Override + public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { + if (connection instanceof HttpsURLConnection) { + ((HttpsURLConnection) connection).setHostnameVerifier(hostnameVerifier); + } + } + + @Override + public void setSSLSocketFactory(SSLSocketFactory socketFactory) { + if (connection instanceof HttpsURLConnection) { + ((HttpsURLConnection) connection).setSSLSocketFactory(socketFactory); + } + } + + /* + * (non-Javadoc) + * * @see at.gv.egiz.bku.binding.DataUrlConnection#connect() */ public void connect() throws SocketTimeoutException, IOException { - connection = (HttpURLConnection) url.openConnection(); - if (connection instanceof HttpsURLConnection) { - log.trace("Detected ssl connection"); - HttpsURLConnection https = (HttpsURLConnection) connection; - if (sslSocketFactory != null) { - log.debug("Setting custom ssl socket factory for ssl connection"); - https.setSSLSocketFactory(sslSocketFactory); - } else { - log.trace("No custom socket factory set"); - } - if (hostnameVerifier != null) { - log.debug("Setting custom hostname verifier"); - https.setHostnameVerifier(hostnameVerifier); - } - } else { - log.trace("No secure connection with: " + url + " class=" - + connection.getClass()); - } - connection.setDoOutput(true); // Transfer-Encoding: chunked is problematic ... // e.g. https://issues.apache.org/bugzilla/show_bug.cgi?id=37794 // ... therefore disabled. // connection.setChunkedStreamingMode(5*1024); if (urlEncoded) { - log.debug("Setting DataURL Content-Type to " - + HttpUtil.APPLICATION_URL_ENCODED); + log.debug("Setting DataURL Content-Type to {}.", + HttpUtil.APPLICATION_URL_ENCODED); connection.addRequestProperty(HttpUtil.HTTP_HEADER_CONTENT_TYPE, HttpUtil.APPLICATION_URL_ENCODED); } else { - log.debug("Setting DataURL Content-Type to " - + HttpUtil.MULTIPART_FOTMDATA_BOUNDARY); + log.debug("Setting DataURL Content-Type to {}.", + HttpUtil.MULTIPART_FOTMDATA_BOUNDARY); connection.addRequestProperty(HttpUtil.HTTP_HEADER_CONTENT_TYPE, HttpUtil.MULTIPART_FOTMDATA + HttpUtil.SEPERATOR[0] + HttpUtil.MULTIPART_FOTMDATA_BOUNDARY + "=" + boundary); } - Set<String> headers = requestHttpHeaders.keySet(); - Iterator<String> headerIt = headers.iterator(); - while (headerIt.hasNext()) { - String name = headerIt.next(); - connection.setRequestProperty(name, requestHttpHeaders.get(name)); - } - log.trace("Connecting to: " + url); + log.trace("Connecting to URL '{}'.", url); connection.connect(); - if (connection instanceof HttpsURLConnection) { - HttpsURLConnection ssl = (HttpsURLConnection) connection; - X509Certificate[] certs = (X509Certificate[]) ssl.getServerCertificates(); - if ((certs != null) && (certs.length >= 1)) { - log.trace("Server certificate: " + certs[0]); - serverCertificate = certs[0]; - } - } } /* (non-Javadoc) - * @see at.gv.egiz.bku.binding.DataUrlConnection#getServerCertificate() + * @see at.gv.egiz.bku.binding.HttpsDataURLConnection#getServerCertificates() */ - public X509Certificate getServerCertificate() { - return serverCertificate; + @Override + public Certificate[] getServerCertificates() + throws SSLPeerUnverifiedException, IllegalStateException { + if (connection instanceof HttpsURLConnection) { + return ((HttpsURLConnection) connection).getServerCertificates(); + } else { + return null; + } } /* (non-Javadoc) - * @see at.gv.egiz.bku.binding.DataUrlConnection#setHTTPHeader(java.lang.String, java.lang.String) + * @see at.gv.egiz.bku.binding.HttpDataURLConnection#setHTTPHeader(java.lang.String, java.lang.String) */ + @Override public void setHTTPHeader(String name, String value) { - if (name != null && value != null) { - requestHttpHeaders.put(name, value); - } + connection.setRequestProperty(name, value); } /* (non-Javadoc) - * @see at.gv.egiz.bku.binding.DataUrlConnection#setHTTPFormParameter(java.lang.String, java.io.InputStream, java.lang.String, java.lang.String, java.lang.String) + * @see at.gv.egiz.bku.binding.HttpDataURLConnection#setHTTPFormParameter(java.lang.String, java.io.InputStream, java.lang.String, java.lang.String, java.lang.String) */ + @Override public void setHTTPFormParameter(String name, InputStream data, String contentType, String charSet, String transferEncoding) { - // if a content type is specified we have to switch to multipart/formdata encoding + // if a content type is specified we have to switch to multipart/form-data + // encoding if (contentType != null && contentType.length() > 0) { urlEncoded = false; } @@ -231,27 +205,27 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { charSet, transferEncoding)); } - - /* (non-Javadoc) * @see at.gv.egiz.bku.binding.DataUrlConnection#transmit(at.gv.egiz.bku.slcommands.SLResult) */ + @Override public void transmit(SLResult slResult) throws IOException { - log.trace("Sending data"); + log.trace("Sending data."); if (urlEncoded) { // // application/x-www-form-urlencoded (legacy, SL < 1.2) // - + OutputStream os = connection.getOutputStream(); - OutputStreamWriter streamWriter = new OutputStreamWriter(os, HttpUtil.DEFAULT_CHARSET); + OutputStreamWriter streamWriter = new OutputStreamWriter(os, + HttpUtil.DEFAULT_CHARSET); // ResponseType streamWriter.write(FORMPARAM_RESPONSETYPE); streamWriter.write("="); streamWriter.write(URLEncoder.encode(DEFAULT_RESPONSETYPE, "UTF-8")); streamWriter.write("&"); - + // XMLResponse / Binary Response if (slResult.getResultType() == SLResultType.XML) { streamWriter.write(DataUrlConnection.FORMPARAM_XMLRESPONSE); @@ -271,17 +245,18 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { streamWriter.write("&"); streamWriter.write(URLEncoder.encode(formParameter.getName(), "UTF-8")); streamWriter.write("="); - InputStreamReader reader = new InputStreamReader(formParameter.getData(), - (formParameter.getCharSet() != null) - ? formParameter.getCharSet() - : "UTF-8"); // assume request was application/x-www-form-urlencoded, formParam therefore UTF-8 + InputStreamReader reader = new InputStreamReader(formParameter + .getData(), (formParameter.getCharSet() != null) ? formParameter + .getCharSet() : "UTF-8"); // assume request was + // application/x-www-form-urlencoded, + // formParam therefore UTF-8 while ((len = reader.read(cbuf)) != -1) { urlEnc.write(cbuf, 0, len); } urlEnc.flush(); } streamWriter.close(); - + } else { // // multipart/form-data (conforming to SL 1.2) @@ -294,7 +269,7 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { DEFAULT_RESPONSETYPE, "UTF-8"); responseType.setTransferEncoding(null); parts.add(responseType); - + // XMLResponse / Binary Response SLResultPart slResultPart = new SLResultPart(slResult, XML_RESPONSE_ENCODING); @@ -307,7 +282,7 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { slResultPart.setContentType(slResult.getMimeType()); } parts.add(slResultPart); - + // transfer parameters for (HTTPFormParameter formParameter : httpFormParameter) { InputStreamPartSource source = new InputStreamPartSource(null, @@ -319,20 +294,21 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { } OutputStream os = connection.getOutputStream(); - Part.sendParts(os, parts.toArray(new Part[parts.size()]), boundary.getBytes()); + Part.sendParts(os, parts.toArray(new Part[parts.size()]), boundary + .getBytes()); os.close(); - + } - + // MultipartRequestEntity PostMethod InputStream is = null; try { is = connection.getInputStream(); } catch (IOException iox) { - log.info(iox); + log.info("Failed to get InputStream of HTTPUrlConnection.", iox); } - log.trace("Reading response"); - result = new DataUrlResponse(url.toString(), connection.getResponseCode(), + log.trace("Reading response."); + response = new DataUrlResponse(url.toString(), connection.getResponseCode(), is); Map<String, String> responseHttpHeaders = new HashMap<String, String>(); Map<String, List<String>> httpHeaders = connection.getHeaderFields(); @@ -349,105 +325,26 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { responseHttpHeaders.put(key, valString); } } - result.setResponseHttpHeaders(responseHttpHeaders); + response.setResponseHttpHeaders(responseHttpHeaders); } @Override public DataUrlResponse getResponse() throws IOException { - return result; - } - - /** - * inits protocol, url, httpHeaders, formParams - * - * @param url - * must not be null - */ - @Override - public void init(URL url) { - - for (int i = 0; i < SUPPORTED_PROTOCOLS.length; i++) { - if (SUPPORTED_PROTOCOLS[i].toString().equalsIgnoreCase(url.getProtocol())) { - protocol = SUPPORTED_PROTOCOLS[i]; - break; - } - } - if (protocol == null) { - throw new SLRuntimeException("Protocol " + url.getProtocol() - + " not supported for data url"); - } - this.url = url; - boundary = "--" + IdFactory.getInstance().createId().toString(); - requestHttpHeaders = new HashMap<String, String>(); - - if (config != null) { - String version = config.getProperty(Configurator.SIGNATURE_LAYOUT); - if ((version != null) && (!"".equals(version.trim()))) { - log.debug("setting SignatureLayout header to " + version); - requestHttpHeaders.put(Configurator.SIGNATURE_LAYOUT, version); - } else { - log.debug("do not set SignatureLayout header"); - } - String userAgent = config.getProperty(Configurator.USERAGENT_CONFIG_P, Configurator.USERAGENT_DEFAULT); - requestHttpHeaders.put(HttpUtil.HTTP_HEADER_USER_AGENT, userAgent); - } else { - requestHttpHeaders - .put(HttpUtil.HTTP_HEADER_USER_AGENT, Configurator.USERAGENT_DEFAULT); - - } - - httpFormParameter = new ArrayList<HTTPFormParameter>(); - - } - - @Override - public DataUrlConnectionSPI newInstance() { - DataUrlConnectionSPI uc = new DataUrlConnectionImpl(); - uc.setConfiguration(config); - uc.setSSLSocketFactory(sslSocketFactory); - uc.setHostnameVerifier(hostnameVerifier); - return uc; + return response; } - @Override - public URL getUrl() { - return url; - } - - @Override - public void setConfiguration(Properties config) { - this.config = config; - } - - @Override - public void setSSLSocketFactory(SSLSocketFactory socketFactory) { - this.sslSocketFactory = socketFactory; - } - - @Override - public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { - this.hostnameVerifier = hostnameVerifier; - } - public class HTTPFormParameter { - private String name; - + private String name; + private InputStream data; - + private String contentType; - + private String charSet; - + private String transferEncoding; - - /** - * @param name - * @param data - * @param contentType - * @param charSet - * @param transferEncoding - */ + public HTTPFormParameter(String name, InputStream data, String contentType, String charSet, String transferEncoding) { super(); @@ -466,7 +363,8 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { } /** - * @param name the name to set + * @param name + * the name to set */ public void setName(String name) { this.name = name; @@ -480,7 +378,8 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { } /** - * @param data the data to set + * @param data + * the data to set */ public void setData(InputStream data) { this.data = data; @@ -494,7 +393,8 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { } /** - * @param contentType the contentType to set + * @param contentType + * the contentType to set */ public void setContentType(String contentType) { this.contentType = contentType; @@ -508,7 +408,8 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { } /** - * @param charSet the charSet to set + * @param charSet + * the charSet to set */ public void setCharSet(String charSet) { this.charSet = charSet; @@ -522,13 +423,12 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { } /** - * @param transferEncoding the transferEncoding to set + * @param transferEncoding + * the transferEncoding to set */ public void setTransferEncoding(String transferEncoding) { this.transferEncoding = transferEncoding; } - - } -}
\ No newline at end of file +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionSPI.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionSPI.java deleted file mode 100644 index f838b919..00000000 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionSPI.java +++ /dev/null @@ -1,64 +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.binding;
-
-import java.net.URL;
-import java.util.Properties; - -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.SSLSocketFactory; -
-/**
- * Prototype of a DataurlconnectionSPI
- * @author wbauer
- *
- */
-public interface DataUrlConnectionSPI extends DataUrlConnection {
-
- /**
- * Returns a new instance of this class to handle a dataurl.
- * Called by the factory each time the openConnection method is called.
- * @return
- */
- public DataUrlConnectionSPI newInstance();
-
- /**
- * Initializes the DataUrlConnection
- * @param url
- */
- public void init(URL url); - - /** - * Sets configuration parameters for this connection - * @param config - */ - public void setConfiguration(Properties config); - - /** - * Sets the socketfactory to be used for ssl connections. - * @param socketFactory if null the socket factory will not be set explicitly - */ - public void setSSLSocketFactory(SSLSocketFactory socketFactory); - - /** - * Sets the hostname verifier to be used, - * @param hostnameVerifier if null the default hostname verifier will be used - */ - public void setHostnameVerifier(HostnameVerifier hostnameVerifier);
-
-
-}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/ExpiryRemover.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/ExpiryRemover.java deleted file mode 100644 index d17a27c2..00000000 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/ExpiryRemover.java +++ /dev/null @@ -1,67 +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.binding;
-
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * This class can be used to check the BindingProcessorManager for expired entries and remove them.
- * Should be run periodically.
- *
- */
-public class ExpiryRemover implements RemovalStrategy {
-
- private static Log log = LogFactory.getLog(ExpiryRemover.class);
-
- protected BindingProcessorManager bindingProcessorManager;
- // keep max 5 min.
- protected long maxAcceptedAge = 1000 * 60 * 5;
-
- @Override
- public void execute() {
- log.debug("Triggered Expiry Remover");
- if (bindingProcessorManager == null) {
- log.warn("Bindingprocessor not set, skipping removal");
- return;
- }
- Set<Id> managedIds = bindingProcessorManager.getManagedIds();
- for (Iterator<Id> it = managedIds.iterator(); it.hasNext();) {
- Id bindId = it.next();
- BindingProcessor bp = bindingProcessorManager.getBindingProcessor(bindId);
- if (bp != null) {
- if (bp.getLastAccessTime().getTime() < (System.currentTimeMillis() - maxAcceptedAge)) {
- log.debug("Removing binding processor: " + bp.getId());
- bindingProcessorManager.removeBindingProcessor(bp.getId());
- }
- }
- }
- }
-
- public void setMaxAcceptedAge(long maxAcceptedAge) {
- this.maxAcceptedAge = maxAcceptedAge;
- }
-
- @Override
- public void setBindingProcessorManager(BindingProcessorManager bp) {
- bindingProcessorManager = bp;
- }
-
-}
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/FormDataURLDereferencer.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/FormDataURLDereferencer.java new file mode 100644 index 00000000..2f62775b --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/FormDataURLDereferencer.java @@ -0,0 +1,71 @@ +/* +* Copyright 2009 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.binding; + +import java.io.IOException; +import java.io.InputStream; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.utils.urldereferencer.StreamData; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; + +public class FormDataURLDereferencer implements URLDereferencer { + + public final static String PROTOCOL = "formdata"; + + private final Logger log = LoggerFactory.getLogger(FormDataURLDereferencer.class); + + private URLDereferencer urlDereferencer; + + private FormDataURLSupplier formDataURLSupplier; + + public FormDataURLDereferencer(URLDereferencer urlDereferencer, FormDataURLSupplier formDataURLSupplier) { + this.urlDereferencer = urlDereferencer; + this.formDataURLSupplier = formDataURLSupplier; + } + + @Override + public StreamData dereference(String url) + throws IOException { + + String urlString = url.toLowerCase().trim(); + if (urlString.startsWith(PROTOCOL)) { + log.debug("Requested to dereference a formdata url."); + return dereferenceFormData(url); + } else { + return urlDereferencer.dereference(url); + } + + } + + protected StreamData dereferenceFormData(String url) throws IOException { + log.debug("Dereferencing formdata url: {}.", url); + String[] parts = url.split(":", 2); + + String contentType = formDataURLSupplier.getFormDataContentType(parts[1]); + InputStream is = formDataURLSupplier.getFormData(parts[1]); + if (is != null) { + return new StreamData(url, contentType, is); + } + throw new IOException("Cannot dereference URL: '" + url + "' not found."); + } + + +} diff --git a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/FormDataURLSupplier.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/FormDataURLSupplier.java index 7272f1bb..a248e683 100644 --- a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/FormDataURLSupplier.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/FormDataURLSupplier.java @@ -14,13 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.utils.urldereferencer;
+package at.gv.egiz.bku.binding;
import java.io.InputStream;
public interface FormDataURLSupplier {
- public static final String PROPERTY_KEY_NAME = "at.gv.egiz.bku.util.urldereferencer.FormDataURLSupplier";
public InputStream getFormData(String aParameterName);
- public String getFormDataContentType(String aParameterName);
+ + public String getFormDataContentType(String aParameterName); +
}
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessor.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessor.java index e39addb5..db422498 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessor.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessor.java @@ -1,844 +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. - */ -package at.gv.egiz.bku.binding; +* Copyright 2009 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. +*/ -import iaik.utils.Base64InputStream; +package at.gv.egiz.bku.binding; -import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Reader; -import java.io.Writer; -import java.net.URL; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; import java.util.Map; -import javax.net.ssl.SSLHandshakeException; -import javax.xml.transform.Templates; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.URIResolver; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.bku.slcommands.ErrorResult; -import at.gv.egiz.bku.slcommands.SLCommand; -import at.gv.egiz.bku.slcommands.SLCommandContext; -import at.gv.egiz.bku.slcommands.SLCommandFactory; -import at.gv.egiz.bku.slcommands.SLCommandInvoker; -import at.gv.egiz.bku.slcommands.SLResult; -import at.gv.egiz.bku.slcommands.SLSourceContext; -import at.gv.egiz.bku.slcommands.SLTargetContext; -import at.gv.egiz.bku.slcommands.impl.ErrorResultImpl; -import at.gv.egiz.bku.slexceptions.SLBindingException; -import at.gv.egiz.bku.slexceptions.SLException; -import at.gv.egiz.bku.slexceptions.SLRuntimeException; -import at.gv.egiz.bku.utils.StreamUtil; -import at.gv.egiz.bku.utils.binding.Protocol; -import at.gv.egiz.bku.utils.urldereferencer.FormDataURLSupplier; -import at.gv.egiz.bku.utils.urldereferencer.SimpleFormDataContextImpl; -import at.gv.egiz.bku.utils.urldereferencer.StreamData; -import at.gv.egiz.bku.utils.urldereferencer.URIResolverAdapter; -import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; -import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerContext; -import at.gv.egiz.stal.QuitRequest; -import at.gv.egiz.stal.STALRequest; - -/** - * Class performing the HTTP binding as defined by the CCE specification. - * Currently a huge monolithic class. - * - * @TODO refactor - */ -@SuppressWarnings("unchecked") -public class HTTPBindingProcessor extends AbstractBindingProcessor implements - FormDataURLSupplier { - - private static Log log = LogFactory.getLog(HTTPBindingProcessor.class); - - private static enum State { - INIT, PROCESS, DATAURL, TRANSFORM, FINISHED - }; - - public final static Collection<String> XML_REQ_TRANSFER_ENCODING = Arrays - .asList(new String[] { "binary" }); - - protected static String XML_MIME_TYPE = "text/xml"; - protected static String BINARY_MIME_TYPE = "application/octet-stream"; - - /** - * If null everything is ok and the result is taken from the command invoker. - */ - protected SLException bindingProcessorError; - protected SLCommandInvoker commandInvoker; - protected DataUrlResponse dataUrlResponse; - protected Map<String, String> headerMap = Collections.EMPTY_MAP; - protected SLCommand slCommand; - protected Map<String, FormParameter> formParameterMap = new HashMap<String, FormParameter>(); - protected SLSourceContext srcContex = new SLSourceContext(); - protected SLTargetContext targetContext = new SLTargetContext(); - protected URL srcUrl; - protected State currentState = State.INIT; - protected Templates templates = null; - protected String resultContentType = null; - protected SLResult slResult = null; - protected int responseCode = 200; - protected Map<String, String> responseHeaders = Collections.EMPTY_MAP; - protected Locale locale = Locale.getDefault(); - protected boolean finished = false; - - /** - * - * @param id - * may be null. In this case a new session id will be created. - * @param cmdInvoker - * must not be null; - */ - public HTTPBindingProcessor(String id, SLCommandInvoker cmdInvoker, URL source) { - super(id); - this.srcUrl = source; - Protocol protocol = Protocol.fromString(source.getProtocol()); - if ((protocol != Protocol.HTTP) && (protocol != Protocol.HTTPS)) { - throw new SLRuntimeException("Protocol not supported: " + protocol); - } - if (cmdInvoker == null) { - throw new NullPointerException("Commandinvoker cannot be set to null"); - } - commandInvoker = cmdInvoker; - srcContex.setSourceUrl(source); - srcContex.setSourceIsDataURL(false); - } - - //---------------------------------------------------------------------------- - // ----------- BEGIN CONVENIENCE METHODS ----------- - - protected void sendSTALQuit() { - log.info("Sending QUIT command to STAL"); - List<STALRequest> quit = new ArrayList<STALRequest>(1); - quit.add(new QuitRequest()); - getSTAL().handleRequest(quit); - } - - protected String getFormParameterAsString(String formParameterName) { - FormParameter fp = formParameterMap.get(formParameterName); - return getFormParameterAsString(fp); - } - - protected String getFormParameterAsString(FormParameter fp) { - if (fp == null) { - return null; - } - try { - return StreamUtil.asString(fp.getFormParameterValue(), HttpUtil - .getCharset(fp.getFormParameterContentType(), true)); - } catch (IOException e) { - return null; - } - } - - protected String getDataUrl() { - return getFormParameterAsString(FixedFormParameters.DATAURL); - } - - protected String getStyleSheetUrl() { - return getFormParameterAsString(FixedFormParameters.STYLESHEETURL); - } - - protected List<FormParameter> getFormParameters(String parameterNamePostfix) { - List<FormParameter> resultList = new ArrayList<FormParameter>(); - for (Iterator<String> fpi = formParameterMap.keySet().iterator(); fpi - .hasNext();) { - String paramName = fpi.next(); - if (paramName.endsWith(parameterNamePostfix)) { - resultList.add(formParameterMap.get(paramName)); - } - } - return resultList; - } - - protected List<FormParameter> getTransferHeaders() { - return getFormParameters("__"); - } - - protected List<FormParameter> getTransferForms() { - List<FormParameter> resultList = new ArrayList<FormParameter>(); - for (Iterator<String> fpi = formParameterMap.keySet().iterator(); fpi - .hasNext();) { - String paramName = fpi.next(); - if ((paramName.endsWith("_")) && (!paramName.endsWith("__"))) { - resultList.add(formParameterMap.get(paramName)); - } - } - return resultList; - } - - protected void closeDataUrlConnection() { - log.debug("Closing data url input stream"); - if (dataUrlResponse == null) { - return; - } - InputStream is = dataUrlResponse.getStream(); - if (is != null) { - try { - is.close(); - } catch (IOException e) { - log.info("Error closing input stream to dataurl server:" + e); - } - } - } - - //---------------------------------------------------------------------------- - // ----------- END CONVENIENCE METHODS ----------- - - //---------------------------------------------------------------------------- - // -- BEGIN Methods that handle the http binding activities as defined in the - // activity diagram -- - - protected void init() { - log.info("Starting Bindingprocessor in Thread: " - + Thread.currentThread().getId()); - if (bindingProcessorError != null) { - log.debug("Detected binding processor error, sending quit command"); - // sendSTALQuit(); - currentState = State.FINISHED; - } else if (slCommand == null) { - log.error("SLCommand not set (consumeRequest not called ??)"); - bindingProcessorError = new SLException(2000); - // sendSTALQuit(); - currentState = State.FINISHED; - } else { - currentState = State.PROCESS; - } - } - - protected void processRequest() { - log.debug("Entered State: " + State.PROCESS); - log.debug("Processing command: " + slCommand); - commandInvoker.setCommand(slCommand); - responseCode = 200; - responseHeaders = Collections.EMPTY_MAP; - dataUrlResponse = null; - try { - commandInvoker.invoke(srcContex); - } catch (SLException e) { - log.info("Caught exception: " + e); - bindingProcessorError = e; - currentState = State.TRANSFORM; - } - if (getDataUrl() != null) { - log.debug("Data Url set to: " + getDataUrl()); - currentState = State.DATAURL; - } else { - log.debug("No data url set"); - currentState = State.TRANSFORM; - } - } - - protected void handleDataUrl() { - log.debug("Entered State: " + State.DATAURL); - try { - DataUrl dataUrl = new DataUrl(getDataUrl()); - DataUrlConnection conn = dataUrl.openConnection(); - - // set transfer headers - for (FormParameter fp : getTransferHeaders()) { - String paramString = getFormParameterAsString(fp); - if (paramString == null) { - log.error("Got empty transfer header, ignoring this"); - } else { - String[] keyVal = paramString.split(":", 2); - String key = keyVal[0]; - String val = null; - if (keyVal.length == 2) { - val = keyVal[1]; - val = val.trim(); - } else { - log.error("Invalid transfer header encoding: "+paramString); - throw new SLBindingException(2005); - } - log.debug("Setting header " + key + " to value " + val); - conn.setHTTPHeader(key, val); - } - } - - // set transfer form parameters - for (FormParameter fp : getTransferForms()) { - String contentTransferEncoding = null; - String contentType = fp.getFormParameterContentType(); - String charSet = HttpUtil.getCharset(contentType, false); - if (charSet != null) { - contentType = contentType.substring(0, contentType - .lastIndexOf(HttpUtil.SEPERATOR[0])); - } - for (Iterator<String> header = fp.getHeaderNames(); header.hasNext();) { - if (HttpUtil.CONTENT_TRANSFER_ENCODING - .equalsIgnoreCase(header.next())) { - contentTransferEncoding = getFormParameterAsString(fp); - } - } - log.debug("Setting form: " + fp.getFormParameterName() - + " contentType: " + contentType + " charset: " + charSet - + " contentTransferEncoding: " + contentTransferEncoding); - conn.setHTTPFormParameter(fp.getFormParameterName(), fp - .getFormParameterValue(), contentType, charSet, - contentTransferEncoding); - } - - // connect - conn.connect(); - // fetch and set SL result - targetContext.setTargetIsDataURL(true); - targetContext.setTargetCertificate(conn.getServerCertificate()); - targetContext.setTargetUrl(conn.getUrl()); - SLResult result = commandInvoker.getResult(targetContext); - - // transfer result - conn.transmit(result); - - // process Dataurl response - dataUrlResponse = conn.getResponse(); - log.debug("Received data url response code: " - + dataUrlResponse.getResponseCode()); - - switch (dataUrlResponse.getResponseCode()) { - case 200: - String contentType = dataUrlResponse.getContentType(); - log.debug("Got dataurl response content type: " + contentType); - if (contentType != null) { - if ((contentType.startsWith(HttpUtil.APPLICATION_URL_ENCODED)) - || (contentType.startsWith(HttpUtil.MULTIPART_FOTMDATA))) { - log.debug("Detected SL Request in dataurl response"); - // process headers and request - setHTTPHeaders(dataUrlResponse.getResponseHeaders()); - consumeRequestStream(dataUrlResponse.getStream()); - //TODO check for bindingProcessorError - closeDataUrlConnection(); - srcContex.setSourceCertificate(conn.getServerCertificate()); - srcContex.setSourceIsDataURL(true); - srcContex.setSourceUrl(conn.getUrl()); - currentState = State.PROCESS; - } else if (((contentType.startsWith(HttpUtil.TXT_HTML)) - || (contentType.startsWith(HttpUtil.TXT_PLAIN)) - || (contentType.startsWith(HttpUtil.TXT_XML))) - && (dataUrlResponse.isHttpResponseXMLOK())) { - log.info("Dataurl response matches <ok/> with content type: " - + contentType); - currentState = State.TRANSFORM; - - } else if ((contentType.startsWith(HttpUtil.TXT_XML)) - && (!dataUrlResponse.isHttpResponseXMLOK())) { - log - .debug("Detected text/xml dataurl response with content != <ok/>"); - headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, contentType); - assignXMLRequest(dataUrlResponse.getStream(), HttpUtil.getCharset( - contentType, true)); - closeDataUrlConnection(); - srcContex.setSourceCertificate(conn.getServerCertificate()); - srcContex.setSourceIsDataURL(true); - srcContex.setSourceUrl(conn.getUrl()); - currentState = State.PROCESS; - // just to be complete, actually not used - srcContex.setSourceHTTPReferer(dataUrlResponse.getResponseHeaders() - .get(HttpUtil.HTTP_HEADER_REFERER)); - } else { - resultContentType = contentType; - responseHeaders = dataUrlResponse.getResponseHeaders(); - responseCode = dataUrlResponse.getResponseCode(); - currentState = State.FINISHED; - } - } else { - log.debug("Content type not set in dataurl response"); - closeDataUrlConnection(); - throw new SLBindingException(2007); - } - - break; - case 307: - contentType = dataUrlResponse.getContentType(); - if ((contentType != null) && (contentType.startsWith(HttpUtil.TXT_XML))) { - log.debug("Received dataurl response code 307 with XML content"); - String location = dataUrlResponse.getResponseHeaders().get( - HttpUtil.HTTP_HEADER_LOCATION); - if (location == null) { - log - .error("Did not get a location header for a 307 data url response"); - throw new SLBindingException(2003); - } - // consumeRequestStream(dataUrlResponse.getStream()); - FormParameterStore fp = new FormParameterStore(); - fp.init(location.getBytes(HttpUtil.DEFAULT_CHARSET), - FixedFormParameters.DATAURL, null, null); - formParameterMap.put(FixedFormParameters.DATAURL, fp); - headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, contentType); - assignXMLRequest(dataUrlResponse.getStream(), HttpUtil.getCharset( - dataUrlResponse.getContentType(), true)); - closeDataUrlConnection(); - srcContex.setSourceCertificate(conn.getServerCertificate()); - srcContex.setSourceIsDataURL(true); - srcContex.setSourceUrl(conn.getUrl()); - currentState = State.PROCESS; - // just to be complete, actually not used - srcContex.setSourceHTTPReferer(dataUrlResponse.getResponseHeaders() - .get(HttpUtil.HTTP_HEADER_REFERER)); - - } else { - log.debug("Received dataurl response code 307 non XML content: " - + dataUrlResponse.getContentType()); - resultContentType = dataUrlResponse.getContentType(); - currentState = State.FINISHED; - } - responseHeaders = dataUrlResponse.getResponseHeaders(); - responseCode = dataUrlResponse.getResponseCode(); - break; - - case 301: - case 302: - case 303: - responseHeaders = dataUrlResponse.getResponseHeaders(); - responseCode = dataUrlResponse.getResponseCode(); - resultContentType = dataUrlResponse.getContentType(); - currentState = State.FINISHED; - break; - - default: - // issue error - log.info("Unexpected response code from dataurl server: " - + dataUrlResponse.getResponseCode()); - throw new SLBindingException(2007); - } - - } catch (SLException slx) { - bindingProcessorError = slx; - log.error("Error during dataurl communication"); - resultContentType = HttpUtil.TXT_XML; - currentState = State.TRANSFORM; - } catch (SSLHandshakeException hx) { - bindingProcessorError = new SLException(2010); - log.info("Error during dataurl communication", hx); - resultContentType = HttpUtil.TXT_XML; - currentState = State.TRANSFORM; - } catch (IOException e) { - bindingProcessorError = new SLBindingException(2001); - log.error("Error while data url handling", e); - resultContentType = HttpUtil.TXT_XML; - currentState = State.TRANSFORM; - return; - } - } - - protected void transformResult() { - log.debug("Entered State: " + State.TRANSFORM); - if (bindingProcessorError != null) { - resultContentType = HttpUtil.TXT_XML; - } else if (dataUrlResponse != null) { - resultContentType = dataUrlResponse.getContentType(); - } else { - targetContext.setTargetIsDataURL(false); - targetContext.setTargetUrl(srcUrl); - try { - slResult = commandInvoker.getResult(targetContext); - resultContentType = slResult.getMimeType(); - log - .debug("Successfully got SLResult from commandinvoker, setting mimetype to: " - + resultContentType); - } catch (SLException e) { - log.info("Cannot get result from invoker:", e); - bindingProcessorError = new SLException(6002); - resultContentType = HttpUtil.TXT_XML; - } - } - templates = getTemplates(getStyleSheetUrl()); - if (templates != null) { - log.debug("Output transformation required"); - resultContentType = templates.getOutputProperties().getProperty("media-type"); - log.debug("Got media type from stylesheet: " + resultContentType); - if (resultContentType == null) { - log.debug("Setting to default text/xml result conent type"); - resultContentType = "text/xml"; - } - log.debug("Deferring sytylesheet processing"); - } - currentState = State.FINISHED; - } - - protected void finished() { - log.debug("Entered State: " + State.FINISHED); - if (bindingProcessorError != null) { - log.debug("Binding processor error, sending quit command"); - resultContentType = HttpUtil.TXT_XML; - } - sendSTALQuit(); - log.info("Terminating Bindingprocessor; Thread: " - + Thread.currentThread().getId()); - finished = true; - } - - // -- END Methods that handle the http binding activities as defined in the - // activity diagram -- - //---------------------------------------------------------------------------- - - /** - * Sets the headers of the SL Request. IMPORTANT: make sure to set all headers - * before invoking {@link #consumeRequestStream(InputStream)} - * - * @param aHeaderMap - * if null all header will be cleared. - */ - public void setHTTPHeaders(Map<String, String> aHeaderMap) { - headerMap = new HashMap<String, String>(); - // ensure lowercase keys - if (aHeaderMap != null) { - for (String s : aHeaderMap.keySet()) { - if (s != null) { - headerMap.put(s.toLowerCase(), aHeaderMap.get(s)); - if (s.equalsIgnoreCase(HttpUtil.HTTP_HEADER_REFERER)) { - String referer = aHeaderMap.get(s); - log.debug("Got referer header: " + referer); - srcContex.setSourceHTTPReferer(referer); - } - } - } - } - } - - public void setSourceCertificate(X509Certificate aCert) { - srcContex.setSourceCertificate(aCert); - } - - /** - * The HTTPBindingProcessor does not handle redirect URLs. It only provides - * the parameter. - * - * @return null if redirect url is not set. - */ - public String getRedirectURL() { - return getFormParameterAsString(FixedFormParameters.REDIRECTURL); - } - - public String getFormDataContentType(String aParameterName) { - FormParameter fp = formParameterMap.get(aParameterName); - if (fp != null) { - return fp.getFormParameterContentType(); - } - return null; - } - - public InputStream getFormData(String aParameterName) { - FormParameter fp = formParameterMap.get(aParameterName); - if (fp != null) { - final String enc = fp.getHeaderValue("Content-Transfer-Encoding"); - if (enc == null || "binary".equals(enc)) { - return fp.getFormParameterValue(); - } else if ("base64".equals(enc)) { - return new Base64InputStream(fp.getFormParameterValue()); - } else { - return new InputStream() { - @Override - public int read() throws IOException { - throw new IOException("Content-Transfer-Encoding : " + enc - + " is not supported."); - } - }; - } - } - return null; - } - - protected void assignXMLRequest(InputStream is, String charset) - throws IOException, SLException { - Reader r = new InputStreamReader(is, charset); - StreamSource source = new StreamSource(r); - SLCommandContext commandCtx = new SLCommandContext(); - commandCtx.setSTAL(getSTAL()); - commandCtx.setURLDereferencerContext(new SimpleFormDataContextImpl(this)); - commandCtx.setLocale(locale); - slCommand = SLCommandFactory.getInstance().createSLCommand(source, - commandCtx); - log.debug("Created new command: " + slCommand); - } - - @Override - public void run() { - boolean done = false; - int hopcounter = 0; - if (bindingProcessorError != null) { - currentState = State.FINISHED; - } - try { - while (!done) { - try { - switch (currentState) { - case INIT: - init(); - break; - case PROCESS: - processRequest(); - break; - case DATAURL: - handleDataUrl(); - if (++hopcounter > config.getMaxDataUrlHops()) { - log.error("Maximum number of dataurl hops reached"); - bindingProcessorError = new SLBindingException(2000); - currentState = State.FINISHED; - } - break; - case TRANSFORM: - transformResult(); - break; - case FINISHED: - done = true; - finished(); - break; - } - } catch (RuntimeException rte) { - throw rte; - } catch (Exception t) { - log.error("Caught unexpected exception", t); - responseCode = 200; - resultContentType = HttpUtil.TXT_XML; - responseHeaders = Collections.EMPTY_MAP; - bindingProcessorError = new SLException(2000); - currentState = State.FINISHED; - } - } - } catch (Throwable t) { - log.error("Caught unexpected exception", t); - responseCode = 200; - resultContentType = HttpUtil.TXT_XML; - responseHeaders = Collections.EMPTY_MAP; - bindingProcessorError = new SLException(2000); - currentState = State.FINISHED; - } - log.debug("Terminated http binding processor"); - finished = true; - } - - @Override - public void consumeRequestStream(InputStream is) { - try { - log.debug("Start consuming request stream"); - formParameterMap.clear(); - String cl = headerMap - .get(HttpUtil.HTTP_HEADER_CONTENT_TYPE.toLowerCase()); - if (cl == null) { - log.info("No content type set in http header"); - throw new SLBindingException(2006); - } - InputDecoder id = InputDecoderFactory.getDecoder(cl, is); - if (id == null) { - log.error("Cannot get inputdecoder for is"); - throw new SLException(2006); - } - for (Iterator<FormParameter> fpi = id.getFormParameterIterator(); fpi - .hasNext();) { - FormParameter fp = fpi.next(); - log.debug("Got request parameter with name: " - + fp.getFormParameterName()); - if (fp.getFormParameterName().equals(FixedFormParameters.XMLREQUEST)) { - log.debug("Creating XML Request"); - for (Iterator<String> headerIterator = fp.getHeaderNames(); headerIterator - .hasNext();) { - String headerName = headerIterator.next(); - if (HttpUtil.CONTENT_TRANSFER_ENCODING.equalsIgnoreCase(headerName)) { - String transferEncoding = fp.getHeaderValue(headerName); - log.debug("Got transfer encoding for xmlrequest: " - + transferEncoding); - if (XML_REQ_TRANSFER_ENCODING.contains(transferEncoding)) { - log.debug("Supported transfer encoding: " + transferEncoding); - } else { - log - .error("Transferencoding not supported: " - + transferEncoding); - throw new SLBindingException(2005); - } - } - } - String charset = HttpUtil.getCharset(cl, true); - assignXMLRequest(fp.getFormParameterValue(), charset); - } else { - FormParameterStore fps = new FormParameterStore(); - fps.init(fp); - //if (!fps.isEmpty()) { - log.debug("Setting form parameter: " + fps.getFormParameterName()); - formParameterMap.put(fps.getFormParameterName(), fps); - //} - } - } - if (slCommand == null) { - throw new SLBindingException(2004); - } - } catch (SLException slx) { - log.info("Error while consuming input stream " + slx); - bindingProcessorError = slx; - } catch (Throwable t) { - log.info("Error while consuming input stream " + t, t); - bindingProcessorError = new SLException(2000); - } finally { - try { - if (is.read() != -1) { - log.warn("Request input stream not completely read."); - while (is.read() != -1); - } - } catch (IOException e) { - log.error(e); - } - } - } - - @Override - public String getResultContentType() { - return resultContentType; - } - - protected Templates getTemplates(String styleSheetURL) { - if (styleSheetURL == null) { - log.debug("Stylesheet URL not set"); - return null; - } - try { - URLDereferencerContext urlCtx = new SimpleFormDataContextImpl(this); - URIResolver resolver = new URIResolverAdapter(URLDereferencer - .getInstance(), urlCtx); - TransformerFactory factory = TransformerFactory.newInstance(); - factory.setURIResolver(resolver); - StreamData sd = URLDereferencer.getInstance().dereference(styleSheetURL, - urlCtx); - return factory.newTemplates(new StreamSource(sd.getStream())); - } catch (Exception ex) { - log.info("Cannot instantiate transformer", ex); - bindingProcessorError = new SLException(2002); - return null; - } - } - - protected void handleBindingProcessorError(OutputStream os, String encoding, - Templates templates) throws IOException { - log.debug("Writing error as result"); - ErrorResultImpl error = new ErrorResultImpl(bindingProcessorError, locale); - Writer writer = writeXMLDeclarationAndProcessingInstruction(os, encoding); - error.writeTo(new StreamResult(writer), templates, true); - } - - protected Writer writeXMLDeclarationAndProcessingInstruction(OutputStream os, String encoding) throws IOException { - if (encoding == null) { - encoding = HttpUtil.DEFAULT_CHARSET; - } - OutputStreamWriter writer = new OutputStreamWriter(os, encoding); - writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"); - writer.write("<?xml-stylesheet type=\"text/css\" href=\"errorresponse.css\"?>\n"); - return writer; - } - - @Override - public void writeResultTo(OutputStream os, String encoding) - throws IOException { - if (encoding == null) { - encoding = HttpUtil.DEFAULT_CHARSET; - } - if (bindingProcessorError != null) { - log.debug("Detected error in binding processor, writing error as result"); - handleBindingProcessorError(os, encoding, templates); - return; - } else if (dataUrlResponse != null) { - log.debug("Writing data url response as result"); - String charEnc = HttpUtil.getCharset(dataUrlResponse.getContentType(), - true); - InputStreamReader isr = new InputStreamReader( - dataUrlResponse.getStream(), charEnc); - OutputStreamWriter osw = new OutputStreamWriter(os, encoding); - if (templates == null) { - StreamUtil.copyStream(isr, osw); - } else { - try { - Transformer transformer = templates.newTransformer(); - transformer.transform(new StreamSource(isr), new StreamResult(osw)); - } catch (TransformerException e) { - log.fatal("Exception occured during result transformation", e); - // bindingProcessorError = new SLException(2008); - // handleBindingProcessorError(os, encoding, null); - return; - } - } - osw.flush(); - isr.close(); - } else if (slResult == null) { - // result not yet assigned -> must be a cancel - bindingProcessorError = new SLException(6001); - handleBindingProcessorError(os, encoding, templates); - return; - } else { - log.debug("Getting result from invoker"); - boolean fragment = false; - Writer writer; - if (slResult instanceof ErrorResult) { - writer = writeXMLDeclarationAndProcessingInstruction(os, encoding); - fragment = true; - } else { - writer = new OutputStreamWriter(os, encoding); - } - slResult.writeTo(new StreamResult(writer), templates, fragment); - writer.flush(); - } - } +public interface HTTPBindingProcessor extends BindingProcessor { - /** - * The response code from the dataurl server or 200 if no dataurl server - * created the result - * - * @return - */ - public int getResponseCode() { - return responseCode; - } + public void setHTTPHeaders(Map<String, String> headerMap); + + public InputStream getFormData(String parameterName); - /** - * All headers from the data url server in case of a direct forward from the - * dataurl server. - * - * @return - */ - public Map<String, String> getResponseHeaders() { - return responseHeaders; - } + public String getRedirectURL(); - @Override - public void setLocale(Locale locale) { - if (locale == null) { - throw new NullPointerException("Locale must not be set to null"); - } - this.locale = locale; - } + public int getResponseCode(); - @Override - public boolean isFinished() { - return finished; - } -}
\ No newline at end of file + public Map<String, String> getResponseHeaders(); + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorFactory.java new file mode 100644 index 00000000..41688e9b --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorFactory.java @@ -0,0 +1,80 @@ +/* +* Copyright 2009 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.binding; + + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLSocketFactory; + + +import at.gv.egiz.bku.utils.binding.Protocol; + +public class HTTPBindingProcessorFactory extends AbstractBindingProcessorFactory implements BindingProcessorFactory { + + private HostnameVerifier hostnameVerifier; + + private SSLSocketFactory sslSocketFactory; + + public HTTPBindingProcessorFactory() { + Set<Protocol> sp = new HashSet<Protocol>(); + Collections.addAll(sp, Protocol.HTTP, Protocol.HTTPS); + supportedProtocols = Collections.unmodifiableSet(sp); + } + + /** + * @return the hostnameVerifier + */ + public HostnameVerifier getHostnameVerifier() { + return hostnameVerifier; + } + + /** + * @param hostnameVerifier the hostnameVerifier to set + */ + public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { + this.hostnameVerifier = hostnameVerifier; + } + + /** + * @return the sslSocketFactory + */ + public SSLSocketFactory getSslSocketFactory() { + return sslSocketFactory; + } + + /** + * @param sslSocketFactory the sslSocketFactory to set + */ + public void setSslSocketFactory(SSLSocketFactory sslSocketFactory) { + this.sslSocketFactory = sslSocketFactory; + } + + @Override + public BindingProcessor createBindingProcessor() { + HTTPBindingProcessorImpl httpBindingProcessor = new HTTPBindingProcessorImpl(); + configureBindingProcessor(httpBindingProcessor); + httpBindingProcessor.setHostnameVerifier(hostnameVerifier); + httpBindingProcessor.setSslSocketFactory(sslSocketFactory); + return httpBindingProcessor; + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java new file mode 100644 index 00000000..b5f34689 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HTTPBindingProcessorImpl.java @@ -0,0 +1,896 @@ +/* + * 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.binding; + +import iaik.utils.Base64InputStream; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; +import java.net.URL; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLHandshakeException; +import javax.net.ssl.SSLSocketFactory; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.conf.MoccaConfigurationFacade; +import at.gv.egiz.bku.slcommands.ErrorResult; +import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slcommands.SLCommandContext; +import at.gv.egiz.bku.slcommands.SLResult; +import at.gv.egiz.bku.slcommands.SLSourceContext; +import at.gv.egiz.bku.slcommands.SLTargetContext; +import at.gv.egiz.bku.slcommands.impl.ErrorResultImpl; +import at.gv.egiz.bku.slexceptions.SLBindingException; +import at.gv.egiz.bku.slexceptions.SLException; +import at.gv.egiz.bku.spring.ConfigurationFactoryBean; +import at.gv.egiz.bku.utils.StreamUtil; +import at.gv.egiz.bku.utils.urldereferencer.StreamData; +import at.gv.egiz.bku.utils.urldereferencer.URIResolverAdapter; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; +import at.gv.egiz.stal.QuitRequest; +import at.gv.egiz.stal.STALRequest; + +/** + * Class performing the HTTP binding as defined by the CCE specification. + * Currently a huge monolithic class. + * + * @TODO refactor + */ +@SuppressWarnings("unchecked") +public class HTTPBindingProcessorImpl extends AbstractBindingProcessor implements + HTTPBindingProcessor, FormDataURLSupplier { + + private final Logger log = LoggerFactory.getLogger(HTTPBindingProcessorImpl.class); + + private static enum State { + INIT, PROCESS, DATAURL, TRANSFORM, FINISHED + }; + + public final static Collection<String> XML_REQ_TRANSFER_ENCODING = Arrays + .asList(new String[] { "binary" }); + + protected static String XML_MIME_TYPE = "text/xml"; + protected static String BINARY_MIME_TYPE = "application/octet-stream"; + + /** + * The citizen card environment identifier for <code>Server</code> and + * <code>UserAgent</code> headers. + */ + protected static String CITIZENC_CARD_ENVIRONMENT = "citizen-card-environment/1.2"; + + /** + * The configuration facade used to access the MOCCA configuration. + */ + protected ConfigurationFacade configurationFacade = new ConfigurationFacade(); + + public class ConfigurationFacade implements MoccaConfigurationFacade { + + public static final String DATAURLCLIENT_MAXHOPS = "DataURLConnection.MaxHops"; + + public int getMaxDataUrlHops() { + return configuration.getInt(DATAURLCLIENT_MAXHOPS, 10); + } + + public String getProductName() { + return configuration.getString( + ConfigurationFactoryBean.MOCCA_IMPLEMENTATIONNAME_PROPERTY, "MOCCA"); + } + + public String getProductVersion() { + return configuration.getString( + ConfigurationFactoryBean.MOCCA_IMPLEMENTATIONVERSION_PROPERTY, + "UNKNOWN"); + } + + public String getSignatureLayout() { + return configuration + .getString(ConfigurationFactoryBean.SIGNATURE_LAYOUT_PROPERTY); + } + + } + + /** + * If null everything is ok and the result is taken from the command invoker. + */ + protected SLException bindingProcessorError; + protected SSLSocketFactory sslSocketFactory; + protected HostnameVerifier hostnameVerifier; + protected DataUrlResponse dataUrlResponse; + protected Map<String, String> headerMap = Collections.EMPTY_MAP; + protected SLCommand slCommand; + protected Map<String, FormParameter> formParameterMap = new HashMap<String, FormParameter>(); + protected SLSourceContext srcContex = new SLSourceContext(); + protected SLTargetContext targetContext = new SLTargetContext(); + protected URL srcUrl; + protected State currentState = State.INIT; + protected Templates templates = null; + protected String resultContentType = null; + protected SLResult slResult = null; + protected int responseCode = 200; + protected Map<String, String> responseHeaders = Collections.EMPTY_MAP; + protected boolean finished = false; + + @Override + public void setUrlDereferencer(URLDereferencer urlDereferencer) { + super.setUrlDereferencer(new FormDataURLDereferencer(urlDereferencer, this)); + } + + /** + * @return the sslSocketFactory + */ + public SSLSocketFactory getSslSocketFactory() { + return sslSocketFactory; + } + + /** + * @param sslSocketFactory + * the sslSocketFactory to set + */ + public void setSslSocketFactory(SSLSocketFactory sslSocketFactory) { + this.sslSocketFactory = sslSocketFactory; + } + + /** + * @return the hostnameVerifier + */ + public HostnameVerifier getHostnameVerifier() { + return hostnameVerifier; + } + + /** + * @param hostnameVerifier + * the hostnameVerifier to set + */ + public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { + this.hostnameVerifier = hostnameVerifier; + } + + protected void sendSTALQuit() { + log.debug("Sending QUIT command to STAL."); + List<STALRequest> quit = new ArrayList<STALRequest>(1); + quit.add(new QuitRequest()); + getSTAL().handleRequest(quit); + } + + protected String getFormParameterAsString(String formParameterName) { + FormParameter fp = formParameterMap.get(formParameterName); + return getFormParameterAsString(fp); + } + + protected String getFormParameterAsString(FormParameter fp) { + if (fp == null) { + return null; + } + try { + return StreamUtil.asString(fp.getFormParameterValue(), HttpUtil + .getCharset(fp.getFormParameterContentType(), true)); + } catch (IOException e) { + return null; + } + } + + protected String getDataUrl() { + return getFormParameterAsString(FixedFormParameters.DATAURL); + } + + protected String getStyleSheetUrl() { + return getFormParameterAsString(FixedFormParameters.STYLESHEETURL); + } + + protected List<FormParameter> getFormParameters(String parameterNamePostfix) { + List<FormParameter> resultList = new ArrayList<FormParameter>(); + for (Iterator<String> fpi = formParameterMap.keySet().iterator(); fpi + .hasNext();) { + String paramName = fpi.next(); + if (paramName.endsWith(parameterNamePostfix)) { + resultList.add(formParameterMap.get(paramName)); + } + } + return resultList; + } + + protected List<FormParameter> getTransferHeaders() { + return getFormParameters("__"); + } + + protected List<FormParameter> getTransferForms() { + List<FormParameter> resultList = new ArrayList<FormParameter>(); + for (Iterator<String> fpi = formParameterMap.keySet().iterator(); fpi + .hasNext();) { + String paramName = fpi.next(); + if ((paramName.endsWith("_")) && (!paramName.endsWith("__"))) { + resultList.add(formParameterMap.get(paramName)); + } + } + return resultList; + } + + protected void closeDataUrlConnection() { + log.debug("Closing data url input stream."); + if (dataUrlResponse == null) { + return; + } + InputStream is = dataUrlResponse.getStream(); + if (is != null) { + try { + is.close(); + } catch (IOException e) { + log.info("Error closing input stream to dataurl server.", e); + } + } + } + + //---------------------------------------------------------------------------- + // ----------- END CONVENIENCE METHODS ----------- + + //---------------------------------------------------------------------------- + // -- BEGIN Methods that handle the http binding activities as defined in the + // activity diagram -- + + protected void init() { + log.info("Starting Bindingprocessor : {}.", id); + if (bindingProcessorError != null) { + log.debug("Detected binding processor error, sending quit command."); + currentState = State.FINISHED; + } else if (slCommand == null) { + log.error("SLCommand not set. (consumeRequest not called?)"); + bindingProcessorError = new SLException(2000); + currentState = State.FINISHED; + } else { + currentState = State.PROCESS; + } + } + + protected void processRequest() { + log.info("Entered State: {}, Processing {}.", State.PROCESS, slCommand.getName()); + SLCommandContext commandCtx = new SLCommandContext( + getSTAL(), + new FormDataURLDereferencer(urlDereferencer, this), + locale); + commandInvoker.setCommand(commandCtx, slCommand); + responseCode = 200; + responseHeaders = Collections.EMPTY_MAP; + dataUrlResponse = null; + try { + commandInvoker.invoke(srcContex); + } catch (SLException e) { + log.info("Failed to invoke command.", e); + bindingProcessorError = e; + currentState = State.TRANSFORM; + } + if (getDataUrl() != null) { + log.debug("DataUrl set to: {}.", getDataUrl()); + currentState = State.DATAURL; + } else { + log.debug("No data url set."); + currentState = State.TRANSFORM; + } + } + + protected void handleDataUrl() { + log.info("Entered State: {}, DataURL={}.", State.DATAURL, getDataUrl()); + try { + DataUrl dataUrl = new DataUrl(getDataUrl()); + HttpsDataURLConnection conn = (HttpsDataURLConnection) dataUrl.openConnection(); + + // set user agent and signature layout headers + conn.setHTTPHeader(HttpUtil.HTTP_HEADER_USER_AGENT, getServerHeaderValue()); + conn.setHTTPHeader(HttpUtil.HTTP_HEADER_SIGNATURE_LAYOUT, getSignatureLayoutHeaderValue()); + conn.setHostnameVerifier(hostnameVerifier); + conn.setSSLSocketFactory(sslSocketFactory); + + // set transfer headers + for (FormParameter fp : getTransferHeaders()) { + String paramString = getFormParameterAsString(fp); + if (paramString == null) { + log.error("Got empty transfer header, ignoring this."); + } else { + String[] keyVal = paramString.split(":", 2); + String key = keyVal[0]; + String val = null; + if (keyVal.length == 2) { + val = keyVal[1]; + val = val.trim(); + } else { + log.error("Invalid transfer header encoding: {}.", paramString); + throw new SLBindingException(2005); + } + log.debug("Setting header '{}' to value '{}'.", key, val); + conn.setHTTPHeader(key, val); + } + } + + // set transfer form parameters + for (FormParameter fp : getTransferForms()) { + String contentTransferEncoding = null; + String contentType = fp.getFormParameterContentType(); + String charSet = HttpUtil.getCharset(contentType, false); + if (charSet != null) { + contentType = contentType.substring(0, contentType + .lastIndexOf(HttpUtil.SEPERATOR[0])); + } + for (Iterator<String> header = fp.getHeaderNames(); header.hasNext();) { + if (HttpUtil.CONTENT_TRANSFER_ENCODING + .equalsIgnoreCase(header.next())) { + contentTransferEncoding = getFormParameterAsString(fp); + } + } + if (log.isDebugEnabled()) { + Object[] args = {fp.getFormParameterName(), contentType, contentTransferEncoding}; + log.debug("Setting form parameter '{}'" + + " (content-type {}, charset {}, content transfer encoding {})", args); + } + conn.setHTTPFormParameter(fp.getFormParameterName(), fp + .getFormParameterValue(), contentType, charSet, + contentTransferEncoding); + } + + // connect + conn.connect(); + // fetch and set SL result + targetContext.setTargetIsDataURL(true); + X509Certificate serverCertificate = null; + if (conn.getServerCertificates() instanceof X509Certificate[]) { + serverCertificate = (X509Certificate) conn.getServerCertificates()[0]; + } + targetContext.setTargetCertificate(serverCertificate); + targetContext.setTargetUrl(conn.getURL()); + SLResult result = commandInvoker.getResult(targetContext); + + // transfer result + conn.transmit(result); + + // process Dataurl response + dataUrlResponse = conn.getResponse(); + log.debug("Received data url response code: {}.", dataUrlResponse.getResponseCode()); + + switch (dataUrlResponse.getResponseCode()) { + case 200: + String contentType = dataUrlResponse.getContentType(); + log.debug("Got dataurl response content type: {}.", contentType); + if (contentType != null) { + if ((contentType.startsWith(HttpUtil.APPLICATION_URL_ENCODED)) + || (contentType.startsWith(HttpUtil.MULTIPART_FOTMDATA))) { + log.debug("Detected SL Request in dataurl response."); + // process headers and request + setHTTPHeaders(dataUrlResponse.getResponseHeaders()); + consumeRequestStream(dataUrlResponse.getUrl(), dataUrlResponse.getStream()); + //TODO check for bindingProcessorError + closeDataUrlConnection(); + srcContex.setSourceCertificate(serverCertificate); + srcContex.setSourceIsDataURL(true); + srcContex.setSourceUrl(conn.getURL()); + currentState = State.PROCESS; + } else if (((contentType.startsWith(HttpUtil.TXT_HTML)) + || (contentType.startsWith(HttpUtil.TXT_PLAIN)) + || (contentType.startsWith(HttpUtil.TXT_XML))) + && (dataUrlResponse.isHttpResponseXMLOK())) { + log.info("Dataurl response matches <ok/> with content type: {}.", contentType); + currentState = State.TRANSFORM; + + } else if ((contentType.startsWith(HttpUtil.TXT_XML)) + && (!dataUrlResponse.isHttpResponseXMLOK())) { + log.debug("Detected text/xml dataurl response with content != <ok/>"); + headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, contentType); + assignXMLRequest(dataUrlResponse.getStream(), HttpUtil.getCharset( + contentType, true)); + closeDataUrlConnection(); + srcContex.setSourceCertificate(serverCertificate); + srcContex.setSourceIsDataURL(true); + srcContex.setSourceUrl(conn.getURL()); + currentState = State.PROCESS; + // just to be complete, actually not used + srcContex.setSourceHTTPReferer(dataUrlResponse.getResponseHeaders() + .get(HttpUtil.HTTP_HEADER_REFERER)); + } else { + resultContentType = contentType; + responseHeaders = dataUrlResponse.getResponseHeaders(); + responseCode = dataUrlResponse.getResponseCode(); + currentState = State.FINISHED; + } + } else { + log.debug("Content type not set in dataurl response."); + closeDataUrlConnection(); + throw new SLBindingException(2007); + } + + break; + case 307: + contentType = dataUrlResponse.getContentType(); + if ((contentType != null) && (contentType.startsWith(HttpUtil.TXT_XML))) { + log.debug("Received dataurl response code 307 with XML content."); + String location = dataUrlResponse.getResponseHeaders().get( + HttpUtil.HTTP_HEADER_LOCATION); + if (location == null) { + log.error("Did not get a location header for a 307 data url response."); + throw new SLBindingException(2003); + } + // consumeRequestStream(dataUrlResponse.getStream()); + FormParameterStore fp = new FormParameterStore(); + fp.init(location.getBytes(HttpUtil.DEFAULT_CHARSET), + FixedFormParameters.DATAURL, null, null); + formParameterMap.put(FixedFormParameters.DATAURL, fp); + headerMap.put(HttpUtil.HTTP_HEADER_CONTENT_TYPE, contentType); + assignXMLRequest(dataUrlResponse.getStream(), HttpUtil.getCharset( + dataUrlResponse.getContentType(), true)); + closeDataUrlConnection(); + srcContex.setSourceCertificate(serverCertificate); + srcContex.setSourceIsDataURL(true); + srcContex.setSourceUrl(conn.getURL()); + currentState = State.PROCESS; + // just to be complete, actually not used + srcContex.setSourceHTTPReferer(dataUrlResponse.getResponseHeaders() + .get(HttpUtil.HTTP_HEADER_REFERER)); + + } else { + log.debug("Received dataurl response code 307 non XML content: {}.", + dataUrlResponse.getContentType()); + resultContentType = dataUrlResponse.getContentType(); + currentState = State.FINISHED; + } + responseHeaders = dataUrlResponse.getResponseHeaders(); + responseCode = dataUrlResponse.getResponseCode(); + break; + + case 301: + case 302: + case 303: + responseHeaders = dataUrlResponse.getResponseHeaders(); + responseCode = dataUrlResponse.getResponseCode(); + resultContentType = dataUrlResponse.getContentType(); + currentState = State.FINISHED; + break; + + default: + // issue error + log.info("Unexpected response code from dataurl server: {}.", + dataUrlResponse.getResponseCode()); + throw new SLBindingException(2007); + } + + } catch (SLException slx) { + bindingProcessorError = slx; + log.error("Error during dataurl communication."); + resultContentType = HttpUtil.TXT_XML; + currentState = State.TRANSFORM; + } catch (SSLHandshakeException hx) { + bindingProcessorError = new SLException(2010); + log.info("Error during dataurl communication.", hx); + resultContentType = HttpUtil.TXT_XML; + currentState = State.TRANSFORM; + } catch (IOException e) { + bindingProcessorError = new SLBindingException(2001); + log.error("Error while data url handling", e); + resultContentType = HttpUtil.TXT_XML; + currentState = State.TRANSFORM; + return; + } + } + + protected void transformResult() { + log.info("Entered State: {}.", State.TRANSFORM); + if (bindingProcessorError != null) { + resultContentType = HttpUtil.TXT_XML; + } else if (dataUrlResponse != null) { + resultContentType = dataUrlResponse.getContentType(); + } else { + targetContext.setTargetIsDataURL(false); + targetContext.setTargetUrl(srcUrl); + try { + slResult = commandInvoker.getResult(targetContext); + resultContentType = slResult.getMimeType(); + log.debug("Successfully got SLResult from commandinvoker, setting mimetype to: {}.", + resultContentType); + } catch (SLException e) { + log.info("Cannot get result from invoker:", e); + bindingProcessorError = new SLException(6002); + resultContentType = HttpUtil.TXT_XML; + } + } + templates = getTemplates(getStyleSheetUrl()); + if (templates != null) { + log.debug("Output transformation required."); + resultContentType = templates.getOutputProperties().getProperty("media-type"); + log.debug("Got media type from stylesheet: {}.", resultContentType); + if (resultContentType == null) { + log.debug("Setting to default text/xml result conent type."); + resultContentType = "text/xml"; + } + log.debug("Deferring sytylesheet processing."); + } + currentState = State.FINISHED; + } + + protected void finished() { + log.info("Entered State: {}.", State.FINISHED); + if (bindingProcessorError != null) { + log.debug("Binding processor error, sending quit command."); + resultContentType = HttpUtil.TXT_XML; + } + sendSTALQuit(); + log.info("Terminating Bindingprocessor : {}.", id); + finished = true; + } + + // -- END Methods that handle the http binding activities as defined in the + // activity diagram -- + //---------------------------------------------------------------------------- + + public String getServerHeaderValue() { + return CITIZENC_CARD_ENVIRONMENT + " " + + configurationFacade.getProductName() + "/" + + configurationFacade.getProductVersion(); + } + + public String getSignatureLayoutHeaderValue() { + return configurationFacade.getSignatureLayout(); + } + + /** + * Sets the headers of the SL Request. IMPORTANT: make sure to set all headers + * before invoking {@link #consumeRequestStream(String, InputStream)} + * + * @param aHeaderMap + * if null all header will be cleared. + */ + @Override + public void setHTTPHeaders(Map<String, String> aHeaderMap) { + headerMap = new HashMap<String, String>(); + // ensure lowercase keys + if (aHeaderMap != null) { + for (String s : aHeaderMap.keySet()) { + if (s != null) { + headerMap.put(s.toLowerCase(), aHeaderMap.get(s)); + if (s.equalsIgnoreCase(HttpUtil.HTTP_HEADER_REFERER)) { + String referer = aHeaderMap.get(s); + log.debug("Got referer header: {}.", referer); + srcContex.setSourceHTTPReferer(referer); + } + } + } + } + } + + public void setSourceCertificate(X509Certificate aCert) { + srcContex.setSourceCertificate(aCert); + } + + /** + * The HTTPBindingProcessor does not handle redirect URLs. It only provides + * the parameter. + * + * @return null if redirect url is not set. + */ + public String getRedirectURL() { + return getFormParameterAsString(FixedFormParameters.REDIRECTURL); + } + + public String getFormDataContentType(String aParameterName) { + FormParameter fp = formParameterMap.get(aParameterName); + if (fp != null) { + return fp.getFormParameterContentType(); + } + return null; + } + + public InputStream getFormData(String aParameterName) { + FormParameter fp = formParameterMap.get(aParameterName); + if (fp != null) { + final String enc = fp.getHeaderValue("Content-Transfer-Encoding"); + if (enc == null || "binary".equals(enc)) { + return fp.getFormParameterValue(); + } else if ("base64".equals(enc)) { + return new Base64InputStream(fp.getFormParameterValue()); + } else { + return new InputStream() { + @Override + public int read() throws IOException { + throw new IOException("Content-Transfer-Encoding : " + enc + + " is not supported."); + } + }; + } + } + return null; + } + + protected void assignXMLRequest(InputStream is, String charset) + throws IOException, SLException { + Reader r = new InputStreamReader(is, charset); + StreamSource source = new StreamSource(r); + slCommand = slCommandFactory.createSLCommand(source); + log.info("XMLRequest={}. Created new command: {}.", slCommand.getName(), slCommand + .getClass().getName()); + } + + @Override + public void process() { + boolean done = false; + int hopcounter = 0; + if (bindingProcessorError != null) { + currentState = State.FINISHED; + } + try { + while (!done) { + try { + switch (currentState) { + case INIT: + init(); + break; + case PROCESS: + processRequest(); + break; + case DATAURL: + handleDataUrl(); + if (++hopcounter > configurationFacade.getMaxDataUrlHops()) { + log.error("Maximum number ({}) of dataurl hops reached.", + configurationFacade.getMaxDataUrlHops()); + bindingProcessorError = new SLBindingException(2000); + currentState = State.FINISHED; + } + break; + case TRANSFORM: + transformResult(); + break; + case FINISHED: + done = true; + finished(); + break; + } + } catch (RuntimeException rte) { + throw rte; + } catch (Exception e) { + log.error("Caught unexpected exception.", e); + responseCode = 200; + resultContentType = HttpUtil.TXT_XML; + responseHeaders = Collections.EMPTY_MAP; + bindingProcessorError = new SLException(2000); + currentState = State.FINISHED; + } + } + } catch (Throwable t) { + log.error("Caught unexpected exception.", t); + responseCode = 200; + resultContentType = HttpUtil.TXT_XML; + responseHeaders = Collections.EMPTY_MAP; + bindingProcessorError = new SLException(2000); + currentState = State.FINISHED; + } + log.debug("Terminated http binding processor."); + finished = true; + } + + @Override + public void consumeRequestStream(String url, InputStream is) { + try { + this.srcUrl = new URL(url); + srcContex.setSourceUrl(srcUrl); + srcContex.setSourceIsDataURL(false); + log.debug("Start consuming request stream."); + formParameterMap.clear(); + String ct = headerMap + .get(HttpUtil.HTTP_HEADER_CONTENT_TYPE.toLowerCase()); + if (ct == null) { + log.info("No content type set in http header."); + throw new SLBindingException(2006); + } + InputDecoder id = InputDecoderFactory.getDecoder(ct, is); + if (id == null) { + log.error("Cannot get inputdecoder for content type {}.", ct); + throw new SLException(2006); + } + for (Iterator<FormParameter> fpi = id.getFormParameterIterator(); fpi + .hasNext();) { + FormParameter fp = fpi.next(); + log.debug("Got request parameter with name: {}.", fp.getFormParameterName()); + if (fp.getFormParameterName().equals(FixedFormParameters.XMLREQUEST)) { + log.debug("Creating XML Request."); + for (Iterator<String> headerIterator = fp.getHeaderNames(); headerIterator + .hasNext();) { + String headerName = headerIterator.next(); + if (HttpUtil.CONTENT_TRANSFER_ENCODING.equalsIgnoreCase(headerName)) { + String transferEncoding = fp.getHeaderValue(headerName); + log.debug("Got transfer encoding for xmlrequest: {}.", + transferEncoding); + if (XML_REQ_TRANSFER_ENCODING.contains(transferEncoding)) { + log.debug("Supported transfer encoding: {}.", transferEncoding); + } else { + log.error("Transfer encoding '{}' not supported.", transferEncoding); + throw new SLBindingException(2005); + } + } + } + String charset = HttpUtil.getCharset(ct, true); + assignXMLRequest(fp.getFormParameterValue(), charset); + } else { + FormParameterStore fps = new FormParameterStore(); + fps.init(fp); + //if (!fps.isEmpty()) { + log.debug("Setting form parameter: {}.", fps.getFormParameterName()); + formParameterMap.put(fps.getFormParameterName(), fps); + //} + } + } + if (slCommand == null) { + throw new SLBindingException(2004); + } + } catch (SLException slx) { + log.info("Error while consuming input stream.", slx); + bindingProcessorError = slx; + } catch (Throwable t) { + log.info("Error while consuming input stream.", t); + bindingProcessorError = new SLException(2000); + } finally { + try { + if (is.read() != -1) { + log.warn("Request input stream not completely read."); + while (is.read() != -1); + } + log.debug("Finished consuming request stream."); + } catch (IOException e) { + log.error("Failed to read request input stream.", e); + } + } + } + + @Override + public String getResultContentType() { + return resultContentType; + } + + protected Templates getTemplates(String styleSheetURL) { + if (styleSheetURL == null) { + log.debug("Stylesheet URL not set."); + return null; + } + try { + TransformerFactory factory = TransformerFactory.newInstance(); + factory.setURIResolver(new URIResolverAdapter(urlDereferencer)); + StreamData sd = urlDereferencer.dereference(styleSheetURL); + return factory.newTemplates(new StreamSource(sd.getStream())); + } catch (Exception ex) { + log.info("Cannot instantiate transformer.", ex); + bindingProcessorError = new SLException(2002); + return null; + } + } + + protected void handleBindingProcessorError(OutputStream os, String encoding, + Templates templates) throws IOException { + log.debug("Writing error as result."); + ErrorResultImpl error = new ErrorResultImpl(bindingProcessorError, locale); + Writer writer = writeXMLDeclarationAndProcessingInstruction(os, encoding); + error.writeTo(new StreamResult(writer), templates, true); + } + + protected Writer writeXMLDeclarationAndProcessingInstruction(OutputStream os, String encoding) throws IOException { + if (encoding == null) { + encoding = HttpUtil.DEFAULT_CHARSET; + } + OutputStreamWriter writer = new OutputStreamWriter(os, encoding); + writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"); + writer.write("<?xml-stylesheet type=\"text/css\" href=\"errorresponse.css\"?>\n"); + return writer; + } + + @Override + public void writeResultTo(OutputStream os, String encoding) + throws IOException { + if (encoding == null) { + encoding = HttpUtil.DEFAULT_CHARSET; + } + if (bindingProcessorError != null) { + log.debug("Detected error in binding processor, writing error as result."); + handleBindingProcessorError(os, encoding, templates); + return; + } else if (dataUrlResponse != null) { + log.debug("Writing data url response as result."); + String charEnc = HttpUtil.getCharset(dataUrlResponse.getContentType(), + true); + InputStreamReader isr = new InputStreamReader( + dataUrlResponse.getStream(), charEnc); + OutputStreamWriter osw = new OutputStreamWriter(os, encoding); + if (templates == null) { + StreamUtil.copyStream(isr, osw); + } else { + try { + Transformer transformer = templates.newTransformer(); + transformer.transform(new StreamSource(isr), new StreamResult(osw)); + } catch (TransformerException e) { + log.error("Exception occured during result transformation.", e); + // bindingProcessorError = new SLException(2008); + // handleBindingProcessorError(os, encoding, null); + return; + } + } + osw.flush(); + isr.close(); + } else if (slResult == null) { + // result not yet assigned -> must be a cancel + bindingProcessorError = new SLException(6001); + handleBindingProcessorError(os, encoding, templates); + return; + } else { + log.debug("Getting result from invoker."); + boolean fragment = false; + Writer writer; + if (slResult instanceof ErrorResult) { + writer = writeXMLDeclarationAndProcessingInstruction(os, encoding); + fragment = true; + } else { + writer = new OutputStreamWriter(os, encoding); + } + slResult.writeTo(new StreamResult(writer), templates, fragment); + writer.flush(); + } + } + + /** + * The response code from the dataurl server or 200 if no dataurl server + * created the result + * + * @return + */ + @Override + public int getResponseCode() { + return responseCode; + } + + /** + * All headers from the data url server in case of a direct forward from the + * dataurl server. + * + * @return + */ + @Override + public Map<String, String> getResponseHeaders() { + LinkedHashMap<String, String> headers = new LinkedHashMap<String, String>(); + headers.put(HttpUtil.HTTP_HEADER_SERVER, getServerHeaderValue()); + headers.put(HttpUtil.HTTP_HEADER_SIGNATURE_LAYOUT, getSignatureLayoutHeaderValue()); + headers.putAll(responseHeaders); + return headers; + } + + public boolean isFinished() { + return finished; + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HttpDataURLConnection.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HttpDataURLConnection.java new file mode 100644 index 00000000..d4ee55d2 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HttpDataURLConnection.java @@ -0,0 +1,68 @@ +/* + * Copyright 2009 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.binding; + +import java.io.InputStream; +import java.net.URL; + +/** + * A HTTP DataURLConnection. + * + * @author mcentner + */ +public abstract class HttpDataURLConnection extends DataUrlConnection { + + /** + * Constructs a DataURL connection to the specified URL. + * + * @param url + * the URL to send responses and retrieve any further requests + */ + public HttpDataURLConnection(URL url) { + super(url); + } + + /** + * Set a HTTP header. + * + * @param key + * the key + * @param value + * multiple values are assumed to have the correct formatting + * (comma-separated list) + */ + public abstract void setHTTPHeader(String key, String value); + + /** + * Set a HTTP form parameter to be transmitted with the SLResult. + * + * @param name + * the name of the form parameter + * @param data + * the content of the form parameter + * @param contentType + * the content type (may be <code>null</code>) + * @param charSet + * the character set (may be <code>null</code>) + * @param transferEncoding + * the transfer encoding (may be <code>null</code>) + */ + public abstract void setHTTPFormParameter(String name, InputStream data, + String contentType, String charSet, String transferEncoding); + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HttpUtil.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HttpUtil.java index 5ea7b25e..8282e34e 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HttpUtil.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HttpUtil.java @@ -31,7 +31,8 @@ public class HttpUtil { public final static String HTTP_HEADER_CONTENT_TYPE = "Content-Type";
public static final String HTTP_HEADER_USER_AGENT = "User-Agent"; public static final String HTTP_HEADER_SERVER = "Server";
- public final static String HTTP_HEADER_REFERER = "Referer";
+ public final static String HTTP_HEADER_REFERER = "Referer"; + public static final String HTTP_HEADER_SIGNATURE_LAYOUT = "SignatureLayout";
public final static String CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
public final static String MULTIPART_FOTMDATA = "multipart/form-data";
public final static String MULTIPART_FOTMDATA_BOUNDARY = "boundary";
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/HttpsDataURLConnection.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HttpsDataURLConnection.java new file mode 100644 index 00000000..0054d52c --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/HttpsDataURLConnection.java @@ -0,0 +1,72 @@ +/* +* Copyright 2009 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.binding; + +import java.io.IOException; +import java.net.URL; +import java.security.cert.Certificate; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLPeerUnverifiedException; +import javax.net.ssl.SSLSocketFactory; + +public abstract class HttpsDataURLConnection extends HttpDataURLConnection { + + /** + * Construct a new + * + * @param url + * @throws IOException + */ + public HttpsDataURLConnection(URL url) { + super(url); + } + + /** + * Sets the <code>SSLSocketFactory</code> to be used when this instance + * creates sockets for secure https URL connections. + * + * @param socketFactory + * the SSL socket factory + */ + public abstract void setSSLSocketFactory(SSLSocketFactory socketFactory); + + /** + * Sets the <code>HostnameVerifier</code> for this instance. + * + * @param hostnameVerifier + * the host name verifier + */ + public abstract void setHostnameVerifier(HostnameVerifier hostnameVerifier); + + /** + * Returns the server's certificate chain which was established as part of + * defining the session. + * + * @return an ordered array of server certificates, with the peer's own + * certificate first followed by any certificate authorities. + * + * @throws SSLPeerUnverifiedException + * if the peer is not verified. + * @throws IllegalStateException + * if this method is called before the connection has been + * established. + */ + public abstract Certificate[] getServerCertificates() throws SSLPeerUnverifiedException, IllegalStateException; + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/IdFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/IdFactory.java index 60bf69a4..a29101f4 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/IdFactory.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/IdFactory.java @@ -14,93 +14,93 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.binding;
-
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Creates or converts Ids for BindingProcessors.
- * @author wbauer
- *
- */
-public class IdFactory {
-
- public static int DEFAULT_NUMBER_OF_BITS = 168;
-
- private static Log log = LogFactory.getLog(IdFactory.class);
-
- private static IdFactory instance = new IdFactory();
-
- private SecureRandom random;
- private int numberOfBits = DEFAULT_NUMBER_OF_BITS;
-
- private IdFactory() {
- try {
- random = SecureRandom.getInstance("SHA1PRNG");
- } catch (NoSuchAlgorithmException e) {
- log.error("Cannot instantiate secure random" + e);
- }
- }
-
- public static IdFactory getInstance() {
- return instance;
- }
-
-
- /**
- * set the secure random number generator to create secure ids.
- *
- * @param random
- * must not be null
- */
- public void setSecureRandom(SecureRandom random) {
- if (random == null) {
- throw new NullPointerException("Cannot set secure random to null");
- }
- this.random = random;
- }
-
- /**
- * Don't use this method unless you know exactly what you do !
- * Be sure to use a sufficient large entropy
- * @param numberOfBits >=1 (although this small entropy does not make sense)
- */
- public void setNumberOfBits(int numberOfBits) {
- if (numberOfBits <1) {
- throw new IllegalArgumentException("Cannot set number of bits < 1");
- }
- this.numberOfBits = numberOfBits;
- }
-
- public int getNumberOfBits() {
- return numberOfBits;
- }
-
- /**
- * Creates a new Id object with the factory's secure RNG and the set number of
- * bits.
- *
- * @return
- */
- public Id createId() {
- return new IdImpl(numberOfBits, random);
- }
-
- /**
- * Creates an Id object for the provided String
- *
- * @param idString
- * may be null in this case the method call creates a new Id.
- * @return
- */
- public Id createId(String idString) {
- if (idString == null) {
- return createId();
- }
- return new IdImpl(idString);
- }
-}
\ No newline at end of file +package at.gv.egiz.bku.binding; + +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Creates or converts Ids for BindingProcessors. + * @author wbauer + * + */ +public class IdFactory { + + private final Logger log = LoggerFactory.getLogger(IdFactory.class); + + public static int DEFAULT_NUMBER_OF_BITS = 168; + + private static IdFactory instance = new IdFactory(); + + private SecureRandom random; + private int numberOfBits = DEFAULT_NUMBER_OF_BITS; + + private IdFactory() { + try { + random = SecureRandom.getInstance("SHA1PRNG"); + } catch (NoSuchAlgorithmException e) { + log.error("Cannot instantiate secure random.", e); + } + } + + public static IdFactory getInstance() { + return instance; + } + + + /** + * set the secure random number generator to create secure ids. + * + * @param random + * must not be null + */ + public void setSecureRandom(SecureRandom random) { + if (random == null) { + throw new NullPointerException("Cannot set secure random to null"); + } + this.random = random; + } + + /** + * Don't use this method unless you know exactly what you do ! + * Be sure to use a sufficient large entropy + * @param numberOfBits >=1 (although this small entropy does not make sense) + */ + public void setNumberOfBits(int numberOfBits) { + if (numberOfBits <1) { + throw new IllegalArgumentException("Cannot set number of bits < 1"); + } + this.numberOfBits = numberOfBits; + } + + public int getNumberOfBits() { + return numberOfBits; + } + + /** + * Creates a new Id object with the factory's secure RNG and the set number of + * bits. + * + * @return + */ + public Id createId() { + return new IdImpl(numberOfBits, random); + } + + /** + * Creates an Id object for the provided String + * + * @param idString + * may be null in this case the method call creates a new Id. + * @return + */ + public Id createId(String idString) { + if (idString == null) { + return createId(); + } + return new IdImpl(idString); + } +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/IdImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/IdImpl.java index c8a76823..096754a6 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/IdImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/IdImpl.java @@ -22,8 +22,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.security.SecureRandom; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Implementation that uses a Base64 representation for self generated Ids. @@ -31,7 +31,8 @@ import org.apache.commons.logging.LogFactory; * */ public class IdImpl implements at.gv.egiz.bku.binding.Id { - private static Log log = LogFactory.getLog(IdImpl.class); + + private final Logger log = LoggerFactory.getLogger(IdImpl.class); private String idString; @@ -50,7 +51,7 @@ public class IdImpl implements at.gv.egiz.bku.binding.Id { b64.close(); idString = new String(baos.toByteArray()); } catch (IOException e) { - log.error("Cannot create secure id: "+e); + log.error("Cannot create secure id.", e); } } @@ -80,4 +81,4 @@ public class IdImpl implements at.gv.egiz.bku.binding.Id { return false; } } -}
\ No newline at end of file +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/InputDecoderFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/InputDecoderFactory.java index 211deee7..081d24d4 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/InputDecoderFactory.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/InputDecoderFactory.java @@ -14,76 +14,78 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.binding;
-
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Factory to get a matching instance for a encoded input stream when reading a http request.
- *
- */
-public class InputDecoderFactory {
-
- public final static String MULTIPART_FORMDATA = "multipart/form-data";
- public final static String URL_ENCODED = "application/x-www-form-urlencoded";
-
- private static InputDecoderFactory instance = new InputDecoderFactory();
- private static Log log = LogFactory.getLog(InputDecoderFactory.class);
-
- private String defaultEncoding = URL_ENCODED;
- private Map<String, Class<? extends InputDecoder>> decoderMap = new HashMap<String, Class<? extends InputDecoder>>();
-
- private InputDecoderFactory() {
- decoderMap.put(MULTIPART_FORMDATA, MultiPartFormDataInputDecoder.class);
- decoderMap.put(URL_ENCODED, XWWWFormUrlInputDecoder.class);
- }
-
- public static InputDecoder getDefaultDecoder(InputStream is) {
- return getDecoder(instance.defaultEncoding, is);
- }
-
- /**
- *
- * @param contentType
- * @param is
- * @return null if the content type is not supported
- */
- public static InputDecoder getDecoder(String contentType, InputStream is) {
- String prefix = contentType.split(";")[0].trim().toLowerCase();
- Class<? extends InputDecoder> dec = instance.decoderMap.get(prefix);
- if (dec == null) {
- log.info("Unknown encoding prefix " + contentType);
- return null;
- }
- InputDecoder id;
- try {
- id = dec.newInstance();
- id.setContentType(contentType);
- id.setInputStream(is);
- return id;
- } catch (InstantiationException e) {
- log.error(e);
- throw new IllegalArgumentException(
- "Cannot get an input decoder for content type: " + contentType);
- } catch (IllegalAccessException e) {
- log.error(e);
- throw new IllegalArgumentException(
- "Cannot get an input decoder for content type: " + contentType);
- }
- }
-
- /**
- * Allows to register decoders for special mime types.
- * @param mimeType
- * @param decoder
- */
- public static void registerDecoder(String mimeType,
- Class<? extends InputDecoder> decoder) {
- instance.decoderMap.put(mimeType.toLowerCase(), decoder);
- }
-}
+package at.gv.egiz.bku.binding; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Factory to get a matching instance for a encoded input stream when reading a http request. + * + */ +public class InputDecoderFactory { + + public final static String MULTIPART_FORMDATA = "multipart/form-data"; + public final static String URL_ENCODED = "application/x-www-form-urlencoded"; + + private static InputDecoderFactory instance = new InputDecoderFactory(); + + private String defaultEncoding = URL_ENCODED; + private Map<String, Class<? extends InputDecoder>> decoderMap = new HashMap<String, Class<? extends InputDecoder>>(); + + private InputDecoderFactory() { + decoderMap.put(MULTIPART_FORMDATA, MultiPartFormDataInputDecoder.class); + decoderMap.put(URL_ENCODED, XWWWFormUrlInputDecoder.class); + } + + public static InputDecoder getDefaultDecoder(InputStream is) { + return getDecoder(instance.defaultEncoding, is); + } + + /** + * + * @param contentType + * @param is + * @return null if the content type is not supported + */ + public static InputDecoder getDecoder(String contentType, InputStream is) { + + Logger log = LoggerFactory.getLogger(InputDecoderFactory.class); + + String prefix = contentType.split(";")[0].trim().toLowerCase(); + Class<? extends InputDecoder> dec = instance.decoderMap.get(prefix); + if (dec == null) { + log.info("Unknown encoding prefix " + contentType); + return null; + } + InputDecoder id; + try { + id = dec.newInstance(); + id.setContentType(contentType); + id.setInputStream(is); + return id; + } catch (InstantiationException e) { + log.error("Failed to instantiate InputDecoder.", e); + throw new IllegalArgumentException( + "Cannot get an input decoder for content type: " + contentType); + } catch (IllegalAccessException e) { + log.error("Failed to instantiate InputDecoder.", e); + throw new IllegalArgumentException( + "Cannot get an input decoder for content type: " + contentType); + } + } + + /** + * Allows to register decoders for special mime types. + * @param mimeType + * @param decoder + */ + public static void registerDecoder(String mimeType, + Class<? extends InputDecoder> decoder) { + instance.decoderMap.put(mimeType.toLowerCase(), decoder); + } +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/MultiPartFormDataInputDecoder.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/MultiPartFormDataInputDecoder.java index f8b13553..2dd57f12 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/MultiPartFormDataInputDecoder.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/MultiPartFormDataInputDecoder.java @@ -14,120 +14,121 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.binding;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-
-import org.apache.commons.fileupload.FileItemIterator;
-import org.apache.commons.fileupload.FileItemStream;
-import org.apache.commons.fileupload.FileUpload;
-import org.apache.commons.fileupload.FileUploadException;
-import org.apache.commons.fileupload.RequestContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.slexceptions.SLRuntimeException;
-
-/**
- * The code to detect the multipart boundary is based on
- * org.apache.commons.fileupload.FileUploadBase of
- * http://commons.apache.org/fileupload/
- *
- * @author wbauer
- *
- */
-public class MultiPartFormDataInputDecoder implements InputDecoder,
- RequestContext {
-
- private static Log log = LogFactory
- .getLog(MultiPartFormDataInputDecoder.class);
-
- private String contentType;
- private InputStream stream;
-
- @Override
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
- @Override
- public String getCharacterEncoding() {
- return null;
- }
-
- @Override
- public int getContentLength() {
- return 0;
- }
-
- @Override
- public String getContentType() {
- return contentType;
- }
-
- @Override
- public InputStream getInputStream() throws IOException {
- return stream;
- }
-
- @Override
- public Iterator<FormParameter> getFormParameterIterator() {
- try {
- FileUpload fup = new FileUpload();
- FileItemIterator fit = fup.getItemIterator(this);
- return new IteratorDelegator(fit);
- } catch (Exception iox) {
- log.error("Cannot decode multipart form data stream " + iox);
- throw new SLRuntimeException(iox);
- }
- }
-
- @Override
- public void setInputStream(InputStream is) {
- stream = is;
- }
-
- static class IteratorDelegator implements Iterator<FormParameter> {
-
- private FileItemIterator fileItemIterator;
-
- public IteratorDelegator(FileItemIterator fit) {
- fileItemIterator = fit;
- }
-
- @Override
- public boolean hasNext() {
- try {
- return fileItemIterator.hasNext();
- } catch (FileUploadException e) {
- log.error(e);
- throw new SLRuntimeException(e);
- } catch (IOException e) {
- log.error(e);
- throw new SLRuntimeException(e);
- }
- }
-
- @Override
- public FormParameter next() {
- try {
- FileItemStream item = fileItemIterator.next();
- return new FormParameterImpl(item.getContentType(),
- item.getFieldName(), item.openStream(), item.getHeaders());
- } catch (FileUploadException e) {
- log.error(e);
- throw new SLRuntimeException(e);
- } catch (IOException e) {
- log.error(e);
- throw new SLRuntimeException(e);
- }
- }
-
- @Override
- public void remove() {
- throw new UnsupportedOperationException("Remove not supported");
- }
- }
-}
+package at.gv.egiz.bku.binding; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Iterator; + +import org.apache.commons.fileupload.FileItemIterator; +import org.apache.commons.fileupload.FileItemStream; +import org.apache.commons.fileupload.FileUpload; +import org.apache.commons.fileupload.FileUploadException; +import org.apache.commons.fileupload.RequestContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.slexceptions.SLRuntimeException; + +/** + * The code to detect the multipart boundary is based on + * org.apache.commons.fileupload.FileUploadBase of + * http://commons.apache.org/fileupload/ + * + * @author wbauer + * + */ +public class MultiPartFormDataInputDecoder implements InputDecoder, + RequestContext { + + private final Logger log = LoggerFactory.getLogger(MultiPartFormDataInputDecoder.class); + + private String contentType; + private InputStream stream; + + @Override + public void setContentType(String contentType) { + this.contentType = contentType; + } + + @Override + public String getCharacterEncoding() { + return null; + } + + @Override + public int getContentLength() { + return 0; + } + + @Override + public String getContentType() { + return contentType; + } + + @Override + public InputStream getInputStream() throws IOException { + return stream; + } + + @Override + public Iterator<FormParameter> getFormParameterIterator() { + try { + FileUpload fup = new FileUpload(); + FileItemIterator fit = fup.getItemIterator(this); + return new IteratorDelegator(fit); + } catch (Exception iox) { + log.error("Cannot decode multipart form data stream " + iox); + throw new SLRuntimeException(iox); + } + } + + @Override + public void setInputStream(InputStream is) { + stream = is; + } + + static class IteratorDelegator implements Iterator<FormParameter> { + + private final Logger log = LoggerFactory.getLogger(MultiPartFormDataInputDecoder.class); + + private FileItemIterator fileItemIterator; + + public IteratorDelegator(FileItemIterator fit) { + fileItemIterator = fit; + } + + @Override + public boolean hasNext() { + try { + return fileItemIterator.hasNext(); + } catch (FileUploadException e) { + log.error("Failed to get next file item.", e); + throw new SLRuntimeException(e); + } catch (IOException e) { + log.error("Failed to get next file item.", e); + throw new SLRuntimeException(e); + } + } + + @Override + public FormParameter next() { + try { + FileItemStream item = fileItemIterator.next(); + return new FormParameterImpl(item.getContentType(), + item.getFieldName(), item.openStream(), item.getHeaders()); + } catch (FileUploadException e) { + log.error("Failed to get next file item.", e); + throw new SLRuntimeException(e); + } catch (IOException e) { + log.error("Failed to get next file item.", e); + throw new SLRuntimeException(e); + } + } + + @Override + public void remove() { + throw new UnsupportedOperationException("Remove not supported"); + } + } +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/ProcessingContext.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/ProcessingContext.java deleted file mode 100644 index 913259f6..00000000 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/ProcessingContext.java +++ /dev/null @@ -1,59 +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.binding; - -import java.util.Hashtable; -import java.util.Map; -import java.util.concurrent.Future; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * - * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> - */ -public class ProcessingContext { - - public static final String BINDING_PROCESSOR = "binding.processor"; - public static final String FUTURE = "future"; - - protected static final Log log = LogFactory.getLog(ProcessingContext.class); - - protected Map<String, Object> properties = new Hashtable<String, Object>(); - - public ProcessingContext(BindingProcessor bp, Future future) { - properties.put(BINDING_PROCESSOR, bp); - properties.put(FUTURE, future); - } - - public BindingProcessor getBindingProcessor() { - return (BindingProcessor) properties.get(BINDING_PROCESSOR); - } - - public Future getFuture() { - return (Future) properties.get(FUTURE); - } - - public Object get(String key) { - return properties.get(key); - } - - public void put(String key, Object value) { - properties.put(key, value); - } -} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/SLCommandInvokerImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/SLCommandInvokerImpl.java index a23d96e8..c2ee4ee1 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/SLCommandInvokerImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/SLCommandInvokerImpl.java @@ -16,11 +16,14 @@ */ package at.gv.egiz.bku.binding; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.accesscontroller.SecurityManagerFacade; +import at.gv.egiz.bku.jmx.ComponentMXBean; +import at.gv.egiz.bku.jmx.ComponentState; import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slcommands.SLCommandContext; import at.gv.egiz.bku.slcommands.SLCommandInvoker; import at.gv.egiz.bku.slcommands.SLResult; import at.gv.egiz.bku.slcommands.SLSourceContext; @@ -31,10 +34,11 @@ import at.gv.egiz.bku.slexceptions.SLException; * This class implements the entry point for the CCEs security management. * */ -public class SLCommandInvokerImpl implements SLCommandInvoker { +public class SLCommandInvokerImpl implements SLCommandInvoker, ComponentMXBean { - private static Log log = LogFactory.getLog(SLCommandInvokerImpl.class); + private final Logger log = LoggerFactory.getLogger(SLCommandInvokerImpl.class); + protected SLCommandContext commandContext; protected SLCommand command; protected SLResult result; protected SecurityManagerFacade securityManager; @@ -46,12 +50,11 @@ public class SLCommandInvokerImpl implements SLCommandInvoker { */ public void invoke(SLSourceContext aContext) throws SLException { if (securityManager == null) { - log.warn("Security policy not implemented yet, invoking command: " - + command); - result = command.execute(); + log.warn("Security policy not implemented yet, invoking command: {}.", command); + result = command.execute(commandContext); } else { if (securityManager.mayInvokeCommand(command, aContext)) { - result = command.execute(); + result = command.execute(commandContext); } else { throw new SLException(6002); } @@ -60,9 +63,7 @@ public class SLCommandInvokerImpl implements SLCommandInvoker { public SLResult getResult(SLTargetContext aContext) throws SLException { if (securityManager == null) { - log - .warn("Security policy not implemented yet, getting result of command: " - + command); + log.warn("Security policy not implemented yet, getting result of command: {}.", command); return result; } else { if (securityManager.maySendResult(command, aContext)) { @@ -73,7 +74,8 @@ public class SLCommandInvokerImpl implements SLCommandInvoker { } } - public void setCommand(SLCommand aCmd) { + public void setCommand(SLCommandContext commandContext, SLCommand aCmd) { + this.commandContext = commandContext; command = aCmd; } @@ -92,4 +94,9 @@ public class SLCommandInvokerImpl implements SLCommandInvoker { this.securityManager = securityManager; } -}
\ No newline at end of file + @Override + public ComponentState checkComponentState() { + return new ComponentState(true); + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIterator.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIterator.java index 9279130d..36d5f723 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIterator.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIterator.java @@ -274,6 +274,7 @@ public class XWWWFormUrlInputIterator implements Iterator<FormParameter> { pos = 0; } int c2 = Character.digit(buf[pos], 16); + pos++; return ((c1 << 4) | c2); } else { return buf[pos++]; diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/conf/CertValidator.java b/bkucommon/src/main/java/at/gv/egiz/bku/conf/CertValidator.java deleted file mode 100644 index 6a95b369..00000000 --- a/bkucommon/src/main/java/at/gv/egiz/bku/conf/CertValidator.java +++ /dev/null @@ -1,13 +0,0 @@ -package at.gv.egiz.bku.conf;
-
-import iaik.x509.X509Certificate;
-
-import java.io.File;
-
-public interface CertValidator {
-
- public abstract void init(File certDir, File caDir);
-
- public abstract boolean isCertificateValid(String transactionId, X509Certificate[] certs);
-
-}
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/conf/CertValidatorImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/conf/CertValidatorImpl.java deleted file mode 100644 index 766fe355..00000000 --- a/bkucommon/src/main/java/at/gv/egiz/bku/conf/CertValidatorImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -package at.gv.egiz.bku.conf;
-
-import iaik.logging.LogConfigurationException;
-import iaik.logging.TransactionId;
-import iaik.logging.impl.TransactionIdImpl;
-import iaik.logging.LoggerConfig;
-import iaik.pki.DefaultPKIConfiguration;
-import iaik.pki.DefaultPKIProfile;
-import iaik.pki.PKIConfiguration;
-import iaik.pki.PKIException;
-import iaik.pki.PKIFactory;
-import iaik.pki.PKIModule;
-import iaik.pki.PKIProfile;
-import iaik.pki.revocation.RevocationSourceTypes;
-import iaik.pki.store.certstore.CertStoreParameters;
-import iaik.pki.store.certstore.directory.DefaultDirectoryCertStoreParameters;
-import iaik.pki.store.truststore.DefaultTrustStoreProfile;
-import iaik.pki.store.truststore.TrustStoreProfile;
-import iaik.pki.store.truststore.TrustStoreTypes;
-import iaik.x509.X509Certificate;
-
-import java.io.File;
-import java.util.Date;
-import java.util.Properties;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class CertValidatorImpl implements CertValidator {
-
- private static Log log = LogFactory.getLog(CertValidatorImpl.class);
-
- private PKIFactory pkiFactory;
- private PKIProfile profile;
-
- public CertValidatorImpl() {
-
- }
-
- /* (non-Javadoc)
- * @see at.gv.egiz.bku.conf.CertValidator#init(java.io.File, java.io.File)
- */
- public void init(File certDir, File caDir) {
- // initialize IAIK logging for PKI module
- log.debug("Configuring logging for IAIK PKI module");
- iaik.logging.LogFactory.configure(new LoggerConfig() {
-
- @Override
- public Properties getProperties() throws LogConfigurationException {
- return null;
- }
-
- @Override
- public String getNodeId() {
- return "pki";
- }
-
- @Override
- public String getFactory() {
- return IAIKCommonsLogFactory.class.getName();
- }
- });
-
-
- // the parameters specifying the directory certstore
- CertStoreParameters[] certStoreParameters = { new DefaultDirectoryCertStoreParameters(
- "CS-001", certDir.getAbsolutePath(), true, false) };
-
- // create a new PKI configuration using the certstore parameters
- PKIConfiguration pkiConfig = new DefaultPKIConfiguration(
- certStoreParameters);
-
- // Transaction ID for logging
- TransactionId tid = new TransactionIdImpl("Configure-PKI");
- // get PKI factory for creating PKI module(s)
- pkiFactory = PKIFactory.getInstance();
- // configure the factory
- try {
- pkiFactory.configure(pkiConfig, tid);
- } catch (PKIException e) {
- log.error("Cannot configure PKI module", e);
- }
- // the truststore to be used
- TrustStoreProfile trustProfile = new DefaultTrustStoreProfile("TS-001",
- TrustStoreTypes.DIRECTORY, caDir.getAbsolutePath());
- profile = new DefaultPKIProfile(trustProfile);
- ((DefaultPKIProfile)profile).setAutoAddCertificates(true);
- ((DefaultPKIProfile) profile).setPreferredServiceOrder(new String[] {
- RevocationSourceTypes.OCSP, RevocationSourceTypes.CRL });
- }
-
- /* (non-Javadoc)
- * @see at.gv.egiz.bku.conf.CertValidator#isCertificateValid(java.lang.String, iaik.x509.X509Certificate[])
- */
- public boolean isCertificateValid(String transactionId,
- X509Certificate[] certs) {
- // Transaction ID for logging
- TransactionId tid = new TransactionIdImpl(transactionId);
- // get a PKIModule
- PKIModule pkiModule;
- try {
- pkiModule = pkiFactory.getPKIModule(profile);
- return pkiModule.validateCertificate(new Date(), certs[0], certs, null,
- tid).isCertificateValid();
- } catch (PKIException e) {
- log.error("Cannot validate certificate", e);
- }
- return false;
- }
-}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/conf/Configuration.java b/bkucommon/src/main/java/at/gv/egiz/bku/conf/Configuration.java deleted file mode 100644 index f813b14d..00000000 --- a/bkucommon/src/main/java/at/gv/egiz/bku/conf/Configuration.java +++ /dev/null @@ -1,100 +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.conf; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * BKU Common Configuration - * - * Injected to BKU Common classes as defined in mocca-conf.xml - * - * Replace at.gv.egiz.bku.conf.Configurator, - * currently only few configuration options are supported. - * - * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> - */ -public class Configuration { - - public static final int MAX_DATAURL_HOPS_DEFAULT = 50; - public static final String IMPLEMENTATION_NAME_DEFAULT = "MOCCA"; - public static final String IMPLEMENTATION_VERSION_DEFAULT = "UNKNOWN"; - - private static final Log log = LogFactory.getLog(Configuration.class); - - private int maxDataUrlHops = -1; - private String implementationName; - private String implementationVersion; - - public void setMaxDataUrlHops(int maxDataUrlHops) { - this.maxDataUrlHops = maxDataUrlHops; - } - - /** - * Defines the maximum number of dataurl connects that are allowed within a - * single SL Request processing. - */ - public int getMaxDataUrlHops() { - if (maxDataUrlHops < 0) { - log.warn("maxDataUrlHops not configured, using default: " + MAX_DATAURL_HOPS_DEFAULT); - return MAX_DATAURL_HOPS_DEFAULT; - } - return maxDataUrlHops; - } - - /** - * @return the implementationName - */ - public String getImplementationName() { - if (implementationName == null) { - log.info("implementationName not configured, using default: " + IMPLEMENTATION_NAME_DEFAULT); - return "MOCCA"; - } - return implementationName; - } - - /** - * @param implementationName the implementationName to set - */ - public void setImplementationName(String implementationName) { - this.implementationName = implementationName; - } - - /** - * @return the implementationVersion - */ - public String getImplementationVersion() { - if (implementationName == null) { - log.info("implementationName not configured, using default: " + IMPLEMENTATION_VERSION_DEFAULT); - return IMPLEMENTATION_VERSION_DEFAULT; - } - return implementationVersion; - } - - /** - * @param implementationVersion the implementationVersion to set - */ - public void setImplementationVersion(String implementationVersion) { - this.implementationVersion = implementationVersion; - } - - - - -} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/conf/Configurator.java b/bkucommon/src/main/java/at/gv/egiz/bku/conf/Configurator.java deleted file mode 100644 index 50f5d2b4..00000000 --- a/bkucommon/src/main/java/at/gv/egiz/bku/conf/Configurator.java +++ /dev/null @@ -1,467 +0,0 @@ -package at.gv.egiz.bku.conf;
-
-import iaik.security.ecc.provider.ECCProvider;
-import iaik.security.provider.IAIK;
-import iaik.xml.crypto.XSecProvider;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.security.GeneralSecurityException;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.NoSuchAlgorithmException;
-import java.security.Provider;
-import java.security.Security;
-import java.security.Provider.Service;
-import java.security.cert.CertStore;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.CollectionCertStoreParameters;
-import java.security.cert.LDAPCertStoreParameters;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.KeyManager;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSession;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.binding.DataUrl;
-import at.gv.egiz.bku.slcommands.impl.xsect.DataObject;
-import at.gv.egiz.bku.slcommands.impl.xsect.STALProvider;
-import at.gv.egiz.bku.slexceptions.SLRuntimeException;
-import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer;
-import javax.net.ssl.SSLSocketFactory;
-
-public abstract class Configurator {
-
- private Log log = LogFactory.getLog(Configurator.class);
-
- public final static String USERAGENT_CONFIG_P = "UserAgent";
- public static final String DATAURLCONNECTION_CONFIG_P = "DataURLConnectionImplClass";
-
- public static final String USERAGENT_DEFAULT = "citizen-card-environment/1.2 MOCCA/UNKNOWN";
- public static final String USERAGENT_BASE = "citizen-card-environment/1.2 MOCCA/";
-
- public static final String SIGNATURE_LAYOUT = "SignatureLayout";
-
- protected Properties properties;
-
- protected CertValidator certValidator;
- protected String signaturLayoutVersion;
-
- protected Configurator() {
- }
-
- protected abstract File getCertDir();
-
- protected abstract File getCADir();
-
- protected abstract InputStream getManifest();
-
- private X509Certificate[] getCACerts() throws IOException,
- CertificateException {
- List<X509Certificate> caCerts = new ArrayList<X509Certificate>();
- File caDir = getCADir();
- if (caDir != null) {
- if (!caDir.isDirectory()) {
- log.error("Expecting directory as SSL.caDirectory parameter");
- throw new SLRuntimeException(
- "Expecting directory as SSL.caDirectory parameter");
- }
- log.info("loading trustStore from " + caDir.getAbsolutePath());
- CertificateFactory cf = CertificateFactory.getInstance("X.509");
- for (File f : caDir.listFiles()) {
- try {
- FileInputStream fis = new FileInputStream(f);
- X509Certificate cert = (X509Certificate) cf.generateCertificate(fis);
- fis.close();
- log.debug("Adding trusted cert " + cert.getSubjectDN());
- caCerts.add(cert);
- } catch (Exception e) {
- log.error("Cannot add trusted ca", e);
- }
- }
- return caCerts.toArray(new X509Certificate[caCerts.size()]);
- } else {
- log.warn("No CA certificates configured");
- }
- return null;
- }
-
- protected List<CertStore> getCertstore() throws IOException,
- CertificateException, InvalidAlgorithmParameterException,
- NoSuchAlgorithmException {
- List<CertStore> resultList = new ArrayList<CertStore>();
- File certDir = getCertDir();
- if (certDir != null) {
- if (!certDir.isDirectory()) {
- log.error("Expecting directory as SSL.certDirectory parameter");
- throw new SLRuntimeException(
- "Expecting directory as SSL.certDirectory parameter");
- }
- log.info("loading certStore from " + certDir.getAbsolutePath());
- List<X509Certificate> certCollection = new LinkedList<X509Certificate>();
- CertificateFactory cf = CertificateFactory.getInstance("X.509");
- for (File f : certDir.listFiles()) {
- try {
- FileInputStream fis = new FileInputStream(f);
- X509Certificate cert = (X509Certificate) cf.generateCertificate(fis);
- certCollection.add(cert);
- fis.close();
- log
- .trace("Added following cert to certstore: "
- + cert.getSubjectDN());
- } catch (Exception ex) {
- log.error("Cannot add certificate", ex);
- }
- }
- CollectionCertStoreParameters csp = new CollectionCertStoreParameters(
- certCollection);
- resultList.add(CertStore.getInstance("Collection", csp));
- log.info("Added collection certstore");
- } else {
- log.warn("No certstore directory configured");
- }
- String ldapHost = getProperty("SSL.ldapServer");
- if ((ldapHost != null) && (!"".equals(ldapHost))) {
- String ldapPortString = getProperty("SSL.ldapPort");
- int ldapPort = 389;
- if (ldapPortString != null) {
- try {
- ldapPort = Integer.parseInt(ldapPortString);
- } catch (NumberFormatException nfe) {
- log.error("Invalid ldap port, using default 389");
- }
- } else {
- log.warn("ldap port not specified, using default 389");
- }
- LDAPCertStoreParameters ldapParams = new LDAPCertStoreParameters(
- ldapHost, ldapPort);
- resultList.add(CertStore.getInstance("LDAP", ldapParams));
- log.info("Added LDAP certstore");
- }
- return resultList;
- }
-
- protected void configUrlConnections() {
- HttpsURLConnection.setFollowRedirects(false);
- HttpURLConnection.setFollowRedirects(false);
- }
-
- protected void configureProviders() {
- log.debug("Registering security providers");
-
- IAIK iaikProvider = new IAIK();
- if (Security.getProvider(iaikProvider.getName()) == null) {
- // register IAIK provider at first position
- Security.insertProviderAt(iaikProvider, 1);
- } else {
- // IAIK provider already registered
- log.info("Provider " + iaikProvider.getName() + " already registered.");
- }
-
- ECCProvider eccProvider = new ECCProvider(false);
- if (Security.getProvider(eccProvider.getName()) == null) {
- // register ECC Provider at second position
- Security.insertProviderAt(eccProvider, 2);
- } else {
- // ECC Provider already registered
- log.info("Provider " + eccProvider.getName() + " already registered.");
- }
-
- // registering STALProvider as delegation provider for XSECT
- STALProvider stalProvider = new STALProvider();
- if (Security.getProvider(stalProvider.getName()) == null) {
- // register STAL provider
- Set<Service> services = stalProvider.getServices();
- StringBuilder sb = new StringBuilder();
- for (Service service : services) {
- String algorithm = service.getType() + "." + service.getAlgorithm();
- XSecProvider.setDelegationProvider(algorithm, stalProvider.getName());
- sb.append("\n" + algorithm);
- }
- log
- .debug("Registered STALProvider as XSecProvider delegation provider for the following services : "
- + sb.toString());
-
- Security.addProvider(stalProvider);
- } else {
- // STAL Provider already registered
- log.info("Provider " + stalProvider.getName() + " already registered.");
- }
-
- if (Security.getProvider(XSecProvider.NAME) == null) {
- // register XML Security provider
- XSecProvider.addAsProvider(false);
- } else {
- log.info("Provider " + XSecProvider.NAME + " already registered.");
- }
-
- if (log.isDebugEnabled()) {
- StringBuilder sb = new StringBuilder();
- sb.append("Registered providers: ");
- int i = 1;
- for (Provider prov : Security.getProviders()) {
- sb.append((i++) + ". : " + prov);
- }
- log.debug(sb.toString());
- }
- }
-
- protected void configViewer() {
- String bv = properties.getProperty("ValidateHashDataInputs");
- if (bv != null) {
- DataObject.enableHashDataInputValidation(Boolean.parseBoolean(bv));
- } else {
- log.warn("ValidateHashDataInputs not set, falling back to default");
- }
- }
-
- public void configureSingatureLayoutVersion() {
- if (properties.get(SIGNATURE_LAYOUT) == null) {
- try {
- String classContainer = Configurator.class.getProtectionDomain()
- .getCodeSource().getLocation().toString();
- URL manifestUrl = new URL("jar:" + classContainer
- + "!/META-INF/MANIFEST.MF");
- Manifest manifest = new Manifest(manifestUrl.openStream());
- Attributes att = manifest.getMainAttributes();
- String layout = null;
- if (att != null) {
- layout = att.getValue(SIGNATURE_LAYOUT);
- }
- if (layout != null) {
- log.info("setting SignatureLayout header to " + layout);
- properties.put(SIGNATURE_LAYOUT, layout);
- } else {
- log.warn("no SignatureLayout version defined");
- }
- } catch (Exception ex) {
- log.warn("Cannot read manifest", ex);
- }
- }
- }
-
- public void configureNetwork() {
- String proxy = getProperty("HTTPProxyHost");
- String portString = getProperty("HTTPProxyPort");
- if ((proxy == null) || (proxy.equals(""))) {
- log.info("No proxy configured");
- } else {
- log.info("Setting proxy to: " + proxy + ":" + portString);
- System.setProperty("proxyHost", proxy);
- System.setProperty("proxyPort", portString);
- }
- String timeout = getProperty("DefaultSocketTimeout");
- if ((timeout != null) && (!timeout.equals(""))) {
- System.setProperty("sun.net.client.defaultConnectTimeout", timeout);
- }
- }
-
- public void configureVersion() {
- if (properties.getProperty(USERAGENT_CONFIG_P) == null) {
- Properties p = new Properties();
- try {
- InputStream is = getManifest();
- if (is != null) {
- p.load(getManifest());
- String version = p.getProperty("Implementation-Build");
- if (version == null) {
- version="UNKNOWN";
- }
- properties.setProperty(USERAGENT_CONFIG_P, USERAGENT_BASE + version);
- log.debug("Setting user agent to: "
- + properties.getProperty(USERAGENT_CONFIG_P));
- } else {
- log.warn("Failed to read manifest, setting user-agent to " + USERAGENT_DEFAULT);
- properties.setProperty(USERAGENT_CONFIG_P, USERAGENT_DEFAULT);
- }
- } catch (IOException e) {
- log.error(e);
- }
- } else {
- log.info("using configured user agent " + properties.getProperty(USERAGENT_CONFIG_P));
- }
- }
-
- /**
- * TODO cleanup configuration (read MANIFEST, DataURLconfig,...)
- */
- public void configure() {
- configureProviders();
- configUrlConnections();
- configViewer();
- configureSSL();
- configureVersion();
- configureSingatureLayoutVersion();
- configureNetwork();
- //after configureVersion() and configureSignatureLayoutVersion()
- DataUrl.setConfiguration(properties);
- }
-
- public void setConfiguration(Properties props) {
- this.properties = props;
- }
-
- public String getProperty(String key) {
- if (properties != null) {
- return properties.getProperty(key);
- }
- return null;
- }
-
- public void configureSSL() {
- X509Certificate[] caCerts = null;
- try {
- caCerts = getCACerts();
- } catch (Exception e1) {
- log.error("Cannot load CA certificates", e1);
- }
- String disableAll = getProperty("SSL.disableAllChecks");
- String disableHostnameVerification = getProperty("SSL.disableHostnameVerification");
- try {
- KeyManager[] km = null;
- SSLContext sslCtx = SSLContext
- .getInstance(getProperty("SSL.sslProtocol"));
- if ((disableAll != null) && (Boolean.parseBoolean(disableAll))) {
- log.warn("--------------------------------------");
- log.warn(" Disabling SSL Certificate Validation ");
- log.warn("--------------------------------------");
-
- sslCtx.init(km,
- new TrustManager[] { new MyAlwaysTrustManager(caCerts) }, null);
- } else {
- MyPKITrustManager pkixTM = new MyPKITrustManager(certValidator,
- getCertDir(), getCADir(), caCerts);
- sslCtx.init(km, new TrustManager[] { pkixTM }, null);
- }
- DataUrl.setSSLSocketFactory(sslCtx.getSocketFactory());
- URLDereferencer.getInstance().setSSLSocketFactory(
- sslCtx.getSocketFactory());
- } catch (Exception e) {
- log.error("Cannot configure SSL", e);
- }
- if ((disableAll != null && Boolean.parseBoolean(disableAll))
- || (disableHostnameVerification != null && Boolean
- .parseBoolean(disableHostnameVerification))) {
- log.warn("---------------------------------");
- log.warn(" Disabling Hostname Verification ");
- log.warn("---------------------------------");
- DataUrl.setHostNameVerifier(new HostnameVerifier() {
- @Override
- public boolean verify(String hostname, SSLSession session) {
- return true;
- }
- });
- URLDereferencer.getInstance().setHostnameVerifier(new HostnameVerifier() {
- @Override
- public boolean verify(String hostname, SSLSession session) {
- return true;
- }
- });
- }
- }
-
- public void setCertValidator(CertValidator certValidator) {
- this.certValidator = certValidator;
- }
-
- private static class MyPKITrustManager implements X509TrustManager {
- private static Log log = LogFactory.getLog(MyPKITrustManager.class);
-
- private CertValidator certValidator;
- private X509Certificate[] trustedCerts;
-
- public MyPKITrustManager(CertValidator cv, File certStore, File trustStore,
- X509Certificate[] trustedCerts) {
- certValidator = cv;
- certValidator.init(certStore, trustStore);
- this.trustedCerts = trustedCerts;
- }
-
- @Override
- public void checkClientTrusted(X509Certificate[] chain, String authType)
- throws CertificateException {
- log.error("Did not expect this method to get called");
- throw new CertificateException("Method not implemented");
- }
-
- private static iaik.x509.X509Certificate[] convertCerts(
- X509Certificate[] certs) throws GeneralSecurityException {
- iaik.x509.X509Certificate[] retVal = new iaik.x509.X509Certificate[certs.length];
- int i = 0;
- for (X509Certificate cert : certs) {
- if (cert instanceof iaik.x509.X509Certificate) {
- retVal[i++] = (iaik.x509.X509Certificate) cert;
- } else {
- retVal[i++] = new iaik.x509.X509Certificate(cert.getEncoded());
- }
- }
- return retVal;
- }
-
- @Override
- public void checkServerTrusted(X509Certificate[] chain, String authType)
- throws CertificateException {
- try {
- boolean valid = certValidator.isCertificateValid(Thread.currentThread()
- .getName(), convertCerts(chain));
- if (!valid) {
- throw new CertificateException("Certificate not valid");
- }
- } catch (GeneralSecurityException e) {
- throw new CertificateException(e);
- }
- }
-
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- return trustedCerts;
- }
- }
-
- private static class MyAlwaysTrustManager implements X509TrustManager {
- private static Log log = LogFactory.getLog(MyAlwaysTrustManager.class);
- private X509Certificate[] trustedCerts;
-
- public MyAlwaysTrustManager(X509Certificate[] trustedCerts) {
- this.trustedCerts = trustedCerts;
- }
-
- @Override
- public void checkClientTrusted(X509Certificate[] arg0, String arg1)
- throws CertificateException {
- log.error("Did not expect this method to get called");
- throw new CertificateException("Method not implemented");
- }
-
- @Override
- public void checkServerTrusted(X509Certificate[] certs, String arg1)
- throws CertificateException {
- log.warn("-------------------------------------");
- log.warn("SSL Certificate Validation Disabled !");
- log.warn("-------------------------------------");
- }
-
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- return trustedCerts;
- }
- }
-}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/conf/IAIKCommonsLogFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/conf/IAIKCommonsLogFactory.java deleted file mode 100644 index 14e2c757..00000000 --- a/bkucommon/src/main/java/at/gv/egiz/bku/conf/IAIKCommonsLogFactory.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - */ -package at.gv.egiz.bku.conf; - -import org.apache.commons.logging.impl.WeakHashtable; - -import iaik.logging.Log; -import iaik.logging.LogConfigurationException; -import iaik.logging.LogFactory; - -/** - * @author mcentner - * - */ -public class IAIKCommonsLogFactory extends LogFactory { - - protected WeakHashtable instances = new WeakHashtable(); - - /* (non-Javadoc) - * @see iaik.logging.LogFactory#getInstance(java.lang.String) - */ - @Override - public Log getInstance(String name) throws LogConfigurationException { - org.apache.commons.logging.Log commonsLog = org.apache.commons.logging.LogFactory.getLog(name); - Log log = (Log) instances.get(commonsLog); - if (log == null) { - log = new IAIKCommonsLog(commonsLog); - log.setNodeId(node_id_); - instances.put(commonsLog, log); - } - return log; - } - - /* (non-Javadoc) - * @see iaik.logging.LogFactory#getInstance(java.lang.Class) - */ - @SuppressWarnings("unchecked") - @Override - public Log getInstance(Class clazz) throws LogConfigurationException { - org.apache.commons.logging.Log commonsLog = org.apache.commons.logging.LogFactory.getLog(clazz); - Log log = (Log) instances.get(commonsLog); - if (log == null) { - log = new IAIKCommonsLog(commonsLog); - log.setNodeId(node_id_); - instances.put(commonsLog, log); - } - return log; - } - - /* (non-Javadoc) - * @see iaik.logging.LogFactory#release() - */ - @Override - public void release() { - instances.clear(); - } - -} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/conf/IAIKCommonsLog.java b/bkucommon/src/main/java/at/gv/egiz/bku/conf/IAIKLogAdapter.java index 1b7dd189..b04509a0 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/conf/IAIKCommonsLog.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/conf/IAIKLogAdapter.java @@ -3,6 +3,8 @@ */ package at.gv.egiz.bku.conf; +import org.slf4j.Logger; + import iaik.logging.Log; import iaik.logging.TransactionId; @@ -10,19 +12,19 @@ import iaik.logging.TransactionId; * @author mcentner * */ -public class IAIKCommonsLog implements Log { +public class IAIKLogAdapter implements Log { /** * The id that will be written to the log if the transactionid == null */ public final static String NO_ID = "Null-ID"; - protected org.apache.commons.logging.Log commonsLog; + protected Logger log; protected String nodeId; - public IAIKCommonsLog(org.apache.commons.logging.Log log) { - this.commonsLog = log; + public IAIKLogAdapter(Logger logger) { + this.log = logger; } /* (non-Javadoc) @@ -30,8 +32,8 @@ public class IAIKCommonsLog implements Log { */ @Override public void debug(TransactionId transactionId, Object message, Throwable t) { - if (commonsLog.isDebugEnabled()) { - commonsLog.debug(nodeId + ": " + if (log.isDebugEnabled()) { + log.debug(nodeId + ": " + ((transactionId != null) ? transactionId.getLogID() : NO_ID) + ": " + message, t); } @@ -42,8 +44,8 @@ public class IAIKCommonsLog implements Log { */ @Override public void info(TransactionId transactionId, Object message, Throwable t) { - if (commonsLog.isInfoEnabled()) { - commonsLog.info(nodeId + ": " + if (log.isInfoEnabled()) { + log.info(nodeId + ": " + ((transactionId != null) ? transactionId.getLogID() : NO_ID) + ": " + message, t); } @@ -54,8 +56,8 @@ public class IAIKCommonsLog implements Log { */ @Override public void warn(TransactionId transactionId, Object message, Throwable t) { - if (commonsLog.isWarnEnabled()) { - commonsLog.warn(nodeId + ": " + if (log.isWarnEnabled()) { + log.warn(nodeId + ": " + ((transactionId != null) ? transactionId.getLogID() : NO_ID) + ": " + message, t); } @@ -66,8 +68,8 @@ public class IAIKCommonsLog implements Log { */ @Override public void error(TransactionId transactionId, Object message, Throwable t) { - if (commonsLog.isErrorEnabled()) { - commonsLog.error(nodeId + ": " + if (log.isErrorEnabled()) { + log.error(nodeId + ": " + ((transactionId != null) ? transactionId.getLogID() : NO_ID) + ": " + message, t); } @@ -78,8 +80,8 @@ public class IAIKCommonsLog implements Log { */ @Override public void fatal(TransactionId transactionId, Object message, Throwable t) { - if (commonsLog.isFatalEnabled()) { - commonsLog.fatal(nodeId + ": " + if (log.isErrorEnabled()) { + log.error(nodeId + ": " + ((transactionId != null) ? transactionId.getLogID() : NO_ID) + ": " + message, t); } @@ -106,7 +108,7 @@ public class IAIKCommonsLog implements Log { */ @Override public boolean isDebugEnabled() { - return commonsLog.isDebugEnabled(); + return log.isDebugEnabled(); } /* (non-Javadoc) @@ -114,7 +116,7 @@ public class IAIKCommonsLog implements Log { */ @Override public boolean isInfoEnabled() { - return commonsLog.isInfoEnabled(); + return log.isInfoEnabled(); } /* (non-Javadoc) @@ -122,7 +124,7 @@ public class IAIKCommonsLog implements Log { */ @Override public boolean isWarnEnabled() { - return commonsLog.isWarnEnabled(); + return log.isWarnEnabled(); } /* (non-Javadoc) @@ -130,7 +132,7 @@ public class IAIKCommonsLog implements Log { */ @Override public boolean isErrorEnabled() { - return commonsLog.isErrorEnabled(); + return log.isErrorEnabled(); } /* (non-Javadoc) @@ -138,7 +140,7 @@ public class IAIKCommonsLog implements Log { */ @Override public boolean isFatalEnabled() { - return commonsLog.isFatalEnabled(); + return log.isErrorEnabled(); } } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/conf/IAIKLogAdapterFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/conf/IAIKLogAdapterFactory.java new file mode 100644 index 00000000..52c3d8d1 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/conf/IAIKLogAdapterFactory.java @@ -0,0 +1,62 @@ +/** + * + */ +package at.gv.egiz.bku.conf; + +import java.util.WeakHashMap; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import iaik.logging.Log; +import iaik.logging.LogConfigurationException; +import iaik.logging.LogFactory; + +/** + * @author mcentner + * + */ +public class IAIKLogAdapterFactory extends LogFactory { + + protected WeakHashMap<Logger, Log> instances = new WeakHashMap<Logger, Log>(); + + /* (non-Javadoc) + * @see iaik.logging.LogFactory#getInstance(java.lang.String) + */ + @Override + public synchronized Log getInstance(String name) throws LogConfigurationException { + Logger logger = LoggerFactory.getLogger(name); + Log log = instances.get(logger); + if (log == null) { + log = new IAIKLogAdapter(logger); + log.setNodeId(node_id_); + instances.put(logger, log); + } + return log; + } + + /* (non-Javadoc) + * @see iaik.logging.LogFactory#getInstance(java.lang.Class) + */ + @SuppressWarnings("unchecked") + @Override + public synchronized Log getInstance(Class clazz) throws LogConfigurationException { + Logger logger = LoggerFactory.getLogger(clazz); + Log log = instances.get(logger); + if (log == null) { + log = new IAIKLogAdapter(logger); + log.setNodeId(node_id_); + instances.put(logger, log); + } + return log; + } + + /* (non-Javadoc) + * @see iaik.logging.LogFactory#release() + */ + @Override + public void release() { + instances.clear(); + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/RemovalStrategy.java b/bkucommon/src/main/java/at/gv/egiz/bku/conf/MoccaConfigurationFacade.java index 6c2dcb9f..52842167 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/RemovalStrategy.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/conf/MoccaConfigurationFacade.java @@ -1,5 +1,5 @@ /* -* Copyright 2008 Federal Chancellery Austria and +* Copyright 2009 Federal Chancellery Austria and * Graz University of Technology * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,13 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.binding;
-
-/**
- * Could be used to remove expired BindingProcessor objects from a BindingProcessorManager.
- *
- */
-public interface RemovalStrategy {
- public void execute();
- public void setBindingProcessorManager(BindingProcessorManager bp);
-}
\ No newline at end of file + +package at.gv.egiz.bku.conf; + +public interface MoccaConfigurationFacade { + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/jmx/ComponentMXBean.java b/bkucommon/src/main/java/at/gv/egiz/bku/jmx/ComponentMXBean.java new file mode 100644 index 00000000..cb501b92 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/jmx/ComponentMXBean.java @@ -0,0 +1,27 @@ +/* +* Copyright 2009 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.jmx; + +import javax.management.MXBean; + +@MXBean +public interface ComponentMXBean { + + public ComponentState checkComponentState(); + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/jmx/ComponentState.java b/bkucommon/src/main/java/at/gv/egiz/bku/jmx/ComponentState.java new file mode 100644 index 00000000..9da8515f --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/jmx/ComponentState.java @@ -0,0 +1,38 @@ +/* +* Copyright 2009 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.jmx; + +import java.beans.ConstructorProperties; + +public class ComponentState { + + boolean ready; + + @ConstructorProperties({"ready"}) + public ComponentState(boolean ready) { + this.ready = ready; + } + + /** + * @return the ready + */ + public boolean isReady() { + return ready; + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/jmx/ComponentStateCheck.java b/bkucommon/src/main/java/at/gv/egiz/bku/jmx/ComponentStateCheck.java new file mode 100644 index 00000000..562c2213 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/jmx/ComponentStateCheck.java @@ -0,0 +1,24 @@ +/* +* Copyright 2009 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.jmx; + +public interface ComponentStateCheck { + + + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/AbstractSLCommandFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/AbstractSLCommandFactory.java new file mode 100644 index 00000000..951e09f4 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/AbstractSLCommandFactory.java @@ -0,0 +1,46 @@ +/* +* Copyright 2009 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.slcommands; + +import javax.xml.bind.JAXBElement; + +import org.apache.commons.configuration.Configuration; + +import at.gv.egiz.bku.slexceptions.SLCommandException; + +public abstract class AbstractSLCommandFactory { + + protected Configuration configuration; + + public abstract SLCommand createSLCommand(JAXBElement<?> object) throws SLCommandException; + + /** + * @return the configuration + */ + public Configuration getConfiguration() { + return configuration; + } + + /** + * @param configuration the configuration to set + */ + public void setConfiguration(Configuration configuration) { + this.configuration = configuration; + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/CreateXMLSignatureCommand.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/CreateXMLSignatureCommand.java index 2d87c39f..7db0098b 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/CreateXMLSignatureCommand.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/CreateXMLSignatureCommand.java @@ -21,5 +21,5 @@ import at.gv.egiz.bku.slexceptions.SLRequestException; public interface CreateXMLSignatureCommand extends SLCommand {
- public void prepareXMLSignature() throws SLCommandException, SLRequestException;
+ public void prepareXMLSignature(SLCommandContext commandContext) throws SLCommandException, SLRequestException;
}
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/CreateXMLSignatureResult.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/CreateXMLSignatureResult.java index 4bc2820b..f27fd905 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/CreateXMLSignatureResult.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/CreateXMLSignatureResult.java @@ -15,6 +15,11 @@ * limitations under the License. */ package at.gv.egiz.bku.slcommands;
+ +import org.w3c.dom.Element; -public interface CreateXMLSignatureResult extends SLResult {
+public interface CreateXMLSignatureResult extends SLResult { + + public Element getContent(); +
}
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/ErrorResult.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/ErrorResult.java index 5d52c0ea..5663627e 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/ErrorResult.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/ErrorResult.java @@ -15,6 +15,12 @@ * limitations under the License. */ package at.gv.egiz.bku.slcommands;
+ -public interface ErrorResult extends SLResult {
+public interface ErrorResult extends SLResult { + + public int getErrorCode(); + + public String getInfo(); +
}
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/InfoboxReadResult.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/InfoboxReadResult.java index c6a51362..599f1ae0 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/InfoboxReadResult.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/InfoboxReadResult.java @@ -16,5 +16,8 @@ */ package at.gv.egiz.bku.slcommands;
-public interface InfoboxReadResult extends SLResult {
+public interface InfoboxReadResult extends SLResult { + + public Object getContent(); +
}
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommand.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommand.java index a8625946..d24c86ef 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommand.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommand.java @@ -20,12 +20,16 @@ import at.gv.egiz.bku.slexceptions.SLCommandException; public interface SLCommand {
- public final String NAMESPACE_URI = "http://www.buergerkarte.at/namespaces/securitylayer/1.2#";
+ public final String NAMESPACE_URI = "http://www.buergerkarte.at/namespaces/securitylayer/1.2#"; + + public final String NAMESPACE_URI_20020225 = "http://www.buergerkarte.at/namespaces/securitylayer/20020225#"; + + public final String NAMESPACE_URI_20020831 = "http://www.buergerkarte.at/namespaces/securitylayer/20020831#";
public String getName();
- public void init(SLCommandContext aCtx, Object aUnmarshalledRequest) throws SLCommandException;
+ public void init(Object aUnmarshalledRequest) throws SLCommandException;
- public SLResult execute();
+ public SLResult execute(SLCommandContext commandContext);
}
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommandContext.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommandContext.java index 5af2afac..f0e46d0c 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommandContext.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommandContext.java @@ -18,30 +18,43 @@ package at.gv.egiz.bku.slcommands; import java.util.Locale; -import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerContext;
+import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; import at.gv.egiz.stal.STAL;
public class SLCommandContext {
- private STAL stal;
- private URLDereferencerContext urlDerefCtx; + private STAL stal; +
+ private URLDereferencer urlDereferencer; - private Locale locale;
-
+ private Locale locale; + + public SLCommandContext(STAL stal, URLDereferencer urlDereferencer) { + this.stal = stal; + this.urlDereferencer = urlDereferencer; + } + + public SLCommandContext(STAL stal, URLDereferencer urlDereferencer, + Locale locale) { + this.stal = stal; + this.urlDereferencer = urlDereferencer; + this.locale = locale; + } + public void setSTAL(STAL aStal) {
this.stal = aStal;
}
- public void setURLDereferencerContext(URLDereferencerContext aCtx) {
- this.urlDerefCtx = aCtx;
+ public void setURLDereferencer(URLDereferencer urlDereferencer) {
+ this.urlDereferencer = urlDereferencer;
}
public STAL getSTAL() {
return stal;
}
- public URLDereferencerContext getURLDereferencerContext() {
- return urlDerefCtx;
+ public URLDereferencer getURLDereferencer() {
+ return urlDereferencer;
} public Locale getLocale() { diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommandFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommandFactory.java index ab2f08cc..0314869e 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommandFactory.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommandFactory.java @@ -16,390 +16,211 @@ */ package at.gv.egiz.bku.slcommands; -import java.io.IOException; -import java.net.URL; import java.util.HashMap; import java.util.Map; -import javax.xml.XMLConstants; -import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.bind.UnmarshalException; import javax.xml.bind.Unmarshaller; -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.ValidationEventLocator; import javax.xml.namespace.QName; -import javax.xml.stream.XMLEventReader; -import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; -import javax.xml.validation.Schema; -import javax.xml.validation.SchemaFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.xml.sax.SAXException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.xml.sax.SAXParseException; + import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.bku.slexceptions.SLExceptionMessages; import at.gv.egiz.bku.slexceptions.SLRequestException; import at.gv.egiz.bku.slexceptions.SLRuntimeException; import at.gv.egiz.bku.slexceptions.SLVersionException; import at.gv.egiz.bku.utils.DebugReader; -import at.gv.egiz.slbinding.RedirectEventFilter; -import at.gv.egiz.slbinding.RedirectUnmarshallerListener; -import at.gv.egiz.validation.ReportingValidationEventHandler; - -public class SLCommandFactory { - - /** - * Schema files required for Security Layer command validation. - */ - public static final String[] SCHEMA_FILES = new String[]{ - "at/gv/egiz/bku/slcommands/schema/xml.xsd", - "at/gv/egiz/bku/slcommands/schema/xmldsig-core-schema.xsd", - "at/gv/egiz/bku/slcommands/schema/Core-1.2.xsd", - "at/gv/egiz/bku/slcommands/schema/Core.20020225.xsd", - "at/gv/egiz/bku/slcommands/schema/Core.20020831.xsd" - }; - /** - * Logging facility. - */ - static Log log = LogFactory.getLog(SLCommandFactory.class); - /** - * The instance returned by {@link #getInstance()}. - */ - private static SLCommandFactory instance; - /** - * Schema for Security Layer command validation. - */ - private Schema slSchema; - /** - * The JAXBContext. - */ - private JAXBContext jaxbContext; - /** - * The map of <namespaceURI>:<localName> to implementation class of the - * corresponding {@link SLCommand}. - */ - private Map<String, Class<? extends SLCommand>> slRequestTypeMap = new HashMap<String, Class<? extends SLCommand>>(); - - /** - * Configures the singleton instance with command implementations - * @param commandImplMap - * @throws ClassNotFoundException - */ - @SuppressWarnings("unchecked") - public void setCommandImpl(Map<String, String> commandImplMap) throws ClassNotFoundException { - ClassLoader cl = getClass().getClassLoader(); - for (String key : commandImplMap.keySet()) { - Class<? extends SLCommand> impl = (Class<? extends SLCommand>) cl.loadClass(commandImplMap.get(key)); - log.debug("Registering sl command implementation for :"+key+ "; implementation class: "+impl.getCanonicalName()); - slRequestTypeMap.put(key, impl); +import at.gv.egiz.slbinding.SLUnmarshaller; + +public class SLCommandFactory extends SLUnmarshaller { + + private final Logger log = LoggerFactory.getLogger(SLCommandFactory.class); + + private static class SLCommandFactoryInstance { + private static final SLCommandFactory INSTANCE = new SLCommandFactory(); + } + + /** + * The mapping of a requests's qualified name to a concrete command factories. + */ + private Map<QName, AbstractSLCommandFactory> slCommandFactories = new HashMap<QName, AbstractSLCommandFactory>(); + + public void setConcreteFactories( + Map<QName, AbstractSLCommandFactory> factories) { + if (log.isDebugEnabled()) { + StringBuilder sb = new StringBuilder(); + sb.append("Registered sl command factory for"); + for (QName qname : factories.keySet()) { + sb.append("\n " + qname + " : " + factories.get(qname).getClass()); } + log.debug(sb.toString()); } - - /** - * Register an {@link SLCommand} implementation class of a Security Layer - * command with the given <code>namespaceUri</code> and <code>localname</code> - * . - * - * @param namespaceUri - * the namespace URI of the Security Layer command - * @param localname - * the localname of the Security Layer command - * @param slCommandClass - * the implementation class, or <code>null</code> to deregister a - * currently registered class - */ - public void setImplClass(String namespaceUri, String localname, - Class<? extends SLCommand> slCommandClass) { - if (slCommandClass != null) { - slRequestTypeMap.put(namespaceUri + ":" + localname, slCommandClass); - } else { - slRequestTypeMap.remove(namespaceUri + ":" + localname); - } - } - - /** - * Returns the implementation class of an {@link SLCommand} with the given - * <code>name</code>, or <code>null</code> if no such class is registered. - * - * @param name - * the <code>QName</code> of the Security Layer command - * @return the implementation class, or <code>null</code> if no class is - * registered for the given <code>name</code> - */ - public Class<? extends SLCommand> getImplClass(QName name) { - String namespaceURI = name.getNamespaceURI(); - String localPart = name.getLocalPart(); - return slRequestTypeMap.get(namespaceURI + ":" + localPart); - } - - /** - * Sets the schema to validate Security Layer commands with. - * - * @param slSchema the schema to validate Security Layer commands with - */ - public void setSLSchema(Schema slSchema) { - this.slSchema = slSchema; - } - - /** - * @return the jaxbContext - */ - public JAXBContext getJaxbContext() { - ensureJaxbContext(); - return jaxbContext; + slCommandFactories = factories; + } + + /** + * Get an instance of the <code>SLCommandFactory</code>. + */ + public synchronized static SLCommandFactory getInstance() { + return SLCommandFactoryInstance.INSTANCE; + } + + /** + * Private constructor used by {@link #getInstance()}. + */ + private SLCommandFactory() { + super(); + } + + /** + * Creates a new <code>SLCommand</code> from the given <code>source</code> and + * <code>context</code>. + * + * @param source + * the <code>Source</code> to unmarshall from + * @return the <code>SLCommand</code> unmarshalled from the given + * <code>source</code> + * @throws SLRequestException + * if unmarshalling fails + * @throws SLCommandException + * if command ist not supported + * @throws SLRuntimeException + * if an unexpected error occurs configuring the unmarshaller, if + * unmarshalling fails with an unexpected error or if the + * corresponding <code>SLCommand</code> could not be instantiated + * @throws SLVersionException + */ + public SLCommand createSLCommand(Source source) + throws SLCommandException, SLRuntimeException, SLRequestException, + SLVersionException { + + DebugReader dr = null; + if (log.isTraceEnabled() && source instanceof StreamSource) { + StreamSource streamSource = (StreamSource) source; + if (streamSource.getReader() != null) { + dr = new DebugReader(streamSource.getReader(), + "SLCommand unmarshalled from:\n"); + streamSource.setReader(dr); + } } - /** - * @param jaxbContext the jaxbContext to set - */ - public void setJaxbContext(JAXBContext jaxbContext) { - this.jaxbContext = jaxbContext; + Object object; + try { + object = unmarshalRequest(source); + } catch (SLRequestException e) { + throw e; + } finally { + if (dr != null) { + log.trace(dr.getCachedString()); + } } - /** - * Initialize the JAXBContext. - */ - private synchronized void ensureJaxbContext() { - if (jaxbContext == null) { - try { - // add top-level types explicitly to jaxb context, otherwise the unmarshaller won't find them. - // cf. http://forums.java.net/jive/thread.jspa?threadID=75778&tstart=0 - String slImplPkg = at.gv.egiz.slbinding.impl.CreateXMLSignatureResponseType.class.getPackage().getName(); - - String slPkg = at.buergerkarte.namespaces.securitylayer._1.ObjectFactory.class.getPackage().getName(); - String xmldsigPkg = org.w3._2000._09.xmldsig_.ObjectFactory.class.getPackage().getName(); - String cardChannelPkg = at.buergerkarte.namespaces.cardchannel.ObjectFactory.class.getPackage().getName(); - String slPkgLegacy1_0 = at.buergerkarte.namespaces.securitylayer._20020225_.ObjectFactory.class.getPackage().getName(); - String slPkgLegacy1_1 = at.buergerkarte.namespaces.securitylayer._20020831_.ObjectFactory.class.getPackage().getName(); - String contextPath = slImplPkg + ":" + slPkg + ":" + xmldsigPkg + ":" + cardChannelPkg - + ":" + slPkgLegacy1_0 + ":" + slPkgLegacy1_1; - log.debug("jaxb context path: " + contextPath); - setJaxbContext(JAXBContext.newInstance(contextPath)); - } catch (JAXBException e) { - log.error("Failed to setup JAXBContext security layer request.", e); - throw new SLRuntimeException(e); - } - } + if (!(object instanceof JAXBElement<?>)) { + // invalid request + log.info("Invalid security layer request.\n{}", object.toString()); + throw new SLRequestException(3002, SLExceptionMessages.EC3002_INVALID, + new Object[] { object.toString() }); } - /** - * Initialize the security layer schema. - */ - private synchronized void ensureSchema() { - if (slSchema == null) { - try { - SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); - ClassLoader cl = SLCommandFactory.class.getClassLoader(); - Source[] sources = new Source[SCHEMA_FILES.length]; - for (int i = 0; i < SCHEMA_FILES.length; i++) { - String schemaFile = SCHEMA_FILES[i]; - URL schemaURL = cl.getResource(schemaFile); - if (schemaURL == null) { - throw new SLRuntimeException("Failed to load schema file " + schemaFile + "."); - } - log.debug("Schema location: " + schemaURL); - sources[i] = new StreamSource(schemaURL.openStream()); - } - Schema schema = schemaFactory.newSchema(sources); - log.debug("Schema successfully created."); - setSLSchema(schema); - } catch (SAXException e) { - log.error("Failed to load security layer schema.", e); - throw new SLRuntimeException("Failed to load security layer schema.", e); - } catch (IOException e) { - log.error("Failed to load security layer schema.", e); - throw new SLRuntimeException("Failed to load security layer schema.", e); - } - - } - } - - /** - * Get an instance of the <code>SLCommandFactory</code>. - */ - public synchronized static SLCommandFactory getInstance() { - if (instance == null) { - instance = new SLCommandFactory(); - instance.ensureJaxbContext(); - instance.ensureSchema(); - } - return instance; + return createSLCommand((JAXBElement<?>) object); + + } + + /** + * Creates a new <code>SLCommand</code> from the given <code>element</code> + * and <code>context</code>. + * + * @param element + * the request element + * @return the <code>SLCommand</code> for for the given <code>element</code> + * @throws SLCommandException + * if command ist not supported + * @throws SLVersionException + */ + public SLCommand createSLCommand(JAXBElement<?> element) throws SLCommandException, SLVersionException { + + QName qName = element.getName(); + if (SLCommand.NAMESPACE_URI_20020831.equals(qName.getNamespaceURI()) + || SLCommand.NAMESPACE_URI_20020225.equals(qName.getNamespaceURI())) { + // security layer request version not supported + log.info("Unsupported security layer request version {}.", qName.getNamespaceURI()); + throw new SLVersionException(qName.getNamespaceURI()); } - /** - * Private constructor used by {@link #getInstance()}. - */ - private SLCommandFactory() { + AbstractSLCommandFactory concreteFactory = slCommandFactories.get(qName); + if (concreteFactory == null) { + // command not supported + log.info("Unsupported command received {}.", qName.toString()); + throw new SLCommandException(4011, + SLExceptionMessages.EC4011_NOTIMPLEMENTED, new Object[] { qName + .toString() }); } - /** - * Unmarshalls from the given <code>source</code>. - * - * @see Unmarshaller#unmarshal(Source) - * - * <em>Note:</em>Could replace JAXB's unmarshal-time validation engine (see commented code), however, - * we need a redirect filter. - * - * @param source - * the source to unmarshal from - * @return the object returned by {@link Unmarshaller#unmarshal(Source)} - * @throws SLRequestException - * if unmarshalling fails - * @throws SLRuntimeException - * if an unexpected error occurs configuring the unmarshaller or if - * unmarshalling fails with an unexpected error - */ - protected Object unmarshal(Source source) throws SLRuntimeException, + return concreteFactory.createSLCommand(element); + + } + + /** + * Unmarshalls from the given <code>source</code>. + * + * @see Unmarshaller#unmarshal(Source) + * + * <em>Note:</em>Could replace JAXB's unmarshal-time validation engine + * (see commented code), however, we need a redirect filter. + * + * @param source + * the source to unmarshal from + * @return the object returned by {@link Unmarshaller#unmarshal(Source)} + * @throws SLRequestException + * if unmarshalling fails + * @throws SLRuntimeException + * if an unexpected error occurs configuring the unmarshaller or if + * unmarshalling fails with an unexpected error + */ + protected Object unmarshalRequest(Source source) throws SLRuntimeException, SLRequestException { - Object object; - ReportingValidationEventHandler validationEventHandler = new ReportingValidationEventHandler(); - try { - - XMLInputFactory inputFactory = XMLInputFactory.newInstance(); - XMLEventReader eventReader = inputFactory.createXMLEventReader(source); - RedirectEventFilter redirectEventFilter = new RedirectEventFilter(); - XMLEventReader filteredReader = inputFactory.createFilteredReader(eventReader, redirectEventFilter); - - Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); - unmarshaller.setListener(new RedirectUnmarshallerListener(redirectEventFilter)); - if (slSchema != null) { - unmarshaller.setSchema(slSchema); - } - log.trace("Before unmarshal()."); - unmarshaller.setEventHandler(validationEventHandler); - object = unmarshaller.unmarshal(filteredReader); - log.trace("After unmarshal()."); - } catch (UnmarshalException e) { - if (log.isDebugEnabled()) { - log.debug("Failed to unmarshall security layer request.", e); - } else { - log.info("Failed to unmarshall security layer request." + e.getMessage()); - } - if (validationEventHandler.getErrorEvent() != null) { - // Validation Error - ValidationEvent errorEvent = validationEventHandler.getErrorEvent(); - ValidationEventLocator locator = errorEvent.getLocator(); - throw new SLRequestException(3002, - SLExceptionMessages.EC3002_INVALID, new Object[]{errorEvent.getMessage()}); - } - Throwable cause = e.getCause(); - if (cause instanceof SAXParseException) { - throw new SLRequestException(3000, - SLExceptionMessages.EC3000_UNCLASSIFIED, new Object[]{cause.getMessage()}); - } else { - throw new SLRequestException(3000, - SLExceptionMessages.EC3000_UNCLASSIFIED, new Object[]{e}); - } - } catch (JAXBException e) { - // unexpected error - log.error("Failed to unmarshall security layer request.", e); - throw new SLRuntimeException(e); - } catch (XMLStreamException e) { - // unexpected error - log.error("Failed to unmarshall security layer request.", e); - throw new SLRuntimeException(e); - } - - return object; + try { + return unmarshal(source); + } catch (UnmarshalException e) { + if (log.isDebugEnabled()) { + log.debug("Failed to unmarshall security layer request.", e); + } else { + log.info("Failed to unmarshall security layer request." + + e.getMessage()); + } + if (e.getLinkedException() != null) { + throw new SLRequestException(3002, SLExceptionMessages.EC3002_INVALID, + new Object[] { e.getMessage() }); + } + Throwable cause = e.getCause(); + if (cause instanceof SAXParseException) { + throw new SLRequestException(3000, + SLExceptionMessages.EC3000_UNCLASSIFIED, new Object[] { cause + .getMessage() }); + } else { + throw new SLRequestException(3000, + SLExceptionMessages.EC3000_UNCLASSIFIED, new Object[] { e }); + } + } catch (JAXBException e) { + // unexpected error + log.error("Failed to unmarshall security layer request.", e); + throw new SLRuntimeException(e); + } catch (XMLStreamException e) { + // unexpected error + log.error("Failed to unmarshall security layer request.", e); + throw new SLRuntimeException(e); } - /** - * Creates a new <code>SLCommand</code> from the given <code>source</code> and - * <code>context</code>. - * - * @param source - * the <code>Source</code> to unmarshall from - * @param context - * the context for the created <code>SLCommand</code> - * @return the <code>SLCommand</code> unmarshalled from the given - * <code>source</code> - * @throws SLRequestException - * if unmarshalling fails - * @throws SLCommandException - * if command ist not supported - * @throws SLRuntimeException - * if an unexpected error occurs configuring the unmarshaller, if - * unmarshalling fails with an unexpected error or if the - * corresponding <code>SLCommand</code> could not be instantiated - * @throws SLVersionException - */ - @SuppressWarnings("unchecked") - public SLCommand createSLCommand(Source source, SLCommandContext context) - throws SLCommandException, SLRuntimeException, SLRequestException, SLVersionException { - - DebugReader dr = null; - if (log.isTraceEnabled() && source instanceof StreamSource) { - StreamSource streamSource = (StreamSource) source; - if (streamSource.getReader() != null) { - dr = new DebugReader(streamSource.getReader(), "SLCommand unmarshalled from:\n"); - streamSource.setReader(dr); - } - } - - Object object; - try { - object = unmarshal(source); - } catch (SLRequestException e) { - throw e; - } finally { - if (dr != null) { - log.trace(dr.getCachedString()); - } - } - - if (!(object instanceof JAXBElement)) { - // invalid request - log.info("Invalid security layer request. " + object.toString()); - throw new SLRequestException(3002, SLExceptionMessages.EC3002_INVALID, - new Object[]{object.toString()}); - } - - QName qName = ((JAXBElement) object).getName(); - if (!SLCommand.NAMESPACE_URI.equals(qName.getNamespaceURI())) { - // security layer request version not supported - log.info("Unsupported security layer request version : " + qName.getNamespaceURI()); - throw new SLVersionException(qName.getNamespaceURI()); - } - - Class<? extends SLCommand> implClass = getImplClass(qName); - if (implClass == null) { - // command not supported - log.info("Unsupported command received: " + qName.toString()); - throw new SLCommandException(4011, - SLExceptionMessages.EC4011_NOTIMPLEMENTED, new Object[]{qName.toString()}); - } - - - - // try to instantiate - SLCommand slCommand; - try { - slCommand = implClass.newInstance(); - log.debug("SLCommand " + slCommand.getClass().toString() + " created."); - } catch (InstantiationException e) { - // unexpected error - log.error("Failed to instantiate security layer command implementation.", - e); - throw new SLRuntimeException(e); - } catch (IllegalAccessException e) { - // unexpected error - log.error("Failed to instantiate security layer command implementation.", - e); - throw new SLRuntimeException(e); - } - - slCommand.init(context, (JAXBElement) object); - - return slCommand; - - } + } }
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommandInvoker.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommandInvoker.java index c28288c9..30be7673 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommandInvoker.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLCommandInvoker.java @@ -36,7 +36,7 @@ public interface SLCommandInvoker { */
public SLResult getResult(SLTargetContext aContext) throws SLException;
- public void setCommand(at.gv.egiz.bku.slcommands.SLCommand aCmd);
+ public void setCommand(SLCommandContext commandContext, at.gv.egiz.bku.slcommands.SLCommand aCmd);
/**
* Prototype creation
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLMarshallerFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLMarshallerFactory.java index e0a375cf..e3fb863c 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLMarshallerFactory.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLMarshallerFactory.java @@ -20,15 +20,15 @@ import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.slexceptions.SLRuntimeException; import at.gv.egiz.marshal.MarshallerFactory; public class SLMarshallerFactory { - static Log log = LogFactory.getLog(SLMarshallerFactory.class); + private final Logger log = LoggerFactory.getLogger(SLMarshallerFactory.class); /** * The JAXBContext used for result marshaling. @@ -98,6 +98,7 @@ public class SLMarshallerFactory { String cardChannelPkg = at.buergerkarte.namespaces.cardchannel.ObjectFactory.class.getPackage().getName(); legacyContext = JAXBContext.newInstance(slPkgLegacy1_0 + ":" + slPkgLegacy1_1 + ":" + xmldsigPkg + ":" + cardChannelPkg); } catch (JAXBException e) { + Logger log = LoggerFactory.getLogger(SLMarshallerFactory.class); log.error("Failed to setup JAXBContext security layer request.", e); throw new SLRuntimeException(e); } @@ -131,7 +132,7 @@ public class SLMarshallerFactory { try { return MarshallerFactory.createMarshaller(context, formattedOutput, fragment); } catch (JAXBException e) { - log.fatal("Failed to marshall error response.", e); + log.error("Failed to marshall error response.", e); throw new SLRuntimeException("Failed to marshall error response.", e); } } @@ -164,7 +165,7 @@ public class SLMarshallerFactory { ensureLegacyContext(); return MarshallerFactory.createMarshaller(legacyContext, formattedOutput, fragment); } catch (JAXBException e) { - log.fatal("Failed to marshall error response.", e); + log.error("Failed to marshall error response.", e); throw new SLRuntimeException("Failed to marshall error response.", e); } } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLSourceContext.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLSourceContext.java index f25a0ea4..8a8a819a 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLSourceContext.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/SLSourceContext.java @@ -19,9 +19,6 @@ package at.gv.egiz.bku.slcommands; import java.net.URL; import java.security.cert.X509Certificate;
-import at.gv.egiz.bku.utils.binding.Protocol;
-
-
public class SLSourceContext {
private URL sourceUrl;
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractAssocArrayInfobox.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractAssocArrayInfobox.java index 9a4536e6..4da9abb7 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractAssocArrayInfobox.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractAssocArrayInfobox.java @@ -26,8 +26,8 @@ import java.util.regex.Pattern; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.buergerkarte.namespaces.securitylayer._1.InfoboxAssocArrayPairType; import at.buergerkarte.namespaces.securitylayer._1.InfoboxReadDataAssocArrayType; @@ -54,7 +54,7 @@ public abstract class AbstractAssocArrayInfobox extends AbstractInfoboxImpl /** * Logging facility. */ - private static Log log = LogFactory.getLog(AbstractAssocArrayInfobox.class); + private final Logger log = LoggerFactory.getLogger(AbstractAssocArrayInfobox.class); /** * The search string pattern. @@ -113,7 +113,7 @@ public abstract class AbstractAssocArrayInfobox extends AbstractInfoboxImpl // TODO : build pattern return Collections.emptyList(); } else { - log.info("Got invalid search string '" + searchString + "'"); + log.info("Got invalid search string '{}'.", searchString); throw new SLCommandException(4010); } @@ -170,14 +170,14 @@ public abstract class AbstractAssocArrayInfobox extends AbstractInfoboxImpl protected InfoboxReadResult readPairs(ReadPairs readPairs, SLCommandContext cmdCtx) throws SLCommandException { if (readPairs.isValuesAreXMLEntities() && !isValuesAreXMLEntities()) { - log.info("Got valuesAreXMLEntities=" + readPairs.isValuesAreXMLEntities() + " but infobox type is binary."); + log.info("Got valuesAreXMLEntities={} but infobox type is binary.", readPairs.isValuesAreXMLEntities()); throw new SLCommandException(4010); } List<String> selectedKeys = selectKeys(readPairs.getSearchString()); if (readPairs.isUserMakesUnique() && selectedKeys.size() > 1) { - log.info("UserMakesUnique not supported"); + log.info("UserMakesUnique not supported."); // TODO: give more specific error message throw new SLCommandException(4010); } @@ -202,7 +202,7 @@ public abstract class AbstractAssocArrayInfobox extends AbstractInfoboxImpl protected InfoboxReadResult readValue(ReadValue readValue, SLCommandContext cmdCtx) throws SLCommandException { if (readValue.isValueIsXMLEntity() && !isValuesAreXMLEntities()) { - log.info("Got valuesAreXMLEntities=" + readValue.isValueIsXMLEntity() + " but infobox type is binary."); + log.info("Got valuesAreXMLEntities={} but infobox type is binary.", readValue.isValueIsXMLEntity()); throw new SLCommandException(4010); } @@ -232,7 +232,7 @@ public abstract class AbstractAssocArrayInfobox extends AbstractInfoboxImpl Object value = values.get(key); if (areXMLEntities) { if (value instanceof byte[]) { - log.info("Got valuesAreXMLEntities=" + areXMLEntities + " but infobox type is binary."); + log.info("Got valuesAreXMLEntities={} but infobox type is binary.", areXMLEntities); throw new SLCommandException(4122); } else { XMLContentType contentType = objectFactory.createXMLContentType(); diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractBinaryFileInfobox.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractBinaryFileInfobox.java index 23394bd5..feead9e5 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractBinaryFileInfobox.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractBinaryFileInfobox.java @@ -16,8 +16,8 @@ */ package at.gv.egiz.bku.slcommands.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.buergerkarte.namespaces.securitylayer._1.InfoboxReadParamsBinaryFileType; import at.buergerkarte.namespaces.securitylayer._1.InfoboxReadRequestType; @@ -32,7 +32,7 @@ public abstract class AbstractBinaryFileInfobox extends AbstractInfoboxImpl impl /** * Logging facility. */ - private static Log log = LogFactory.getLog(AbstractBinaryFileInfobox.class); + private final Logger log = LoggerFactory.getLogger(AbstractBinaryFileInfobox.class); /** * Is this infobox' content an XML entity? @@ -57,7 +57,7 @@ public abstract class AbstractBinaryFileInfobox extends AbstractInfoboxImpl impl InfoboxReadParamsBinaryFileType binaryFileParameters = request.getBinaryFileParameters(); if (binaryFileParameters != null) { isXMLEntity = binaryFileParameters.isContentIsXMLEntity(); - log.debug("Got ContentIsXMLEntity=" + isXMLEntity + "."); + log.debug("Got ContentIsXMLEntity={}.", isXMLEntity); } } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractInfoboxCommandFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractInfoboxCommandFactory.java new file mode 100644 index 00000000..547f7eda --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractInfoboxCommandFactory.java @@ -0,0 +1,40 @@ +/* +* Copyright 2009 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.slcommands.impl; + +import at.gv.egiz.bku.slcommands.AbstractSLCommandFactory; + +public abstract class AbstractInfoboxCommandFactory extends AbstractSLCommandFactory { + + protected InfoboxFactory infoboxFactory; + + /** + * @return the infoboxFactory + */ + public InfoboxFactory getInfoboxFactory() { + return infoboxFactory; + } + + /** + * @param infoboxFactory the infoboxFactory to set + */ + public void setInfoboxFactory(InfoboxFactory infoboxFactory) { + this.infoboxFactory = infoboxFactory; + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractInfoboxCommandImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractInfoboxCommandImpl.java index 8a7edb71..8a54260f 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractInfoboxCommandImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractInfoboxCommandImpl.java @@ -16,7 +16,6 @@ */ package at.gv.egiz.bku.slcommands.impl; -import at.gv.egiz.bku.slcommands.SLCommandContext; import at.gv.egiz.bku.slexceptions.SLCommandException; /** @@ -32,15 +31,34 @@ public abstract class AbstractInfoboxCommandImpl<T> extends SLCommandImpl<T> { * The infobox implementation. */ protected Infobox infobox; + + /** + * The infobox factory. + */ + protected InfoboxFactory infoboxFactory; + + /** + * @return the infoboxFactory + */ + public InfoboxFactory getInfoboxFactory() { + return infoboxFactory; + } + + /** + * @param infoboxFactory the infoboxFactory to set + */ + public void setInfoboxFactory(InfoboxFactory infoboxFactory) { + this.infoboxFactory = infoboxFactory; + } @Override - public void init(SLCommandContext ctx, Object request) + public void init(Object request) throws SLCommandException { - super.init(ctx, request); + super.init(request); String infoboxIdentifier = getInfoboxIdentifier(getRequestValue()); - infobox = InfoboxFactory.getInstance().createInfobox(infoboxIdentifier); + infobox = infoboxFactory.createInfobox(infoboxIdentifier); } /** diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractInfoboxFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractInfoboxFactory.java new file mode 100644 index 00000000..410d0cf8 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/AbstractInfoboxFactory.java @@ -0,0 +1,24 @@ +/* +* Copyright 2009 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.slcommands.impl; + +public abstract class AbstractInfoboxFactory { + + public abstract Infobox createInfobox(); + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CardChannelInfoboxFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CardChannelInfoboxFactory.java new file mode 100644 index 00000000..ec46f8ac --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CardChannelInfoboxFactory.java @@ -0,0 +1,27 @@ +/* +* Copyright 2009 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.slcommands.impl; + +public class CardChannelInfoboxFactory extends AbstractInfoboxFactory { + + @Override + public Infobox createInfobox() { + return new CardChannelInfoboxImpl(); + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CardChannelInfoboxImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CardChannelInfoboxImpl.java index 19b84ac7..a7851b1e 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CardChannelInfoboxImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CardChannelInfoboxImpl.java @@ -30,8 +30,8 @@ import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.buergerkarte.namespaces.cardchannel.ATRType; import at.buergerkarte.namespaces.cardchannel.CommandAPDUType; @@ -58,7 +58,7 @@ import at.gv.egiz.stal.ext.APDUScriptResponse.ResponseScriptElement; public class CardChannelInfoboxImpl extends AbstractBinaryFileInfobox { - private static Log log = LogFactory.getLog(CardChannelInfoboxImpl.class); + private final Logger log = LoggerFactory.getLogger(CardChannelInfoboxImpl.class); private static WeakHashMap<STAL, JAXBElement<ResponseType>> scriptResults = new WeakHashMap<STAL, JAXBElement<ResponseType>>(); @@ -149,7 +149,7 @@ public class CardChannelInfoboxImpl extends AbstractBinaryFileInfobox { } - log.info("Infobox identifier is '" + getIdentifier() + "' but XMLContent does not contain 'Script'."); + log.info("Infobox identifier is '{}' but XMLContent does not contain 'Script'.", getIdentifier()); throw new SLCommandException(4010); } @@ -217,9 +217,7 @@ public class CardChannelInfoboxImpl extends AbstractBinaryFileInfobox { ResponseAPDUType responseAPDUType = objectFactory.createResponseAPDUType(); responseAPDUType.setSequence(BigInteger.valueOf(response.getSequence())); -// if (response.getRc() != 0) { - responseAPDUType.setRc(BigInteger.valueOf(response.getRc())); -// } + responseAPDUType.setRc(BigInteger.valueOf(response.getRc())); responseAPDUType.setSw(response.getSw()); responseAPDUType.setValue(response.getApdu()); diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CertificatesInfoboxFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CertificatesInfoboxFactory.java new file mode 100644 index 00000000..5474f249 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CertificatesInfoboxFactory.java @@ -0,0 +1,27 @@ +/* +* Copyright 2009 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.slcommands.impl; + +public class CertificatesInfoboxFactory extends AbstractInfoboxFactory { + + @Override + public Infobox createInfobox() { + return new CertificatesInfoboxImpl(); + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CertificatesInfoboxImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CertificatesInfoboxImpl.java index 0208f137..8a80e824 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CertificatesInfoboxImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CertificatesInfoboxImpl.java @@ -23,8 +23,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.slcommands.SLCommandContext; import at.gv.egiz.bku.slexceptions.SLCommandException; @@ -42,7 +42,7 @@ public class CertificatesInfoboxImpl extends AbstractAssocArrayInfobox { /** * Logging facility. */ - private static Log log = LogFactory.getLog(CertificatesInfoboxImpl.class); + private final Logger log = LoggerFactory.getLogger(CertificatesInfoboxImpl.class); /** * The valid keys. diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureCommandFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureCommandFactory.java new file mode 100644 index 00000000..750c2838 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureCommandFactory.java @@ -0,0 +1,65 @@ +/* +* Copyright 2009 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.slcommands.impl; + +import javax.xml.bind.JAXBElement; + +import org.apache.commons.configuration.Configuration; + +import at.gv.egiz.bku.conf.MoccaConfigurationFacade; +import at.gv.egiz.bku.slcommands.AbstractSLCommandFactory; +import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slcommands.impl.xsect.DataObject; +import at.gv.egiz.bku.slexceptions.SLCommandException; + +public class CreateXMLSignatureCommandFactory extends AbstractSLCommandFactory { + + private ConfigurationFacade configurationFacade = new ConfigurationFacade(); + + private class ConfigurationFacade implements MoccaConfigurationFacade { + + public static final String VALIDATE_HASH_DATA_INPUTS = "ValidateHashDataInputs"; + + public boolean getValidateHashDataInputs() { + return configuration.getBoolean(VALIDATE_HASH_DATA_INPUTS, true); + } + + } + + @Override + public SLCommand createSLCommand(JAXBElement<?> element) throws SLCommandException { + + CreateXMLSignatureCommandImpl command = new CreateXMLSignatureCommandImpl(); + command.init(element); + return command; + + } + + /* (non-Javadoc) + * @see at.gv.egiz.bku.slcommands.AbstractSLCommandFactory#setConfiguration(org.apache.commons.configuration.Configuration) + */ + @Override + public void setConfiguration(Configuration configuration) { + // static configuration + super.setConfiguration(configuration); + DataObject.enableHashDataInputValidation(configurationFacade.getValidateHashDataInputs()); + } + + + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureCommandImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureCommandImpl.java index 01686641..d52027b2 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureCommandImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureCommandImpl.java @@ -26,8 +26,8 @@ import javax.xml.crypto.MarshalException; import javax.xml.crypto.URIReferenceException; import javax.xml.crypto.dsig.XMLSignatureException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.LSSerializer; @@ -62,8 +62,7 @@ public class CreateXMLSignatureCommandImpl extends /** * Logging facility. */ - protected static Log log = LogFactory - .getLog(CreateXMLSignatureCommandImpl.class); + private final Logger log = LoggerFactory.getLogger(CreateXMLSignatureCommandImpl.class); /** * The signing certificate. @@ -79,23 +78,22 @@ public class CreateXMLSignatureCommandImpl extends * The to-be signed signature. */ protected Signature signature; - - @Override - public void init(SLCommandContext ctx, Object unmarshalledRequest) - throws SLCommandException { - super.init(ctx, unmarshalledRequest); - } - + + /** + * Disable hash data input validation? + */ + protected boolean disableHashdataInputValidation; + @Override - public void prepareXMLSignature() throws SLCommandException, + public void prepareXMLSignature(SLCommandContext commandContext) throws SLCommandException, SLRequestException { CreateXMLSignatureRequestType request = getRequestValue(); - // TODO: make configurable?
+ // TODO: make configurable? IdValueFactory idValueFactory = new IdValueFactoryImpl(); - // TODO: make configurable?
+ // TODO: make configurable? AlgorithmMethodFactory algorithmMethodFactory; try { algorithmMethodFactory = new AlgorithmMethodFactoryImpl( @@ -105,21 +103,21 @@ public class CreateXMLSignatureCommandImpl extends throw new SLCommandException(4006); } - signature = new Signature(getCmdCtx().getURLDereferencerContext(), + signature = new Signature(commandContext.getURLDereferencer(), idValueFactory, algorithmMethodFactory); - // SigningTime
+ // SigningTime signature.setSigningTime(new Date()); - // SigningCertificate
+ // SigningCertificate signature.setSignerCeritifcate(signingCertificate); - // SignatureInfo
+ // SignatureInfo if (request.getSignatureInfo() != null) { signature.setSignatureInfo(request.getSignatureInfo()); } - // DataObjects
+ // DataObjects for (DataObjectInfoType dataObjectInfo : request.getDataObjectInfo()) { signature.addDataObject(dataObjectInfo); } @@ -130,11 +128,12 @@ public class CreateXMLSignatureCommandImpl extends /** * Gets the signing certificate from STAL. + * @param commandContext TODO * * @throws SLCommandException * if getting the singing certificate fails */ - private void getSigningCertificate() throws SLCommandException { + private void getSigningCertificate(SLCommandContext commandContext) throws SLCommandException { CreateXMLSignatureRequestType request = getRequestValue(); keyboxIdentifier = request.getKeyboxIdentifier(); @@ -142,6 +141,8 @@ public class CreateXMLSignatureCommandImpl extends InfoboxReadRequest stalRequest = new InfoboxReadRequest(); stalRequest.setInfoboxIdentifier(keyboxIdentifier); + STALHelper stalHelper = new STALHelper(commandContext.getSTAL()); + stalHelper.transmitSTALRequest(Collections.singletonList((STALRequest) stalRequest)); List<X509Certificate> certificates = stalHelper.getCertificatesFromResponses(); if (certificates == null || certificates.size() != 1) { @@ -154,15 +155,16 @@ public class CreateXMLSignatureCommandImpl extends /** * Signs the signature. + * @param commandContext TODO * * @throws SLCommandException * if signing the signature fails * @throws SLViewerException */ - private void signXMLSignature() throws SLCommandException, SLViewerException { + private void signXMLSignature(SLCommandContext commandContext) throws SLCommandException, SLViewerException { try { - signature.sign(getCmdCtx().getSTAL(), keyboxIdentifier); + signature.sign(commandContext.getSTAL(), keyboxIdentifier); } catch (MarshalException e) { log.error("Failed to marshall XMLSignature.", e); throw new SLCommandException(4000); @@ -181,33 +183,42 @@ public class CreateXMLSignatureCommandImpl extends } @Override - public SLResult execute() { + public SLResult execute(SLCommandContext commandContext) { try { // get certificate in order to select appropriate algorithms for hashing - // and signing
- getSigningCertificate(); - - // prepare the XMLSignature for signing
- prepareXMLSignature(); + // and signing + log.info("Requesting signing certificate."); + getSigningCertificate(commandContext); + if (log.isDebugEnabled()) { + log.debug("Got signing certificate. {}", signingCertificate); + } else { + log.info("Got signing certificate."); + } - // sign the XMLSignature
- signXMLSignature(); + // prepare the XMLSignature for signing + log.info("Preparing XML signature."); + prepareXMLSignature(commandContext); - if (log.isTraceEnabled()) { + // sign the XMLSignature + log.info("Signing XML signature."); + signXMLSignature(commandContext); + if (log.isDebugEnabled()) { DOMImplementationLS domImplLS = DOMUtils.getDOMImplementationLS(); LSSerializer serializer = domImplLS.createLSSerializer(); String debugString = serializer.writeToString(signature.getDocument()); - log.trace(debugString); + log.debug(debugString); + } else { + log.info("XML signature signed."); } return new CreateXMLSignatureResultImpl(signature.getDocument()); } catch (SLException e) { - return new ErrorResultImpl(e, cmdCtx.getLocale()); + return new ErrorResultImpl(e, commandContext.getLocale()); } } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureResultImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureResultImpl.java index 19df4334..51b54a37 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureResultImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureResultImpl.java @@ -22,8 +22,8 @@ import javax.xml.bind.Marshaller; import javax.xml.transform.Result; import javax.xml.transform.Templates; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Element; @@ -31,6 +31,7 @@ import org.w3c.dom.Node; import at.buergerkarte.namespaces.securitylayer._1.CreateXMLSignatureResponseType; import at.buergerkarte.namespaces.securitylayer._1.ObjectFactory; +import at.gv.egiz.bku.slcommands.CreateXMLSignatureResult; import at.gv.egiz.bku.slcommands.SLMarshallerFactory; import at.gv.egiz.bku.slexceptions.SLRuntimeException; @@ -39,12 +40,12 @@ import at.gv.egiz.bku.slexceptions.SLRuntimeException; * * @author mcentner */ -public class CreateXMLSignatureResultImpl extends SLResultImpl { +public class CreateXMLSignatureResultImpl extends SLResultImpl implements CreateXMLSignatureResult { /** * Logging facility. */ - private static Log log = LogFactory.getLog(CreateXMLSignatureResultImpl.class); + private final Logger log = LoggerFactory.getLogger(CreateXMLSignatureResultImpl.class); /** * The document containing the XMLSignature. @@ -52,6 +53,11 @@ public class CreateXMLSignatureResultImpl extends SLResultImpl { protected Document doc; /** + * The content of the CreateXMLSignatureResponse. + */ + protected Element content; + + /** * Creates a new instance of this CreateXMLSignatureResultImpl with the given * signature <code>document</code>. * @@ -67,6 +73,7 @@ public class CreateXMLSignatureResultImpl extends SLResultImpl { } this.doc = document; + this.content = document.getDocumentElement(); marshallCreateXMLSignatureResponse(); } @@ -78,7 +85,7 @@ public class CreateXMLSignatureResultImpl extends SLResultImpl { ObjectFactory factory = new ObjectFactory(); - CreateXMLSignatureResponseType createCreateXMLSignatureResponseType = factory.createCreateXMLSignatureResponseType(); + at.gv.egiz.slbinding.impl.CreateXMLSignatureResponseType createCreateXMLSignatureResponseType = factory.createCreateXMLSignatureResponseType(); JAXBElement<CreateXMLSignatureResponseType> createCreateXMLSignatureResponse = factory.createCreateXMLSignatureResponse(createCreateXMLSignatureResponseType); DocumentFragment fragment = doc.createDocumentFragment(); @@ -87,14 +94,13 @@ public class CreateXMLSignatureResultImpl extends SLResultImpl { try { marshaller.marshal(createCreateXMLSignatureResponse, fragment); } catch (JAXBException e) { - log.error("Failed to marshall 'CreateXMLSignatureResponse'", e); + log.error("Failed to marshall 'CreateXMLSignatureResponse'.", e); throw new SLRuntimeException(e); } Node child = fragment.getFirstChild(); if (child instanceof Element) { - Node node = doc.replaceChild(child, doc.getDocumentElement()); - child.appendChild(node); + child.appendChild(doc.replaceChild(child, content)); } } @@ -104,4 +110,9 @@ public class CreateXMLSignatureResultImpl extends SLResultImpl { writeTo(doc, result, templates, fragment); } + @Override + public Element getContent() { + return content; + } + } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/DomCreateXMLSignatureResultImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/DomCreateXMLSignatureResultImpl.java new file mode 100644 index 00000000..6d8537d6 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/DomCreateXMLSignatureResultImpl.java @@ -0,0 +1,47 @@ +/* +* Copyright 2009 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.slcommands.impl; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import at.gv.egiz.bku.slcommands.CreateXMLSignatureResult; + +public class DomCreateXMLSignatureResultImpl extends DomSLResult implements + CreateXMLSignatureResult { + + public DomCreateXMLSignatureResultImpl(Element resultElement) { + super(resultElement); + } + + @Override + public Element getContent() { + + NodeList children = resultElement.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node child = children.item(i); + if (child.getNodeType() == Node.ELEMENT_NODE) { + return (Element) child; + } + } + + return null; + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/DomErrorResultImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/DomErrorResultImpl.java new file mode 100644 index 00000000..6bb52a00 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/DomErrorResultImpl.java @@ -0,0 +1,70 @@ +/* +* Copyright 2009 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.slcommands.impl; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import at.gv.egiz.bku.slcommands.ErrorResult; +import at.gv.egiz.bku.slcommands.SLCommand; + +public class DomErrorResultImpl extends DomSLResult implements + ErrorResult { + + public DomErrorResultImpl(Element resultElement) { + super(resultElement); + } + + @Override + public int getErrorCode() { + + NodeList childNodes = resultElement.getChildNodes(); + for (int i = 0; i < childNodes.getLength(); i++) { + Node n = childNodes.item(i); + if (n.getNodeType() == Node.ELEMENT_NODE + && SLCommand.NAMESPACE_URI.equals(n.getNamespaceURI()) + && "ErrorCode".equals(n.getLocalName())) { + try { + return Integer.parseInt(n.getTextContent()); + } catch (NumberFormatException e) { } + } + } + + return 0; + + } + + @Override + public String getInfo() { + + NodeList childNodes = resultElement.getChildNodes(); + for (int i = 0; i < childNodes.getLength(); i++) { + Node n = childNodes.item(i); + if (n.getNodeType() == Node.ELEMENT_NODE + && SLCommand.NAMESPACE_URI.equals(n.getNamespaceURI()) + && "Info".equals(n.getLocalName())) { + return n.getTextContent(); + } + } + + return null; + + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/DomInfoboxReadResultImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/DomInfoboxReadResultImpl.java new file mode 100644 index 00000000..ce69c852 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/DomInfoboxReadResultImpl.java @@ -0,0 +1,105 @@ +/* +* Copyright 2009 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.slcommands.impl; + +import iaik.utils.Base64InputStream; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import at.gv.egiz.bku.slcommands.InfoboxReadResult; +import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slexceptions.SLRuntimeException; +import at.gv.egiz.bku.utils.StreamUtil; + +public class DomInfoboxReadResultImpl extends DomSLResult implements + InfoboxReadResult { + + public DomInfoboxReadResultImpl(Element resultElement) { + super(resultElement); + } + + private List<Node> getXMLContent(Node node) { + ArrayList<Node> content = new ArrayList<Node>(); + NodeList xmlContent = node.getChildNodes(); + for (int i = 0; i < xmlContent.getLength(); i++) { + content.add(xmlContent.item(i)); + } + return content; + } + + private byte[] getBase64Content(Node node) { + String content = node.getTextContent(); + if (content != null) { + try { + byte[] bytes = content.getBytes("ASCII"); + Base64InputStream bis = new Base64InputStream(new ByteArrayInputStream(bytes)); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + StreamUtil.copyStream(bis, bos); + return bos.toByteArray(); + } catch (UnsupportedEncodingException e) { + throw new SLRuntimeException(e); + } catch (IOException e) { + throw new SLRuntimeException(e); + } + } else { + return new byte[] {}; + } + } + + private Object getBinaryFileDataContent(Node node) { + NodeList childNodes = node.getChildNodes(); + for (int i = 0; i < childNodes.getLength(); i++) { + Node n = childNodes.item(i); + if (n.getNodeType() == Node.ELEMENT_NODE && SLCommand.NAMESPACE_URI.equals(n.getNamespaceURI())) { + if ("XMLContent".equals(n.getLocalName())) { + return getXMLContent(n); + } else if ("Base64Content".equals(n.getLocalName())) { + return getBase64Content(n); + } + } + } + return Collections.EMPTY_LIST; + } + + @Override + public Object getContent() { + + NodeList childNodes = resultElement.getChildNodes(); + for (int i = 0; i < childNodes.getLength(); i++) { + Node node = childNodes.item(i); + if (node.getNodeType() == Node.ELEMENT_NODE + && SLCommand.NAMESPACE_URI.equals(node.getNamespaceURI()) + && "BinaryFileData".equals(node.getLocalName())) { + return getBinaryFileDataContent(node); + } + } + return Collections.EMPTY_LIST; + + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/DomSLResult.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/DomSLResult.java new file mode 100644 index 00000000..ad81b388 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/DomSLResult.java @@ -0,0 +1,41 @@ +/* +* Copyright 2009 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.slcommands.impl; + +import javax.xml.transform.Result; +import javax.xml.transform.Templates; + +import org.w3c.dom.Element; + + +public abstract class DomSLResult extends SLResultImpl { + + protected Element resultElement; + + public DomSLResult(Element resultElement) { + this.resultElement= resultElement; + } + + @Override + public void writeTo(Result result, Templates templates, boolean fragment) { + writeTo(resultElement.getOwnerDocument(), result, templates, fragment); + } + + + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/ErrorResultImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/ErrorResultImpl.java index aedde238..4eb01490 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/ErrorResultImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/ErrorResultImpl.java @@ -63,5 +63,23 @@ public class ErrorResultImpl extends SLResultImpl implements ErrorResult { writeErrorTo(slException, result, templates, locale, fragment); } } + + @Override + public int getErrorCode() { + if (slException != null) { + return slException.getErrorCode(); + } else { + return -1; + } + } + + @Override + public String getInfo() { + if (slException != null) { + return slException.getLocalizedMessage(locale); + } else { + return null; + } + } }
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/GetStatusCommandFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/GetStatusCommandFactory.java new file mode 100644 index 00000000..2a29b8da --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/GetStatusCommandFactory.java @@ -0,0 +1,37 @@ +/* +* Copyright 2009 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.slcommands.impl; + +import javax.xml.bind.JAXBElement; + +import at.gv.egiz.bku.slcommands.AbstractSLCommandFactory; +import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slexceptions.SLCommandException; + +public class GetStatusCommandFactory extends AbstractSLCommandFactory { + + @Override + public SLCommand createSLCommand(JAXBElement<?> element) throws SLCommandException { + + GetStatusCommandImpl command = new GetStatusCommandImpl(); + command.init(element); + return command; + + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/GetStatusCommandImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/GetStatusCommandImpl.java index 0c2b96f9..d58141a1 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/GetStatusCommandImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/GetStatusCommandImpl.java @@ -19,6 +19,7 @@ package at.gv.egiz.bku.slcommands.impl; import at.buergerkarte.namespaces.securitylayer._1.GetStatusRequestType; import at.gv.egiz.bku.slcommands.GetStatusCommand; +import at.gv.egiz.bku.slcommands.SLCommandContext; import at.gv.egiz.bku.slcommands.SLResult; import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.stal.ErrorResponse; @@ -28,8 +29,8 @@ import at.gv.egiz.stal.StatusRequest; import at.gv.egiz.stal.StatusResponse; import java.util.Collections; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -37,7 +38,7 @@ import org.apache.commons.logging.LogFactory; */ public class GetStatusCommandImpl extends SLCommandImpl<GetStatusRequestType> implements GetStatusCommand { - protected static Log log = LogFactory.getLog(GetStatusCommandImpl.class); + protected final Logger log = LoggerFactory.getLogger(GetStatusCommandImpl.class); @Override public String getName() { @@ -45,16 +46,15 @@ public class GetStatusCommandImpl extends SLCommandImpl<GetStatusRequestType> im } @Override - public SLResult execute() { + public SLResult execute(SLCommandContext commandContext) { //ignore maxDelay and TokenStatus -// GetStatusRequestType req = getRequestValue(); - log.debug("execute GetStatusRequest"); + log.debug("Execute GetStatusRequest."); StatusRequest stalRequest = new StatusRequest(); - STAL stal = cmdCtx.getSTAL(); + STAL stal = commandContext.getSTAL(); List<STALResponse> responses = stal.handleRequest(Collections.singletonList(stalRequest)); @@ -62,16 +62,16 @@ public class GetStatusCommandImpl extends SLCommandImpl<GetStatusRequestType> im STALResponse stalResponse = responses.get(0); if (stalResponse instanceof StatusResponse) { boolean ready = ((StatusResponse) stalResponse).isCardReady(); - log.trace("received status response cardReady: " + ready); + log.trace("Received status response cardReady: {}.", ready); return new GetStatusResultImpl(ready); } else if (stalResponse instanceof ErrorResponse) { - log.debug("received error response"); + log.debug("Received error response."); SLCommandException ex = new SLCommandException(((ErrorResponse) stalResponse).getErrorCode()); - return new ErrorResultImpl(ex, cmdCtx.getLocale()); + return new ErrorResultImpl(ex, commandContext.getLocale()); } } - log.error("received unexpected responses"); - return new ErrorResultImpl(new SLCommandException(4000), cmdCtx.getLocale()); + log.error("Received unexpected responses."); + return new ErrorResultImpl(new SLCommandException(4000), commandContext.getLocale()); } } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/IdentityLinkInfoboxFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/IdentityLinkInfoboxFactory.java new file mode 100644 index 00000000..c19f52ac --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/IdentityLinkInfoboxFactory.java @@ -0,0 +1,48 @@ +/* +* Copyright 2009 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.slcommands.impl; + +import at.gv.egiz.idlink.IdentityLinkTransformer; + +public class IdentityLinkInfoboxFactory extends AbstractInfoboxFactory { + + private IdentityLinkTransformer identityLinkTransformer; + + @Override + public Infobox createInfobox() { + IdentityLinkInfoboxImpl infoboxImpl = new IdentityLinkInfoboxImpl(); + infoboxImpl.setIdentityLinkTransformer(identityLinkTransformer); + return infoboxImpl; + } + + /** + * @return the identityLinkTransformer + */ + public IdentityLinkTransformer getIdentityLinkTransformer() { + return identityLinkTransformer; + } + + /** + * @param identityLinkTransformer the identityLinkTransformer to set + */ + public void setIdentityLinkTransformer( + IdentityLinkTransformer identityLinkTransformer) { + this.identityLinkTransformer = identityLinkTransformer; + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/IdentityLinkInfoboxImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/IdentityLinkInfoboxImpl.java index 160e9589..ec873e20 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/IdentityLinkInfoboxImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/IdentityLinkInfoboxImpl.java @@ -37,8 +37,8 @@ import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; @@ -68,13 +68,30 @@ public class IdentityLinkInfoboxImpl extends AbstractBinaryFileInfobox { /** * Logging facility. */ - private static Log log = LogFactory.getLog(IdentityLinkInfoboxImpl.class); + private final Logger log = LoggerFactory.getLogger(IdentityLinkInfoboxImpl.class); /** * The box specific parameter <code>IdentityLinkDomainIdentifier</code>. */ public static final String BOX_SPECIFIC_PARAMETER_IDENTITY_LINK_DOMAIN_IDENTIFIER = "IdentityLinkDomainIdentifier"; + private IdentityLinkTransformer identityLinkTransformer; + + /** + * @return the identityLinkTransformer + */ + public IdentityLinkTransformer getIdentityLinkTransformer() { + return identityLinkTransformer; + } + + /** + * @param identityLinkTransformer the identityLinkTransformer to set + */ + public void setIdentityLinkTransformer( + IdentityLinkTransformer identityLinkTransformer) { + this.identityLinkTransformer = identityLinkTransformer; + } + /** * The value of the box specific parameter <code>IdentityLinkDomainIdentifier</code>. */ @@ -147,7 +164,6 @@ public class IdentityLinkInfoboxImpl extends AbstractBinaryFileInfobox { JAXBElement<CompressedIdentityLinkType> compressedIdentityLink = idLinkFactory .createCompressedIdentityLink(identityLink, certificates, getDomainIdentifier()); - IdentityLinkTransformer identityLinkTransformer = IdentityLinkTransformer.getInstance(); String issuerTemplate = identityLink.getIssuerTemplate(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); @@ -262,12 +278,12 @@ public class IdentityLinkInfoboxImpl extends AbstractBinaryFileInfobox { Transformer transformer = transformerFactory.newTransformer(); transformer.transform(xmlSource, new StreamResult(resultBytes)); } catch (TransformerConfigurationException e) { - log.error(e); + log.error("Failed to transform identity link.", e); throw new SLCommandException(4000, SLExceptionMessages.EC4000_UNCLASSIFIED_IDLINK_TRANSFORMATION_FAILED, new Object[] { issuerTemplate }); } catch (TransformerException e) { - log.error(e); + log.error("Failed to transform identity link.", e); throw new SLCommandException(4000, SLExceptionMessages.EC4000_UNCLASSIFIED_IDLINK_TRANSFORMATION_FAILED, new Object[] { issuerTemplate }); diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxFactory.java index e9736f6d..5ba06ac4 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxFactory.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxFactory.java @@ -17,10 +17,9 @@ package at.gv.egiz.bku.slcommands.impl; import java.util.HashMap; -import java.util.Map; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.bku.slexceptions.SLExceptionMessages; @@ -36,71 +35,27 @@ public class InfoboxFactory { /** * Logging facility. */ - private static Log log = LogFactory.getLog(InfoboxFactory.class); + private final Logger log = LoggerFactory.getLogger(InfoboxFactory.class); /** - * The singleton instance of this InfoboxFactory. + * The mapping of Infobox name to concrete Infobox factory. */ - private static InfoboxFactory instance; - - /** - * @return an instance of this InfoboxFactory - */ - public synchronized static InfoboxFactory getInstance() { - if (instance == null) { - instance = new InfoboxFactory(); - } - return instance; - } - - /** - * The mapping of infobox identifier to implementation class. - */ - private HashMap<String, Class<? extends Infobox>> implementations; - - /** - * Private constructor. - */ - private InfoboxFactory() { - } - - /** - * Sets the mapping of infobox identifier to implementation class name. - * - * @param infoboxImplMap - * a mapping of infobox identifiers to implementation class names - * - * @throws ClassNotFoundException - * if implementation class is not an instance of {@link Infobox} - */ - @SuppressWarnings("unchecked") - public void setInfoboxImpl(Map<String, String> infoboxImplMap) throws ClassNotFoundException { - HashMap<String, Class<? extends Infobox>> implMap = new HashMap<String, Class<? extends Infobox>>(); - ClassLoader cl = getClass().getClassLoader(); - for (String key : infoboxImplMap.keySet()) { - Class<? extends Infobox> impl = (Class<? extends Infobox>) cl.loadClass(infoboxImplMap.get(key)); - log.debug("Registering infobox '" + key + "' implementation '" + impl.getCanonicalName() + "'."); - implMap.put(key, impl); - } - implementations = implMap; - } - + private HashMap<String, AbstractInfoboxFactory> infoboxFactories = new HashMap<String, AbstractInfoboxFactory>(); + /** - * Returns the configured implementation class for the given - * <code>infoboxIdentifier</code>. - * - * @param infoboxIdentifier - * the infobox identifier - * - * @return the implementation class for the given infobox identifier or - * <code>null</code> if there is no implementation class configured + * @param infoboxFactories the infoboxFactories to set */ - public Class<? extends Infobox> getImplClass(String infoboxIdentifier) { - if (implementations != null) { - return implementations.get(infoboxIdentifier); - } else { - return null; + public void setInfoboxFactories( + HashMap<String, AbstractInfoboxFactory> factories) { + if (log.isDebugEnabled()) { + StringBuilder sb = new StringBuilder(); + sb.append("Registered infobox factories for"); + for (String name : factories.keySet()) { + sb.append("\n " + name + " : " + factories.get(name).getClass()); + } + log.debug(sb.toString()); } + this.infoboxFactories = factories; } /** @@ -119,31 +74,15 @@ public class InfoboxFactory { */ public Infobox createInfobox(String infoboxIdentifier) throws SLCommandException, SLRuntimeException { - Class<? extends Infobox> implClass = getImplClass(infoboxIdentifier); - if (implClass == null) { - // infobox not supported - log.info("Unsupported infobox '" + infoboxIdentifier + "."); + AbstractInfoboxFactory factory = infoboxFactories.get(infoboxIdentifier); + if (factory == null) { + log.info("Unsupported infobox '{}'.", infoboxIdentifier); throw new SLCommandException(4002, SLExceptionMessages.EC4002_INFOBOX_UNKNOWN, new Object[] { infoboxIdentifier }); } - // try to instantiate - Infobox infobox; - try { - infobox = implClass.newInstance(); - log.debug("Infobox '" + infobox.getIdentifier() + "' created."); - } catch (InstantiationException e) { - // unexpected error - log.error("Failed to instantiate infobox implementation.", e); - throw new SLRuntimeException(e); - } catch (IllegalAccessException e) { - // unexpected error - log.error("Failed to instantiate infobox implementation.", e); - throw new SLRuntimeException(e); - } - - return infobox; + return factory.createInfobox(); } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadCommandFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadCommandFactory.java new file mode 100644 index 00000000..a9ba28e4 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadCommandFactory.java @@ -0,0 +1,37 @@ +/* +* Copyright 2009 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.slcommands.impl; + +import javax.xml.bind.JAXBElement; + +import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slexceptions.SLCommandException; + +public class InfoboxReadCommandFactory extends AbstractInfoboxCommandFactory { + + @Override + public SLCommand createSLCommand(JAXBElement<?> element) throws SLCommandException { + + InfoboxReadCommandImpl command = new InfoboxReadCommandImpl(); + command.setInfoboxFactory(infoboxFactory); + command.init(element); + return command; + + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadCommandImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadCommandImpl.java index 693f444f..736e7cbb 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadCommandImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadCommandImpl.java @@ -14,50 +14,50 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.slcommands.impl;
-
-import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +package at.gv.egiz.bku.slcommands.impl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.buergerkarte.namespaces.securitylayer._1.InfoboxReadRequestType; import at.gv.egiz.bku.slcommands.InfoboxReadCommand; import at.gv.egiz.bku.slcommands.SLCommandContext; import at.gv.egiz.bku.slcommands.SLResult; import at.gv.egiz.bku.slexceptions.SLCommandException; -
-/**
- * This class implements the security layer command
- * <code>InfoboxReadRequest</code>.
- * <p>
- * <b>NOTE:</b> Currently the only supported infobox identifier is '
- * <code>IdentityLink</code>'.
- * </p>
- *
- * @author mcentner
- */
-public class InfoboxReadCommandImpl extends AbstractInfoboxCommandImpl<InfoboxReadRequestType> implements
- InfoboxReadCommand {
-
- /**
- * Logging facility.
- */
- protected static Log log = LogFactory.getLog(InfoboxReadCommandImpl.class); + +/** + * This class implements the security layer command + * <code>InfoboxReadRequest</code>. + * <p> + * <b>NOTE:</b> Currently the only supported infobox identifier is ' + * <code>IdentityLink</code>'. + * </p> + * + * @author mcentner + */ +public class InfoboxReadCommandImpl extends AbstractInfoboxCommandImpl<InfoboxReadRequestType> implements + InfoboxReadCommand { + + /** + * Logging facility. + */ + protected final Logger log = LoggerFactory.getLogger(InfoboxReadCommandImpl.class); - @Override
- public String getName() {
- return "InfoboxReadRequest";
- }
-
+ @Override + public String getName() { + return "InfoboxReadRequest"; + } + @Override protected String getInfoboxIdentifier(InfoboxReadRequestType request) { return request.getInfoboxIdentifier(); } - @Override
- public void init(SLCommandContext ctx, Object request) throws SLCommandException {
- super.init(ctx, request);
-
- InfoboxReadRequestType req = getRequestValue();
+ @Override + public void init(Object request) throws SLCommandException { + super.init(request); + + InfoboxReadRequestType req = getRequestValue(); if (req.getAssocArrayParameters() != null && !(infobox instanceof AssocArrayInfobox)) { @@ -70,20 +70,20 @@ public class InfoboxReadCommandImpl extends AbstractInfoboxCommandImpl<InfoboxRe log.info("Got BinaryFileParameters but Infobox type is not BinaryFile."); throw new SLCommandException(4010); } -
- }
-
- @Override
- public SLResult execute() { + + } + + @Override + public SLResult execute(SLCommandContext commandContext) { try { - return infobox.read(getRequestValue(), getCmdCtx()); + return infobox.read(getRequestValue(), commandContext); } catch (SLCommandException e) { - return new ErrorResultImpl(e, getCmdCtx().getLocale()); + return new ErrorResultImpl(e, commandContext.getLocale()); } - }
-
+ } + @Override public String getIdentityLinkDomainId() { if (infobox instanceof IdentityLinkInfoboxImpl) { @@ -93,4 +93,4 @@ public class InfoboxReadCommandImpl extends AbstractInfoboxCommandImpl<InfoboxRe } } -}
+} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java index 422b424f..ddbbcadc 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultFileImpl.java @@ -16,6 +16,9 @@ */ package at.gv.egiz.bku.slcommands.impl; +import java.util.ArrayList; +import java.util.Collections; + import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; @@ -25,8 +28,8 @@ import javax.xml.transform.Result; import javax.xml.transform.Templates; import javax.xml.transform.dom.DOMResult; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -51,12 +54,17 @@ public class InfoboxReadResultFileImpl extends SLResultImpl implements /** * Logging facility. */ - protected static Log log = LogFactory.getLog(InfoboxReadResultFileImpl.class); + protected final Logger log = LoggerFactory.getLogger(InfoboxReadResultFileImpl.class); /** * The XML document containing the infobox content. */ protected Document xmlDocument; + + /** + * Binary content of the infobox (may be <code>null</code>). + */ + protected byte[] binaryContent; /** * Creates the response document from the given <code>binaryContent</code>. @@ -147,14 +155,34 @@ public class InfoboxReadResultFileImpl extends SLResultImpl implements * @param resultBytes */ public void setResultBytes(byte[] resultBytes) { - - xmlDocument = createResponseDocument(resultBytes, false); - + this.binaryContent = resultBytes; } @Override public void writeTo(Result result, Templates templates, boolean fragment) { + if (xmlDocument == null) { + xmlDocument = createResponseDocument(binaryContent, false); + } writeTo(xmlDocument, result, templates, fragment); } + @Override + public Object getContent() { + if (xmlDocument != null) { + NodeList nodes = xmlDocument.getElementsByTagNameNS(SLCommand.NAMESPACE_URI, "XMLContent"); + if (nodes.getLength() > 0) { + NodeList children = nodes.item(0).getChildNodes(); + ArrayList<Node> content = new ArrayList<Node>(); + for (int i = 0; i < children.getLength(); i++) { + content.add(children.item(i)); + } + return Collections.unmodifiableList(content); + } else { + return null; + } + } else { + return binaryContent; + } + } + } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultImpl.java index 271ec955..3be6c8f8 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadResultImpl.java @@ -61,4 +61,22 @@ public class InfoboxReadResultImpl extends SLResultImpl implements InfoboxReadRe writeTo(response, result, templates, fragment); } + @Override + public Object getContent() { + if (infoboxReadResponse != null) { + if (infoboxReadResponse.getAssocArrayData() != null) { + return infoboxReadResponse.getAssocArrayData(); + } else { + Base64XMLContentType binaryFileData = infoboxReadResponse.getBinaryFileData(); + if (binaryFileData.getBase64Content() != null) { + return binaryFileData.getBase64Content(); + } else { + return binaryFileData.getXMLContent().getContent(); + } + } + } else { + return null; + } + } + } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxUpdateCommandFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxUpdateCommandFactory.java new file mode 100644 index 00000000..0d421b2f --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxUpdateCommandFactory.java @@ -0,0 +1,37 @@ +/* +* Copyright 2009 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.slcommands.impl; + +import javax.xml.bind.JAXBElement; + +import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slexceptions.SLCommandException; + +public class InfoboxUpdateCommandFactory extends AbstractInfoboxCommandFactory { + + @Override + public SLCommand createSLCommand(JAXBElement<?> element) throws SLCommandException { + + InfoboxUpdateCommandImpl command = new InfoboxUpdateCommandImpl(); + command.setInfoboxFactory(infoboxFactory); + command.init(element); + return command; + + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxUpdateCommandImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxUpdateCommandImpl.java index 1cdeda94..100be13b 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxUpdateCommandImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxUpdateCommandImpl.java @@ -16,8 +16,8 @@ */ package at.gv.egiz.bku.slcommands.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.buergerkarte.namespaces.securitylayer._1.InfoboxUpdateRequestType; import at.gv.egiz.bku.slcommands.InfoboxUpdateCommand; @@ -28,7 +28,7 @@ import at.gv.egiz.bku.slexceptions.SLCommandException; public class InfoboxUpdateCommandImpl extends AbstractInfoboxCommandImpl<InfoboxUpdateRequestType> implements InfoboxUpdateCommand { - private static Log log = LogFactory.getLog(InfoboxUpdateCommandImpl.class); + private final Logger log = LoggerFactory.getLogger(InfoboxUpdateCommandImpl.class); @Override public String getName() { @@ -41,8 +41,8 @@ public class InfoboxUpdateCommandImpl extends } @Override - public void init(SLCommandContext ctx, Object request) throws SLCommandException { - super.init(ctx, request); + public void init(Object request) throws SLCommandException { + super.init(request); InfoboxUpdateRequestType req = getRequestValue(); @@ -61,12 +61,12 @@ public class InfoboxUpdateCommandImpl extends } @Override - public SLResult execute() { + public SLResult execute(SLCommandContext commandContext) { try { - return infobox.update(getRequestValue(), getCmdCtx()); + return infobox.update(getRequestValue(), commandContext); } catch (SLCommandException e) { - return new ErrorResultImpl(e, getCmdCtx().getLocale()); + return new ErrorResultImpl(e, commandContext.getLocale()); } } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/NullOperationCommandFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/NullOperationCommandFactory.java new file mode 100644 index 00000000..4b5ba381 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/NullOperationCommandFactory.java @@ -0,0 +1,37 @@ +/* +* Copyright 2009 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.slcommands.impl; + +import javax.xml.bind.JAXBElement; + +import at.gv.egiz.bku.slcommands.AbstractSLCommandFactory; +import at.gv.egiz.bku.slcommands.SLCommand; +import at.gv.egiz.bku.slexceptions.SLCommandException; + +public class NullOperationCommandFactory extends AbstractSLCommandFactory { + + @Override + public SLCommand createSLCommand(JAXBElement<?> element) throws SLCommandException { + + NullOperationCommandImpl command = new NullOperationCommandImpl(); + command.init(element); + return command; + + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/NullOperationCommandImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/NullOperationCommandImpl.java index 1b6fb237..4d326157 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/NullOperationCommandImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/NullOperationCommandImpl.java @@ -19,6 +19,7 @@ package at.gv.egiz.bku.slcommands.impl; import at.buergerkarte.namespaces.securitylayer._1.NullOperationRequestType; import at.gv.egiz.bku.slcommands.NullOperationCommand; import at.gv.egiz.bku.slcommands.NullOperationResult; +import at.gv.egiz.bku.slcommands.SLCommandContext; import at.gv.egiz.bku.slcommands.SLResult; /** @@ -31,7 +32,7 @@ public class NullOperationCommandImpl extends SLCommandImpl<NullOperationRequest protected static NullOperationResult RESULT = new NullOperationResultImpl(); @Override - public SLResult execute() { + public SLResult execute(SLCommandContext commandContext) { return RESULT; } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SLCommandImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SLCommandImpl.java index ed055b69..41783c34 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SLCommandImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SLCommandImpl.java @@ -19,7 +19,6 @@ package at.gv.egiz.bku.slcommands.impl; import javax.xml.bind.JAXBElement; import at.gv.egiz.bku.slcommands.SLCommand; -import at.gv.egiz.bku.slcommands.SLCommandContext; import at.gv.egiz.bku.slexceptions.SLCommandException; /**
@@ -34,30 +33,15 @@ import at.gv.egiz.bku.slexceptions.SLCommandException; public abstract class SLCommandImpl<T> implements SLCommand {
/**
- * The <code>SLCommandContext</code> for this <code>SLCommand</code>.
- */
- protected SLCommandContext cmdCtx; - - /** - * The STAL helper. - */ - protected STALHelper stalHelper;
-
- /**
* The request element of this command.
*/
protected JAXBElement<T> request;
@SuppressWarnings("unchecked")
@Override
- public void init(SLCommandContext ctx, Object request)
+ public void init(Object request)
throws SLCommandException {
-
this.request = (JAXBElement<T>) request;
-
- this.cmdCtx = ctx; - stalHelper = new STALHelper(cmdCtx.getSTAL());
-
}
/**
@@ -70,12 +54,13 @@ public abstract class SLCommandImpl<T> implements SLCommand { */
protected T getRequestValue() {
return request.getValue();
- }
+ } + + /** + * @return the request + */ + public JAXBElement<T> getRequest() { + return request; + } - /**
- * @return the corresponding <code>SLCommandContext</code>
- */
- protected SLCommandContext getCmdCtx() {
- return cmdCtx;
- }
}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SLResultImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SLResultImpl.java index 0077b7b2..1a2dcb52 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SLResultImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SLResultImpl.java @@ -37,8 +37,8 @@ import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Node; import at.buergerkarte.namespaces.securitylayer._1.ErrorResponseType; @@ -64,7 +64,7 @@ public abstract class SLResultImpl implements SLResult { /** * Logging facility. */ - private static Log log = LogFactory.getLog(SLResult.class); + private final Logger log = LoggerFactory.getLogger(SLResult.class); /** * The security layer result type (default = XML). @@ -158,21 +158,21 @@ public abstract class SLResultImpl implements SLResult { marshaller.marshal(response, result); } } catch (JAXBException e) { - log.info("Failed to marshall " + response.getName() + " result." , e); + log.info("Failed to marshall {} result.", response.getName(), e); SLCommandException commandException = new SLCommandException(4000); writeErrorTo(commandException, result, templates, fragment); } if (ds != null) { try { - log.trace("Marshalled result:\n" + new String(ds.getBufferedBytes(), "UTF-8")); + log.trace("Marshalled result:\n{}", new String(ds.getBufferedBytes(), "UTF-8")); } catch (UnsupportedEncodingException e) { log.trace(e.getMessage()); } } if (dw != null) { - log.trace("Marshalled result:\n" + dw.getBufferedString()); + log.trace("Marshalled result:\n{}", dw.getBufferedString()); } } @@ -226,14 +226,14 @@ public abstract class SLResultImpl implements SLResult { if (ds != null) { try { - log.trace("Marshalled result:\n" + new String(ds.getBufferedBytes(), "UTF-8")); + log.trace("Marshalled result:\n{}", new String(ds.getBufferedBytes(), "UTF-8")); } catch (UnsupportedEncodingException e) { log.trace(e.getMessage()); } } if (dw != null) { - log.trace("Marshalled result:\n" + dw.getBufferedString()); + log.trace("Marshalled result:\n{}", dw.getBufferedString()); } } @@ -288,7 +288,7 @@ public abstract class SLResultImpl implements SLResult { marshaller.marshal(response, result); } } catch (JAXBException e) { - log.fatal("Failed to marshall error result." , e); + log.error("Failed to marshall error result." , e); throw new SLRuntimeException("Failed to marshall error result."); } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/STALHelper.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/STALHelper.java index e903c608..fd20acb4 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/STALHelper.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/STALHelper.java @@ -22,11 +22,8 @@ import iaik.utils.Base64OutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; -import java.io.StringWriter; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; @@ -35,8 +32,8 @@ import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.bku.slexceptions.SLExceptionMessages; @@ -59,7 +56,7 @@ public class STALHelper { /** * Logging facility. */ - private static Log log = LogFactory.getLog(STALHelper.class); + private final Logger log = LoggerFactory.getLogger(STALHelper.class); /** * The STAL implementation. @@ -95,11 +92,11 @@ public class STALHelper { public void transmitSTALRequest(List<? extends STALRequest> stalRequests) throws SLCommandException { List<STALResponse> responses = stal.handleRequest(stalRequests); if (responses == null) { - Log log = LogFactory.getLog(this.getClass()); + Logger log = LoggerFactory.getLogger(this.getClass()); log.info("Received no responses from STAL."); throw new SLCommandException(4000); } else if (responses.size() != stalRequests.size()) { - Log log = LogFactory.getLog(this.getClass()); + Logger log = LoggerFactory.getLogger(this.getClass()); log.info("Received invalid count of responses from STAL. Expected " + stalRequests.size() + ", but got " + responses.size() + "."); // throw new SLCommandException(4000); @@ -144,7 +141,7 @@ public class STALHelper { } if (!(responseClass.isAssignableFrom(response.getClass()))) { - Log log = LogFactory.getLog(this.getClass()); + Logger log = LoggerFactory.getLogger(this.getClass()); log.info("Received " + response.getClass() + " from STAL but expected " + responseClass); throw new SLCommandException(4000); @@ -195,7 +192,7 @@ public class STALHelper { } catch (IOException e1) { log.info("Failed to decode certificate.", e); } - log.debug("Failed to decode certificate.\n" + certDump.toString(), e); + log.debug("Failed to decode certificate.\n{}", certDump.toString(), e); } else { log.info("Failed to decode certificate.", e); } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxFactory.java new file mode 100644 index 00000000..ea892ea9 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxFactory.java @@ -0,0 +1,27 @@ +/* +* Copyright 2009 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.slcommands.impl; + +public class SVPersonendatenInfoboxFactory extends AbstractInfoboxFactory { + + @Override + public Infobox createInfobox() { + return new SVPersonendatenInfoboxImpl(); + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImpl.java index 7e204632..4a94b627 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImpl.java @@ -44,8 +44,8 @@ import java.util.TimeZone; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.buergerkarte.namespaces.cardchannel.AttributeList; import at.buergerkarte.namespaces.cardchannel.AttributeType; @@ -68,7 +68,7 @@ public class SVPersonendatenInfoboxImpl extends AbstractAssocArrayInfobox { /** * Logging facility. */ - private static Log log = LogFactory.getLog(SVPersonendatenInfoboxImpl.class); + private final Logger log = LoggerFactory.getLogger(SVPersonendatenInfoboxImpl.class); public static final String EHIC = "EHIC"; @@ -145,7 +145,7 @@ public class SVPersonendatenInfoboxImpl extends AbstractAssocArrayInfobox { } } catch (CodingException e) { - log.info("Failed to decode '" + getIdentifier() + "' infobox.", e); + log.info("Failed to decode '{}' infobox.", getIdentifier(), e); throw new SLCommandException(4000, SLExceptionMessages.EC4000_UNCLASSIFIED_INFOBOX_INVALID, new Object[] { "IdentityLink" }); @@ -256,6 +256,8 @@ public class SVPersonendatenInfoboxImpl extends AbstractAssocArrayInfobox { private static void setAttributeValue(AttributeType attributeType, ASN1Object value) { + Logger log = LoggerFactory.getLogger(SVPersonendatenInfoboxImpl.class); + if (value.isA(ASN.OCTET_STRING)) { try { diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/AlgorithmMethodFactoryImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/AlgorithmMethodFactoryImpl.java index 8391e450..f1219a6c 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/AlgorithmMethodFactoryImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/AlgorithmMethodFactoryImpl.java @@ -165,8 +165,7 @@ public class AlgorithmMethodFactoryImpl implements AlgorithmMethodFactory { public SignatureMethod createSignatureMethod(SignatureContext signatureContext)
throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
- return signatureContext.getSignatureFactory().newSignatureMethod(
- signatureAlgorithmURI, signatureMethodParameterSpec);
+ return new STALSignatureMethod(signatureAlgorithmURI, signatureMethodParameterSpec);
}
}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/DataObject.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/DataObject.java index 2cae41d6..a3f913de 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/DataObject.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/DataObject.java @@ -20,11 +20,13 @@ import iaik.xml.crypto.dom.DOMCryptoContext; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.SequenceInputStream; import java.io.StringWriter; import java.io.UnsupportedEncodingException; +import java.net.URI; import java.net.URISyntaxException; import java.nio.charset.Charset; import java.security.InvalidAlgorithmParameterException; @@ -36,6 +38,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; import javax.xml.crypto.MarshalException; import javax.xml.crypto.dom.DOMStructure; import javax.xml.crypto.dsig.CanonicalizationMethod; @@ -46,15 +51,17 @@ import javax.xml.crypto.dsig.XMLObject; import javax.xml.crypto.dsig.spec.TransformParameterSpec; import javax.xml.crypto.dsig.spec.XPathFilter2ParameterSpec; import javax.xml.crypto.dsig.spec.XPathType; +import javax.xml.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; import org.w3c.dom.Element; import org.w3c.dom.Node; +import org.w3c.dom.NodeList; import org.w3c.dom.Text; import org.w3c.dom.bootstrap.DOMImplementationRegistry; import org.w3c.dom.ls.DOMImplementationLS; @@ -70,6 +77,7 @@ import at.buergerkarte.namespaces.securitylayer._1.MetaInfoType; import at.buergerkarte.namespaces.securitylayer._1.TransformsInfoType; import at.gv.egiz.bku.binding.HttpUtil; import at.gv.egiz.bku.gui.viewer.MimeTypes; +import at.gv.egiz.bku.slcommands.SLMarshallerFactory; import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.bku.slexceptions.SLRequestException; import at.gv.egiz.bku.slexceptions.SLRuntimeException; @@ -81,10 +89,6 @@ import at.gv.egiz.bku.viewer.Validator; import at.gv.egiz.bku.viewer.ValidatorFactory; import at.gv.egiz.dom.DOMUtils; import at.gv.egiz.slbinding.impl.XMLContentType; -import java.io.File; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; /** * This class represents a <code>DataObject</code> of an XML-Signature @@ -97,7 +101,7 @@ public class DataObject { /** * Logging facility. */ - private static Log log = LogFactory.getLog(DataObject.class); + private final Logger log = LoggerFactory.getLogger(DataObject.class); /** * DOM Implementation. @@ -205,7 +209,7 @@ public class DataObject { domImplLS = (DOMImplementationLS) registry.getDOMImplementation(DOM_LS_3_0); if (domImplLS == null) { - log.error("Failed to get DOMImplementation " + DOM_LS_3_0); + log.error("Failed to get DOMImplementation {}.", DOM_LS_3_0); throw new SLRuntimeException("Failed to get DOMImplementation " + DOM_LS_3_0); } @@ -276,7 +280,7 @@ public class DataObject { try { validator = ValidatorFactory.newValidator(mediaType); } catch (IllegalArgumentException e) { - log.error("No validator found for mime type '" + mediaType + "'."); + log.error("No validator found for mime type '{}'.", mediaType, e); throw new SLViewerException(5000); } @@ -299,7 +303,7 @@ public class DataObject { } } else { - log.debug("MIME media type '" + mediaType + "' is not a s/valid/SUPPORTED digest input, omitting validation."); + log.debug("MIME media type '{}' is not a s/valid/SUPPORTED digest input, omitting validation.", mediaType); } } @@ -359,12 +363,12 @@ public class DataObject { if (reference != null) { if (reference.getURI() != null && !"".equals(reference.getURI())) { try { - log.info("deriving filename from reference URI " + reference.getURI()); + log.info("Deriving filename from reference URI {}.", reference.getURI()); URI refURI = new URI(reference.getURI()); if (refURI.isOpaque()) { // could check scheme component, but also allow other schemes (e.g. testlocal) - log.trace("opaque reference URI, use scheme-specific part as filename"); + log.trace("Opaque reference URI, use scheme-specific part as filename."); filename = refURI.getSchemeSpecificPart(); if (!hasExtension(filename)) { filename += MimeTypes.getExtension(mimeType); @@ -376,34 +380,34 @@ public class DataObject { } else if ("".equals(refURI.getPath()) && refURI.getFragment() != null && refURI.getFragment().indexOf('(') < 0) { // exclude (schemebased) xpointer expressions - log.trace("fragment (shorthand xpointer) URI, use fragment as filename"); + log.trace("Fragment (shorthand xpointer) URI, use fragment as filename."); filename = refURI.getFragment(); if(!hasExtension(filename)) { filename += MimeTypes.getExtension(mimeType); } } else if (!"".equals(refURI.getPath())) { - log.trace("hierarchical URI with path component, use path as filename"); + log.trace("Hierarchical URI with path component, use path as filename."); File refFile = new File(refURI.getPath()); filename = refFile.getName(); if(!hasExtension(filename)) { filename += MimeTypes.getExtension(mimeType); } } else { - log.debug("failed to derive filename from URI '" + refURI + "', derive filename from reference ID"); + log.debug("Failed to derive filename from URI '{}', derive filename from reference ID.", refURI); filename = reference.getId() + MimeTypes.getExtension(mimeType); } } catch (URISyntaxException ex) { - log.error("failed to derive filename from invalid URI " + ex.getMessage()); + log.error("Failed to derive filename from invalid URI {}.", ex.getMessage()); filename = reference.getId() + MimeTypes.getExtension(mimeType); } } else { - log.debug("same-document URI, derive filename from reference ID"); + log.debug("Same-document URI, derive filename from reference ID."); filename = reference.getId() + MimeTypes.getExtension(mimeType); } } else { - log.error("failed to derive filename, no reference created"); + log.error("Failed to derive filename, no reference created."); } - log.debug("derived filename for reference " + reference.getId() + ": " + filename); + log.debug("Derived filename for reference {}: {}.", reference.getId(), filename); return filename; } @@ -413,30 +417,12 @@ public class DataObject { } private byte[] getTransformsBytes(at.gv.egiz.slbinding.impl.TransformsInfoType ti) { - return ti.getRedirectedStream().toByteArray(); -// byte[] transformsBytes = ti.getRedirectedStream().toByteArray(); -// -// if (transformsBytes == null || transformsBytes.length == 0) { -// return null; -// } -// -// String dsigPrefix = ti.getNamespaceContext().getNamespaceURI("http://www.w3.org/2000/09/xmldsig#"); -// byte[] pre, post; -// if (dsigPrefix == null) { -// log.trace("XMLDSig not declared in outside dsig:Transforms"); -// pre = "<AssureDSigNS>".getBytes(); -// post = "</AssureDSigNS>".getBytes(); -// } else { -// log.trace("XMLDSig bound to prefix " + dsigPrefix); -// pre = ("<AssureDSigNS xmlns:" + dsigPrefix + "=\"http://www.w3.org/2000/09/xmldsig#\">").getBytes(); -// post = "</AssureDSigNS>".getBytes(); -// } -// -// byte[] workaround = new byte[pre.length + transformsBytes.length + post.length]; -// System.arraycopy(pre, 0, workaround, 0, pre.length); -// System.arraycopy(transformsBytes, 0, workaround, pre.length, transformsBytes.length); -// System.arraycopy(post, 0, workaround, pre.length + transformsBytes.length, post.length); -// return workaround; + ByteArrayOutputStream redirectedStream = ti.getRedirectedStream(); + if (redirectedStream != null) { + return redirectedStream.toByteArray(); + } else { + return null; + } } /** @@ -487,9 +473,8 @@ public class DataObject { // create XMLObject DocumentFragment content = parseDataObject((XMLContentType) dataObject.getXMLContent()); - XMLObject xmlObject = createXMLObject(content); - setXMLObjectAndReferenceXML(xmlObject, transforms); + setXMLObjectAndReferenceXML(createXMLObject(content), transforms); } else if (dataObject.getLocRefContent() != null) { @@ -521,7 +506,7 @@ public class DataObject { // The content of sl:DataObject remains empty // - log.debug("Adding DataObject from reference URI '" + reference + "'."); + log.debug("Adding DataObject from reference URI '{}'.", reference); setEnvelopedDataObject(reference, transforms); @@ -564,13 +549,13 @@ public class DataObject { } // dereference URL - URLDereferencer dereferencer = URLDereferencer.getInstance(); + URLDereferencer dereferencer = ctx.getUrlDereferencer(); StreamData streamData; try { - streamData = dereferencer.dereference(reference, ctx.getDereferencerContext()); + streamData = dereferencer.dereference(reference); } catch (IOException e) { - log.info("Failed to dereference XMLObject from '" + reference + "'.", e); + log.info("Failed to dereference XMLObject from '{}'.", reference, e); throw new SLCommandException(4110); } @@ -587,7 +572,7 @@ public class DataObject { childNode = doc.getDocumentElement(); if (childNode == null) { - log.info("Failed to parse XMLObject from '" + reference + "'."); + log.info("Failed to parse XMLObject from '{}'.", reference); throw new SLCommandException(4111); } @@ -666,12 +651,12 @@ public class DataObject { if (dataObject.getLocRefContent() != null) { String locRef = dataObject.getLocRefContent(); try { - this.reference.setDereferencer(new LocRefDereferencer(ctx.getDereferencerContext(), locRef)); + this.reference.setDereferencer(new LocRefDereferencer(ctx.getUrlDereferencer(), locRef)); } catch (URISyntaxException e) { - log.info("Invalid URI '" + locRef + "' in DataObject.", e); + log.info("Invalid URI '{}' in DataObject.", locRef, e); throw new SLCommandException(4003); } catch (IllegalArgumentException e) { - log.info("LocRef URI of '" + locRef + "' not supported in DataObject. ", e); + log.info("LocRef URI of '{}' not supported in DataObject. ", locRef, e); throw new SLCommandException(4003); } } else if (dataObject.getBase64Content() != null) { @@ -734,7 +719,7 @@ public class DataObject { } if (debugString != null) { - log.debug(debugString); + log.debug(debugString.toString()); } // look for preferred transform @@ -778,7 +763,7 @@ public class DataObject { StringBuilder sb = new StringBuilder(); sb.append("Trying to parse transforms:\n"); sb.append(new String(transforms, Charset.forName("UTF-8"))); - log.trace(sb); + log.trace(sb.toString()); } DOMImplementationLS domImplLS = DOMUtils.getDOMImplementationLS(); @@ -933,8 +918,7 @@ public class DataObject { } catch (MarshalException e) { String mimeType = preferredTransformsInfo.getFinalDataMetaInfo().getMimeType(); - log.info("Failed to unmarshal preferred transformation path (MIME-Type=" - + mimeType + ").", e); + log.info("Failed to unmarshal preferred transformation path (MIME-Type={}).", mimeType, e); } @@ -950,8 +934,7 @@ public class DataObject { } catch (MarshalException e) { String mimeType = transformsInfoType.getFinalDataMetaInfo().getMimeType(); - log.info("Failed to unmarshal transformation path (MIME-Type=" - + mimeType + ").", e); + log.info("Failed to unmarshal transformation path (MIME-Type={}).", mimeType, e); } } @@ -975,7 +958,7 @@ public class DataObject { try { textNode = at.gv.egiz.dom.DOMUtils.createBase64Text(content, ctx.getDocument()); } catch (IOException e) { - log.error(e); + log.error("Failed to create XMLObject.", e); throw new SLRuntimeException(e); } @@ -1170,36 +1153,68 @@ public class DataObject { // content of the redirect stream as the content has already been parsed // and serialized again to the redirect stream. - List<InputStream> inputStreams = new ArrayList<InputStream>(); - try { - // dummy start element - inputStreams.add(new ByteArrayInputStream("<dummy>".getBytes("UTF-8"))); - - // content - inputStreams.add(new ByteArrayInputStream(redirectedStream.toByteArray())); - - // dummy end element - inputStreams.add(new ByteArrayInputStream("</dummy>".getBytes("UTF-8"))); - } catch (UnsupportedEncodingException e) { - throw new SLRuntimeException(e); - } + DocumentFragment fragment; + if (redirectedStream != null) { - SequenceInputStream inputStream = new SequenceInputStream(Collections.enumeration(inputStreams)); - - // parse DataObject - Document doc = parseDataObject(inputStream, "UTF-8"); + List<InputStream> inputStreams = new ArrayList<InputStream>(); + try { + // dummy start element + inputStreams.add(new ByteArrayInputStream("<dummy>".getBytes("UTF-8"))); - Element documentElement = doc.getDocumentElement(); - - if (documentElement == null || - !"dummy".equals(documentElement.getLocalName())) { - log.info("Failed to parse DataObject XMLContent."); - throw new SLCommandException(4111); - } + // content + inputStreams.add(new ByteArrayInputStream(redirectedStream.toByteArray())); + + // dummy end element + inputStreams.add(new ByteArrayInputStream("</dummy>".getBytes("UTF-8"))); + } catch (UnsupportedEncodingException e) { + throw new SLRuntimeException(e); + } + + SequenceInputStream inputStream = new SequenceInputStream(Collections.enumeration(inputStreams)); - DocumentFragment fragment = doc.createDocumentFragment(); - while (documentElement.getFirstChild() != null) { - fragment.appendChild(documentElement.getFirstChild()); + // parse DataObject + Document doc = parseDataObject(inputStream, "UTF-8"); + + Element documentElement = doc.getDocumentElement(); + + if (documentElement == null || + !"dummy".equals(documentElement.getLocalName())) { + log.info("Failed to parse DataObject XMLContent."); + throw new SLCommandException(4111); + } + + fragment = doc.createDocumentFragment(); + while (documentElement.getFirstChild() != null) { + fragment.appendChild(documentElement.getFirstChild()); + } + + } else { + + fragment = ctx.getDocument().createDocumentFragment(); + Marshaller marshaller = SLMarshallerFactory.getInstance().createMarshaller(false); + + JAXBElement<at.buergerkarte.namespaces.securitylayer._1.XMLContentType> element = + new JAXBElement<at.buergerkarte.namespaces.securitylayer._1.XMLContentType>( + new QName("dummy"), + at.buergerkarte.namespaces.securitylayer._1.XMLContentType.class, + xmlContent); + + try { + marshaller.marshal(element, fragment); + } catch (JAXBException e) { + log.info("Failed to marshal DataObject (XMLContent).", e); + throw new SLCommandException(4111); + } + + Node dummy = fragment.getFirstChild(); + if (dummy != null) { + NodeList nodes = dummy.getChildNodes(); + for (int i = 0; i < nodes.getLength(); i++) { + fragment.appendChild(nodes.item(i)); + } + fragment.removeChild(dummy); + } + } // log parsed document @@ -1256,6 +1271,8 @@ public class DataObject { SimpleDOMErrorHandler errorHandler = new SimpleDOMErrorHandler(); domConfig.setParameter("error-handler", errorHandler); domConfig.setParameter("validate", Boolean.FALSE); + domConfig.setParameter("entities", Boolean.TRUE); + Document doc; try { diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/LocRefDereferencer.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/LocRefDereferencer.java index f5394157..e513738c 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/LocRefDereferencer.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/LocRefDereferencer.java @@ -14,99 +14,96 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.slcommands.impl.xsect;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import javax.xml.crypto.Data;
-import javax.xml.crypto.OctetStreamData;
-import javax.xml.crypto.URIDereferencer;
-import javax.xml.crypto.URIReference;
-import javax.xml.crypto.URIReferenceException;
-import javax.xml.crypto.XMLCryptoContext;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.utils.urldereferencer.StreamData;
-import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer;
-import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerContext;
-
-/**
- * An URIDereferencer implementation that dereferences <code>LocRef</code>
- * references.
- *
- * @author mcentner
- */
-public class LocRefDereferencer implements URIDereferencer {
-
- /**
- * Logging facility.
- */
- private static Log log = LogFactory.getLog(LocRefDereferencer.class);
-
- /**
- * The <code>LocRef</code>-reference to be dereferenced by
- * {@link #dereference(URIReference, XMLCryptoContext)}.
- */
- protected String locRef;
-
- /**
- * The context to be used for dereferencing.
- */
- protected URLDereferencerContext dereferencerContext;
-
- /**
- * Creates a new instance of this LocRefDereferencer with the given
- * <code>dereferencerContext</code> and <code>locRef</code> reference.
- *
- * @param dereferencerContext
- * the context to be used for dereferencing
- * @param locRef
- * the <code>LocRef</code>-reference (must be an absolute URI)
- *
- * @throws URISyntaxException
- * if <code>LocRef</code> is not an absolute URI
- */
- public LocRefDereferencer(URLDereferencerContext dereferencerContext,
- String locRef) throws URISyntaxException {
-
- this.dereferencerContext = dereferencerContext;
-
- URI locRefUri = new URI(locRef);
- if (locRefUri.isAbsolute()) {
- this.locRef = locRef;
- } else {
- throw new IllegalArgumentException(
- "Parameter 'locRef' must be an absolut URI.");
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * javax.xml.crypto.URIDereferencer#dereference(javax.xml.crypto.URIReference,
- * javax.xml.crypto.XMLCryptoContext)
- */
- @Override
- public Data dereference(URIReference uriReference, XMLCryptoContext context)
- throws URIReferenceException {
-
- URLDereferencer dereferencer = URLDereferencer.getInstance();
- StreamData streamData;
- try {
- streamData = dereferencer.dereference(locRef, dereferencerContext);
- } catch (IOException e) {
- log.info("Failed to dereference URI'" + locRef + "'. " + e.getMessage(),
- e);
- throw new URIReferenceException("Failed to dereference URI '" + locRef
- + "'. " + e.getMessage(), e);
- }
- return new OctetStreamData(streamData.getStream(), locRef, streamData
- .getContentType());
- }
-
-}
+package at.gv.egiz.bku.slcommands.impl.xsect; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.xml.crypto.Data; +import javax.xml.crypto.OctetStreamData; +import javax.xml.crypto.URIDereferencer; +import javax.xml.crypto.URIReference; +import javax.xml.crypto.URIReferenceException; +import javax.xml.crypto.XMLCryptoContext; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.bku.utils.urldereferencer.StreamData; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; + +/** + * An URIDereferencer implementation that dereferences <code>LocRef</code> + * references. + * + * @author mcentner + */ +public class LocRefDereferencer implements URIDereferencer { + + /** + * Logging facility. + */ + private final Logger log = LoggerFactory.getLogger(LocRefDereferencer.class); + + /** + * The <code>LocRef</code>-reference to be dereferenced by + * {@link #dereference(URIReference, XMLCryptoContext)}. + */ + protected String locRef; + + /** + * The URLDereferencer to be used for dereferencing. + */ + protected URLDereferencer dereferencer; + + /** + * Creates a new instance of this LocRefDereferencer with the given + * <code>dereferencerContext</code> and <code>locRef</code> reference. + * + * @param dereferencer + * the context to be used for dereferencing + * @param locRef + * the <code>LocRef</code>-reference (must be an absolute URI) + * + * @throws URISyntaxException + * if <code>LocRef</code> is not an absolute URI + */ + public LocRefDereferencer(URLDereferencer dereferencer, + String locRef) throws URISyntaxException { + + this.dereferencer = dereferencer; + + URI locRefUri = new URI(locRef); + if (locRefUri.isAbsolute()) { + this.locRef = locRef; + } else { + throw new IllegalArgumentException( + "Parameter 'locRef' must be an absolut URI."); + } + } + + /* + * (non-Javadoc) + * + * @see + * javax.xml.crypto.URIDereferencer#dereference(javax.xml.crypto.URIReference, + * javax.xml.crypto.XMLCryptoContext) + */ + @Override + public Data dereference(URIReference uriReference, XMLCryptoContext context) + throws URIReferenceException { + + StreamData streamData; + try { + streamData = dereferencer.dereference(locRef); + } catch (IOException e) { + log.info("Failed to dereference URI '{}'.", locRef, e); + throw new URIReferenceException("Failed to dereference URI '" + locRef + + "'. " + e.getMessage(), e); + } + return new OctetStreamData(streamData.getStream(), locRef, streamData + .getContentType()); + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALPrivateKey.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALPrivateKey.java index 25e2d4e5..87a165cf 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALPrivateKey.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALPrivateKey.java @@ -16,7 +16,6 @@ */ package at.gv.egiz.bku.slcommands.impl.xsect; -import at.gv.egiz.stal.HashDataInput; import java.security.PrivateKey; import at.gv.egiz.stal.STAL; @@ -24,7 +23,7 @@ import at.gv.egiz.stal.STAL; import java.util.List; /** - * This class implements a private key used by the {@link STALSignature} class. + * This class implements a private key used by the {@link STALSignatureMethod} class. * * @author mcentner */ diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALProvider.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALProvider.java deleted file mode 100644 index 9fb9a3f1..00000000 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALProvider.java +++ /dev/null @@ -1,71 +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.slcommands.impl.xsect;
-
-import iaik.xml.crypto.XmldsigMore;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.Provider;
-import java.security.Signature;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.crypto.dsig.SignatureMethod;
-
-/**
- * A security provider implementation that provides {@link Signature} implementations
- * based on STAL.
- *
- * @author mcentner
- */
-public class STALProvider extends Provider {
-
- private static final long serialVersionUID = 1L;
-
- private static String IMPL_PACKAGE_NAME = "at.gv.egiz.bku.slcommands.impl.xsect";
-
- public STALProvider() {
-
- super("STAL", 1.0, "Security Token Abstraction Layer Provider");
-
- final Map<String, String> map = new HashMap<String, String>();
-
- // TODO: register further algorithms
- map.put("Signature." + SignatureMethod.RSA_SHA1,
- IMPL_PACKAGE_NAME + ".STALSignature");
- map.put("Signature." + XmldsigMore.SIGNATURE_ECDSA_SHA1,
- IMPL_PACKAGE_NAME + ".STALSignature"); - map.put("Signature." + XmldsigMore.SIGNATURE_RSA_SHA256, - IMPL_PACKAGE_NAME + ".STALSignature"); - map.put("Signature." + XmldsigMore.SIGNATURE_ECDSA_SHA256, - IMPL_PACKAGE_NAME + ".STALSignature"); - map.put("Signature." + XmldsigMore.SIGNATURE_ECDSA_SHA512, - IMPL_PACKAGE_NAME + ".STALSignature"); - -
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
- @Override
- public Void run() {
- putAll(map);
- return null;
- }
- });
-
- }
-
-}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALSignature.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALSignature.java deleted file mode 100644 index dd7c7d8a..00000000 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALSignature.java +++ /dev/null @@ -1,184 +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.slcommands.impl.xsect; - -import at.gv.egiz.bku.slcommands.impl.DataObjectHashDataInput; -import at.gv.egiz.bku.slexceptions.SLViewerException; - -import java.io.ByteArrayOutputStream; -import java.security.InvalidKeyException; -import java.security.InvalidParameterException; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.SignatureException; -import java.security.SignatureSpi; -import java.util.Collections; -import java.util.List; - -import at.gv.egiz.stal.ErrorResponse; -import at.gv.egiz.stal.HashDataInput; -import at.gv.egiz.stal.STAL; -import at.gv.egiz.stal.STALRequest; -import at.gv.egiz.stal.STALResponse; -import at.gv.egiz.stal.SignRequest; -import at.gv.egiz.stal.SignResponse; -//import at.gv.egiz.stal.HashDataInputCallback; -import java.util.ArrayList; - -/** - * A signature service provider implementation that uses STAL to sign. - * - * @author mcentner - */ -public class STALSignature extends SignatureSpi { - -// private static final Log log = LogFactory.getLog(STALSignature.class); - - /** - * The private key. - */ - protected STALPrivateKey privateKey; - - /** - * The to-be signed data. - */ - protected ByteArrayOutputStream data = new ByteArrayOutputStream(); - - /* (non-Javadoc) - * @see java.security.SignatureSpi#engineGetParameter(java.lang.String) - */ - @Override - protected Object engineGetParameter(String param) - throws InvalidParameterException { - throw new InvalidParameterException(); - } - - /* (non-Javadoc) - * @see java.security.SignatureSpi#engineInitSign(java.security.PrivateKey) - */ - @Override - protected void engineInitSign(PrivateKey privateKey) - throws InvalidKeyException { - - if (!(privateKey instanceof STALPrivateKey)) { - throw new InvalidKeyException("STALSignature supports STALKeys only."); - } - - this.privateKey = (STALPrivateKey) privateKey; - - } - - /* (non-Javadoc) - * @see java.security.SignatureSpi#engineInitVerify(java.security.PublicKey) - */ - @Override - protected void engineInitVerify(PublicKey publicKey) - throws InvalidKeyException { - - throw new UnsupportedOperationException("STALSignature does not support signature verification."); - } - - /* (non-Javadoc) - * @see java.security.SignatureSpi#engineSetParameter(java.lang.String, java.lang.Object) - */ - @Override - protected void engineSetParameter(String param, Object value) - throws InvalidParameterException { - } - - /* (non-Javadoc) - * @see java.security.SignatureSpi#engineSign() - */ - @Override - protected byte[] engineSign() throws SignatureException { - - STAL stal = privateKey.getStal(); - - if (stal == null) { - throw new SignatureException("STALSignature requires the STALPrivateKey " + - "to provide a STAL implementation reference."); - } - - String keyboxIdentifier = privateKey.getKeyboxIdentifier(); - - if (keyboxIdentifier == null) { - throw new SignatureException("STALSignature requires the STALPrivateKey " + - "to provide a KeyboxIdentifier."); - } - - // get hashDataInputs (DigestInputStreams) once slcommands.impl.xsect.Signature::sign() was called - List<DataObject> dataObjects = privateKey.getDataObjects(); -// log.debug("got " + dataObjects.size() + " DataObjects, passing HashDataInputs to STAL SignRequest"); - - List<HashDataInput> hashDataInputs = new ArrayList<HashDataInput>(); - for (DataObject dataObject : dataObjects) { - try { - dataObject.validateHashDataInput(); - } catch (SLViewerException e) { - throw new STALSignatureException(e); - } - hashDataInputs.add(new DataObjectHashDataInput(dataObject)); - } - - SignRequest signRequest = new SignRequest(); - signRequest.setKeyIdentifier(keyboxIdentifier); - signRequest.setSignedInfo(data.toByteArray()); - signRequest.setHashDataInput(hashDataInputs); - - List<STALResponse> responses = stal.handleRequest(Collections.singletonList((STALRequest) signRequest)); - - if (responses == null || responses.size() != 1) { - throw new SignatureException("Failed to access STAL."); - } - - STALResponse response = responses.get(0); - if (response instanceof SignResponse) { - return ((SignResponse) response).getSignatureValue(); - } else if (response instanceof ErrorResponse) { - throw new STALSignatureException(((ErrorResponse) response).getErrorCode()); - } else { - throw new SignatureException("Failed to access STAL."); - } - - } - - /* (non-Javadoc) - * @see java.security.SignatureSpi#engineUpdate(byte) - */ - @Override - protected void engineUpdate(byte b) throws SignatureException { - data.write(b); - } - - /* (non-Javadoc) - * @see java.security.SignatureSpi#engineUpdate(byte[], int, int) - */ - @Override - protected void engineUpdate(byte[] b, int off, int len) - throws SignatureException { - data.write(b, off, len); - } - - /* (non-Javadoc) - * @see java.security.SignatureSpi#engineVerify(byte[]) - */ - @Override - protected boolean engineVerify(byte[] sigBytes) throws SignatureException { - throw new UnsupportedOperationException("STALSignature des not support signature verification."); - } - -} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALSignatureException.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALSignatureException.java index 4e86b07c..b727600f 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALSignatureException.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALSignatureException.java @@ -19,7 +19,7 @@ package at.gv.egiz.bku.slcommands.impl.xsect; import java.security.SignatureException;
/**
- * A SignatureException thrown by the {@link STALSignature}.
+ * A SignatureException thrown by the {@link STALSignatureMethod}.
*
* @author mcentner
*/
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALSignatureMethod.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALSignatureMethod.java new file mode 100644 index 00000000..a9bb8e04 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/STALSignatureMethod.java @@ -0,0 +1,127 @@ +/* +* Copyright 2009 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.slcommands.impl.xsect; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.InvalidAlgorithmParameterException; +import java.security.Key; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.xml.crypto.XMLCryptoContext; +import javax.xml.crypto.dsig.XMLSignatureException; +import javax.xml.crypto.dsig.spec.SignatureMethodParameterSpec; + +import at.gv.egiz.bku.slcommands.impl.DataObjectHashDataInput; +import at.gv.egiz.bku.slexceptions.SLViewerException; +import at.gv.egiz.bku.utils.StreamUtil; +import at.gv.egiz.stal.ErrorResponse; +import at.gv.egiz.stal.HashDataInput; +import at.gv.egiz.stal.STAL; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.SignRequest; +import at.gv.egiz.stal.SignResponse; + +import iaik.xml.crypto.dsig.AbstractSignatureMethodImpl; + +public class STALSignatureMethod extends AbstractSignatureMethodImpl { + + /** + * Creates a new instance of this <code>STALSignatureMethod</code> + * with the given <code>algorithm</code> and <code>params</code>. + * + * @param algorithm the algorithm URI + * @param params optional algorithm parameters + * @throws InvalidAlgorithmParameterException if the specified parameters + * are inappropriate for the requested algorithm + * @throws NoSuchAlgorithmException if an implementation of the specified + * algorithm cannot be found + * @throws NullPointerException if <code>algorithm</code> is <code>null</code> + */ + public STALSignatureMethod(String algorithm, + SignatureMethodParameterSpec params) + throws InvalidAlgorithmParameterException, NoSuchAlgorithmException { + super(algorithm, params); + } + + @Override + public byte[] calculateSignatureValue(XMLCryptoContext context, Key key, InputStream message) + throws XMLSignatureException, IOException { + + if (!(key instanceof STALPrivateKey)) { + throw new XMLSignatureException("STALSignatureMethod expects STALPrivateKey."); + } + + STAL stal = ((STALPrivateKey) key).getStal(); + String keyboxIdentifier = ((STALPrivateKey) key).getKeyboxIdentifier(); + List<DataObject> dataObjects = ((STALPrivateKey) key).getDataObjects(); + + List<HashDataInput> hashDataInputs = new ArrayList<HashDataInput>(); + for (DataObject dataObject : dataObjects) { + try { + dataObject.validateHashDataInput(); + } catch (SLViewerException e) { + throw new XMLSignatureException(e); + } + hashDataInputs.add(new DataObjectHashDataInput(dataObject)); + } + + ByteArrayOutputStream m = new ByteArrayOutputStream(); + StreamUtil.copyStream(message, m); + + SignRequest signRequest = new SignRequest(); + signRequest.setKeyIdentifier(keyboxIdentifier); + signRequest.setSignedInfo(m.toByteArray()); + signRequest.setHashDataInput(hashDataInputs); + + List<STALResponse> responses = + stal.handleRequest(Collections.singletonList((STALRequest) signRequest)); + + if (responses == null || responses.size() != 1) { + throw new XMLSignatureException("Failed to access STAL."); + } + + STALResponse response = responses.get(0); + if (response instanceof SignResponse) { + return ((SignResponse) response).getSignatureValue(); + } else if (response instanceof ErrorResponse) { + STALSignatureException se = new STALSignatureException(((ErrorResponse) response).getErrorCode()); + throw new XMLSignatureException(se); + } else { + throw new XMLSignatureException("Failed to access STAL."); + } + + } + + @Override + public boolean validateSignatureValue(XMLCryptoContext context, Key key, byte[] value, + InputStream message) throws XMLSignatureException, IOException { + throw new XMLSignatureException("The STALSignatureMethod does not support validation."); + } + + @Override + protected Class<?> getParameterSpecClass() { + return null; + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java index 3cebb6a3..b4ce0e79 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java @@ -51,8 +51,8 @@ import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory; import javax.xml.crypto.dsig.keyinfo.X509Data; import javax.xml.stream.XMLStreamException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.etsi.uri._01903.v1_1.DataObjectFormatType; import org.etsi.uri._01903.v1_1.QualifyingPropertiesType; import org.w3c.dom.DOMConfiguration; @@ -82,7 +82,6 @@ import at.gv.egiz.bku.slexceptions.SLViewerException; import at.gv.egiz.bku.utils.HexDump; import at.gv.egiz.bku.utils.urldereferencer.StreamData; import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; -import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerContext; import at.gv.egiz.dom.DOMUtils; import at.gv.egiz.slbinding.impl.XMLContentType; import at.gv.egiz.stal.STAL; @@ -101,7 +100,7 @@ public class Signature { /** * Logging facility. */ - private static Log log = LogFactory.getLog(Signature.class); + private final Logger log = LoggerFactory.getLogger(Signature.class); /** * The DOM implementation used. @@ -151,8 +150,9 @@ public class Signature { /** * Creates a new SLXMLSignature instance. + * @param urlDereferencer TODO */ - public Signature(URLDereferencerContext dereferencerContext, + public Signature(URLDereferencer urlDereferencer, IdValueFactory idValueFactory, AlgorithmMethodFactory algorithmMethodFactory) { @@ -162,7 +162,7 @@ public class Signature { ctx.setSignatureFactory(XMLSignatureFactory.getInstance()); - ctx.setDereferencerContext(dereferencerContext); + ctx.setUrlDereferencer(urlDereferencer); ctx.setIdValueFactory(idValueFactory); ctx.setAlgorithmMethodFactory(algorithmMethodFactory); @@ -408,7 +408,7 @@ public class Signature { signContext.putNamespacePrefix(XMLSignature.XMLNS,XMLDSIG_PREFIX); - signContext.setURIDereferencer(new URIDereferncerAdapter(ctx.getDereferencerContext())); + signContext.setURIDereferencer(new URIDereferncerAdapter(ctx.getUrlDereferencer())); try { xmlSignature.sign(signContext); @@ -455,7 +455,7 @@ public class Signature { sb.append(HexDump.hexDump(digestInputStream)); } } catch (IOException e) { - log.error(e); + log.error("Failed to log DigestInput.", e); } log.trace(sb.toString()); } else { @@ -478,7 +478,7 @@ public class Signature { sb.append(new String(b, 0, l)); } } catch (IOException e) { - log.error(e); + log.error("Failed to log DigestInput.", e); } log.trace(sb.toString()); } else { @@ -735,7 +735,7 @@ public class Signature { LSInput input; try { if (signatureEnvironment.getReference() != null) { - log.debug("SignatureEnvironment contains Reference " + signatureEnvironment.getReference() + "."); + log.debug("SignatureEnvironment contains Reference '{}'.", signatureEnvironment.getReference()); input = createLSInput(signatureEnvironment.getReference()); } else if (signatureEnvironment.getBase64Content() != null) { log.debug("SignatureEnvironment contains Base64Content."); @@ -784,11 +784,12 @@ public class Signature { if (log.isInfoEnabled()) { List<String> errorMessages = errorHandler.getErrorMessages(); StringBuffer sb = new StringBuffer(); + sb.append("XML document in which the signature is to be integrated cannot be parsed."); for (String errorMessage : errorMessages) { sb.append(" "); sb.append(errorMessage); } - log.info("XML document in which the signature is to be integrated cannot be parsed." + sb.toString()); + log.info(sb.toString()); } throw new SLCommandException(4101); } @@ -826,8 +827,8 @@ public class Signature { */ private LSInput createLSInput(String reference) throws IOException { - URLDereferencer urlDereferencer = URLDereferencer.getInstance(); - StreamData streamData = urlDereferencer.dereference(reference, ctx.getDereferencerContext()); + URLDereferencer urlDereferencer = ctx.getUrlDereferencer(); + StreamData streamData = urlDereferencer.dereference(reference); String contentType = streamData.getContentType(); String charset = HttpUtil.getCharset(contentType, true); @@ -835,7 +836,7 @@ public class Signature { try { streamReader = new InputStreamReader(streamData.getStream(), charset); } catch (UnsupportedEncodingException e) { - log.info("Charset " + charset + " not supported. Using default."); + log.info("Charset {} not supported. Using default.", charset); streamReader = new InputStreamReader(streamData.getStream()); } @@ -942,7 +943,7 @@ public class Signature { if (systemId != null) { - log.debug("Resolve resource '" + systemId + "'."); + log.debug("Resolve resource '{}'.", systemId); for (DataObjectAssociationType supplement : supplements) { @@ -954,23 +955,23 @@ public class Signature { try { if (content.getLocRefContent() != null) { - log.trace("Resolved resource '" + reference + "' to supplement with LocRefContent."); + log.trace("Resolved resource '{}' to supplement with LocRefContent.", reference); return createLSInput(content.getLocRefContent()); } else if (content.getBase64Content() != null) { - log.trace("Resolved resource '" + reference + "' to supplement with Base64Content."); + log.trace("Resolved resource '{}' to supplement with Base64Content.", reference); return createLSInput(content.getBase64Content()); } else if (content.getXMLContent() != null) { - log.trace("Resolved resource '" + reference + "' to supplement with XMLContent."); + log.trace("Resolved resource '{}' to supplement with XMLContent.", reference); return createLSInput((XMLContentType) content.getXMLContent()); } else { return null; } } catch (IOException e) { - log.info("Failed to resolve resource '" + systemId + "' to supplement.", e); + log.info("Failed to resolve resource '{}' to supplement.", systemId, e); error = e; return null; } catch (XMLStreamException e) { - log.info("Failed to resolve resource '" + systemId + "' to supplement.", e); + log.info("Failed to resolve resource '{}' to supplement.", systemId, e); error = e; return null; } @@ -981,7 +982,7 @@ public class Signature { } - log.info("Failed to resolve resource '" + systemId + "' to supplement. No such supplement."); + log.info("Failed to resolve resource '{}' to supplement. No such supplement.", systemId); } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureContext.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureContext.java index 0925f2fd..48c82bd5 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureContext.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureContext.java @@ -16,12 +16,12 @@ */ package at.gv.egiz.bku.slcommands.impl.xsect;
-import javax.xml.crypto.dsig.DigestMethod;
+import javax.xml.crypto.AlgorithmMethod; import javax.xml.crypto.dsig.XMLSignatureFactory;
import org.w3c.dom.Document;
-import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerContext;
+import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; /**
* An instance of this class carries context information for a XML-Signature
@@ -45,16 +45,16 @@ public class SignatureContext { * The XMLSignatureFactory to create XML signature objects.
*/
private XMLSignatureFactory signatureFactory;
+ + /** + * The URLDereferencer to dereference URLs with. + */ + private URLDereferencer urlDereferencer; /**
- * The URLDereferencerContext for dereferencing URLs.
+ * The AlgorithmMethodFactory to create {@link AlgorithmMethod} objects.
*/
- private URLDereferencerContext dereferencerContext;
-
- /**
- * The DigestMethodFactory to create {@link DigestMethod} objects.
- */
- private AlgorithmMethodFactory digestMethodFactory;
+ private AlgorithmMethodFactory algorithmMethodFactory;
/**
* @return the document
@@ -99,31 +99,31 @@ public class SignatureContext { }
/**
- * @return the dereferencerContext
- */
- public URLDereferencerContext getDereferencerContext() {
- return dereferencerContext;
- }
-
- /**
- * @param dereferencerContext the dereferencerContext to set
- */
- public void setDereferencerContext(URLDereferencerContext dereferencerContext) {
- this.dereferencerContext = dereferencerContext;
- }
-
- /**
* @return the digestMethodFactory
*/
public AlgorithmMethodFactory getAlgorithmMethodFactory() {
- return digestMethodFactory;
+ return algorithmMethodFactory;
}
/**
* @param digestMethodFactory the digestMethodFactory to set
*/
public void setAlgorithmMethodFactory(AlgorithmMethodFactory digestMethodFactory) {
- this.digestMethodFactory = digestMethodFactory;
+ this.algorithmMethodFactory = digestMethodFactory;
+ } + + /** + * @return the urlDereferencer + */ + public URLDereferencer getUrlDereferencer() { + return urlDereferencer; + } + + /** + * @param urlDereferencer the urlDereferencer to set + */ + public void setUrlDereferencer(URLDereferencer urlDereferencer) { + this.urlDereferencer = urlDereferencer; }
}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureLocation.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureLocation.java index ebe50b3f..26a4aa4e 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureLocation.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureLocation.java @@ -14,212 +14,212 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.slcommands.impl.xsect;
-
-import java.util.Iterator;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.Node;
-
-import at.buergerkarte.namespaces.securitylayer._1.SignatureInfoCreationType;
-import at.gv.egiz.bku.slexceptions.SLCommandException;
-import at.gv.egiz.slbinding.impl.SignatureLocationType;
-
-/**
- * This class implements the <code>SignatureLocation</code> of an XML-Signature
- * to be created by the security layer command <code>CreateXMLSignature</code>.
- *
- * @author mcentner
- */
-public class SignatureLocation {
-
- /**
- * Logging facility.
- */
- private static Log log = LogFactory.getLog(SignatureLocation.class);
-
- /**
- * The SignatureContext for the XML signature
- */
- private SignatureContext ctx;
-
- /**
- * The parent node for the XML signature.
- */
- private Node parent;
-
- /**
- * The next sibling node for the XML signature.
- */
- private Node nextSibling;
-
- /**
- * Creates a new SignatureLocation with the given <code>signatureContext</code>
- *
- * @param signatureContext the context for the XML signature creation
- */
- public SignatureLocation(SignatureContext signatureContext) {
- this.ctx = signatureContext;
- }
-
- /**
- * @return the parent node for the XML signature
- */
- public Node getParent() {
- return parent;
- }
-
- /**
- * @param parent the parent for the XML signature
- */
- public void setParent(Node parent) {
- this.parent = parent;
- }
-
- /**
- * @return the next sibling node for the XML signature
- */
- public Node getNextSibling() {
- return nextSibling;
- }
-
- /**
- * @param nextSibling the next sibling node for the XML signature
- */
- public void setNextSibling(Node nextSibling) {
- this.nextSibling = nextSibling;
- }
-
- /**
- * Configures this SignatureLocation with the information provided by the
- * given <code>SignatureInfo</code> element.
- *
- * @param signatureInfo
- * the <code>SignatureInfo</code> element
- *
- * @throws SLCommandException
- * if configuring this SignatureLocation with given
- * <code>signatureInfo</code>fails
- */
- public void setSignatureInfo(SignatureInfoCreationType signatureInfo)
- throws SLCommandException {
-
- // evaluate signature location XPath ...
- SignatureLocationType signatureLocation = (SignatureLocationType) signatureInfo
- .getSignatureLocation();
-
- NamespaceContext namespaceContext = new MOAIDWorkaroundNamespaceContext(
- signatureLocation.getNamespaceContext());
-
- parent = evaluateSignatureLocation(signatureInfo.getSignatureLocation()
- .getValue(), namespaceContext, ctx.getDocument().getDocumentElement());
-
- // ... and index
- nextSibling = findNextSibling(parent, signatureInfo.getSignatureLocation()
- .getIndex().intValue());
-
- }
-
- /**
- * Evaluates the given <code>xpath</code> with the document element as context node
- * and returns the resulting node.
- *
- * @param xpath the XPath expression
- * @param nsContext the namespace context of the XPath expression
- * @param contextNode the context node for the XPath evaluation
- *
- * @return the result of evaluating the XPath expression
- *
- * @throws SLCommandException
- */
- private Node evaluateSignatureLocation(String xpath, NamespaceContext nsContext, Node contextNode) throws SLCommandException {
-
- Node node = null;
- try {
- XPathFactory xpathFactory = XPathFactory.newInstance();
- XPath xPath = xpathFactory.newXPath();
- xPath.setNamespaceContext(nsContext);
- XPathExpression xpathExpr = xPath.compile(xpath);
- node = (Node) xpathExpr.evaluate(contextNode, XPathConstants.NODE);
- } catch (XPathExpressionException e) {
- log.info("Failed to evaluate SignatureLocation XPath expression '" + xpath + "' on context node.", e);
- throw new SLCommandException(4102);
- }
-
- if (node == null) {
- log.info("Failed to evaluate SignatureLocation XPath expression '" + xpath + "'. Result is empty.");
- throw new SLCommandException(4102);
- }
-
- return node;
-
- }
-
- /**
- * Finds the next sibling node of the <code>parent</code>'s <code>n</code>-th child node
- * or <code>null</code> if there is no next sibling.
- *
- * @param parent the parent node
- * @param n the index of the child node
- *
- * @return the next sibling node of the node specified by <code>parent</code> and index <code>n</code>,
- * or <code>null</code> if there is no next sibling node.
- *
- * @throws SLCommandException if the <code>n</code>-th child of <code>parent</code> does not exist
- */
- private Node findNextSibling(Node parent, int n) throws SLCommandException {
- return parent.getChildNodes().item(n);
- }
-
- /**
- * Workaround for a missing namespace prefix declaration in MOA-ID.
- *
- * @author mcentner
- */
- private class MOAIDWorkaroundNamespaceContext implements NamespaceContext {
-
- private NamespaceContext namespaceContext;
-
- public MOAIDWorkaroundNamespaceContext(NamespaceContext namespaceContext) {
- super();
- this.namespaceContext = namespaceContext;
- }
-
- @Override
- public String getNamespaceURI(String prefix) {
-
- String namespaceURI = namespaceContext.getNamespaceURI(prefix);
-
- if ((namespaceURI == null || XMLConstants.NULL_NS_URI.equals(namespaceURI)) && "saml".equals(prefix)) {
- namespaceURI = "urn:oasis:names:tc:SAML:1.0:assertion";
- log.debug("Namespace prefix '" + prefix + "' resolved to '" + namespaceURI + "' (MOA-ID Workaround).");
- } else {
- log.trace("Namespace prefix '" + prefix + "' resolved to '" + namespaceURI + "'.");
- }
-
- return namespaceURI;
- }
-
- @Override
- public String getPrefix(String namespaceURI) {
- return namespaceContext.getPrefix(namespaceURI);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Iterator getPrefixes(String namespaceURI) {
- return namespaceContext.getPrefixes(namespaceURI);
- }
-
- }
-
-}
+package at.gv.egiz.bku.slcommands.impl.xsect; + +import java.util.Iterator; + +import javax.xml.XMLConstants; +import javax.xml.namespace.NamespaceContext; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpression; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Node; + +import at.buergerkarte.namespaces.securitylayer._1.SignatureInfoCreationType; +import at.gv.egiz.bku.slexceptions.SLCommandException; +import at.gv.egiz.slbinding.impl.SignatureLocationType; + +/** + * This class implements the <code>SignatureLocation</code> of an XML-Signature + * to be created by the security layer command <code>CreateXMLSignature</code>. + * + * @author mcentner + */ +public class SignatureLocation { + + /** + * Logging facility. + */ + private final Logger log = LoggerFactory.getLogger(SignatureLocation.class); + + /** + * The SignatureContext for the XML signature + */ + private SignatureContext ctx; + + /** + * The parent node for the XML signature. + */ + private Node parent; + + /** + * The next sibling node for the XML signature. + */ + private Node nextSibling; + + /** + * Creates a new SignatureLocation with the given <code>signatureContext</code> + * + * @param signatureContext the context for the XML signature creation + */ + public SignatureLocation(SignatureContext signatureContext) { + this.ctx = signatureContext; + } + + /** + * @return the parent node for the XML signature + */ + public Node getParent() { + return parent; + } + + /** + * @param parent the parent for the XML signature + */ + public void setParent(Node parent) { + this.parent = parent; + } + + /** + * @return the next sibling node for the XML signature + */ + public Node getNextSibling() { + return nextSibling; + } + + /** + * @param nextSibling the next sibling node for the XML signature + */ + public void setNextSibling(Node nextSibling) { + this.nextSibling = nextSibling; + } + + /** + * Configures this SignatureLocation with the information provided by the + * given <code>SignatureInfo</code> element. + * + * @param signatureInfo + * the <code>SignatureInfo</code> element + * + * @throws SLCommandException + * if configuring this SignatureLocation with given + * <code>signatureInfo</code>fails + */ + public void setSignatureInfo(SignatureInfoCreationType signatureInfo) + throws SLCommandException { + + // evaluate signature location XPath ... + SignatureLocationType signatureLocation = (SignatureLocationType) signatureInfo + .getSignatureLocation(); + + NamespaceContext namespaceContext = new MOAIDWorkaroundNamespaceContext( + signatureLocation.getNamespaceContext()); + + parent = evaluateSignatureLocation(signatureInfo.getSignatureLocation() + .getValue(), namespaceContext, ctx.getDocument().getDocumentElement()); + + // ... and index + nextSibling = findNextSibling(parent, signatureInfo.getSignatureLocation() + .getIndex().intValue()); + + } + + /** + * Evaluates the given <code>xpath</code> with the document element as context node + * and returns the resulting node. + * + * @param xpath the XPath expression + * @param nsContext the namespace context of the XPath expression + * @param contextNode the context node for the XPath evaluation + * + * @return the result of evaluating the XPath expression + * + * @throws SLCommandException + */ + private Node evaluateSignatureLocation(String xpath, NamespaceContext nsContext, Node contextNode) throws SLCommandException { + + Node node = null; + try { + XPathFactory xpathFactory = XPathFactory.newInstance(); + XPath xPath = xpathFactory.newXPath(); + xPath.setNamespaceContext(nsContext); + XPathExpression xpathExpr = xPath.compile(xpath); + node = (Node) xpathExpr.evaluate(contextNode, XPathConstants.NODE); + } catch (XPathExpressionException e) { + log.info("Failed to evaluate SignatureLocation XPath expression '{}' on context node.", xpath, e); + throw new SLCommandException(4102); + } + + if (node == null) { + log.info("Failed to evaluate SignatureLocation XPath expression '{}'. Result is empty.", xpath); + throw new SLCommandException(4102); + } + + return node; + + } + + /** + * Finds the next sibling node of the <code>parent</code>'s <code>n</code>-th child node + * or <code>null</code> if there is no next sibling. + * + * @param parent the parent node + * @param n the index of the child node + * + * @return the next sibling node of the node specified by <code>parent</code> and index <code>n</code>, + * or <code>null</code> if there is no next sibling node. + * + * @throws SLCommandException if the <code>n</code>-th child of <code>parent</code> does not exist + */ + private Node findNextSibling(Node parent, int n) throws SLCommandException { + return parent.getChildNodes().item(n); + } + + /** + * Workaround for a missing namespace prefix declaration in MOA-ID. + * + * @author mcentner + */ + private class MOAIDWorkaroundNamespaceContext implements NamespaceContext { + + private NamespaceContext namespaceContext; + + public MOAIDWorkaroundNamespaceContext(NamespaceContext namespaceContext) { + super(); + this.namespaceContext = namespaceContext; + } + + @Override + public String getNamespaceURI(String prefix) { + + String namespaceURI = namespaceContext.getNamespaceURI(prefix); + + if ((namespaceURI == null || XMLConstants.NULL_NS_URI.equals(namespaceURI)) && "saml".equals(prefix)) { + namespaceURI = "urn:oasis:names:tc:SAML:1.0:assertion"; + log.debug("Namespace prefix '{}' resolved to '{}' (MOA-ID Workaround).", prefix, namespaceURI); + } else { + log.trace("Namespace prefix '{}' resolved to '{}'.", prefix, namespaceURI); + } + + return namespaceURI; + } + + @Override + public String getPrefix(String namespaceURI) { + return namespaceContext.getPrefix(namespaceURI); + } + + @SuppressWarnings("unchecked") + @Override + public Iterator getPrefixes(String namespaceURI) { + return namespaceContext.getPrefixes(namespaceURI); + } + + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/URIDereferncerAdapter.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/URIDereferncerAdapter.java index c94937be..5ae728b3 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/URIDereferncerAdapter.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/URIDereferncerAdapter.java @@ -30,8 +30,7 @@ import javax.xml.crypto.URIReferenceException; import javax.xml.crypto.XMLCryptoContext;
import at.gv.egiz.bku.utils.urldereferencer.StreamData;
-import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer;
-import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerContext;
+import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; /**
* An URIDereferencer implementation that uses an {@link URLDereferencer} to
@@ -44,17 +43,17 @@ public class URIDereferncerAdapter implements URIDereferencer { /**
* The context for dereferencing.
*/
- protected URLDereferencerContext urlDereferencerContext;
+ protected URLDereferencer dereferencer;
/**
* Creates a new URIDereferencerAdapter instance with the given
* <code>urlDereferencerContext</code>.
*
- * @param urlDereferencerContext the context to be used for dereferencing
+ * @param urlDereferencer the context to be used for dereferencing
*/
- public URIDereferncerAdapter(URLDereferencerContext urlDereferencerContext) {
+ public URIDereferncerAdapter(URLDereferencer urlDereferencer) {
super();
- this.urlDereferencerContext = urlDereferencerContext;
+ this.dereferencer = urlDereferencer;
}
/* (non-Javadoc)
@@ -78,10 +77,9 @@ public class URIDereferncerAdapter implements URIDereferencer { if (uri.isAbsolute()) {
- URLDereferencer dereferencer = URLDereferencer.getInstance();
StreamData streamData;
try {
- streamData = dereferencer.dereference(uriString, urlDereferencerContext);
+ streamData = dereferencer.dereference(uriString);
} catch (IOException e) {
throw new URIReferenceException(e.getMessage(), e);
}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLBindingException.java b/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLBindingException.java index 3f1732ba..eff9aec5 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLBindingException.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLBindingException.java @@ -21,6 +21,8 @@ package at.gv.egiz.bku.slexceptions; */
public class SLBindingException extends SLException {
+ private static final long serialVersionUID = 1L; + public SLBindingException(int errorCode) {
super(errorCode);
}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLCanceledException.java b/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLCanceledException.java index 8136a093..801526dc 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLCanceledException.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLCanceledException.java @@ -19,6 +19,8 @@ package at.gv.egiz.bku.slexceptions; public class SLCanceledException extends
at.gv.egiz.bku.slexceptions.SLException {
+ private static final long serialVersionUID = 1L; + public SLCanceledException(int errorCode, String msg, Object[] args) {
super(errorCode, msg, args);
// TODO Auto-generated constructor stub
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLException.java b/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLException.java index 4b541deb..854c1658 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLException.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLException.java @@ -82,7 +82,14 @@ public class SLException extends Exception { return localizedMessage;
+ } + + /* (non-Javadoc) + * @see java.lang.Throwable#getMessage() + */ + @Override + public String getMessage() { + return getLocalizedMessage(); }
-
}
\ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLRequestException.java b/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLRequestException.java index 548732e6..fd02cff7 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLRequestException.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLRequestException.java @@ -18,6 +18,8 @@ package at.gv.egiz.bku.slexceptions; public class SLRequestException extends SLException {
+ private static final long serialVersionUID = 1L; + public SLRequestException(int errorCode) {
super(errorCode);
// TODO Auto-generated constructor stub
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLRuntimeException.java b/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLRuntimeException.java index d09ca418..aa8cd5b5 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLRuntimeException.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLRuntimeException.java @@ -18,6 +18,8 @@ package at.gv.egiz.bku.slexceptions; public class SLRuntimeException extends RuntimeException {
+ private static final long serialVersionUID = 1L; + public SLRuntimeException(String message, Throwable cause) {
super(message, cause);
}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLViewerException.java b/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLViewerException.java index 853328d5..1bfad289 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLViewerException.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slexceptions/SLViewerException.java @@ -18,6 +18,8 @@ package at.gv.egiz.bku.slexceptions; public class SLViewerException extends SLException {
+ private static final long serialVersionUID = 1L; + public SLViewerException(int errorCode) { super(errorCode); } diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/spring/ConfigurableHostnameVerifier.java b/bkucommon/src/main/java/at/gv/egiz/bku/spring/ConfigurableHostnameVerifier.java new file mode 100644 index 00000000..c2f64994 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/spring/ConfigurableHostnameVerifier.java @@ -0,0 +1,77 @@ +/* +* Copyright 2009 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.spring; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLSession; + +import org.apache.commons.configuration.Configuration; + +import at.gv.egiz.bku.conf.MoccaConfigurationFacade; + +public class ConfigurableHostnameVerifier implements HostnameVerifier { + + /** + * The configuration facade. + */ + protected final ConfigurationFacade configurationFacade = new ConfigurationFacade(); + + public class ConfigurationFacade implements MoccaConfigurationFacade { + + private Configuration configuration; + + public static final String SSL_DISSABLE_HOSTNAME_VERIFICATION = "SSL.disableHostnameVerification"; + + public static final String SSL_DISSABLE_ALL_CHECKS = "SSL.disableAllChecks"; + + public boolean disableSslHostnameVerification() { + return configuration.getBoolean(SSL_DISSABLE_HOSTNAME_VERIFICATION, false); + } + + public boolean disableAllSslChecks() { + return configuration.getBoolean(SSL_DISSABLE_ALL_CHECKS, false); + } + + } + + /** + * @return the configuration + */ + public Configuration getConfiguration() { + return configurationFacade.configuration; + } + + /** + * @param configuration the configuration to set + */ + public void setConfiguration(Configuration configuration) { + configurationFacade.configuration = configuration; + } + + + @Override + public boolean verify(String hostname, SSLSession session) { + if (configurationFacade.disableAllSslChecks() || configurationFacade.disableSslHostnameVerification()) { + return true; + } else { + return HttpsURLConnection.getDefaultHostnameVerifier().verify(hostname, session); + } + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/spring/ConfigurationFactoryBean.java b/bkucommon/src/main/java/at/gv/egiz/bku/spring/ConfigurationFactoryBean.java new file mode 100644 index 00000000..a6a7c346 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/spring/ConfigurationFactoryBean.java @@ -0,0 +1,172 @@ +/* +* Copyright 2009 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.spring; + +import java.io.IOException; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; +import java.util.jar.Attributes; +import java.util.jar.Manifest; + +import org.apache.commons.configuration.CompositeConfiguration; +import org.apache.commons.configuration.Configuration; +import org.apache.commons.configuration.ConfigurationException; +import org.apache.commons.configuration.MapConfiguration; +import org.apache.commons.configuration.XMLConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.FactoryBean; +import org.springframework.context.ResourceLoaderAware; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; + +import at.gv.egiz.bku.slcommands.impl.CreateXMLSignatureCommandImpl; + +/** + * This is a {@link FactoryBean} for the creation of a {@link Configuration}. + * + * @author mcentner + */ +public class ConfigurationFactoryBean implements FactoryBean, ResourceLoaderAware { + + protected static final Logger log = LoggerFactory.getLogger(ConfigurationFactoryBean.class); + + public static final String DEFAULT_CONFIG = "/WEB-INF/conf/configuration.xml"; + + public static final String MOCCA_IMPLEMENTATIONNAME_PROPERTY = "ProductName"; + + public static final String MOCCA_IMPLEMENTATIONVERSION_PROPERTY = "ProductVersion"; + + public static final String SIGNATURE_LAYOUT_PROPERTY = "SignatureLayout"; + + /** + * The URL of the configuration file. + */ + protected Resource configurationResource; + + /** + * The ResourceLoader. + */ + protected ResourceLoader resourceLoader; + + @Override + public void setResourceLoader(ResourceLoader resourceLoader) { + this.resourceLoader = resourceLoader; + } + + /** + * @return the configurationURL + */ + public Resource getConfigurationResource() { + return configurationResource; + } + + /** + * @param configurationResource the configurationURL to set + */ + public void setConfigurationResource(Resource configurationResource) { + this.configurationResource = configurationResource; + } + + protected Configuration getDefaultConfiguration() + throws ConfigurationException, IOException { + Resource resource = resourceLoader.getResource(DEFAULT_CONFIG); + XMLConfiguration xmlConfiguration = new XMLConfiguration(); + xmlConfiguration.load(resource.getInputStream()); + xmlConfiguration.setURL(resource.getURL()); + return xmlConfiguration; + } + + protected Configuration getVersionConfiguration() throws IOException { + + Map<String, String> map = new HashMap<String, String>(); + map.put(MOCCA_IMPLEMENTATIONNAME_PROPERTY, "MOCCA"); + + // implementation version + String version = null; + try { + Resource resource = resourceLoader.getResource("META-INF/MANIFEST.MF"); + Manifest properties = new Manifest(resource.getInputStream()); + Attributes attributes = properties.getMainAttributes(); + // TODO: replace by Implementation-Version ? + version = attributes.getValue("Implementation-Build"); + } catch (Exception e) { + log.warn("Failed to get implemenation version from manifest. {}", e.getMessage()); + } + + if (version == null) { + version="UNKNOWN"; + } + map.put(MOCCA_IMPLEMENTATIONVERSION_PROPERTY, version); + + // signature layout + try { + String classContainer = CreateXMLSignatureCommandImpl.class.getProtectionDomain() + .getCodeSource().getLocation().toString(); + URL manifestUrl = new URL("jar:" + classContainer + + "!/META-INF/MANIFEST.MF"); + Manifest manifest = new Manifest(manifestUrl.openStream()); + Attributes attributes = manifest.getMainAttributes(); + String signatureLayout = attributes.getValue("SignatureLayout"); + if (signatureLayout != null) { + map.put(SIGNATURE_LAYOUT_PROPERTY, signatureLayout); + } + } catch (Exception e) { + log.warn("Failed to get signature layout from manifest.", e); + } + + + return new MapConfiguration(map); + + } + + @Override + public Object getObject() throws Exception { + + log.info("Configuration resource is {}.", configurationResource); + + CompositeConfiguration configuration; + if (configurationResource == null) { + // initialize default configuration + log.warn("Initializing with default configuration."); + configuration = new CompositeConfiguration(); + } else { + // initialize with writable configuration + URL url = configurationResource.getURL(); + XMLConfiguration writableConfiguration = new XMLConfiguration(url); + configuration = new CompositeConfiguration(writableConfiguration); + log.info("Initialized with configuration from '{}'.", url); + } + configuration.addConfiguration(getDefaultConfiguration()); + configuration.addConfiguration(getVersionConfiguration()); + return configuration; + } + + @Override + public Class<?> getObjectType() { + return Configuration.class; + } + + @Override + public boolean isSingleton() { + return true; + } + + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/spring/PKIProfileFactoryBean.java b/bkucommon/src/main/java/at/gv/egiz/bku/spring/PKIProfileFactoryBean.java new file mode 100644 index 00000000..97a0d872 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/spring/PKIProfileFactoryBean.java @@ -0,0 +1,235 @@ +/* +* Copyright 2009 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.spring; + +import iaik.logging.LogConfigurationException; +import iaik.logging.LoggerConfig; +import iaik.logging.impl.TransactionIdImpl; +import iaik.pki.DefaultPKIConfiguration; +import iaik.pki.DefaultPKIProfile; +import iaik.pki.PKIException; +import iaik.pki.PKIFactory; +import iaik.pki.PKIProfile; +import iaik.pki.revocation.RevocationSourceTypes; +import iaik.pki.store.certstore.CertStoreParameters; +import iaik.pki.store.certstore.directory.DefaultDirectoryCertStoreParameters; +import iaik.pki.store.truststore.DefaultTrustStoreProfile; +import iaik.pki.store.truststore.TrustStoreProfile; +import iaik.pki.store.truststore.TrustStoreTypes; + +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Properties; + +import org.apache.commons.configuration.CompositeConfiguration; +import org.apache.commons.configuration.Configuration; +import org.apache.commons.configuration.FileConfiguration; +import org.springframework.beans.factory.FactoryBean; +import org.springframework.context.ResourceLoaderAware; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; + +import at.gv.egiz.bku.conf.IAIKLogAdapterFactory; +import at.gv.egiz.bku.conf.MoccaConfigurationFacade; + +public class PKIProfileFactoryBean implements FactoryBean, ResourceLoaderAware { + + /** + * The configuration facade. + */ + protected final ConfigurationFacade configurationFacade = new ConfigurationFacade(); + + public class ConfigurationFacade implements MoccaConfigurationFacade { + + private Configuration configuration; + + public static final String SSL_CERT_DIRECTORY = "SSL.certDirectory"; + + public static final String SSL_CERT_DIRECTORY_DEFAULT = "classpath:at/gv/egiz/bku/certs/certStore"; + + public static final String SSL_CA_DIRECTORY = "SSL.caDirectory"; + + public static final String SSL_CA_DIRECTORY_DEFAULT = "classpath:at/gv/egiz/bku/certs/trustStore"; + + public URL getCertDirectory() throws MalformedURLException { + return getURL(SSL_CERT_DIRECTORY); + } + + public URL getCaDirectory() throws MalformedURLException { + return getURL(SSL_CA_DIRECTORY); + } + + private URL getURL(String key) throws MalformedURLException { + String url = configuration.getString(key); + if (url == null || url.isEmpty()) { + return null; + } + return new URL(getBasePath(key), configuration.getString(key)); + } + + private URL getBasePath(String key) { + Configuration configuration = this.configuration; + if (configuration instanceof CompositeConfiguration) { + CompositeConfiguration compositeConfiguration = (CompositeConfiguration) configuration; + for (int i = 0; i < compositeConfiguration.getNumberOfConfigurations(); i++) { + if (compositeConfiguration.getConfiguration(i).containsKey(key)) { + configuration = compositeConfiguration.getConfiguration(i); + break; + } + } + } + if (configuration instanceof FileConfiguration) { + return ((FileConfiguration) configuration).getURL(); + } + return null; + } + + } + + + private ResourceLoader resourceLoader; + + protected String trustProfileId; + + @Override + public void setResourceLoader(ResourceLoader loader) { + this.resourceLoader = loader; + } + + /** + * @return the configuration + */ + public Configuration getConfiguration() { + return configurationFacade.configuration; + } + + /** + * @param configuration the configuration to set + */ + public void setConfiguration(Configuration configuration) { + configurationFacade.configuration = configuration; + } + + /** + * @return the trustProfileId + */ + public String getTrustProfileId() { + return trustProfileId; + } + + /** + * @param trustProfileId the trustProfileId to set + */ + public void setTrustProfileId(String trustProfileId) { + this.trustProfileId = trustProfileId; + } + + protected File getDirectory(String url) throws IOException { + Resource resource = resourceLoader.getResource(url); + File path = resource.getFile(); + if (!path.exists() && !path.isDirectory()) { + throw new IOException("URL '" + url + "' is not a directory."); + } + return path; + } + + protected void configureIAIKLogging() { + // initialize IAIK logging for PKI module + iaik.logging.LogFactory.configure(new LoggerConfig() { + + @Override + public Properties getProperties() throws LogConfigurationException { + return null; + } + + @Override + public String getNodeId() { + return "pki"; + } + + @Override + public String getFactory() { + return IAIKLogAdapterFactory.class.getName(); + } + }); + } + + protected void configurePkiFactory() throws MalformedURLException, PKIException, IOException { + + URL url = configurationFacade.getCertDirectory(); + File certDirectory = (url != null) + ? getDirectory(url.toString()) + : getDirectory(ConfigurationFacade.SSL_CERT_DIRECTORY_DEFAULT); + + CertStoreParameters[] certStoreParameters = { new DefaultDirectoryCertStoreParameters( + "CS", certDirectory.getAbsolutePath(), true, false) }; + + DefaultPKIConfiguration pkiConfiguration = new DefaultPKIConfiguration(certStoreParameters); + + + PKIFactory pkiFactory = PKIFactory.getInstance(); + pkiFactory.configure(pkiConfiguration, new TransactionIdImpl("Configure-PKI")); + } + + protected TrustStoreProfile createDirectoryTrustStoreProfile() throws MalformedURLException, IOException { + + URL url = configurationFacade.getCaDirectory(); + File caDirectory = (url != null) + ? getDirectory(url.toString()) + : getDirectory(ConfigurationFacade.SSL_CA_DIRECTORY_DEFAULT); + + return new DefaultTrustStoreProfile(trustProfileId, + TrustStoreTypes.DIRECTORY, caDirectory.getAbsolutePath()); + + } + + @Override + public Object getObject() throws Exception { + + configureIAIKLogging(); + + PKIFactory pkiFactory = PKIFactory.getInstance(); + + if (!pkiFactory.isAlreadyConfigured()) { + configurePkiFactory(); + } + + TrustStoreProfile trustProfile = createDirectoryTrustStoreProfile(); + + DefaultPKIProfile pkiProfile = new DefaultPKIProfile(trustProfile); + + pkiProfile.setAutoAddCertificates(true); + pkiProfile.setPreferredServiceOrder(new String[] { + RevocationSourceTypes.OCSP, RevocationSourceTypes.CRL }); + + return pkiProfile; + } + + @Override + public Class<?> getObjectType() { + return PKIProfile.class; + } + + @Override + public boolean isSingleton() { + return false; + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/spring/PKITrustManager.java b/bkucommon/src/main/java/at/gv/egiz/bku/spring/PKITrustManager.java new file mode 100644 index 00000000..36fdcd06 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/spring/PKITrustManager.java @@ -0,0 +1,173 @@ +/* +* Copyright 2009 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.spring; + +import iaik.logging.TransactionId; +import iaik.pki.PKIException; +import iaik.pki.PKIFactory; +import iaik.pki.PKIModule; +import iaik.pki.PKIProfile; +import iaik.pki.store.truststore.TrustStore; +import iaik.pki.store.truststore.TrustStoreException; +import iaik.pki.store.truststore.TrustStoreFactory; + +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.Date; + +import javax.net.ssl.X509TrustManager; + +import org.apache.commons.configuration.Configuration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; + +import at.gv.egiz.bku.conf.MoccaConfigurationFacade; + +public class PKITrustManager implements X509TrustManager { + + Logger log = LoggerFactory.getLogger(PKITrustManager.class); + + protected PKIProfile pkiProfile; + + /** + * The configuration facade. + */ + protected final ConfigurationFacade configurationFacade = new ConfigurationFacade(); + + public class ConfigurationFacade implements MoccaConfigurationFacade { + + private Configuration configuration; + + public static final String SSL_DISSABLE_ALL_CHECKS = "SSL.disableAllChecks"; + + public boolean disableAllSslChecks() { + return configuration.getBoolean(SSL_DISSABLE_ALL_CHECKS, false); + } + + } + + /** + * @return the configuration + */ + public Configuration getConfiguration() { + return configurationFacade.configuration; + } + + /** + * @param configuration the configuration to set + */ + public void setConfiguration(Configuration configuration) { + configurationFacade.configuration = configuration; + } + + /** + * @return the pkiProfile + */ + public PKIProfile getPkiProfile() { + return pkiProfile; + } + + /** + * @param pkiProfile the pkiProfile to set + */ + public void setPkiProfile(PKIProfile pkiProfile) { + this.pkiProfile = pkiProfile; + } + + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + checkServerTrusted(chain, authType); + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) + throws CertificateException { + + if (pkiProfile == null) { + throw new CertificateException("No PKI profile set. Configuration error."); + } + + if (configurationFacade.disableAllSslChecks()) { + log.warn("SSL certificate validation disabled. " + + "Accepted certificate {}.", chain[0].getSubjectDN()); + } else { + + iaik.x509.X509Certificate[] certs = convertCerts(chain); + + TransactionId tid = new MDCTransactionId(); + try { + PKIModule pkiModule = PKIFactory.getInstance().getPKIModule(pkiProfile); + if (!pkiModule.validateCertificate(new Date(), certs[0], certs, null, + tid).isCertificateValid()) { + throw new CertificateException("Certificate not valid."); + } + } catch (PKIException e) { + log.warn("Failed to validate certificate.", e); + throw new CertificateException("Failed to validate certificate. " + e.getMessage()); + } + + } + + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + + if (pkiProfile == null) { + log.warn("No PKI profile set. Configuration error."); + return new X509Certificate[] {}; + } + + TransactionId tid = new MDCTransactionId(); + + try { + + TrustStore trustStore = TrustStoreFactory.getInstance(pkiProfile.getTrustStoreProfile(), tid); + return (X509Certificate[]) trustStore.getTrustedCertificates(tid).toArray(); + + } catch (TrustStoreException e) { + log.warn("Failed to get list of accepted issuers.", e); + return new X509Certificate[] {}; + } + + } + + private static iaik.x509.X509Certificate[] convertCerts( + X509Certificate[] certs) throws CertificateException { + iaik.x509.X509Certificate[] retVal = new iaik.x509.X509Certificate[certs.length]; + int i = 0; + for (X509Certificate cert : certs) { + if (cert instanceof iaik.x509.X509Certificate) { + retVal[i++] = (iaik.x509.X509Certificate) cert; + } else { + retVal[i++] = new iaik.x509.X509Certificate(cert.getEncoded()); + } + } + return retVal; + } + + private static class MDCTransactionId implements TransactionId { + @Override + public String getLogID() { + String sessionId = MDC.get("SessionId"); + return (sessionId != null) ? sessionId : "PKITrustManager"; + } + } +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/spring/SSLSocketFactoryBean.java b/bkucommon/src/main/java/at/gv/egiz/bku/spring/SSLSocketFactoryBean.java new file mode 100644 index 00000000..f6dbddd6 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/spring/SSLSocketFactoryBean.java @@ -0,0 +1,109 @@ +/* +* Copyright 2009 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.spring; + +import iaik.pki.PKIProfile; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; + +import org.apache.commons.configuration.Configuration; +import org.springframework.beans.factory.FactoryBean; + +import at.gv.egiz.bku.conf.MoccaConfigurationFacade; + +public class SSLSocketFactoryBean implements FactoryBean { + + protected PKIProfile pkiProfile; + + /** + * The configuration facade. + */ + protected final ConfigurationFacade configurationFacade = new ConfigurationFacade(); + + public class ConfigurationFacade implements MoccaConfigurationFacade { + + private Configuration configuration; + + public static final String SSL_PROTOCOL = "SSL.sslProtocol"; + + public static final String SSL_DISSABLE_ALL_CHECKS = "SSL.disableAllChecks"; + + public String getSslProtocol() { + return configuration.getString(SSL_PROTOCOL, "TLS"); + } + + public boolean disableAllSslChecks() { + return configuration.getBoolean(SSL_DISSABLE_ALL_CHECKS, false); + } + + } + + /** + * @return the configuration + */ + public Configuration getConfiguration() { + return configurationFacade.configuration; + } + + /** + * @param configuration the configuration to set + */ + public void setConfiguration(Configuration configuration) { + configurationFacade.configuration = configuration; + } + + /** + * @return the pkiProfile + */ + public PKIProfile getPkiProfile() { + return pkiProfile; + } + + /** + * @param pkiProfile the pkiProfile to set + */ + public void setPkiProfile(PKIProfile pkiProfile) { + this.pkiProfile = pkiProfile; + } + + @Override + public Object getObject() throws Exception { + + PKITrustManager pkiTrustManager = new PKITrustManager(); + pkiTrustManager.setConfiguration(configurationFacade.configuration); + pkiTrustManager.setPkiProfile(pkiProfile); + + SSLContext sslContext = SSLContext.getInstance(configurationFacade.getSslProtocol()); + sslContext.init(null, new TrustManager[] {pkiTrustManager}, null); + + return sslContext.getSocketFactory(); + } + + @Override + public Class<?> getObjectType() { + return SSLSocketFactory.class; + } + + @Override + public boolean isSingleton() { + return false; + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/spring/SecurityManagerFactoryBean.java b/bkucommon/src/main/java/at/gv/egiz/bku/spring/SecurityManagerFactoryBean.java new file mode 100644 index 00000000..4e9e4d76 --- /dev/null +++ b/bkucommon/src/main/java/at/gv/egiz/bku/spring/SecurityManagerFactoryBean.java @@ -0,0 +1,102 @@ +/* +* Copyright 2009 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.spring; + +import org.apache.commons.configuration.Configuration; +import org.springframework.beans.factory.FactoryBean; +import org.springframework.context.ResourceLoaderAware; +import org.springframework.core.io.Resource; +import org.springframework.core.io.ResourceLoader; + +import at.gv.egiz.bku.accesscontroller.SecurityManagerFacade; + +public class SecurityManagerFactoryBean implements ResourceLoaderAware, + FactoryBean { + + protected ResourceLoader resourceLoader; + + protected ConfigurationFacade configurationFacade = new ConfigurationFacade(); + + public class ConfigurationFacade { + + protected ConfigurationFacade() { + } + + public static final String ACCESSCONTROLLER_POLICYRESOURCE = "AccessController.PolicyResource"; + + public static final String ACCESSCONTROLLER_DEFAULT_POLICYRESOURCE = "classpath:/at/gv/egiz/bku/accesscontrol/config/accessControlConfig.xml"; + + public static final String ACCESSCONTROLLER_ACCEPTNOMATCH = "AccessController.AcceptNoMatch"; + + public static final boolean ACCESSCONTROLLER_DEFAULT_ACCEPTNOMATCH = false; + + protected String getPolicyResource() { + return configuration.getString(ACCESSCONTROLLER_POLICYRESOURCE, ACCESSCONTROLLER_DEFAULT_POLICYRESOURCE); + } + + protected boolean getAcceptNoMatch() { + return configuration.getBoolean(ACCESSCONTROLLER_ACCEPTNOMATCH, ACCESSCONTROLLER_DEFAULT_ACCEPTNOMATCH); + } + + } + + protected Configuration configuration; + + /** + * @return the configuration + */ + public Configuration getConfiguration() { + return configuration; + } + + /** + * @param configuration the configuration to set + */ + public void setConfiguration(Configuration configuration) { + this.configuration = configuration; + } + + @Override + public void setResourceLoader(ResourceLoader resourceLoader) { + this.resourceLoader = resourceLoader; + } + + @Override + public Object getObject() throws Exception { + + SecurityManagerFacade sm = new SecurityManagerFacade(); + sm.setAllowUnmatched(configurationFacade.getAcceptNoMatch()); + + Resource policyResource = resourceLoader.getResource(configurationFacade.getPolicyResource()); + sm.init(policyResource.getInputStream()); + + return sm; + + } + + @Override + public Class<?> getObjectType() { + return SecurityManagerFacade.class; + } + + @Override + public boolean isSingleton() { + return true; + } + +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/viewer/ResourceFontLoader.java b/bkucommon/src/main/java/at/gv/egiz/bku/viewer/ResourceFontLoader.java index 8cab581d..91dfc9da 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/viewer/ResourceFontLoader.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/viewer/ResourceFontLoader.java @@ -19,8 +19,8 @@ package at.gv.egiz.bku.viewer; import at.gv.egiz.bku.gui.viewer.FontProviderException; import at.gv.egiz.bku.gui.viewer.FontProvider; import java.awt.Font; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Loads font(s) as classpath resource. @@ -31,7 +31,7 @@ public class ResourceFontLoader implements FontProvider { public static final String FONT_RESOURCE = "DejaVuLGCSansMono.ttf"; - protected final static Log log = LogFactory.getLog(ResourceFontLoader.class); + private final Logger log = LoggerFactory.getLogger(ResourceFontLoader.class); /** TextValidator and (local) SecureViewerDialog (see LocalStalFactory) use ResourceFontLoader, load resource only once */ protected static Font font; diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/viewer/ValidatorFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/viewer/ValidatorFactory.java index ad9bf6bb..c5a90a61 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/viewer/ValidatorFactory.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/viewer/ValidatorFactory.java @@ -26,15 +26,15 @@ import java.util.Iterator; import java.util.List; import java.util.Properties; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ValidatorFactory { /** * Logging facility. */ - protected static Log log = LogFactory.getLog(ValidatorFactory.class); + private final Logger log = LoggerFactory.getLogger(ValidatorFactory.class); private static final Class<Validator> VALIDATOR_CLASS = Validator.class; @@ -93,7 +93,7 @@ public class ValidatorFactory { try { properties.load(url.openStream()); } catch (IOException e) { - log.error("Failed to load service properties " + url.toExternalForm()); + log.error("Failed to load service properties {}.", url.toExternalForm()); continue; } String className = properties.getProperty(mimeType); @@ -124,22 +124,22 @@ public class ValidatorFactory { return (Validator) implConstructor.newInstance((Object[])null); } catch (InvocationTargetException ex) { //ex from constructor - log.error("Failed to initialize validator class '" + className + "': " + ex.getCause().getMessage(), ex.getCause()); + log.error("Failed to initialize validator class '{}'.", className, ex.getCause()); throw ex; } catch (NoSuchMethodException ex) { - log.error("Validator class '" + className + "' has no nullary constructor", ex); + log.error("Validator class '{}' has no nullary constructor.", className, ex); throw ex; } catch (ClassNotFoundException e) { - log.error("Validator class '" + className + "' not found.", e); + log.error("Validator class '{}' not found.", className, e); throw e; } catch (InstantiationException e) { - log.error("Faild to initialize validator class '" + className + "'.", e); + log.error("Faild to initialize validator class '{}'.", className, e); throw e; } catch (IllegalAccessException e) { - log.error("Faild to initialize validator class '" + className + "'.", e); + log.error("Faild to initialize validator class '{}'.", className, e); throw e; } catch (ClassCastException e) { - log.error("Class '" + className + "' is not a validator implementation.", e); + log.error("Class '{}' is not a validator implementation.", className, e); throw e; } @@ -168,7 +168,7 @@ public class ValidatorFactory { }; } catch (IOException e) { - log.error("Failed to enumerate resources " + SERVICE_ID); + log.error("Failed to enumerate resources {}.", SERVICE_ID); List<URL> list = Collections.emptyList(); return list.iterator(); } diff --git a/BKUOnline/src/main/resources/at/gv/egiz/bku/online/conf/accessControlConfig.xml b/bkucommon/src/main/resources/at/gv/egiz/bku/accesscontrol/config/accessControlConfig.xml index f8d1411c..f8d1411c 100644 --- a/BKUOnline/src/main/resources/at/gv/egiz/bku/online/conf/accessControlConfig.xml +++ b/bkucommon/src/main/resources/at/gv/egiz/bku/accesscontrol/config/accessControlConfig.xml diff --git a/bkucommon/src/main/resources/at/gv/egiz/bku/slcommands/schema/xmldsig-transforms.xsd b/bkucommon/src/main/resources/at/gv/egiz/bku/slcommands/schema/xmldsig-transforms.xsd deleted file mode 100644 index 25fdec88..00000000 --- a/bkucommon/src/main/resources/at/gv/egiz/bku/slcommands/schema/xmldsig-transforms.xsd +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<!-- Schema for XML Signatures
- http://www.w3.org/2000/09/xmldsig#
- $Revision: 1.1 $ on $Date: 2002/02/08 20:32:26 $ by $Author: reagle $
-
- Copyright 2001 The Internet Society and W3C (Massachusetts Institute
- of Technology, Institut National de Recherche en Informatique et en
- Automatique, Keio University). All Rights Reserved.
- http://www.w3.org/Consortium/Legal/
-
- This document is governed by the W3C Software License [1] as described
- in the FAQ [2].
-
- [1] http://www.w3.org/Consortium/Legal/copyright-software-19980720
- [2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD
--->
-
-
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
- targetNamespace="http://www.w3.org/2000/09/xmldsig#"
- version="0.1" elementFormDefault="qualified">
-
- <element name="Transforms" type="ds:TransformsType"/>
- <complexType name="TransformsType">
- <sequence>
- <element ref="ds:Transform" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
-
- <element name="Transform" type="ds:TransformType"/>
- <complexType name="TransformType" mixed="true">
- <choice minOccurs="0" maxOccurs="unbounded">
- <any namespace="##other" processContents="lax"/>
- <!-- (1,1) elements from (0,unbounded) namespaces -->
- <element name="XPath" type="string"/>
- </choice>
- <attribute name="Algorithm" type="anyURI" use="required"/>
- </complexType>
-
-</schema>
\ No newline at end of file diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/accesscontroller/ConfigTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/accesscontroller/ConfigTest.java index bce3cdd9..88832753 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/accesscontroller/ConfigTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/accesscontroller/ConfigTest.java @@ -7,7 +7,6 @@ import org.junit.Test; import at.gv.egiz.bku.slcommands.InfoboxReadCommand;
import at.gv.egiz.bku.slcommands.SLCommandContext;
import at.gv.egiz.bku.slcommands.SLResult;
-import at.gv.egiz.bku.slcommands.impl.InfoboxReadCommandImpl;
import at.gv.egiz.bku.slexceptions.SLCommandException;
import at.gv.egiz.bku.slexceptions.SLException;
import static org.junit.Assert.*;
@@ -20,7 +19,6 @@ public class ConfigTest { static class MyInfoBox implements InfoboxReadCommand {
private String domainId;
private String boxId;
- private String name;
public MyInfoBox(String identifier, String domainId) {
this.boxId = identifier;
@@ -38,12 +36,11 @@ public class ConfigTest { }
@Override
- public SLResult execute() {
+ public SLResult execute(SLCommandContext commandContext) {
return null;
}
public void setName(String name) {
- this.name = name;
}
@Override
@@ -52,7 +49,7 @@ public class ConfigTest { }
@Override
- public void init(SLCommandContext ctx, Object unmarshalledRequest)
+ public void init(Object unmarshalledRequest)
throws SLCommandException {
}
}
diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/AbstractBindingProcessorTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/AbstractBindingProcessorTest.java new file mode 100644 index 00000000..409d2611 --- /dev/null +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/AbstractBindingProcessorTest.java @@ -0,0 +1,77 @@ +/* +* Copyright 2009 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.binding; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import iaik.security.ecc.provider.ECCProvider; +import iaik.security.provider.IAIK; +import iaik.xml.crypto.XSecProvider; + +import java.security.Security; + +import org.junit.BeforeClass; +import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import at.gv.egiz.bku.slcommands.SLCommandInvoker; +import at.gv.egiz.stal.STAL; + +public abstract class AbstractBindingProcessorTest { + + protected static AbstractApplicationContext ctx; + + @BeforeClass + public static void setUpClass() { + Security.insertProviderAt(new IAIK(), 1); + Security.insertProviderAt(new ECCProvider(false), 2); + XSecProvider.addAsProvider(false); + + ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext( + "at/gv/egiz/bku/slcommands/testApplicationContext.xml"); + assertNotNull(ctx); + HttpBindingProcessorTest.ctx = ctx; + } + + protected static BindingProcessorManager getBindingProcessorManager() { + Object bean = ctx.getBean("bindingProcessorManager"); + assertTrue(bean instanceof BindingProcessorManagerImpl); + BindingProcessorManagerImpl manager = (BindingProcessorManagerImpl) bean; + + assertNotNull(manager.getCommandInvoker()); + assertNotNull(manager.getStalFactory()); + return manager; + } + + public static BindingProcessor createBindingProcessor(String protocol) { + + BindingProcessorManagerImpl manager = (BindingProcessorManagerImpl) getBindingProcessorManager(); + + assertNotNull(manager.getCommandInvoker()); + assertNotNull(manager.getStalFactory()); + + BindingProcessor bindingProcessor = manager.createBindingProcessor(protocol); + SLCommandInvoker commandInvoker = manager.getCommandInvoker().newInstance(); + STAL stal = manager.getStalFactory().createSTAL(); + bindingProcessor.init("test", stal, commandInvoker); + + return bindingProcessor; + + } + +} diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/BindingProcessorManagerTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/BindingProcessorManagerTest.java index 22a7aa3b..d4c91560 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/BindingProcessorManagerTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/BindingProcessorManagerTest.java @@ -16,36 +16,19 @@ */ package at.gv.egiz.bku.binding; -import at.gv.egiz.bku.conf.Configuration; -import at.gv.egiz.bku.conf.DummyConfiguration; import static org.junit.Assert.*; import java.net.MalformedURLException; -import org.junit.Before; import org.junit.Test; -public class BindingProcessorManagerTest { +public class BindingProcessorManagerTest extends AbstractBindingProcessorTest { - @Before - public void setUp() { - IdFactory.getInstance().setNumberOfBits(24*10); - } - - - @Test(expected = MalformedURLException.class) + @Test(expected = IllegalArgumentException.class) public void basicCreationTest() throws MalformedURLException { - //TODO for the moment empty config sufficient (currently only maxDataURLHops configured) - BindingProcessorManager manager = new BindingProcessorManagerImpl(new DummyStalFactory(), new SLCommandInvokerImpl(), new DummyConfiguration()); - BindingProcessor bp = manager.createBindingProcessor("http://www.at/", null); - assertNotNull(bp.getId().toString()); - assertEquals(40, bp.getId().toString().length()); - String hansi = "Hansi"; - bp = manager.createBindingProcessor("http://www.iaik.at",hansi); - assertEquals(hansi, bp.getId().toString()); - bp = manager.createBindingProcessor("HtTp://www.iaik.at", null); - assertNotNull(bp); - manager.createBindingProcessor("seppl", null); + assertNotNull(createBindingProcessor("http")); + assertNotNull(createBindingProcessor("HtTp")); + createBindingProcessor("seppl"); } } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/DataUrlConnectionTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/DataUrlConnectionTest.java index 6e48e6fa..215af8da 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/DataUrlConnectionTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/DataUrlConnectionTest.java @@ -20,8 +20,8 @@ */ package at.gv.egiz.bku.binding; -import at.gv.egiz.bku.conf.Configuration; -import at.gv.egiz.bku.conf.DummyConfiguration; +import static org.junit.Assert.*; + import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -35,13 +35,15 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import at.gv.egiz.bku.slexceptions.SLException; + import com.sun.net.httpserver.Headers; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; @@ -51,20 +53,20 @@ import com.sun.net.httpserver.HttpServer; * * @author clemens */ -public class DataUrlConnectionTest { +public class DataUrlConnectionTest extends AbstractBindingProcessorTest { public static final String REQUEST_RESOURCE = "at/gv/egiz/bku/binding/NOPMultipartDataUrl.txt"; - private static final Log log = LogFactory.getLog(DataUrlConnectionTest.class); + private final Logger log = LoggerFactory.getLogger(DataUrlConnectionTest.class); static HttpServer server; - static BindingProcessor bindingProcessor; - static BindingProcessorManager manager; + static HTTPBindingProcessorImpl bindingProcessor; protected InputStream requestStream; @BeforeClass public static void setUpHTTPServer() throws IOException { + Logger log = LoggerFactory.getLogger(DataUrlConnectionTest.class); log.debug("setting up HTTPServer"); InetSocketAddress addr = new InetSocketAddress("localhost", 8081); server = HttpServer.create(addr, 0); @@ -72,14 +74,12 @@ public class DataUrlConnectionTest { server.start(); log.debug("setting up HTTPBindingProcessor"); - manager = new BindingProcessorManagerImpl(new DummyStalFactory(), - new SLCommandInvokerImpl(), new DummyConfiguration()); - bindingProcessor = (HTTPBindingProcessor) manager.createBindingProcessor( - "http://www.iaik.at", null); + bindingProcessor = (HTTPBindingProcessorImpl) createBindingProcessor("http"); + Map<String, String> headers = new HashMap<String, String>(); headers.put("Content-Type", InputDecoderFactory.MULTIPART_FORMDATA + ";boundary=---------------------------2330864292941"); - ((HTTPBindingProcessor) bindingProcessor).setHTTPHeaders(headers); + ((HTTPBindingProcessorImpl) bindingProcessor).setHTTPHeaders(headers); } @Before @@ -91,6 +91,7 @@ public class DataUrlConnectionTest { @AfterClass public static void stopServer() { if (server != null) { + Logger log = LoggerFactory.getLogger(DataUrlConnectionTest.class); log.debug("stopping HTTPServer"); server.stop(0); } @@ -98,9 +99,12 @@ public class DataUrlConnectionTest { @Test public void testBasicNop() { - bindingProcessor.consumeRequestStream(requestStream); - // manager.process(bindingProcessor); + bindingProcessor.consumeRequestStream("http://localhost:3495/http-security-layer-request", requestStream); bindingProcessor.run(); + SLException e = bindingProcessor.bindingProcessorError; + if (e != null) { + fail(e.getMessage()); + } } // @Test @@ -109,8 +113,7 @@ public class DataUrlConnectionTest { URL dataUrl = new URL("http://localhost:8081/"); log.debug("creating DataUrlConnection " + dataUrl.toString()); - DataUrlConnectionImpl c = new DataUrlConnectionImpl(); - c.init(dataUrl); + DataUrlConnectionImpl c = new DataUrlConnectionImpl(dataUrl); c.setHTTPHeader("httpHeader_1", "001"); ByteArrayInputStream bais = new ByteArrayInputStream("Hello, world!" @@ -124,6 +127,8 @@ public class DataUrlConnectionTest { static class DataUrlHandler implements HttpHandler { + private final Logger log = LoggerFactory.getLogger(DataUrlConnectionTest.class); + public DataUrlHandler() { log.debug("setting up DataUrlHandler"); } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/EmptyMultipartSLRequestTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/EmptyMultipartSLRequestTest.java deleted file mode 100644 index ee17f5e9..00000000 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/EmptyMultipartSLRequestTest.java +++ /dev/null @@ -1,98 +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.binding; - -import at.gv.egiz.bku.conf.Configuration; -import iaik.security.ecc.provider.ECCProvider; -import iaik.security.provider.IAIK; -import iaik.xml.crypto.XSecProvider; - -import java.io.InputStream; -import java.net.MalformedURLException; -import java.security.Provider; -import java.security.Security; -import java.security.Provider.Service; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.Before; -import org.junit.Test; - -import at.gv.egiz.bku.conf.Configurator; -import at.gv.egiz.bku.conf.DummyConfiguration; -import at.gv.egiz.bku.slcommands.SLCommandFactory; -import at.gv.egiz.bku.slcommands.impl.xsect.STALProvider; - -public class EmptyMultipartSLRequestTest { - - private static Log log = LogFactory.getLog(EmptyMultipartSLRequestTest.class); - - protected String resourceName = "at/gv/egiz/bku/binding/MultipartEmpty.txt"; - - protected BindingProcessor bindingProcessor; - protected InputStream dataStream; - protected BindingProcessorManager manager; - - @Before - public void setUp() throws MalformedURLException, ClassNotFoundException { - manager = new BindingProcessorManagerImpl(new DummyStalFactory(), - new SLCommandInvokerImpl(), new DummyConfiguration()); - HTTPBindingProcessor http = (HTTPBindingProcessor) manager - .createBindingProcessor("http://www.at/", null); - Map<String, String> headers = new HashMap<String, String>(); - headers.put("Content-Type", InputDecoderFactory.MULTIPART_FORMDATA - + ";boundary=uW10q_I9UeqKyw-1o5EW4jtEAaGs7-mC6o"); - http.setHTTPHeaders(headers); - dataStream = getClass().getClassLoader().getResourceAsStream(resourceName); - bindingProcessor = http; - Map<String, String> commandMap = new HashMap<String, String>(); - commandMap - .put( - "http://www.buergerkarte.at/namespaces/securitylayer/1.2#:CreateXMLSignatureRequest", - "at.gv.egiz.bku.slcommands.impl.CreateXMLSignatureCommandImpl"); - commandMap - .put( - "http://www.buergerkarte.at/namespaces/securitylayer/1.2#:InfoboxReadRequest", - "at.gv.egiz.bku.slcommands.impl.InfoboxReadCommandImpl"); - SLCommandFactory.getInstance().setCommandImpl(commandMap); - Security.insertProviderAt(new IAIK(), 1); - Security.insertProviderAt(new ECCProvider(false), 2); - XSecProvider.addAsProvider(false); - // registering STALProvider as delegation provider for XSECT - STALProvider stalProvider = new STALProvider(); - Security.addProvider(stalProvider); - Set<Service> services = stalProvider.getServices(); - StringBuilder sb = new StringBuilder(); - for (Service service : services) { - String algorithm = service.getType() + "." + service.getAlgorithm(); - XSecProvider.setDelegationProvider(algorithm, stalProvider.getName()); - sb.append("\n" + algorithm); - } - log.debug(sb); - } - - @Test - public void testBasicNop() { - bindingProcessor.consumeRequestStream(dataStream); - // manager.process(bindingProcessor); - bindingProcessor.run(); - } - -} diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/ExpiryRemoverTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/ExpiryRemoverTest.java deleted file mode 100644 index faf08c54..00000000 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/ExpiryRemoverTest.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.binding; - -import at.gv.egiz.bku.conf.Configuration; -import at.gv.egiz.bku.conf.DummyConfiguration; -import java.net.MalformedURLException; - -import org.junit.Test; -import static org.junit.Assert.*; - -public class ExpiryRemoverTest { - - @Test - public void testMe() throws InterruptedException, MalformedURLException { - //TODO for the moment empty config sufficient (currently only maxDataURLHops configured) - BindingProcessorManager manager = new BindingProcessorManagerImpl(new DummyStalFactory(), - new SLCommandInvokerImpl(), new DummyConfiguration()); - BindingProcessor bp = manager.createBindingProcessor("http://www.at", null); - ExpiryRemover remover = new ExpiryRemover(); - remover.setBindingProcessorManager(manager); - remover.execute(); - manager.process(bp); - remover.execute(); - assertTrue(manager.getManagedIds().size() == 1); - remover.setMaxAcceptedAge(1000); - Thread.sleep(100); - remover.execute(); - assertTrue(manager.getManagedIds().size() == 1); - Thread.sleep(910); - remover.execute(); - assertTrue(manager.getManagedIds().size() == 0); - } - - @Test - public void testMe2() throws InterruptedException, MalformedURLException { - BindingProcessorManager manager = new BindingProcessorManagerImpl(new DummyStalFactory(), - new SLCommandInvokerImpl(), new DummyConfiguration()); - BindingProcessor bp = manager.createBindingProcessor("http://www.iaik.at", null); - ExpiryRemover remover = new ExpiryRemover(); - remover.setBindingProcessorManager(manager); - remover.execute(); - manager.process(bp); - remover.execute(); - assertTrue(manager.getManagedIds().size() == 1); - remover.setMaxAcceptedAge(1000); - Thread.sleep(500); - remover.execute(); - assertTrue(manager.getManagedIds().size() == 1); - bp.updateLastAccessTime(); - Thread.sleep(510); - remover.execute(); - assertTrue(manager.getManagedIds().size() == 1); - } - -} diff --git a/utils/src/test/java/at/gv/egiz/urldereferencer/FormDataTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/FormDataTest.java index ecd4c8f7..4f6e0664 100644 --- a/utils/src/test/java/at/gv/egiz/urldereferencer/FormDataTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/FormDataTest.java @@ -14,27 +14,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.urldereferencer;
+package at.gv.egiz.bku.binding;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
-import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
+import at.gv.egiz.bku.binding.FormDataURLSupplier; import at.gv.egiz.bku.utils.StreamUtil;
-import at.gv.egiz.bku.utils.urldereferencer.FormDataURLSupplier;
-import at.gv.egiz.bku.utils.urldereferencer.SimpleFormDataContextImpl;
import at.gv.egiz.bku.utils.urldereferencer.StreamData;
-import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer;
-import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerContext;
+import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerImpl;
public class FormDataTest implements FormDataURLSupplier {
- protected URLDereferencerContext urlCtx;
protected InputStream testStream = null;
protected String contentType = null;
protected String paramName = "";
@@ -57,21 +53,17 @@ public class FormDataTest implements FormDataURLSupplier { }
}
- @Before
- public void setUp() {
- urlCtx = new SimpleFormDataContextImpl(this);
- }
-
@Test(expected = MalformedURLException.class)
public void testInvalidFormdataUrl() throws IOException {
- String url = "abs://whatknowi";
- StreamData sd = URLDereferencer.getInstance().dereference(url, urlCtx);
+ String url = "abs://whatknowi"; + FormDataURLDereferencer dereferencer = new FormDataURLDereferencer(URLDereferencerImpl.getInstance(), this);
+ StreamData sd = dereferencer.dereference(url);
assertNull(sd);
url = ":://whatknowi";
- sd = URLDereferencer.getInstance().dereference(url, urlCtx);
+ sd = URLDereferencerImpl.getInstance().dereference(url);
assertNull(sd);
url = "";
- sd = URLDereferencer.getInstance().dereference(url, urlCtx);
+ sd = URLDereferencerImpl.getInstance().dereference(url);
}
@Test
@@ -79,7 +71,8 @@ public class FormDataTest implements FormDataURLSupplier { paramName = "Müllcontainer";
testStream = new ByteArrayInputStream("HelloWorld".getBytes("UTF-8"));
String url = "formdata:"+paramName;
- StreamData sd = URLDereferencer.getInstance().dereference(url, urlCtx);
+ FormDataURLDereferencer dereferencer = new FormDataURLDereferencer(URLDereferencerImpl.getInstance(), this); + StreamData sd = dereferencer.dereference(url); assertNotNull(sd);
String result = StreamUtil.asString(sd.getStream(), "UTF-8");
assertEquals("HelloWorld", result);
@@ -90,7 +83,8 @@ public class FormDataTest implements FormDataURLSupplier { paramName = "Müllcontainer"; testStream = new ByteArrayInputStream("HelloWorld".getBytes("UTF-8")); String url = "formdata:"+paramName+"2"; - StreamData sd = URLDereferencer.getInstance().dereference(url, urlCtx); + FormDataURLDereferencer dereferencer = new FormDataURLDereferencer(URLDereferencerImpl.getInstance(), this); + dereferencer.dereference(url); } }
diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/HttpBindingProcessorTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/HttpBindingProcessorTest.java index d03e1807..994fd1de 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/HttpBindingProcessorTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/HttpBindingProcessorTest.java @@ -21,23 +21,18 @@ import static org.junit.Assert.assertTrue; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; import at.gv.egiz.bku.binding.MultiTestDataUrlConnection.DataSourceProvider; -import at.gv.egiz.bku.conf.Configuration; -import at.gv.egiz.bku.conf.DummyConfiguration; -import at.gv.egiz.bku.utils.StreamUtil; -public class HttpBindingProcessorTest { +public class HttpBindingProcessorTest extends AbstractBindingProcessorTest { public static class TestDataSource implements DataSourceProvider { @@ -80,33 +75,32 @@ public class HttpBindingProcessorTest { } } - protected BindingProcessorManager manager; - protected HTTPBindingProcessor bindingProcessor; + protected static String requestUrl = "http://localhost:3495/http-security-layer-request"; + protected static String dataUrl = "http://localhost:8080/dataUrl"; + + protected HTTPBindingProcessorImpl bindingProcessor; protected Map<String, String> serverHeaderMap; protected Map<String, String> clientHeaderMap; protected TestDataUrlConnection server; - protected static ApplicationContext appCtx; - - @BeforeClass - public static void setUpClass() { - appCtx = new ClassPathXmlApplicationContext("at/gv/egiz/bku/slcommands/testApplicationContext.xml"); - } - - @Before public void setUp() throws IOException { - server = new TestDataUrlConnection(); - DataUrl.setDataUrlConnectionImpl(server); + + DataUrl.setConnectionFactory(new DataURLConnectionFactory() { + @Override + public DataUrlConnection openConnection(URL url) { + return server; + } + }); serverHeaderMap = new HashMap<String, String>(); serverHeaderMap.put("Content-Type", HttpUtil.TXT_XML); + server = new TestDataUrlConnection(new URL(dataUrl)); server.setResponseCode(200); server.setResponseContent("<ok/>"); server.setResponseHeaders(serverHeaderMap); - manager = new BindingProcessorManagerImpl(new DummyStalFactory(), - new SLCommandInvokerImpl(), new DummyConfiguration()); - bindingProcessor = (HTTPBindingProcessor) manager.createBindingProcessor( - "http://www.iaik.at", null); + + bindingProcessor = (HTTPBindingProcessorImpl) createBindingProcessor("http"); + clientHeaderMap = new HashMap<String, String>(); clientHeaderMap.put("Content-Type", "application/x-www-form-urlencoded;charset=utf8"); @@ -123,12 +117,14 @@ public class HttpBindingProcessorTest { public void testWithoutDataUrlWithoutStylesheet() throws IOException { RequestFactory rf = new RequestFactory(); rf.addForm("Haßnsi", "Wüurzel"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); bindingProcessor.run(); assertEquals(HttpUtil.TXT_XML, bindingProcessor.getResultContentType()); + String result = resultAsString("UTF-8"); + System.out.println(result); assertTrue(resultAsString("UTF-8").indexOf("NullOperationResponse") != -1); assertEquals(200, bindingProcessor.getResponseCode()); - assertEquals(0, bindingProcessor.getResponseHeaders().size()); + assertEquals(2, bindingProcessor.getResponseHeaders().size()); } @Test @@ -137,19 +133,19 @@ public class HttpBindingProcessorTest { rf.addForm("Hansi", "Wurzel"); rf.addFormAsResource("Styleshit", "at/gv/egiz/bku/binding/stylesheet.xslt"); rf.addForm(RequestFactory.STYLESHEETURL, "formdata:Styleshit"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); bindingProcessor.run(); assertEquals(HttpUtil.TXT_HTML, bindingProcessor.getResultContentType()); assertTrue(resultAsString("UTF-8").indexOf("NullKommaJosef") != -1); assertEquals(200, bindingProcessor.getResponseCode()); - assertEquals(0, bindingProcessor.getResponseHeaders().size()); + assertEquals(2, bindingProcessor.getResponseHeaders().size()); } @Test public void testWithDataUrl301WithStylesheet() throws IOException { RequestFactory rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(301); rf = new RequestFactory(); rf.addFormAsResource("Styleshit", "at/gv/egiz/bku/binding/stylesheet.xslt"); @@ -166,7 +162,7 @@ public class HttpBindingProcessorTest { public void testWithDataUrl302WithStylesheet() throws IOException { RequestFactory rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(302); rf = new RequestFactory(); rf.addFormAsResource("Styleshit", "at/gv/egiz/bku/binding/stylesheet.xslt"); @@ -183,7 +179,7 @@ public class HttpBindingProcessorTest { public void testWithDataUrl303WithStylesheet() throws IOException { RequestFactory rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(303); rf = new RequestFactory(); rf.addFormAsResource("Styleshit", "at/gv/egiz/bku/binding/stylesheet.xslt"); @@ -200,7 +196,7 @@ public class HttpBindingProcessorTest { public void testWithDataUrl306WithStylesheet() throws IOException { RequestFactory rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(306); rf = new RequestFactory(); rf.addFormAsResource("Styleshit", "at/gv/egiz/bku/binding/stylesheet.xslt"); @@ -210,14 +206,14 @@ public class HttpBindingProcessorTest { assertEquals(HttpUtil.TXT_XML, bindingProcessor.getResultContentType()); assertTrue(resultAsString("UTF-8").indexOf("ErrorResponse") != -1); assertEquals(200, bindingProcessor.getResponseCode()); - assertTrue(bindingProcessor.getResponseHeaders().size() == 0); + assertTrue(bindingProcessor.getResponseHeaders().size() == 2); } @Test public void testWithDataUrl307NonXML() throws IOException { RequestFactory rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(307); serverHeaderMap.put("Content-Type", HttpUtil.TXT_PLAIN); server.setResponseHeaders(serverHeaderMap); @@ -229,14 +225,14 @@ public class HttpBindingProcessorTest { assertEquals(HttpUtil.TXT_PLAIN, bindingProcessor.getResultContentType()); assertTrue(resultAsString("UTF-8").indexOf("NullOperationRequest") != -1); assertEquals(307, bindingProcessor.getResponseCode()); - assertTrue(bindingProcessor.getResponseHeaders().size() > 0); + assertTrue(bindingProcessor.getResponseHeaders().size() > 2); } @Test public void testWithInvalidDataUrl307XML() throws IOException { RequestFactory rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(307); serverHeaderMap.put("Content-Type", HttpUtil.TXT_XML); serverHeaderMap.put("Location", "noUrl"); @@ -247,13 +243,12 @@ public class HttpBindingProcessorTest { assertEquals(HttpUtil.TXT_XML, bindingProcessor.getResultContentType()); assertTrue(resultAsString("UTF-8").indexOf("ErrorResponse") != -1); assertEquals(200, bindingProcessor.getResponseCode()); - assertTrue(bindingProcessor.getResponseHeaders().size() == 0); + assertTrue(bindingProcessor.getResponseHeaders().size() == 2); } @Test public void testWithValidDataUrl307XML() throws IOException, InterruptedException { - server = new MultiTestDataUrlConnection(); - DataUrl.setDataUrlConnectionImpl(server); + server = new MultiTestDataUrlConnection(null); TestDataSource tds = new TestDataSource(); ((MultiTestDataUrlConnection)server).setDataSource(tds); @@ -275,7 +270,7 @@ public class HttpBindingProcessorTest { rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); bindingProcessor.run(); assertTrue(bindingProcessor.getResponseHeaders().size()>0); @@ -290,7 +285,7 @@ public class HttpBindingProcessorTest { RequestFactory rf = new RequestFactory(); rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(200); rf = new RequestFactory(); rf.addFormAsResource("Styleshit", "at/gv/egiz/bku/binding/stylesheet.xslt"); @@ -298,7 +293,7 @@ public class HttpBindingProcessorTest { server.setResponseHeaders(serverHeaderMap); server.setResponseContent(rf.getURLencodedAsString()); bindingProcessor.run(); - assertTrue(bindingProcessor.getResponseHeaders().size()==0); + assertTrue(bindingProcessor.getResponseHeaders().size() == 2); assertEquals(200,bindingProcessor.getResponseCode()); assertEquals(HttpUtil.TXT_XML, bindingProcessor.getResultContentType()); assertTrue(resultAsString("UTF-8").indexOf("NullOperationResponse") != -1); @@ -309,7 +304,7 @@ public class HttpBindingProcessorTest { RequestFactory rf = new RequestFactory(); rf = new RequestFactory(); rf.addForm(RequestFactory.DATAURL, "http://localhost:8080"); - bindingProcessor.consumeRequestStream(rf.getURLencoded()); + bindingProcessor.consumeRequestStream(requestUrl, rf.getURLencoded()); server.setResponseCode(200); rf = new RequestFactory(); rf.addFormAsResource("Styleshit", "at/gv/egiz/bku/binding/stylesheet.xslt"); @@ -318,7 +313,7 @@ public class HttpBindingProcessorTest { server.setResponseHeaders(serverHeaderMap); server.setResponseContent(rf.getURLencodedAsString()); bindingProcessor.run(); - assertTrue(bindingProcessor.getResponseHeaders().size()==0); + assertTrue(bindingProcessor.getResponseHeaders().size() == 2); assertEquals(200,bindingProcessor.getResponseCode()); assertEquals(HttpUtil.TXT_HTML, bindingProcessor.getResultContentType()); assertTrue(resultAsString("UTF-8").indexOf("NullKommaJosef") != -1); diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultiTestDataUrlConnection.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultiTestDataUrlConnection.java index 5d2a7544..363757d7 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultiTestDataUrlConnection.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultiTestDataUrlConnection.java @@ -17,10 +17,15 @@ package at.gv.egiz.bku.binding;
import java.io.IOException;
+import java.net.URL; import java.util.Map;
public class MultiTestDataUrlConnection extends TestDataUrlConnection {
+ public MultiTestDataUrlConnection(URL url) { + super(url); + } + public static interface DataSourceProvider {
public Map<String, String> getResponseHeaders();
public String getResponseContent();
diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultipartSLRequestTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultipartSLRequestTest.java index 1a9a6a70..0ac23c69 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultipartSLRequestTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/MultipartSLRequestTest.java @@ -16,44 +16,80 @@ */ package at.gv.egiz.bku.binding; -import at.gv.egiz.bku.conf.DummyConfiguration; +import static org.junit.Assert.*; + import java.io.InputStream; import java.net.MalformedURLException; import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; import java.util.Map; -import org.junit.Before; import org.junit.Test; -public class MultipartSLRequestTest { +public class MultipartSLRequestTest extends AbstractBindingProcessorTest { - protected String resourceName = "at/gv/egiz/bku/binding/MultipartFromTutorial.txt"; + @Test + public void testMultipartFromTutorial() throws MalformedURLException { - protected BindingProcessor bindingProcessor; - protected InputStream dataStream; - protected BindingProcessorManager manager; + HTTPBindingProcessorImpl http = (HTTPBindingProcessorImpl) createBindingProcessor("http"); - @Before - public void setUp() throws MalformedURLException { - manager = new BindingProcessorManagerImpl(new DummyStalFactory(), - new SLCommandInvokerImpl(), new DummyConfiguration()); - HTTPBindingProcessor http = (HTTPBindingProcessor) manager - .createBindingProcessor("http://www.at/", null); Map<String, String> headers = new HashMap<String, String>(); headers.put("Content-Type", InputDecoderFactory.MULTIPART_FORMDATA + ";boundary=---------------------------2330864292941"); http.setHTTPHeaders(headers); - dataStream = getClass().getClassLoader().getResourceAsStream(resourceName); - bindingProcessor = http; + + InputStream dataStream = getClass().getClassLoader().getResourceAsStream( + "at/gv/egiz/bku/binding/MultipartFromTutorial.txt"); + + http.consumeRequestStream("http://localhost:3495/http-security-layer-request", dataStream); + http.run(); + + assertNotNull(http.bindingProcessorError); + assertEquals(4011, http.bindingProcessorError.getErrorCode()); + } @Test - public void testBasicNop() { - bindingProcessor.consumeRequestStream(dataStream); - // manager.process(bindingProcessor); - bindingProcessor.run(); + public void testMultipartEmpty() throws MalformedURLException, ClassNotFoundException { + + HTTPBindingProcessorImpl http = (HTTPBindingProcessorImpl) createBindingProcessor("http"); + + Map<String, String> headers = new HashMap<String, String>(); + headers.put("Content-Type", InputDecoderFactory.MULTIPART_FORMDATA + + ";boundary=uW10q_I9UeqKyw-1o5EW4jtEAaGs7-mC6o"); + http.setHTTPHeaders(headers); + + InputStream dataStream = getClass().getClassLoader().getResourceAsStream( + "at/gv/egiz/bku/binding/MultipartEmpty.txt"); + + http.consumeRequestStream("http://localhost:3495/http-security-layer-request", dataStream); + http.run(); + + if (http.bindingProcessorError != null) { + fail(http.bindingProcessorError.getMessage()); + } + + } + + @Test + public void testNulloperationRequest() throws MalformedURLException, ClassNotFoundException { + + HTTPBindingProcessorImpl http = (HTTPBindingProcessorImpl) createBindingProcessor("http"); + + Map<String, String> headers = new HashMap<String, String>(); + headers.put("Content-Type", "application/x-www-form-urlencoded"); + http.setHTTPHeaders(headers); + + InputStream dataStream = getClass().getClassLoader().getResourceAsStream( + "at/gv/egiz/bku/binding/NulloperationRequest.txt.bin"); + + http.consumeRequestStream("http://localhost:3495/http-security-layer-request", dataStream); + http.run(); + + if (http.bindingProcessorError != null) { + fail(http.bindingProcessorError.getMessage()); + } + } + } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/NullOperationTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/NullOperationTest.java deleted file mode 100644 index 58c82c49..00000000 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/NullOperationTest.java +++ /dev/null @@ -1,54 +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.binding; - -import at.gv.egiz.bku.conf.DummyConfiguration; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.util.HashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; - -public class NullOperationTest { - - protected String resourceName = "at/gv/egiz/bku/binding/NulloperationRequest.txt.bin"; - - protected BindingProcessor bindingProcessor; - protected InputStream dataStream; - protected BindingProcessorManager manager; - - @Before - public void setUp() throws MalformedURLException { - manager = new BindingProcessorManagerImpl(new DummyStalFactory(), new SLCommandInvokerImpl(), new DummyConfiguration()); - HTTPBindingProcessor http = (HTTPBindingProcessor) manager.createBindingProcessor("http://www.at/", null); - Map<String, String> headers = new HashMap<String, String>(); - headers.put("Content-Type", "application/x-www-form-urlencoded"); - http.setHTTPHeaders(headers); - dataStream = getClass().getClassLoader().getResourceAsStream(resourceName); - bindingProcessor = http; - } - - @Test - public void testBasicNop() { - bindingProcessor.consumeRequestStream(dataStream); - //manager.process(bindingProcessor); - bindingProcessor.run(); - } - -} diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/SSLDataUrlConnectionTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/SSLDataUrlConnectionTest.java index 79757244..ae146bfe 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/SSLDataUrlConnectionTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/SSLDataUrlConnectionTest.java @@ -16,24 +16,22 @@ */ package at.gv.egiz.bku.binding;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.IOException;
-import java.net.URL;
-
+import static org.junit.Assert.assertNotNull; + +import java.io.IOException; + import org.junit.Ignore; -import org.junit.Test;
+import org.junit.Test; @Ignore
public class SSLDataUrlConnectionTest {
@Test
public void testVerisign() throws IOException {
- URL url = new URL("https://www.verisign.com:443");
- DataUrlConnectionImpl uc = new DataUrlConnectionImpl();
- uc.init(url);
+ DataUrl dataUrl = new DataUrl("https://www.verisign.com:443"); + HttpsDataURLConnection uc = (HttpsDataURLConnection) dataUrl.openConnection();
uc.connect();
- assertNotNull(uc.getServerCertificate());
+ assertNotNull(uc.getServerCertificates());
//uc.transmit(null);
}
diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/TestDataUrlConnection.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/TestDataUrlConnection.java index 0a24b5c5..a83fff17 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/TestDataUrlConnection.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/TestDataUrlConnection.java @@ -14,137 +14,111 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.binding;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.SocketTimeoutException;
-import java.net.URL;
-import java.security.cert.X509Certificate;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties; +package at.gv.egiz.bku.binding; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.SocketTimeoutException; +import java.net.URL; +import java.security.cert.Certificate; +import java.security.cert.X509Certificate; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSocketFactory; -
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.Ignore;
-
-import at.gv.egiz.bku.slcommands.SLResult;
-
-@Ignore
-public class TestDataUrlConnection implements DataUrlConnectionSPI {
-
-
- protected Log log = LogFactory.getLog(TestDataUrlConnection.class);
- protected X509Certificate serverCertificate;
- protected Map<String, String> responseHeaders = Collections.EMPTY_MAP;
- protected Map<String, String> requestHeaders = new HashMap<String, String>();
- protected String responseContent = "";
- protected int responseCode = 200;
-
- protected URL url;
-
- @Override
- public void init(URL url) {
- log.debug("Init Testdataurlconnection to url: " + url);
- this.url = url;
- }
-
- @Override
- public void connect() throws SocketTimeoutException, IOException {
- log.debug("Dummy connect to Testdataurlconnection to url: " + url);
-
- }
-
- @Override
- public String getProtocol() {
- return url.getProtocol();
- }
-
- @Override
- public DataUrlResponse getResponse() throws IOException {
- String ct = responseHeaders.get(HttpUtil.HTTP_HEADER_CONTENT_TYPE);
- if (ct != null) {
- ct = HttpUtil.getCharset(ct, true);
- } else {
- ct = HttpUtil.DEFAULT_CHARSET;
- }
- DataUrlResponse response = new DataUrlResponse(url.toString(), responseCode, new ByteArrayInputStream(responseContent.getBytes(ct)));
- response.setResponseHttpHeaders(responseHeaders);
- return response;
- }
-
- @Override
- public X509Certificate getServerCertificate() {
- return serverCertificate;
- }
-
- @Override
- public void setHTTPFormParameter(String name, InputStream data,
- String contentType, String charSet, String transferEncoding) {
- // TODO Auto-generated method stub
- }
-
- @Override
- public void setHTTPHeader(String key, String value) {
- requestHeaders.put(key, value);
- }
-
- @Override
- public void transmit(SLResult slResult) throws IOException {
- log.debug("Dummy transmit to url: " + url);
- }
-
- public void setServerCertificate(X509Certificate serverCertificate) {
- this.serverCertificate = serverCertificate;
- }
-
- public void setResponseHeaders(Map<String, String> responseHeaders) {
- this.responseHeaders = responseHeaders;
- }
-
- public void setResponseContent(String responseContent) {
- this.responseContent = responseContent;
- }
-
- public void setResponseCode(int responseCode) {
- this.responseCode = responseCode;
- }
-
- public Map<String, String> getRequestHeaders() {
- return requestHeaders;
- }
-
- @Override
- public DataUrlConnectionSPI newInstance() {
- return this;
+ +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.junit.Ignore; + +import at.gv.egiz.bku.slcommands.SLResult; + +@Ignore +public class TestDataUrlConnection extends HttpsDataURLConnection { + + protected final Logger log = LoggerFactory.getLogger(TestDataUrlConnection.class); + protected X509Certificate serverCertificate; + protected Map<String, String> responseHeaders = Collections.emptyMap(); + protected Map<String, String> requestHeaders = new HashMap<String, String>(); + protected String responseContent = ""; + protected int responseCode = 200; + + public TestDataUrlConnection(URL url) { + super(url); } + - @Override - public URL getUrl() { - return url; - } + @Override + public void connect() throws SocketTimeoutException, IOException { + log.debug("Dummy connect to Testdataurlconnection to url: " + url); + + } @Override - public void setConfiguration(Properties config) { - // TODO Auto-generated method stub - + public DataUrlResponse getResponse() throws IOException { + String ct = responseHeaders.get(HttpUtil.HTTP_HEADER_CONTENT_TYPE); + if (ct != null) { + ct = HttpUtil.getCharset(ct, true); + } else { + ct = HttpUtil.DEFAULT_CHARSET; + } + DataUrlResponse response = new DataUrlResponse("" + url, responseCode, new ByteArrayInputStream(responseContent.getBytes(ct))); + response.setResponseHttpHeaders(responseHeaders); + return response; + } + + @Override + public void setHTTPFormParameter(String name, InputStream data, + String contentType, String charSet, String transferEncoding) { + } + + @Override + public void setHTTPHeader(String key, String value) { + requestHeaders.put(key, value); + } + + @Override + public void transmit(SLResult slResult) throws IOException { + log.debug("Dummy transmit to url: " + url); + } + + public void setServerCertificate(X509Certificate serverCertificate) { + this.serverCertificate = serverCertificate; + } + + public void setResponseHeaders(Map<String, String> responseHeaders) { + this.responseHeaders = responseHeaders; + } + + public void setResponseContent(String responseContent) { + this.responseContent = responseContent; + } + + public void setResponseCode(int responseCode) { + this.responseCode = responseCode; + } + + public Map<String, String> getRequestHeaders() { + return requestHeaders; } @Override public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { - // TODO Auto-generated method stub - } @Override public void setSSLSocketFactory(SSLSocketFactory socketFactory) { - // TODO Auto-generated method stub - - }
- }
+ } + + + @Override + public Certificate[] getServerCertificates() + throws SSLPeerUnverifiedException, IllegalStateException { + return new Certificate[] {serverCertificate}; + } + + } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIteratorTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIteratorTest.java index 4d81f038..57484fa8 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIteratorTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/XWWWFormUrlInputIteratorTest.java @@ -4,17 +4,13 @@ import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLEncoder; -import java.nio.CharBuffer; -import java.nio.channels.FileChannel; import java.nio.charset.Charset; import org.junit.Ignore; diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java deleted file mode 100644 index d97d741d..00000000 --- a/bkucommon/src/test/java/at/gv/egiz/bku/conf/CertValidatorTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package at.gv.egiz.bku.conf;
-
-import iaik.x509.X509Certificate;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.security.cert.CertificateException;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class CertValidatorTest {
-
- private CertValidator cv;
-
- @Before
- public void setUp() throws URISyntaxException {
- cv = new CertValidatorImpl();
- URL caDir = getClass().getClassLoader().getResource("at/gv/egiz/bku/conf/certs/CACerts");
- URL certDir = getClass().getClassLoader().getResource("at/gv/egiz/bku/conf/certs/certStore");
- cv.init(new File(caDir.toURI()), new File(certDir.toURI()));
- }
-
- @Test
- public void testValid() throws CertificateException, IOException {
- X509Certificate cert = new X509Certificate(getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/conf/certs/testCerts/www.a-trust.at.der"));
- assertTrue(cv.isCertificateValid("TID", new X509Certificate[]{cert}));
- }
-
-}
diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/SLCommandFactoryTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/SLCommandFactoryTest.java index 7a087b38..4b89880d 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/SLCommandFactoryTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/SLCommandFactoryTest.java @@ -34,13 +34,11 @@ import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.bku.slexceptions.SLRequestException; import at.gv.egiz.bku.slexceptions.SLRuntimeException; import at.gv.egiz.bku.slexceptions.SLVersionException; -import at.gv.egiz.stal.dummy.DummySTAL; public class SLCommandFactoryTest { protected static ApplicationContext appCtx; - SLCommandFactory factory; - SLCommandContext context; + protected SLCommandFactory factory; @BeforeClass public static void setUpClass() { @@ -49,9 +47,10 @@ public class SLCommandFactoryTest { @Before public void setUp() { - factory = SLCommandFactory.getInstance(); - context = new SLCommandContext(); - context.setSTAL(new DummySTAL()); + Object bean = appCtx.getBean("slCommandFactory"); + assertTrue(bean instanceof SLCommandFactory); + + factory = (SLCommandFactory) bean; } @Test @@ -60,7 +59,7 @@ public class SLCommandFactoryTest { "<NullOperationRequest xmlns=\"http://www.buergerkarte.at/namespaces/securitylayer/1.2#\"/>"); Source source = new StreamSource(requestReader); - SLCommand slCommand = factory.createSLCommand(source, context); + SLCommand slCommand = factory.createSLCommand(source); assertTrue(slCommand instanceof NullOperationCommand); } @@ -71,7 +70,7 @@ public class SLCommandFactoryTest { "<CreateCMSSignatureRequest xmlns=\"http://www.buergerkarte.at/namespaces/securitylayer/1.2#\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.buergerkarte.at/namespaces/securitylayer/1.2# file:/home/clemens/IAIK/BKU2/svn/bku/utils/src/main/schema/Core-1.2.xsd\" Structure=\"detached\"><KeyboxIdentifier></KeyboxIdentifier><DataObject><MetaInfo><MimeType></MimeType></MetaInfo><Content><Base64Content></Base64Content></Content></DataObject></CreateCMSSignatureRequest>"); Source source = new StreamSource(requestReader); - factory.createSLCommand(source, context); + factory.createSLCommand(source); } @@ -83,7 +82,7 @@ public class SLCommandFactoryTest { "</NullOperationRequest>"); Source source = new StreamSource(requestReader); - factory.createSLCommand(source, context); + factory.createSLCommand(source); } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureComandImplTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureComandImplTest.java index 4e9b4cd7..4f56b423 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureComandImplTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/CreateXMLSignatureComandImplTest.java @@ -21,7 +21,6 @@ import static org.junit.Assert.assertTrue; import iaik.xml.crypto.XSecProvider; import java.io.InputStream; -import java.security.Security; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; @@ -29,41 +28,56 @@ import javax.xml.transform.stream.StreamSource; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import at.gv.egiz.bku.slcommands.CreateXMLSignatureCommand; +import at.gv.egiz.bku.slcommands.ErrorResult; import at.gv.egiz.bku.slcommands.InfoboxReadCommand; import at.gv.egiz.bku.slcommands.SLCommand; import at.gv.egiz.bku.slcommands.SLCommandContext; import at.gv.egiz.bku.slcommands.SLCommandFactory; import at.gv.egiz.bku.slcommands.SLResult; -import at.gv.egiz.bku.slcommands.impl.xsect.STALProvider; import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.bku.slexceptions.SLRequestException; import at.gv.egiz.bku.slexceptions.SLRuntimeException; import at.gv.egiz.bku.slexceptions.SLVersionException; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; import at.gv.egiz.stal.STAL; -import at.gv.egiz.stal.dummy.DummySTAL; +import at.gv.egiz.stal.STALFactory; //@Ignore
public class CreateXMLSignatureComandImplTest {
- private SLCommandFactory factory;
+ protected static ApplicationContext appCtx; + private SLCommandFactory factory; + + private STAL stal; + + private URLDereferencer urlDereferencer; - private STAL stal;
-
@BeforeClass
public static void setUpClass() {
- - new ClassPathXmlApplicationContext("at/gv/egiz/bku/slcommands/testApplicationContext.xml"); -
- Security.addProvider(new STALProvider());
+ appCtx = new ClassPathXmlApplicationContext("at/gv/egiz/bku/slcommands/testApplicationContext.xml"); XSecProvider.addAsProvider(true);
}
@Before
public void setUp() {
- factory = SLCommandFactory.getInstance();
- stal = new DummySTAL();
+ Object bean = appCtx.getBean("slCommandFactory"); + assertTrue(bean instanceof SLCommandFactory); + + factory = (SLCommandFactory) bean; + + bean = appCtx.getBean("stalFactory"); + assertTrue(bean instanceof STALFactory); + + stal = ((STALFactory) bean).createSTAL(); + + bean = appCtx.getBean("urlDereferencer"); + assertTrue(bean instanceof URLDereferencer); + + urlDereferencer = (URLDereferencer) bean; + }
@Test
@@ -71,33 +85,34 @@ public class CreateXMLSignatureComandImplTest { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/createxmlsignaturerequest/CreateXMLSignatureRequest.xml");
assertNotNull(inputStream);
- SLCommandContext context = new SLCommandContext();
- context.setSTAL(stal);
- SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context);
+ SLCommand command = factory.createSLCommand(new StreamSource(inputStream));
assertTrue(command instanceof CreateXMLSignatureCommand);
- SLResult result = command.execute();
+ SLCommandContext context = new SLCommandContext(stal, urlDereferencer); + SLResult result = command.execute(context);
result.writeTo(new StreamResult(System.out), false);
}
-// @Test(expected=SLCommandException.class)
+ @Test(expected=SLCommandException.class)
public void testInfboxReadRequestInvalid1() throws SLCommandException, SLRuntimeException, SLRequestException, SLVersionException {
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-1.xml");
assertNotNull(inputStream);
- SLCommandContext context = new SLCommandContext();
- SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context);
+ SLCommand command = factory.createSLCommand(new StreamSource(inputStream));
assertTrue(command instanceof InfoboxReadCommand);
}
-// @Test(expected=SLCommandException.class)
+ @Test
public void testInfboxReadRequestInvalid2() throws SLCommandException, SLRuntimeException, SLRequestException, SLVersionException {
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-2.xml");
assertNotNull(inputStream);
- SLCommandContext context = new SLCommandContext();
- SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context);
- assertTrue(command instanceof InfoboxReadCommand);
+ SLCommand command = factory.createSLCommand(new StreamSource(inputStream));
+ assertTrue(command instanceof InfoboxReadCommandImpl); +
+ SLCommandContext context = new SLCommandContext(stal, urlDereferencer); + SLResult result = command.execute(context); + assertTrue(result instanceof ErrorResult); }
}
diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java index bfc784f7..814ef8a9 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java @@ -40,18 +40,20 @@ import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.bku.slexceptions.SLRequestException; import at.gv.egiz.bku.slexceptions.SLRuntimeException; import at.gv.egiz.bku.slexceptions.SLVersionException; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; import at.gv.egiz.stal.STAL; -import at.gv.egiz.stal.dummy.DummySTAL; +import at.gv.egiz.stal.STALFactory; //@Ignore
public class InfoboxReadComandImplTest {
- private static ApplicationContext appCtx; + protected static ApplicationContext appCtx; + private SLCommandFactory factory; + + private STAL stal; + + private URLDereferencer urlDereferencer; - private SLCommandFactory factory;
-
- private STAL stal;
-
@BeforeClass public static void setUpClass() { appCtx = new ClassPathXmlApplicationContext("at/gv/egiz/bku/slcommands/testApplicationContext.xml"); @@ -59,8 +61,20 @@ public class InfoboxReadComandImplTest { @Before
public void setUp() {
- factory = SLCommandFactory.getInstance();
- stal = new DummySTAL();
+ Object bean = appCtx.getBean("slCommandFactory"); + assertTrue(bean instanceof SLCommandFactory); + + factory = (SLCommandFactory) bean; + + bean = appCtx.getBean("stalFactory"); + assertTrue(bean instanceof STALFactory); + + stal = ((STALFactory) bean).createSTAL(); + + bean = appCtx.getBean("urlDereferencer"); + assertTrue(bean instanceof URLDereferencer); + + urlDereferencer = (URLDereferencer) bean; }
@Test
@@ -68,12 +82,12 @@ public class InfoboxReadComandImplTest { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.xml");
assertNotNull(inputStream);
- SLCommandContext context = new SLCommandContext();
+ SLCommandContext context = new SLCommandContext(stal, urlDereferencer); context.setSTAL(stal);
- SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context);
+ SLCommand command = factory.createSLCommand(new StreamSource(inputStream));
assertTrue(command instanceof InfoboxReadCommand);
- SLResult result = command.execute();
+ SLResult result = command.execute(context);
result.writeTo(new StreamResult(System.out), false);
}
@@ -82,9 +96,7 @@ public class InfoboxReadComandImplTest { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-1.xml");
assertNotNull(inputStream);
- SLCommandContext context = new SLCommandContext(); - context.setSTAL(stal);
- SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context);
+ SLCommand command = factory.createSLCommand(new StreamSource(inputStream));
assertTrue(command instanceof InfoboxReadCommand);
}
@@ -92,12 +104,11 @@ public class InfoboxReadComandImplTest { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-2.xml");
assertNotNull(inputStream);
- SLCommandContext context = new SLCommandContext(); - context.setSTAL(stal);
- SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context);
+ SLCommandContext context = new SLCommandContext(stal, urlDereferencer); + SLCommand command = factory.createSLCommand(new StreamSource(inputStream));
assertTrue(command instanceof InfoboxReadCommand); - SLResult result = command.execute(); + SLResult result = command.execute(context); assertTrue(result instanceof ErrorResult);
}
diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java index a17f0797..2627de72 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java @@ -19,6 +19,7 @@ package at.gv.egiz.bku.slcommands.impl; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import iaik.asn1.CodingException; +import iaik.xml.crypto.XSecProvider; import java.io.IOException; import java.io.InputStream; @@ -29,7 +30,8 @@ import javax.xml.bind.Marshaller; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; -import org.junit.Ignore; +import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -47,8 +49,9 @@ import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.bku.slexceptions.SLRequestException; import at.gv.egiz.bku.slexceptions.SLRuntimeException; import at.gv.egiz.bku.slexceptions.SLVersionException; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; import at.gv.egiz.stal.STAL; -import at.gv.egiz.stal.dummy.DummySTAL; +import at.gv.egiz.stal.STALFactory; //@Ignore
public class SVPersonendatenInfoboxImplTest {
@@ -70,22 +73,37 @@ public class SVPersonendatenInfoboxImplTest { (byte) 0x30, (byte) 0x30, (byte) 0x30, (byte) 0x30, (byte) 0x5a }; - private static ApplicationContext appCtx; + protected static ApplicationContext appCtx; + private SLCommandFactory factory; + + private STAL stal; - private SLCommandFactory factory;
-
- private STAL stal;
-
-// @BeforeClass + private URLDereferencer urlDereferencer; + + @BeforeClass public static void setUpClass() { appCtx = new ClassPathXmlApplicationContext("at/gv/egiz/bku/slcommands/testApplicationContext.xml"); + XSecProvider.addAsProvider(true); } + + @Before + public void setUp() { + Object bean = appCtx.getBean("slCommandFactory"); + assertTrue(bean instanceof SLCommandFactory); + + factory = (SLCommandFactory) bean; + + bean = appCtx.getBean("stalFactory"); + assertTrue(bean instanceof STALFactory); + + stal = ((STALFactory) bean).createSTAL(); + + bean = appCtx.getBean("urlDereferencer"); + assertTrue(bean instanceof URLDereferencer); + + urlDereferencer = (URLDereferencer) bean; -// @Before
- public void setUp() {
- factory = SLCommandFactory.getInstance();
- stal = new DummySTAL();
- }
+ } @Test public void testEHIC() throws SLCommandException, JAXBException, CodingException, IOException { @@ -102,44 +120,38 @@ public class SVPersonendatenInfoboxImplTest { } - @Ignore
@Test
public void testInfboxReadRequest() throws SLCommandException, SLRuntimeException, SLRequestException, SLVersionException {
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.xml");
assertNotNull(inputStream);
- SLCommandContext context = new SLCommandContext();
- context.setSTAL(stal);
- SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context);
+ SLCommandContext context = new SLCommandContext(stal, urlDereferencer);
+ SLCommand command = factory.createSLCommand(new StreamSource(inputStream));
assertTrue(command instanceof InfoboxReadCommand);
- SLResult result = command.execute();
+ SLResult result = command.execute(context);
result.writeTo(new StreamResult(System.out), false);
}
- @Ignore
@Test(expected=SLCommandException.class)
public void testInfboxReadRequestInvalid1() throws SLCommandException, SLRuntimeException, SLRequestException, SLVersionException {
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-1.xml");
assertNotNull(inputStream);
- SLCommandContext context = new SLCommandContext(); - context.setSTAL(stal);
- SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context);
+ SLCommand command = factory.createSLCommand(new StreamSource(inputStream));
assertTrue(command instanceof InfoboxReadCommand);
}
- @Ignore
+ @Test
public void testInfboxReadRequestInvalid2() throws SLCommandException, SLRuntimeException, SLRequestException, SLVersionException {
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-2.xml");
assertNotNull(inputStream);
- SLCommandContext context = new SLCommandContext(); - context.setSTAL(stal);
- SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context);
+ SLCommandContext context = new SLCommandContext(stal, urlDereferencer); + SLCommand command = factory.createSLCommand(new StreamSource(inputStream));
assertTrue(command instanceof InfoboxReadCommand); - SLResult result = command.execute(); + SLResult result = command.execute(context); assertTrue(result instanceof ErrorResult);
}
diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureTest.java index 0a34c8f3..6a413483 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureTest.java @@ -73,14 +73,11 @@ import at.gv.egiz.bku.slexceptions.SLRequestException; import at.gv.egiz.bku.slexceptions.SLViewerException; import at.gv.egiz.bku.utils.urldereferencer.StreamData; import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; -import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerContext; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerImpl; import at.gv.egiz.bku.utils.urldereferencer.URLProtocolHandler; import at.gv.egiz.dom.DOMUtils; import at.gv.egiz.slbinding.RedirectEventFilter; import at.gv.egiz.slbinding.RedirectUnmarshallerListener; -import org.junit.Ignore; -import org.w3c.dom.NodeList; -import static org.junit.Assert.*; public class SignatureTest { @@ -135,6 +132,8 @@ public class SignatureTest { private static X509Certificate certificate; + private static URLDereferencer urlDereferencer; + @BeforeClass public static void setUpClass() throws JAXBException, NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException, UnrecoverableKeyException { @@ -161,14 +160,16 @@ public class SignatureTest { certificate = (X509Certificate) keystore.getCertificate(firstAlias); privateKey = (PrivateKey) keystore.getKey(firstAlias, passwd); + urlDereferencer = URLDereferencerImpl.getInstance(); + } private static void initURLDereferencer() { - URLDereferencer.getInstance().registerHandler("testlocal", new URLProtocolHandler() { + URLDereferencerImpl.getInstance().registerHandler("testlocal", new URLProtocolHandler() { @Override - public StreamData dereference(String url, URLDereferencerContext context) + public StreamData dereference(String url) throws IOException { ClassLoader classLoader = SignatureTest.class.getClassLoader(); @@ -237,12 +238,11 @@ public class SignatureTest { // // - @SuppressWarnings("unchecked") private SignatureInfoCreationType unmarshalSignatureInfo(String file) throws JAXBException, XMLStreamException { Object object = unmarshal(file); - Object requestType = ((JAXBElement) object).getValue(); + Object requestType = ((JAXBElement<?>) object).getValue(); assertTrue(requestType instanceof CreateXMLSignatureRequestType); @@ -259,7 +259,7 @@ public class SignatureTest { SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Base64_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), null); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), null); signature.setSignatureInfo(signatureInfo); @@ -281,7 +281,7 @@ public class SignatureTest { SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Base64_2.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), null); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), null); signature.setSignatureInfo(signatureInfo); @@ -301,7 +301,7 @@ public class SignatureTest { SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Base64_3.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), null); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), null); signature.setSignatureInfo(signatureInfo); @@ -321,7 +321,7 @@ public class SignatureTest { SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_XMLContent_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), null); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), null); signature.setSignatureInfo(signatureInfo); @@ -341,7 +341,7 @@ public class SignatureTest { SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Reference_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), null); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), null); signature.setSignatureInfo(signatureInfo); @@ -362,12 +362,11 @@ public class SignatureTest { // // - @SuppressWarnings("unchecked") private List<DataObjectInfoType> unmarshalDataObjectInfo(String file) throws JAXBException, XMLStreamException { Object object = unmarshal(file); - Object requestType = ((JAXBElement) object).getValue(); + Object requestType = ((JAXBElement<?>) object).getValue(); assertTrue(requestType instanceof CreateXMLSignatureRequestType); @@ -397,19 +396,17 @@ public class SignatureTest { output.setByteStream(System.out); LSSerializer serializer = domImplLS.createLSSerializer(); -// serializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE); serializer.getDomConfig().setParameter("namespaces", Boolean.FALSE); serializer.write(document, output); } - @SuppressWarnings("unchecked") @Test public void testDataObject_Base64Content_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { List<DataObjectInfoType> dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Base64Content_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -427,10 +424,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List<Transform> transforms = reference.getTransforms(); + List<?> transforms = reference.getTransforms(); assertTrue(transforms.size() == 1); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.BASE64.equals(transform.getAlgorithm())); List<XMLObject> objects = signature.getXMLObjects(); @@ -443,16 +440,14 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test - public void testDataObject_XMLContent_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { System.out.println("\n ****************** testDataObject_XMLContent_1 \n"); List<DataObjectInfoType> dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_XMLContent_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -470,10 +465,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List<Transform> transforms = reference.getTransforms(); + List<?> transforms = reference.getTransforms(); assertTrue(transforms.size() == 2); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.XPATH2.equals(transform.getAlgorithm())); List<XMLObject> objects = signature.getXMLObjects(); @@ -486,7 +481,6 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testDataObject_XMLContent_2() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { @@ -494,7 +488,7 @@ public class SignatureTest { List<DataObjectInfoType> dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_XMLContent_2.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -512,10 +506,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List<Transform> transforms = reference.getTransforms(); + List<?> transforms = reference.getTransforms(); assertTrue(transforms.size() == 2); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.XPATH2.equals(transform.getAlgorithm())); List<XMLObject> objects = signature.getXMLObjects(); @@ -529,7 +523,6 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testDataObject_LocRefContent_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { @@ -537,7 +530,7 @@ public class SignatureTest { List<DataObjectInfoType> dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_LocRefContent_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -553,10 +546,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List<Transform> transforms = reference.getTransforms(); + List<?> transforms = reference.getTransforms(); assertTrue(transforms.size() == 2); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.XPATH2.equals(transform.getAlgorithm())); List<XMLObject> objects = signature.getXMLObjects(); @@ -569,7 +562,6 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testDataObject_LocRefContent_2() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { @@ -577,7 +569,7 @@ public class SignatureTest { List<DataObjectInfoType> dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_LocRefContent_2.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -593,10 +585,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List<Transform> transforms = reference.getTransforms(); + List<?> transforms = reference.getTransforms(); assertTrue(transforms.size() == 1); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.BASE64.equals(transform.getAlgorithm())); List<XMLObject> objects = signature.getXMLObjects(); @@ -609,7 +601,6 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testDataObject_Reference_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { @@ -617,7 +608,7 @@ public class SignatureTest { List<DataObjectInfoType> dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Reference_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -633,10 +624,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List<Transform> transforms = reference.getTransforms(); + List<?> transforms = reference.getTransforms(); assertTrue(transforms.size() == 1); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.BASE64.equals(transform.getAlgorithm())); List<XMLObject> objects = signature.getXMLObjects(); @@ -649,7 +640,6 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testDataObject_Detached_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { @@ -657,7 +647,7 @@ public class SignatureTest { List<DataObjectInfoType> dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Detached_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -673,7 +663,7 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List<Transform> transforms = reference.getTransforms(); + List<?> transforms = reference.getTransforms(); assertTrue(transforms.size() == 0); List<XMLObject> objects = signature.getXMLObjects(); @@ -682,7 +672,6 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testDataObject_Detached_Base64Content() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { @@ -690,7 +679,7 @@ public class SignatureTest { List<DataObjectInfoType> dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Detached_Base64Content.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -700,13 +689,13 @@ public class SignatureTest { signAndMarshalSignature(signature); - List<Reference> references = signature.getReferences(); + List<?> references = signature.getReferences(); assertTrue(references.size() == 2); - Reference reference = references.get(0); + Reference reference = (Reference) references.get(0); assertNotNull(reference.getId()); - List<Transform> transforms = reference.getTransforms(); + List<?> transforms = reference.getTransforms(); assertTrue(transforms.size() == 0); List<XMLObject> objects = signature.getXMLObjects(); @@ -715,7 +704,6 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testDataObject_Detached_LocRefContent() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { @@ -723,7 +711,7 @@ public class SignatureTest { List<DataObjectInfoType> dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Detached_LocRefContent.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); for (DataObjectInfoType dataObjectInfo : dataObjectInfos) { signature.addDataObject(dataObjectInfo); @@ -739,7 +727,7 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List<Transform> transforms = reference.getTransforms(); + List<?> transforms = reference.getTransforms(); assertTrue(transforms.size() == 0); List<XMLObject> objects = signature.getXMLObjects(); @@ -754,12 +742,11 @@ public class SignatureTest { // // - @SuppressWarnings("unchecked") private CreateXMLSignatureRequestType unmarshalCreateXMLSignatureRequest(String file) throws JAXBException, XMLStreamException { Object object = unmarshal(file); - Object requestType = ((JAXBElement) object).getValue(); + Object requestType = ((JAXBElement<?>) object).getValue(); assertTrue(requestType instanceof CreateXMLSignatureRequestType); @@ -768,13 +755,12 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test public void testTransformsInfo_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { CreateXMLSignatureRequestType requestType = unmarshalCreateXMLSignatureRequest("TransformsInfo_1.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); signature.setSignatureInfo(requestType.getSignatureInfo()); @@ -797,10 +783,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List<Transform> transforms = reference.getTransforms(); + List<?> transforms = reference.getTransforms(); assertTrue("Size " + transforms.size() + "", transforms.size() == 3); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.ENVELOPED.equals(transform.getAlgorithm())); List<XMLObject> objects = signature.getXMLObjects(); @@ -809,14 +795,12 @@ public class SignatureTest { } - @SuppressWarnings("unchecked") @Test - @Ignore public void testTransformsInfo_2() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException { CreateXMLSignatureRequestType requestType = unmarshalCreateXMLSignatureRequest("TransformsInfo_2.xml"); - Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); + Signature signature = new Signature(urlDereferencer, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl()); signature.setSignatureInfo(requestType.getSignatureInfo()); @@ -839,10 +823,10 @@ public class SignatureTest { Reference reference = references.get(0); assertNotNull(reference.getId()); - List<Transform> transforms = reference.getTransforms(); + List<?> transforms = reference.getTransforms(); assertTrue("Size " + transforms.size() + "", transforms.size() == 2); - Transform transform = transforms.get(0); + Transform transform = (Transform) transforms.get(0); assertTrue(Transform.XSLT.equals(transform.getAlgorithm())); List<XMLObject> objects = signature.getXMLObjects(); diff --git a/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummySTAL.java b/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummySTAL.java index 8adeadee..e4ffdb9d 100644 --- a/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummySTAL.java +++ b/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummySTAL.java @@ -27,10 +27,9 @@ import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; -import java.util.Locale; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.stal.ErrorResponse; import at.gv.egiz.stal.InfoboxReadRequest; @@ -43,7 +42,7 @@ import at.gv.egiz.stal.SignResponse; public class DummySTAL implements STAL { - static Log log = LogFactory.getLog(DummySTAL.class); + private final Logger log = LoggerFactory.getLogger(DummySTAL.class); protected X509Certificate cert = null; protected PrivateKey privateKey = null; @@ -66,7 +65,7 @@ public class DummySTAL implements STAL { } } } catch (Exception e) { - log.error(e); + log.error("Failed to create DummySTAL.", e); } } @@ -113,7 +112,7 @@ public class DummySTAL implements STAL { infoboxReadResponse.setInfoboxValue(cert.getEncoded()); response = infoboxReadResponse; } catch (CertificateEncodingException e) { - log.error(e); + log.error("Failed to encode certificate.", e); response = new ErrorResponse(); } } else { @@ -136,7 +135,7 @@ public class DummySTAL implements STAL { resp.setSignatureValue(sigVal); responses.add(resp); } catch (Exception e) { - log.error(e); + log.error("Failed to create signature.", e); responses.add(new ErrorResponse()); } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java b/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummyStalFactory.java index f832f364..b8e3fff4 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java +++ b/bkucommon/src/test/java/at/gv/egiz/stal/dummy/DummyStalFactory.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.binding;
+package at.gv.egiz.stal.dummy;
import java.util.Locale; diff --git a/bkucommon/src/test/resources/at/gv/egiz/bku/binding/NOPMultipartDataUrl.txt b/bkucommon/src/test/resources/at/gv/egiz/bku/binding/NOPMultipartDataUrl.txt index fb8cc1c3..5d401009 100644 --- a/bkucommon/src/test/resources/at/gv/egiz/bku/binding/NOPMultipartDataUrl.txt +++ b/bkucommon/src/test/resources/at/gv/egiz/bku/binding/NOPMultipartDataUrl.txt @@ -43,5 +43,5 @@ MyHeader:veryUgly -----------------------------2330864292941
Content-Disposition: form-data; name="DataURL"
-http://localhost:8080/
+http://localhost:8081/
-----------------------------2330864292941--
diff --git a/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/impl/TransformsInfo_2.xml b/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/impl/TransformsInfo_2.xml index f43dc61a..c45c91aa 100644 --- a/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/impl/TransformsInfo_2.xml +++ b/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/impl/TransformsInfo_2.xml @@ -267,7 +267,7 @@ </sl:FinalDataMetaInfo>
</sl:TransformsInfo>
<sl:TransformsInfo>
- <dsig:Transforms> <!-- xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"-->
+ <dsig:Transforms xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
<dsig:Transform Algorithm="http://www.w3.org/TR/1999/REC-xslt-19991116">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:pr="http://reference.e-government.gv.at/namespace/persondata/20020228#" exclude-result-prefixes="pr saml">
<xsl:output method="xml" xml:space="default"/>
diff --git a/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/testApplicationContext.xml b/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/testApplicationContext.xml index a7b588aa..b20202ad 100644 --- a/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/testApplicationContext.xml +++ b/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/testApplicationContext.xml @@ -15,38 +15,134 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
-
- <bean id="slCommandFactory" class="at.gv.egiz.bku.slcommands.SLCommandFactory"
- factory-method="getInstance">
- <property name="commandImpl">
- <map>
- <entry
- key="http://www.buergerkarte.at/namespaces/securitylayer/1.2#:NullOperationRequest"
- value="at.gv.egiz.bku.slcommands.impl.NullOperationCommandImpl" />
- <entry
- key="http://www.buergerkarte.at/namespaces/securitylayer/1.2#:InfoboxReadRequest"
- value="at.gv.egiz.bku.slcommands.impl.InfoboxReadCommandImpl" />
- <entry
- key="http://www.buergerkarte.at/namespaces/securitylayer/1.2#:CreateXMLSignatureRequest"
- value="at.gv.egiz.bku.slcommands.impl.CreateXMLSignatureCommandImpl" />
- </map>
- </property>
- </bean>
-
- <bean id="infoboxFactory" class="at.gv.egiz.bku.slcommands.impl.InfoboxFactory"
+ <bean id="configuration" class="org.apache.commons.configuration.MapConfiguration">
+ <constructor-arg>
+ <map>
+ <entry key="ValidateHashDataInputs" value="false"/>
+ </map>
+ </constructor-arg>
+ </bean>
+
+ <!-- URL dereferencer -->
+ <bean id="urlDereferencer" class="at.gv.egiz.bku.utils.urldereferencer.URLDereferencerImpl"
+ factory-method="getInstance"/>
+
+ <!-- command invoker -->
+ <bean id="slCommandInvoker" class="at.gv.egiz.bku.binding.SLCommandInvokerImpl">
+ </bean>
+
+ <!-- Security Layer command factory -->
+
+ <bean id="abstractCommandFactory" class="at.gv.egiz.bku.slcommands.AbstractSLCommandFactory"
+ abstract="true">
+ <property name="configuration" ref="configuration"/>
+ </bean>
+
+ <bean id="certificatesInfoboxFactory"
+ class="at.gv.egiz.bku.slcommands.impl.CertificatesInfoboxFactory" />
+ <bean id="identityLinkInfoboxFactory"
+ class="at.gv.egiz.bku.slcommands.impl.IdentityLinkInfoboxFactory">
+ <property name="identityLinkTransformer">
+ <bean class="at.gv.egiz.idlink.IdentityLinkTransformer">
+ <property name="urlDereferencer" ref="urlDereferencer"/>
+ </bean>
+ </property>
+ </bean>
+ <bean id="cardChannelInfoboxFactory"
+ class="at.gv.egiz.bku.slcommands.impl.CardChannelInfoboxFactory" />
+ <bean id="svPersonendatenInfoboxFactory"
+ class="at.gv.egiz.bku.slcommands.impl.SVPersonendatenInfoboxFactory" />
+
+ <bean id="infoboxFactory" class="at.gv.egiz.bku.slcommands.impl.InfoboxFactory">
+ <property name="infoboxFactories">
+ <map>
+ <entry key="Certificates" value-ref="certificatesInfoboxFactory" />
+ <entry key="IdentityLink" value-ref="identityLinkInfoboxFactory" />
+ <entry key="CardChannel" value-ref="cardChannelInfoboxFactory" />
+ <entry key="SV-Personendaten" value-ref="svPersonendatenInfoboxFactory" />
+ </map>
+ </property>
+ </bean>
+
+ <bean id="nullOperationCommandFactory"
+ class="at.gv.egiz.bku.slcommands.impl.NullOperationCommandFactory"
+ parent="abstractCommandFactory" />
+ <bean id="nullOperationRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="NullOperationRequest" />
+ </bean>
+ <bean id="infoboxReadCommandFactory"
+ class="at.gv.egiz.bku.slcommands.impl.InfoboxReadCommandFactory"
+ parent="abstractCommandFactory">
+ <property name="infoboxFactory" ref="infoboxFactory" />
+ </bean>
+ <bean id="infoboxReadRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="InfoboxReadRequest" />
+ </bean>
+ <bean id="infoboxUpdateCommandFactory"
+ class="at.gv.egiz.bku.slcommands.impl.InfoboxUpdateCommandFactory"
+ parent="abstractCommandFactory">
+ <property name="infoboxFactory" ref="infoboxFactory" />
+ </bean>
+ <bean id="infoboxUpdateRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="InfoboxUpdateRequest" />
+ </bean>
+ <bean id="createXMLSignatureCommandFactory"
+ class="at.gv.egiz.bku.slcommands.impl.CreateXMLSignatureCommandFactory"
+ parent="abstractCommandFactory" />
+ <bean id="createXMLSignatureRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="CreateXMLSignatureRequest" />
+ </bean>
+ <bean id="getStatusCommandFactory" class="at.gv.egiz.bku.slcommands.impl.GetStatusCommandFactory"
+ parent="abstractCommandFactory" />
+ <bean id="getStatusRequest" class="javax.xml.namespace.QName">
+ <constructor-arg
+ value="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" />
+ <constructor-arg value="GetStatusRequest" />
+ </bean>
+
+ <bean id="slCommandFactory" class="at.gv.egiz.bku.slcommands.SLCommandFactory"
factory-method="getInstance">
- <property name="infoboxImpl">
+ <property name="concreteFactories">
<map>
- <entry
- key="Certificates"
- value="at.gv.egiz.bku.slcommands.impl.CertificatesInfoboxImpl" />
- <entry
- key="IdentityLink"
- value="at.gv.egiz.bku.slcommands.impl.IdentityLinkInfoboxImpl" />
- <!--<entry
- key="CardChannel"
- value="at.gv.egiz.bku.slcommands.impl.CardChannel" />
- --></map>
+ <entry key-ref="nullOperationRequest" value-ref="nullOperationCommandFactory" />
+ <entry key-ref="infoboxReadRequest" value-ref="infoboxReadCommandFactory" />
+ <entry key-ref="infoboxUpdateRequest" value-ref="infoboxUpdateCommandFactory" />
+ <entry key-ref="createXMLSignatureRequest" value-ref="createXMLSignatureCommandFactory" />
+ <entry key-ref="getStatusRequest" value-ref="getStatusCommandFactory" />
+ </map>
+ </property>
+ </bean>
+
+ <!-- STAL factory -->
+ <bean id="stalFactory" class="at.gv.egiz.stal.dummy.DummyStalFactory"
+ scope="singleton">
+ </bean>
+
+ <!-- binding processor factories -->
+ <bean id="httpBindingProcessorFactory" class="at.gv.egiz.bku.binding.HTTPBindingProcessorFactory">
+ <property name="configuration" ref="configuration" />
+ <property name="slCommandFactory" ref="slCommandFactory" />
+ <property name="urlDereferencer" ref="urlDereferencer" />
+ </bean>
+
+ <!-- binding processor manager -->
+ <bean id="bindingProcessorManager" class="at.gv.egiz.bku.binding.BindingProcessorManagerImpl"
+ scope="singleton">
+ <property name="configuration" ref="configuration" />
+ <property name="stalFactory" ref="stalFactory" />
+ <property name="slCommandInvoker" ref="slCommandInvoker" />
+ <property name="factories">
+ <list>
+ <ref bean="httpBindingProcessorFactory"/>
+ </list>
</property>
</bean>
diff --git a/bkucommon/src/test/resources/commons-logging.properties b/bkucommon/src/test/resources/commons-logging.properties deleted file mode 100644 index 29292562..00000000 --- a/bkucommon/src/test/resources/commons-logging.properties +++ /dev/null @@ -1 +0,0 @@ -org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger @@ -2,11 +2,15 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <packaging>pom</packaging> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> <name>BKU</name> <url>http://bku.egiz.gv.at</url> + <properties> + <mocca.certificates.version>1.2</mocca.certificates.version> + <mocca.fonts.version>1.2</mocca.fonts.version> + </properties> <modules> <module>utils</module> <module>bkucommon</module> @@ -27,7 +31,6 @@ <module>BKUHelp</module> <module>BKUGuiExt</module> <module>smccSTALExt</module> - <!--module>BKUWebStartPackage</module--> <module>BKUFonts</module> </modules> <developers> @@ -37,20 +40,15 @@ <email>mcentner@egiz.gv.at</email> </developer> <developer> - <id>wbauer</id> - <name>Wolfgang Bauer</name> - <email>wbauer@egiz.gv.at</email> - </developer> - <developer> <id>corthacker</id> <name>Clemens Orthacker</name> <email>corthacker@egiz.gv.at</email> </developer> </developers> <scm> - <connection>scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk</connection> - <developerConnection>scm:svn:svn+ssh://svn.egovlabs.gv.at/svnroot/mocca/trunk</developerConnection> - <url>svn://svn.egovlabs.gv.at/svnroot/mocca/trunk</url> + <connection>scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.2.13-id-1-SNAPSHOT</connection> + <developerConnection>scm:svn:svn+ssh://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.2.13-id-1-SNAPSHOT</developerConnection> + <url>svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.2.13-id-1-SNAPSHOT</url> </scm> <organization> <name>E-Government Innovation Center (EGIZ)</name> @@ -74,6 +72,7 @@ <verbose>true</verbose> <showWarnings>true</showWarnings> <encoding>UTF-8</encoding> + <debug>false</debug> </configuration> </plugin> <plugin> @@ -123,6 +122,14 @@ <groupId>org.apache.maven.plugins</groupId> <version>2.3</version> </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <groupId>org.apache.maven.plugins</groupId> + <version>2.5</version> + <configuration> + <redirectTestOutputToFile>true</redirectTestOutputToFile> + </configuration> + </plugin> </plugins> </pluginManagement> </build> @@ -146,6 +153,11 @@ </repositories> <dependencies> <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <scope>test</scope> + </dependency> + <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <scope>test</scope> @@ -165,12 +177,6 @@ <scope>runtime</scope> </dependency> <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.1.1</version> - <scope>compile</scope> - </dependency> - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.4</version> @@ -205,7 +211,7 @@ <dependency> <groupId>iaik</groupId> <artifactId>iaik_xsect</artifactId> - <version>1.14</version> + <version>1.17</version> </dependency> <dependency> <groupId>iaik</groupId> @@ -213,6 +219,12 @@ <version>1.0-MOCCA</version> <scope>compile</scope> </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.5</version> + <scope>provided</scope> + </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> @@ -250,9 +262,47 @@ <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUWebStart</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.version}</version> <type>zip</type> </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>2.5.5</version> + </dependency> + <dependency> + <groupId>commons-configuration</groupId> + <artifactId>commons-configuration</artifactId> + <version>1.6</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.5.11</version> + <type>jar</type> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.5.11</version> + <type>jar</type> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-jdk14</artifactId> + <version>1.5.11</version> + <type>jar</type> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <version>2.5.5</version> + <type>jar</type> + <scope>compile</scope> + </dependency> </dependencies> </dependencyManagement> </project>
\ No newline at end of file diff --git a/smcc/keystore.ks b/smcc/keystore.ks Binary files differindex 824c3a40..ba0b4652 100644 --- a/smcc/keystore.ks +++ b/smcc/keystore.ks diff --git a/smcc/pom.xml b/smcc/pom.xml index 3febe352..a5a61cd9 100644 --- a/smcc/pom.xml +++ b/smcc/pom.xml @@ -1,15 +1,15 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>smcc</artifactId> <name>smcc</name> <packaging>jar</packaging> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <url>http://bku.egiz.gv.at</url> <build> <plugins> @@ -24,8 +24,8 @@ </build> <dependencies> <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> </dependency> <dependency> <groupId>junit</groupId> @@ -37,10 +37,5 @@ <artifactId>iaik_jce_full_signed</artifactId> <scope>test</scope> </dependency> - <!-- FIXME just for testing - <dependency> - <groupId>iaik</groupId> - <artifactId>iaik_jce_full_signed</artifactId> - </dependency> --> </dependencies> </project>
\ No newline at end of file diff --git a/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java b/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java index 9b3b88ed..e35aa5a4 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java @@ -26,7 +26,6 @@ import java.security.GeneralSecurityException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; -import java.util.List; import javax.crypto.Cipher; import javax.crypto.SecretKey; @@ -40,8 +39,8 @@ import javax.smartcardio.CardTerminal; import javax.smartcardio.CommandAPDU; import javax.smartcardio.ResponseAPDU; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.smcc.util.ISO7816Utils; import at.gv.egiz.smcc.util.SMCCHelper; @@ -49,7 +48,7 @@ import at.gv.egiz.smcc.util.TransparentFileInputStream; public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureCard { - private static Log log = LogFactory.getLog(ACOSCard.class); + private final Logger log = LoggerFactory.getLogger(ACOSCard.class); public static final byte[] AID_DEC = new byte[] { (byte) 0xA0, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x18, (byte) 0x45, (byte) 0x4E }; @@ -115,22 +114,7 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC (byte) 0x01 // RSA // TODO: Not verified yet }; - private static final PINSpec DEC_PIN_SPEC = new PINSpec(0, 8, "[0-9]", - "at/gv/egiz/smcc/ACOSCard", "dec.pin", KID_PIN_DEC, AID_DEC); - - private static final PINSpec SIG_PIN_SPEC = new PINSpec(0, 8, "[0-9]", - "at/gv/egiz/smcc/ACOSCard", "sig.pin", KID_PIN_SIG, AID_SIG); - - private static final PINSpec INF_PIN_SPEC = new PINSpec(0, 8, "[0-9]", - "at/gv/egiz/smcc/ACOSCard", "inf.pin", KID_PIN_INF, AID_DEC); - - static { - if (SignatureCardFactory.ENFORCE_RECOMMENDED_PIN_LENGTH) { - DEC_PIN_SPEC.setRecLength(4); - SIG_PIN_SPEC.setRecLength(6); - INF_PIN_SPEC.setRecLength(4); - } - } + protected PinInfo decPinInfo, sigPinInfo, infPinInfo; /** * The version of the card's digital signature application. @@ -160,20 +144,29 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC appVersion = 1; log.info("a-sign premium application version = " + appVersion); } catch (SignatureCardException e) { - log.warn(e); + log.warn("Failed to execute command.", e); appVersion = 0; } catch (IOException e) { - log.warn(e); + log.warn("Failed to execute command.", e); appVersion = 0; } catch (CardException e) { - log.warn(e); + log.warn("Failed to execute command.", e); appVersion = 0; - } - - pinSpecs.add(DEC_PIN_SPEC); - pinSpecs.add(SIG_PIN_SPEC); - if (appVersion < 2) { - pinSpecs.add(INF_PIN_SPEC); + } + + decPinInfo = new PinInfo(0, 8, "[0-9]", + "at/gv/egiz/smcc/ACOSCard", "dec.pin", KID_PIN_DEC, AID_DEC, 10); + + sigPinInfo = new PinInfo(0, 8, "[0-9]", + "at/gv/egiz/smcc/ACOSCard", "sig.pin", KID_PIN_SIG, AID_SIG, 10); + + infPinInfo= new PinInfo(0, 8, "[0-9]", + "at/gv/egiz/smcc/ACOSCard", "inf.pin", KID_PIN_INF, AID_DEC, 10); + + if (SignatureCardFactory.ENFORCE_RECOMMENDED_PIN_LENGTH) { + decPinInfo.setRecLength(4); + sigPinInfo.setRecLength(6); + infPinInfo.setRecLength(4); } } @@ -205,7 +198,7 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC int maxSize = -1; if (getAppVersion() < 2) { maxSize = ISO7816Utils.getLengthFromFCx(fcx); - log.debug("Size of selected file = " + maxSize); + log.debug("Size of selected file = {}.", maxSize); } // READ BINARY byte[] certificate = ISO7816Utils.readTransparentFileTLV(channel, maxSize, (byte) 0x30); @@ -251,13 +244,13 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC // SELECT file byte[] fcx = execSELECT_FID(channel, EF_INFOBOX); int maxSize = ISO7816Utils.getLengthFromFCx(fcx); - log.debug("Size of selected file = " + maxSize); + log.debug("Size of selected file = {}.", maxSize); // READ BINARY while(true) { try { return ISO7816Utils.readTransparentFileTLV(channel, maxSize, (byte) 0x30); } catch (SecurityStatusNotSatisfiedException e) { - verifyPINLoop(channel, INF_PIN_SPEC, provider); + verifyPINLoop(channel, infPinInfo, provider); } } @@ -295,7 +288,7 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC b = is.read(); if (b != 0x01) { - String msg = "Infobox structure v" + b + " not supported."; + String msg = "Infobox structure v{}" + b + " not supported."; log.info(msg); throw new SignatureCardException(msg); } @@ -348,7 +341,7 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC plainKey = execPSO_DECIPHER(channel, key); break; } catch(SecurityStatusNotSatisfiedException e) { - verifyPINLoop(channel, DEC_PIN_SPEC, provider); + verifyPINLoop(channel, decPinInfo, provider); } } @@ -444,14 +437,12 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC if (KeyboxName.SECURE_SIGNATURE_KEYPAIR.equals(keyboxName)) { - PINSpec spec = SIG_PIN_SPEC; - // SELECT application execSELECT_AID(channel, AID_SIG); // MANAGE SECURITY ENVIRONMENT : SET DST execMSE(channel, 0x41, 0xb6, dst.toByteArray()); // VERIFY - verifyPINLoop(channel, spec, provider); + verifyPINLoop(channel, sigPinInfo, provider); // PERFORM SECURITY OPERATION : HASH execPSO_HASH(channel, digest); // PERFORM SECURITY OPERATION : COMPUTE DIGITAL SIGNATRE @@ -459,8 +450,6 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC } else if (KeyboxName.CERITIFIED_KEYPAIR.equals(keyboxName)) { - PINSpec spec = DEC_PIN_SPEC; - // SELECT application execSELECT_AID(channel, AID_DEC); // MANAGE SECURITY ENVIRONMENT : SET AT @@ -471,7 +460,7 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC // INTERNAL AUTHENTICATE return execINTERNAL_AUTHENTICATE(channel, digest); } catch (SecurityStatusNotSatisfiedException e) { - verifyPINLoop(channel, spec, provider); + verifyPINLoop(channel, decPinInfo, provider); } } @@ -481,7 +470,7 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC } } catch (CardException e) { - log.warn(e); + log.warn("Failed to execute command.", e); throw new SignatureCardException("Failed to access card.", e); } @@ -492,10 +481,10 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC } /* (non-Javadoc) - * @see at.gv.egiz.smcc.AbstractSignatureCard#verifyPIN(at.gv.egiz.smcc.PINSpec, at.gv.egiz.smcc.PINProvider) + * @see at.gv.egiz.smcc.AbstractSignatureCard#verifyPIN(at.gv.egiz.smcc.pinInfo, at.gv.egiz.smcc.PINProvider) */ @Override - public void verifyPIN(PINSpec pinSpec, PINGUI pinProvider) + public void verifyPIN(PinInfo pinInfo, PINGUI pinProvider) throws LockedException, NotActivatedException, CancelledException, TimeoutException, SignatureCardException, InterruptedException { @@ -503,9 +492,9 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC try { // SELECT application - execSELECT_AID(channel, pinSpec.getContextAID()); + execSELECT_AID(channel, pinInfo.getContextAID()); // VERIFY - verifyPINLoop(channel, pinSpec, pinProvider); + verifyPINLoop(channel, pinInfo, pinProvider); } catch (CardException e) { log.info("Failed to verify PIN.", e); throw new SignatureCardException("Failed to verify PIN.", e); @@ -514,10 +503,10 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC } /* (non-Javadoc) - * @see at.gv.egiz.smcc.AbstractSignatureCard#changePIN(at.gv.egiz.smcc.PINSpec, at.gv.egiz.smcc.ChangePINProvider) + * @see at.gv.egiz.smcc.AbstractSignatureCard#changePIN(at.gv.egiz.smcc.pinInfo, at.gv.egiz.smcc.ChangePINProvider) */ @Override - public void changePIN(PINSpec pinSpec, ModifyPINGUI pinProvider) + public void changePIN(PinInfo pinInfo, ModifyPINGUI pinProvider) throws LockedException, NotActivatedException, CancelledException, TimeoutException, SignatureCardException, InterruptedException { @@ -525,9 +514,9 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC try { // SELECT application - execSELECT_AID(channel, pinSpec.getContextAID()); + execSELECT_AID(channel, pinInfo.getContextAID()); // CHANGE REFERENCE DATA - changePINLoop(channel, pinSpec, pinProvider); + changePINLoop(channel, pinInfo, pinProvider); } catch (CardException e) { log.info("Failed to change PIN.", e); throw new SignatureCardException("Failed to change PIN.", e); @@ -536,7 +525,7 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC } @Override - public void activatePIN(PINSpec pinSpec, ModifyPINGUI pinGUI) + public void activatePIN(PinInfo pinInfo, ModifyPINGUI pinGUI) throws CancelledException, SignatureCardException, CancelledException, TimeoutException, InterruptedException { log.error("ACTIVATE PIN not supported by ACOS"); @@ -544,29 +533,20 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC } @Override - public void unblockPIN(PINSpec pinSpec, ModifyPINGUI pinGUI) + public void unblockPIN(PinInfo pinInfo, ModifyPINGUI pinGUI) throws CancelledException, SignatureCardException, InterruptedException { throw new SignatureCardException("Unblock PIN not supported."); } /* (non-Javadoc) - * @see at.gv.egiz.smcc.PINMgmtSignatureCard#getPINSpecs() + * @see at.gv.egiz.smcc.PINMgmtSignatureCard#getpinInfos() */ @Override - public List<PINSpec> getPINSpecs() { - if (getAppVersion() < 2) { - return Arrays.asList(new PINSpec[] {DEC_PIN_SPEC, SIG_PIN_SPEC, INF_PIN_SPEC}); - } else { - return Arrays.asList(new PINSpec[] {DEC_PIN_SPEC, SIG_PIN_SPEC}); + public PinInfo[] getPinInfos() { + if (appVersion < 2) { + return new PinInfo[] {decPinInfo, sigPinInfo, infPinInfo }; } - } - - /* (non-Javadoc) - * @see at.gv.egiz.smcc.PINMgmtSignatureCard#getPINStatus(at.gv.egiz.smcc.PINSpec) - */ - @Override - public PIN_STATE getPINState(PINSpec pinSpec) throws SignatureCardException { - return PIN_STATE.UNKNOWN; + return new PinInfo[] {decPinInfo, sigPinInfo }; } @Override @@ -578,7 +558,7 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC // PROTECTED METHODS (assume exclusive card access) //////////////////////////////////////////////////////////////////////// - protected void verifyPINLoop(CardChannel channel, PINSpec spec, PINGUI provider) + protected void verifyPINLoop(CardChannel channel, PinInfo spec, PINGUI provider) throws InterruptedException, CardException, SignatureCardException { int retries = -1; @@ -587,7 +567,7 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC } while (retries > 0); } - protected void changePINLoop(CardChannel channel, PINSpec spec, ModifyPINGUI provider) + protected void changePINLoop(CardChannel channel, PinInfo spec, ModifyPINGUI provider) throws InterruptedException, CardException, SignatureCardException { int retries = -1; @@ -596,44 +576,48 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC } while (retries > 0); } - protected int verifyPIN(CardChannel channel, PINSpec pinSpec, + protected int verifyPIN(CardChannel channel, PinInfo pinInfo, PINGUI provider, int retries) throws InterruptedException, CardException, SignatureCardException { VerifyAPDUSpec apduSpec = new VerifyAPDUSpec( new byte[] { - (byte) 0x00, (byte) 0x20, (byte) 0x00, pinSpec.getKID(), (byte) 0x08, + (byte) 0x00, (byte) 0x20, (byte) 0x00, pinInfo.getKID(), (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 }, 0, VerifyAPDUSpec.PIN_FORMAT_ASCII, 8); - ResponseAPDU resp = reader.verify(channel, apduSpec, provider, pinSpec, retries); + ResponseAPDU resp = reader.verify(channel, apduSpec, provider, pinInfo, retries); if (resp.getSW() == 0x9000) { + pinInfo.setActive(pinInfo.maxRetries); return -1; } if (resp.getSW() >> 4 == 0x63c) { + pinInfo.setActive(0x0f & resp.getSW()); return 0x0f & resp.getSW(); } switch (resp.getSW()) { case 0x6983: // authentication method blocked + pinInfo.setBlocked(); throw new LockedException(); default: String msg = "VERIFY failed. SW=" + Integer.toHexString(resp.getSW()); log.info(msg); + pinInfo.setUnknown(); throw new SignatureCardException(msg); } } - protected int changePIN(CardChannel channel, PINSpec pinSpec, + protected int changePIN(CardChannel channel, PinInfo pinInfo, ModifyPINGUI pinProvider, int retries) throws CancelledException, InterruptedException, CardException, SignatureCardException { ChangeReferenceDataAPDUSpec apduSpec = new ChangeReferenceDataAPDUSpec( new byte[] { - (byte) 0x00, (byte) 0x24, (byte) 0x00, pinSpec.getKID(), (byte) 0x10, + (byte) 0x00, (byte) 0x24, (byte) 0x00, pinInfo.getKID(), (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, @@ -643,23 +627,27 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC - ResponseAPDU resp = reader.modify(channel, apduSpec, pinProvider, pinSpec, retries); + ResponseAPDU resp = reader.modify(channel, apduSpec, pinProvider, pinInfo, retries); if (resp.getSW() == 0x9000) { + pinInfo.setActive(pinInfo.maxRetries); return -1; } if (resp.getSW() >> 4 == 0x63c) { + pinInfo.setActive(0x0f & resp.getSW()); return 0x0f & resp.getSW(); } switch (resp.getSW()) { case 0x6983: // authentication method blocked + pinInfo.setBlocked(); throw new LockedException(); default: String msg = "CHANGE REFERENCE DATA failed. SW=" + Integer.toHexString(resp.getSW()); log.info(msg); + pinInfo.setUnknown(); throw new SignatureCardException(msg); } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java b/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java index fcb94fc6..73dadceb 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java @@ -18,8 +18,6 @@ package at.gv.egiz.smcc; import at.gv.egiz.smcc.reader.CardReader; import at.gv.egiz.smcc.reader.ReaderFactory; -import java.util.ArrayList; -import java.util.List; import java.util.Locale; import java.util.ResourceBundle; @@ -28,14 +26,12 @@ import javax.smartcardio.CardChannel; import javax.smartcardio.CardException; import javax.smartcardio.CardTerminal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public abstract class AbstractSignatureCard implements SignatureCard { - private static Log log = LogFactory.getLog(AbstractSignatureCard.class); - - protected List<PINSpec> pinSpecs = new ArrayList<PINSpec>(); + private final Logger log = LoggerFactory.getLogger(AbstractSignatureCard.class); private ResourceBundle i18n; private String resourceBundleName; @@ -118,4 +114,16 @@ public abstract class AbstractSignatureCard implements SignatureCard { } } + public void interfaceMethod(PinInfoTest pinInfo) { + + } + + int testMember = 3; + + public static class PinInfoTest { + + void setStatus(int status) { + } + + } } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/BELPICCard.java b/smcc/src/main/java/at/gv/egiz/smcc/BELPICCard.java index 41358bb5..bd42f47c 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/BELPICCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/BELPICCard.java @@ -29,8 +29,8 @@ 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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.smcc.util.ISO7816Utils; import at.gv.egiz.smcc.util.SMCCHelper; @@ -40,7 +40,7 @@ public class BELPICCard extends AbstractSignatureCard implements SignatureCard { /** * Logging facility. */ - private static Log log = LogFactory.getLog(BELPICCard.class); + private final Logger log = LoggerFactory.getLogger(BELPICCard.class); public static final byte[] MF = new byte[] { (byte) 0x3F, (byte) 0x00 }; @@ -64,16 +64,15 @@ public class BELPICCard extends AbstractSignatureCard implements SignatureCard { public static final int PINSPEC_SS = 0; - private static final PINSpec SS_PIN_SPEC = - new PINSpec(4, 12, "[0-9]", - "at/gv/egiz/smcc/BELPICCard", "sig.pin", KID, DF_BELPIC); + protected PinInfo ssPinInfo = + new PinInfo(4, 12, "[0-9]", + "at/gv/egiz/smcc/BELPICCard", "sig.pin", KID, DF_BELPIC, PinInfo.UNKNOWN_RETRIES); /** * Creates a new instance. */ public BELPICCard() { super("at/gv/egiz/smcc/BelpicCard"); - pinSpecs.add(SS_PIN_SPEC); } @Override @@ -161,12 +160,12 @@ public class BELPICCard extends AbstractSignatureCard implements SignatureCard { // VERIFY execMSE(channel, 0x41, 0xb6, dst); // PERFORM SECURITY OPERATION : COMPUTE DIGITAL SIGNATURE - verifyPINLoop(channel, SS_PIN_SPEC, provider); + verifyPINLoop(channel, ssPinInfo, provider); // MANAGE SECURITY ENVIRONMENT : SET DST return execPSO_COMPUTE_DIGITAL_SIGNATURE(channel, digest); } catch (CardException e) { - log.warn(e); + log.warn("Failed to execute command.", e); throw new SignatureCardException("Failed to access card.", e); } @@ -176,7 +175,7 @@ public class BELPICCard extends AbstractSignatureCard implements SignatureCard { return "Belpic Card"; } - protected void verifyPINLoop(CardChannel channel, PINSpec spec, + protected void verifyPINLoop(CardChannel channel, PinInfo spec, PINGUI provider) throws LockedException, NotActivatedException, SignatureCardException, InterruptedException, CardException { @@ -186,7 +185,7 @@ public class BELPICCard extends AbstractSignatureCard implements SignatureCard { } while (retries > 0); } - protected int verifyPIN(CardChannel channel, PINSpec pinSpec, + protected int verifyPIN(CardChannel channel, PinInfo pinSpec, PINGUI provider, int retries) throws SignatureCardException, LockedException, NotActivatedException, InterruptedException, CardException { @@ -281,4 +280,4 @@ public class BELPICCard extends AbstractSignatureCard implements SignatureCard { -}
\ No newline at end of file +} diff --git a/smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java b/smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java new file mode 100644 index 00000000..93c439a3 --- /dev/null +++ b/smcc/src/main/java/at/gv/egiz/smcc/EstEIDCard.java @@ -0,0 +1,280 @@ +/* +* Copyright 2009 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.smcc; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +import javax.smartcardio.CardChannel; +import javax.smartcardio.CardException; +import javax.smartcardio.CommandAPDU; +import javax.smartcardio.ResponseAPDU; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.smcc.pin.gui.PINGUI; +import at.gv.egiz.smcc.util.ISO7816Utils; +import at.gv.egiz.smcc.util.SMCCHelper; + +public class EstEIDCard extends AbstractSignatureCard { + + private final Logger log = LoggerFactory.getLogger(EstEIDCard.class); + + public static final byte KID_PIN_2 = (byte) 0x02; + + public static final byte[] DF = { (byte) 0xEE, (byte) 0xEE }; + + public static final byte[] EF_CERT = { (byte) 0xDD, (byte) 0x0CE }; + + private static final PinInfo QS_PIN_SPEC = new PinInfo(5, 12, "[0-9]", + "at/gv/egiz/smcc/EstEIDCard", "qs.pin", KID_PIN_2, DF, PinInfo.UNKNOWN_RETRIES); + + public EstEIDCard() { + super("at/gv/egiz/smcc/EstEIDCard"); + } + + @Override + public byte[] getCertificate(KeyboxName keyboxName) + throws SignatureCardException, InterruptedException { + + try { + CardChannel channel = getCardChannel(); + // SELECT MF + execSELECT_MF(channel); + // SELECT DF + execSELECT_DF(channel, DF); + // SELECT EF CERT + execSELECT_EF(channel, EF_CERT); + // READ BINARY + byte[] certificate = ISO7816Utils.readTransparentFileTLV(channel, -1, (byte) 0x30); + if (certificate == null) { + throw new NotActivatedException(); + } + return certificate; + } catch(FileNotFoundException e) { + throw new NotActivatedException(); + } catch (CardException e) { + log.info("Failed to get certificate.", e); + throw new SignatureCardException(e); + } + } + + @Override + public byte[] createSignature(InputStream input, KeyboxName keyboxName, + PINGUI pinGUI, String alg) throws SignatureCardException, + InterruptedException, IOException { + + if (!"http://www.w3.org/2000/09/xmldsig#rsa-sha1".equals(alg)) { + throw new SignatureCardException("Card does not support algorithm " + alg + "."); + } + + MessageDigest md; + try { + md = MessageDigest.getInstance("SHA-1"); + } catch (NoSuchAlgorithmException e) { + log.error("Failed to get MessageDigest.", e); + throw new SignatureCardException(e); + } + // calculate message digest + byte[] digest = new byte[md.getDigestLength()]; + for (int l; (l = input.read(digest)) != -1;) { + md.update(digest, 0, l); + } + digest = md.digest(); + + try { + + CardChannel channel = getCardChannel(); + + // SELECT MF + execSELECT_MF(channel); + // SELECT DF + execSELECT_DF(channel, DF); + // MANAGE SECURITY ENVIRONMENT : RESTORE + execMSE(channel, 0xF3, 0x01, null); + // VERIFY + verifyPINLoop(channel, QS_PIN_SPEC, pinGUI); + // PERFORM SECURITY OPERATION : COMPUTE DIGITAL SIGNATURE + return execPSO_COMPUTE_DIGITAL_SIGNATURE(channel, digest); + + } catch (CardException e) { + log.warn("Failed to execute command.", e); + throw new SignatureCardException("Failed to access card.", e); + } + + } + + @Override + public byte[] getInfobox(String infobox, PINGUI pinGUI, String domainId) + throws SignatureCardException, InterruptedException { + + throw new IllegalArgumentException("Infobox '" + infobox + + "' not supported."); + } + + protected void verifyPINLoop(CardChannel channel, PinInfo spec, + PINGUI provider) throws LockedException, NotActivatedException, + SignatureCardException, InterruptedException, CardException { + + int retries = -1; + do { + retries = verifyPIN(channel, spec, provider, retries); + } while (retries >= -1); + } + + protected int verifyPIN(CardChannel channel, PinInfo pinSpec, + PINGUI provider, int retries) throws SignatureCardException, + LockedException, NotActivatedException, InterruptedException, + CardException { + + VerifyAPDUSpec apduSpec = new VerifyAPDUSpec( + new byte[] { + (byte) 0x00, (byte) 0x20, (byte) 0x00, pinSpec.getKID()}, + 0, VerifyAPDUSpec.PIN_FORMAT_ASCII, 0); + + ResponseAPDU resp = reader.verify(channel, apduSpec, provider, pinSpec, retries); + + if (resp.getSW() == 0x9000) { + return -2; + } + if (resp.getSW() >> 4 == 0x63c) { + return 0x0f & resp.getSW(); + } + + switch (resp.getSW()) { + case 0x6300: + // incorrect PIN, number of retries not provided + return -1; + case 0x6400: + // ? + throw new TimeoutException(); + case 0x6983: + // authentication method blocked + throw new LockedException(); + case 0x6984: + // reference data not usable + throw new NotActivatedException(); + case 0x6985: + // conditions of use not satisfied + throw new NotActivatedException(); + + default: + String msg = "VERIFY failed. SW=" + Integer.toHexString(resp.getSW()); + log.info(msg); + throw new SignatureCardException(msg); + } + + } + + + protected void execSELECT_MF(CardChannel channel) + throws SignatureCardException, CardException { + execSELECT(channel, 0x00, null); + } + + protected void execSELECT_DF(CardChannel channel, byte[] fid) + throws SignatureCardException, CardException { + execSELECT(channel, 0x01, fid); + } + + protected void execSELECT_EF(CardChannel channel, byte[] fid) + throws SignatureCardException, CardException { + execSELECT(channel, 0x02, fid); + } + + protected void execSELECT(CardChannel channel, int p1, byte[] fid) + throws SignatureCardException, CardException { + + CommandAPDU command; + if (fid != null) { + command = new CommandAPDU(0x00, 0xA4, p1, 0x0C, fid, 256); + } else { + command = new CommandAPDU(0x00, 0xA4, p1, 0x0C, 256); + } + + ResponseAPDU resp = channel.transmit(command); + + if (resp.getSW() == 0x6A82) { + String msg = "File or application not found FID=" + + SMCCHelper.toString(fid) + " SW=" + + Integer.toHexString(resp.getSW()) + "."; + log.info(msg); + throw new FileNotFoundException(msg); + } else if (resp.getSW() != 0x9000) { + String msg = "Failed to select application FID=" + + SMCCHelper.toString(fid) + " SW=" + + Integer.toHexString(resp.getSW()) + "."; + log.error(msg); + throw new SignatureCardException(msg); + } + + } + + protected void execMSE(CardChannel channel, int p1, int p2, byte[] data) + throws CardException, SignatureCardException { + + ResponseAPDU resp; + if (data == null) { + resp = channel.transmit(new CommandAPDU(0x00, 0x22, p1, p2)); + } else { + resp = channel.transmit(new CommandAPDU(0x00, 0x22, p1, p2, data)); + } + + if (resp.getSW() != 0x9000) { + throw new SignatureCardException("MSE:SET failed: SW=" + + Integer.toHexString(resp.getSW())); + } + + } + + protected byte[] execPSO_COMPUTE_DIGITAL_SIGNATURE(CardChannel channel, + byte[] hash) throws CardException, SignatureCardException { + + byte[] oid = new byte[] { (byte) 0x30, (byte) 0x21, (byte) 0x30, + (byte) 0x09, (byte) 0x06, (byte) 0x05, (byte) 0x2b, + (byte) 0x0e, (byte) 0x03, (byte) 0x02, (byte) 0x1a, + (byte) 0x05, (byte) 0x00, (byte) 0x04, (byte) 0x14 }; + + ByteArrayOutputStream data = new ByteArrayOutputStream(); + + try { + // oid + data.write(oid); + // hash + data.write(hash); + } catch (IOException e) { + throw new SignatureCardException(e); + } + + ResponseAPDU resp = channel + .transmit(new CommandAPDU(0x00, 0x2A, 0x9E, 0x9A, data.toByteArray(), 0x80)); + + if (resp.getSW() != 0x9000) { + throw new SignatureCardException( + "PSO: COMPUTE DIGITAL SIGNATRE failed: SW=" + + Integer.toHexString(resp.getSW())); + } else { + return resp.getData(); + } + } + +} diff --git a/smcc/src/main/java/at/gv/egiz/smcc/ExclSignatureCardProxy.java b/smcc/src/main/java/at/gv/egiz/smcc/ExclSignatureCardProxy.java index bfbd0063..2562ae56 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/ExclSignatureCardProxy.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/ExclSignatureCardProxy.java @@ -26,12 +26,12 @@ import javax.smartcardio.Card; import javax.smartcardio.CardException; import javax.smartcardio.CardTerminal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ExclSignatureCardProxy implements InvocationHandler { - private static Log log = LogFactory.getLog(ExclSignatureCardProxy.class); + private final Logger log = LoggerFactory.getLogger(ExclSignatureCardProxy.class); private static final Method init; @@ -85,11 +85,10 @@ public class ExclSignatureCardProxy implements InvocationHandler { if (card != null) { try { - log.trace("Invoking method " + method.getName() + "() with exclusive access."); + log.trace("Invoking method {}() with exclusive access.", method.getName()); card.beginExclusive(); } catch (CardException e) { - log.info("Failed to get exclusive access to signature card " - + signatureCard.toString() + "."); + log.info("Failed to get exclusive access to signature card {}.", signatureCard); throw new SignatureCardException(e); } } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/ITCard.java b/smcc/src/main/java/at/gv/egiz/smcc/ITCard.java index 64389190..9ed65d53 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/ITCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/ITCard.java @@ -29,8 +29,8 @@ 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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.smcc.util.ISO7816Utils; import at.gv.egiz.smcc.util.SMCCHelper; @@ -40,7 +40,7 @@ public class ITCard extends AbstractSignatureCard { /** * Logging facility. */ - private static Log log = LogFactory.getLog(STARCOSCard.class); + private final Logger log = LoggerFactory.getLogger(STARCOSCard.class); public static final byte[] MF = new byte[] { (byte) 0x3F, (byte) 0x00 }; @@ -48,17 +48,15 @@ public class ITCard extends AbstractSignatureCard { public static final byte[] EF_C_Carta = new byte[] { (byte) 0x11, (byte) 0x01 }; - private static final PINSpec SS_PIN_SPEC = - new PINSpec(5, 8, "[0-9]", - "at/gv/egiz/smcc/ITCard", "sig.pin", (byte) 0x10, - new byte[] { (byte) 0x11, (byte) 0x00 }); - + protected PinInfo ssPinInfo = new PinInfo(5, 8, "[0-9]", + "at/gv/egiz/smcc/ITCard", "sig.pin", (byte) 0x10, + new byte[] { (byte) 0x11, (byte) 0x00 }, PinInfo.UNKNOWN_RETRIES); + /** * Creates a new instance. */ public ITCard() { super("at/gv/egiz/smcc/ITCard"); - pinSpecs.add(SS_PIN_SPEC); } @Override @@ -144,7 +142,7 @@ public class ITCard extends AbstractSignatureCard { // SELECT MF execSELECT_FID(channel, MF); // VERIFY - verifyPINLoop(channel, SS_PIN_SPEC, provider); + verifyPINLoop(channel, ssPinInfo, provider); // MANAGE SECURITY ENVIRONMENT : RESTORE SE execMSE(channel, 0xF3, 0x03, null); // MANAGE SECURITY ENVIRONMENT : SET DST @@ -153,13 +151,13 @@ public class ITCard extends AbstractSignatureCard { return execPSO_COMPUTE_DIGITAL_SIGNATURE(channel, digest); } catch (CardException e) { - log.warn(e); + log.warn("Failed to execute command.", e); throw new SignatureCardException("Failed to access card.", e); } } - protected void verifyPINLoop(CardChannel channel, PINSpec spec, + protected void verifyPINLoop(CardChannel channel, PinInfo spec, PINGUI provider) throws LockedException, NotActivatedException, SignatureCardException, InterruptedException, CardException { @@ -169,7 +167,7 @@ public class ITCard extends AbstractSignatureCard { } while (retries >= -1); } - protected int verifyPIN(CardChannel channel, PINSpec pinSpec, + protected int verifyPIN(CardChannel channel, PinInfo pinSpec, PINGUI provider, int retries) throws SignatureCardException, LockedException, NotActivatedException, InterruptedException, CardException { diff --git a/smcc/src/main/java/at/gv/egiz/smcc/LogCardChannel.java b/smcc/src/main/java/at/gv/egiz/smcc/LogCardChannel.java index 3fc80fa1..cbccda3d 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/LogCardChannel.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/LogCardChannel.java @@ -24,12 +24,12 @@ 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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class LogCardChannel extends CardChannel { - protected static Log log = LogFactory.getLog(LogCardChannel.class); + private final Logger log = LoggerFactory.getLogger(LogCardChannel.class); private CardChannel channel; @@ -61,11 +61,11 @@ public class LogCardChannel extends CardChannel { switch (command.getINS()) { case 0x20: // VERIFY case 0x21: // VERIFY - case 0x24: { // CHANGE REFERENCE DATA - // Don't log possibly sensitive command data + case 0x24: { // CHANGE REFERENCE DATA + // Don't log possibly sensitive command data StringBuilder sb = new StringBuilder(); sb.append(command); - sb.append('\n'); + sb.append("\n-> "); byte[] c = new byte[4]; c[0] = (byte) command.getCLA(); c[1] = (byte) command.getINS(); @@ -87,12 +87,12 @@ public class LogCardChannel extends CardChannel { }; break; default: - log.trace(command + "\n" + toString(command.getBytes())); + log.trace(command + "\n-> " + toString(command.getBytes())); } long t0 = System.currentTimeMillis(); ResponseAPDU response = channel.transmit(command); long t1 = System.currentTimeMillis(); - log.trace(response + " [" + (t1 - t0) + "ms]\n" + toString(response.getBytes())); + log.trace(response + " [" + (t1 - t0) + "ms]\n<- " + toString(response.getBytes())); return response; } else { return channel.transmit(command); diff --git a/smcc/src/main/java/at/gv/egiz/smcc/PINConfirmationException.java b/smcc/src/main/java/at/gv/egiz/smcc/PINConfirmationException.java index 24dfa53c..4d7d34f5 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/PINConfirmationException.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/PINConfirmationException.java @@ -23,4 +23,7 @@ package at.gv.egiz.smcc; * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> */ public class PINConfirmationException extends SignatureCardException { + + private static final long serialVersionUID = 1L; + } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/PINFormatException.java b/smcc/src/main/java/at/gv/egiz/smcc/PINFormatException.java index 721c63e2..08bc0f18 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/PINFormatException.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/PINFormatException.java @@ -23,4 +23,7 @@ package at.gv.egiz.smcc; * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at> */ public class PINFormatException extends SignatureCardException { + + private static final long serialVersionUID = 1L; + } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/PINMgmtSignatureCard.java b/smcc/src/main/java/at/gv/egiz/smcc/PINMgmtSignatureCard.java index 5091c10f..70b19ff0 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/PINMgmtSignatureCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/PINMgmtSignatureCard.java @@ -19,26 +19,26 @@ package at.gv.egiz.smcc; import at.gv.egiz.smcc.pin.gui.ModifyPINGUI; import at.gv.egiz.smcc.pin.gui.PINGUI; -import java.util.List; public interface PINMgmtSignatureCard extends SignatureCard { - public enum PIN_STATE {UNKNOWN, ACTIV, NOT_ACTIV, BLOCKED}; - - public List<PINSpec> getPINSpecs(); + /** + * PinInfo declares protected methods to be used from within card implementations. + * DO NOT REFACTOR CARD INTERFACE AND IMPLEMENTATIONS TO SEPARATE PACKAGES + * @throws SignatureCardException if the card is STARCOS G3 and not activated (G3 pin activation fails if card not active) + */ + public PinInfo[] getPinInfos() throws SignatureCardException; - public PIN_STATE getPINState(PINSpec pinSpec) throws SignatureCardException; - - public void verifyPIN(PINSpec pinSpec, PINGUI pinGUI) + public void verifyPIN(PinInfo pinInfo, PINGUI pinGUI) throws LockedException, NotActivatedException, CancelledException, SignatureCardException, InterruptedException; - public void changePIN(PINSpec pinSpec, ModifyPINGUI changePINGUI) + public void changePIN(PinInfo pinInfo, ModifyPINGUI changePINGUI) throws LockedException, NotActivatedException, CancelledException, PINFormatException, SignatureCardException, InterruptedException; - public void activatePIN(PINSpec pinSpec, ModifyPINGUI activatePINGUI) + public void activatePIN(PinInfo pinInfo, ModifyPINGUI activatePINGUI) throws CancelledException, SignatureCardException, InterruptedException; - public void unblockPIN(PINSpec pinSpec, ModifyPINGUI pukGUI) + public void unblockPIN(PinInfo pinInfo, ModifyPINGUI pukGUI) throws CancelledException, SignatureCardException, InterruptedException; } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java b/smcc/src/main/java/at/gv/egiz/smcc/PinInfo.java index f68edbed..d2acf666 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/PinInfo.java @@ -24,18 +24,25 @@ import java.util.ResourceBundle; * * @author mcentner */ -public class PINSpec { +public class PinInfo { + public enum STATE {UNKNOWN, ACTIV, NOT_ACTIV, BLOCKED}; + + /** + * the number of remaining retries is unknown or irrelevant (blocked, not active states) + */ + public static final int UNKNOWN_RETRIES = -1; + /** * The minimum PIN length. */ - protected int minLength = 0; + protected final int minLength; /** * The maximum PIN length or -1 if not specified. */ - protected int maxLength = -1; - + protected final int maxLength; + /** * The recommended PIN length or -1 if not specified. */ @@ -44,34 +51,42 @@ public class PINSpec { /** * The regular expression pattern of a single PIN digit or character. */ - protected String rexepPattern; + protected final String rexepPattern; /** * The name of the corresponding resource bundle. */ - protected String resourceBundleName; + protected final String resourceBundleName; /** * The key of the PIN name in the resource bundle. */ - protected String nameKey; + protected final String nameKey; /** - * The name of the PIN. - */ - protected String name; - - /** * The key id to be used in VERIFY or CHANGE REFERENCE DATA APDUs. */ - protected byte kid; + protected final byte kid; /** * The context AID of the key id. */ - protected byte[] context_aid; + protected final byte[] context_aid; + + protected final int maxRetries; + + /** + * The current status of this PIN + */ + protected STATE state = STATE.UNKNOWN; /** + * number of further allowed retries (before the pin is blocked) + */ + protected int retries = UNKNOWN_RETRIES; + + + /** * Creates a new instance of this PINSpec with the given lengths, regular * expression pattern, the ResourceBundle name and key to lookup the PIN name * and the KID and AID. @@ -84,8 +99,8 @@ public class PINSpec { * @param kid the key id of the PIN * @param contextAID the AID the KID is valid in */ - public PINSpec(int minLenght, int maxLength, String rexepPattern, - String resourceBundleName, String resourceKey, byte kid, byte[] contextAID) { + public PinInfo(int minLenght, int maxLength, String rexepPattern, + String resourceBundleName, String resourceKey, byte kid, byte[] contextAID, int maxRetries) { this.minLength = minLenght; this.maxLength = maxLength; @@ -94,48 +109,23 @@ public class PINSpec { this.nameKey = resourceKey + ".name"; this.kid = kid; this.context_aid = contextAID; - } - - /** - * Creates a new instance of this PINSpec with the given lengths, regular - * expression pattern, the name of the PIN and the KID and AID. - * - * @param minLenght the minimum length of the PIN - * @param maxLength the maximum length of the PIN, or -1 if there is no maximum length - * @param rexepPattern the regular expression pattern of a single PIN digit or character - * @param name the name of the PIN - * @param kid the key id of the PIN - * @param contextAID the AID the KID is valid in - */ - public PINSpec(int minLenght, int maxLength, String rexepPattern, - String name, byte kid, byte[] contextAID) { - - this.minLength = minLenght; - this.maxLength = maxLength; - this.rexepPattern = rexepPattern; - this.name = name; - this.kid = kid; - this.context_aid = contextAID; + this.maxRetries = maxRetries; } /** * This method sets the recommended PIN length. - * + * * @param recLength the recommended PIN length */ public void setRecLength(int recLength) { this.recLength = recLength; } - + /** - * @return the localized (using the default locale) name of the PIN, or the - * name set by - * {@link #PINSpec(int, int, String, String, byte, byte[])}. + * @return the localized (using the default locale) name of the PIN */ public String getLocalizedName() { - if (name != null) { - return name; - } else if (resourceBundleName != null){ + if (resourceBundleName != null){ try { return ResourceBundle.getBundle(resourceBundleName).getString(nameKey); } catch (MissingResourceException e) { @@ -146,13 +136,10 @@ public class PINSpec { /** * @param locale the locale for which the name should be returned - * @return the localized name of the PIN, or the name set by - * {@link #PINSpec(int, int, String, String, byte, byte[])} + * @return the localized name of the PIN, */ public String getLocalizedName(Locale locale) { - if (name != null) { - return name; - } else if (resourceBundleName != null) { + if (resourceBundleName != null) { try { return ResourceBundle.getBundle(resourceBundleName, locale).getString(nameKey); } catch (MissingResourceException e) { @@ -235,5 +222,37 @@ public class PINSpec { public byte[] getContextAID() { return context_aid; } - + + public STATE getState() { + return state; + } + + public int getRetries() { + return retries; + } + + ////////////////////////////////////////////////////////////////////////////// + //* PinInfo declares protected methods to be used from within card implementations. + //* DO NOT REFACTOR CARD INTERFACE AND IMPLEMENTATIONS TO SEPARATE PACKAGES + + protected void setNotActive() { + this.state = STATE.NOT_ACTIV; + this.retries = UNKNOWN_RETRIES; + } + + protected void setActive(int retries) { + this.state = STATE.ACTIV; + this.retries = retries; + } + + protected void setBlocked() { + this.state = STATE.BLOCKED; + this.retries = UNKNOWN_RETRIES; + } + + protected void setUnknown() { + this.state = STATE.UNKNOWN; + this.retries = UNKNOWN_RETRIES; + } + } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/PtEidCard.java b/smcc/src/main/java/at/gv/egiz/smcc/PtEidCard.java new file mode 100644 index 00000000..8bd49e01 --- /dev/null +++ b/smcc/src/main/java/at/gv/egiz/smcc/PtEidCard.java @@ -0,0 +1,310 @@ +/* + * Copyright 2010 Federal Chancellery Austria and + * Graz University of Technology + * + * based on an implementation + * + * Copyright 2009 Manuel Preliteiro, MULTICERT S.A. + * + * Licensed under the EUPL, Version 1.1 or – as soon they + * will be approved by the European Commission - subsequent + * versions of the EUPL (the "Licence"); + * + * You may not use this work except in compliance with the + * Licence. + * + * You may obtain a copy of the Licence at: + * + * http://ec.europa.eu/idabc/eupl + * + * Unless required by applicable law or agreed to in + * writing, software distributed under the Licence is + * distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. + * + * See the Licence for the specific language governing + * permissions and limitations under the Licence. + */ + +package at.gv.egiz.smcc; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +import javax.smartcardio.CardChannel; +import javax.smartcardio.CardException; +import javax.smartcardio.CommandAPDU; +import javax.smartcardio.ResponseAPDU; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.smcc.pin.gui.PINGUI; +import at.gv.egiz.smcc.util.ISO7816Utils; +import at.gv.egiz.smcc.util.SMCCHelper; + +public class PtEidCard extends AbstractSignatureCard { + + private final Logger log = LoggerFactory.getLogger(PtEidCard.class); + + private static final byte[] AID_APPLET = { (byte) 0x60, (byte) 0x46, (byte) 0x32, + (byte) 0xff, (byte) 0x00, (byte) 0x00, (byte) 0x02 }; + + private static final byte[] DF_ISSUES = {(byte) 0x5F, (byte) 0x00}; + + private static final byte[] EF_SIGN_CERT = { (byte) 0xEF, (byte) 0x08 }; + + private static final PinInfo QS_PIN_SPEC = + new PinInfo(4, 4, "[0-9]", + "at/gv/egiz/smcc/PtEidCard", "sig.pin", (byte) 0x82, DF_ISSUES, PinInfo.UNKNOWN_RETRIES); + + protected PtEidCard() { + super("at/gv/egiz/smcc/PtEidCard"); + } + + @Override + public byte[] getCertificate(KeyboxName keyboxName) + throws SignatureCardException, InterruptedException { + + try { + CardChannel channel = getCardChannel(); + // SELECT applet + execSELECT_AID(channel, AID_APPLET); + // SELECT DF_ISSUES + execSELECT_FID(channel, DF_ISSUES); + // SELECT EF_SIGN_CERT + byte[] fcx = execSELECT_FID(channel, EF_SIGN_CERT); + int maxsize = ISO7816Utils.getLengthFromFCx(fcx); + // READ BINARY + byte[] certificate = ISO7816Utils.readTransparentFileTLV(channel, maxsize, (byte) 0x30); + if (certificate == null) { + throw new NotActivatedException(); + } + return certificate; + } catch (FileNotFoundException e) { + throw new NotActivatedException(); + } catch (CardException e) { + log.info("Failed to get certificate.", e); + throw new SignatureCardException(e); + } + + } + + @Override + public byte[] getInfobox(String infobox, PINGUI pinGUI, String domainId) + throws SignatureCardException, InterruptedException { + + throw new IllegalArgumentException("Infobox '" + infobox + + "' not supported."); + } + + @Override + public byte[] createSignature(InputStream input, KeyboxName keyboxName, + PINGUI pinGUI, String alg) throws SignatureCardException, + InterruptedException, IOException { + + if (!"http://www.w3.org/2000/09/xmldsig#rsa-sha1".equals(alg)) { + throw new SignatureCardException("Card does not support algorithm " + alg + "."); + } + + final byte[] dst = { + (byte) 0x80, // algorithm reference + (byte) 0x01, (byte) 0x12, // RSASSA-PKCS1-v1.5 using SHA1 + (byte) 0x84, // private key reference + (byte) 0x01, (byte) 0x01}; + + MessageDigest md; + try { + md = MessageDigest.getInstance("SHA-1"); + } catch (NoSuchAlgorithmException e) { + log.error("Failed to get MessageDigest.", e); + throw new SignatureCardException(e); + } + // calculate message digest + byte[] digest = new byte[md.getDigestLength()]; + for (int l; (l = input.read(digest)) != -1;) { + md.update(digest, 0, l); + } + digest = md.digest(); + + + try { + + CardChannel channel = getCardChannel(); + + // SELECT applet + execSELECT_AID(channel, AID_APPLET); + // SELECT DF_ISSUES + execSELECT_FID(channel, DF_ISSUES); + // VERIFY + verifyPINLoop(channel, QS_PIN_SPEC, pinGUI); + // MANAGE SECURITY ENVIRONMENT : RESTORE SE + execMSE(channel, 0x73, 0x03, null); + // MANAGE SECURITY ENVIRONMENT : SET DST + execMSE(channel, 0x41, 0xB6, dst); + // PERFORM SECURITY OPERATION : HASH + execPSO_HASH(channel, digest); + // PERFORM SECURITY OPERATION : COMPUTE DIGITAL SIGNATURE + return execPSO_COMPUTE_DIGITAL_SIGNATURE(channel); + + } catch (CardException e) { + log.warn("Failed to execute command.", e); + throw new SignatureCardException("Failed to access card.", e); + } + + } + + protected void verifyPINLoop(CardChannel channel, PinInfo spec, + PINGUI provider) throws LockedException, NotActivatedException, + SignatureCardException, InterruptedException, CardException { + + int retries = -1; + do { + retries = verifyPIN(channel, spec, provider, retries); + } while (retries >= -1); + } + + protected int verifyPIN(CardChannel channel, PinInfo pinSpec, + PINGUI provider, int retries) throws SignatureCardException, + LockedException, NotActivatedException, InterruptedException, + CardException { + + VerifyAPDUSpec apduSpec = new VerifyAPDUSpec( + new byte[] { (byte) 0x00, (byte) 0x20, (byte) 0x00, pinSpec.getKID(), + (byte) 0x08, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, + (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF }, + 0, VerifyAPDUSpec.PIN_FORMAT_ASCII, 8); + + ResponseAPDU resp = reader.verify(channel, apduSpec, provider, pinSpec, retries); + + if (resp.getSW() == 0x9000) { + return -2; + } + if (resp.getSW() >> 4 == 0x63c) { + return 0x0f & resp.getSW(); + } + + switch (resp.getSW()) { + case 0x6300: + // incorrect PIN, number of retries not provided + return -1; + case 0x6983: + // authentication method blocked + throw new LockedException(); + + default: + String msg = "VERIFY failed. SW=" + Integer.toHexString(resp.getSW()); + log.info(msg); + throw new SignatureCardException(msg); + } + + } + + + + protected void execSELECT_AID(CardChannel channel, byte[] aid) + throws SignatureCardException, CardException { + + ResponseAPDU resp = channel.transmit(new CommandAPDU(0x00, 0xA4, 0x04, + 0x0C, aid, 256)); + + if (resp.getSW() == 0x6A82) { + String msg = "File or application not found FID=" + + SMCCHelper.toString(aid) + " SW=" + + Integer.toHexString(resp.getSW()) + "."; + log.info(msg); + throw new FileNotFoundException(msg); + } else if (resp.getSW() != 0x9000) { + String msg = "Failed to select application FID=" + + SMCCHelper.toString(aid) + " SW=" + + Integer.toHexString(resp.getSW()) + "."; + log.error(msg); + throw new SignatureCardException(msg); + } + + } + + protected byte[] execSELECT_FID(CardChannel channel, byte[] fid) + throws SignatureCardException, CardException { + + ResponseAPDU resp = channel.transmit(new CommandAPDU(0x00, 0xA4, 0x00, + 0x00, fid, 256)); + + if (resp.getSW() == 0x6A82) { + String msg = "File or application not found FID=" + + SMCCHelper.toString(fid) + " SW=" + + Integer.toHexString(resp.getSW()) + "."; + log.info(msg); + throw new FileNotFoundException(msg); + } else if (resp.getSW() != 0x9000) { + String msg = "Failed to select application FID=" + + SMCCHelper.toString(fid) + " SW=" + + Integer.toHexString(resp.getSW()) + "."; + log.error(msg); + throw new SignatureCardException(msg); + } else { + return resp.getBytes(); + } + + } + + protected void execMSE(CardChannel channel, int p1, int p2, byte[] data) + throws CardException, SignatureCardException { + + ResponseAPDU resp; + if (data == null) { + resp = channel.transmit(new CommandAPDU(0x00, 0x22, p1, p2, 256)); + } else { + resp = channel.transmit(new CommandAPDU(0x00, 0x22, p1, p2, data, 256)); + } + + if (resp.getSW() != 0x9000) { + throw new SignatureCardException("MSE:SET failed: SW=" + + Integer.toHexString(resp.getSW())); + } + } + + protected void execPSO_HASH(CardChannel channel, byte[] hash) throws CardException, SignatureCardException { + + ByteArrayOutputStream data = new ByteArrayOutputStream(hash.length + 2); + try { + data.write(0x90); + data.write(hash.length); + data.write(hash); + } catch (IOException e) { + throw new SignatureCardException(e); + } + + ResponseAPDU resp = channel.transmit( + new CommandAPDU(0x00, 0x2A, 0x90, 0xA0, data.toByteArray())); + if (resp.getSW() != 0x9000) { + throw new SignatureCardException("PSO - HASH failed: SW=" + + Integer.toHexString(resp.getSW())); + } + + } + + protected byte[] execPSO_COMPUTE_DIGITAL_SIGNATURE(CardChannel channel) + throws CardException, SignatureCardException { + + ResponseAPDU resp = channel + .transmit(new CommandAPDU(0x00, 0x2A, 0x9E, 0x9A, 0x14)); + + if (resp.getSW() == 0x6982) { + throw new SecurityStatusNotSatisfiedException(); + } else if (resp.getSW() == 0x6983) { + throw new LockedException(); + } else if (resp.getSW() != 0x9000) { + throw new SignatureCardException( + "PSO: COMPUTE DIGITAL SIGNATRE failed: SW=" + + Integer.toHexString(resp.getSW())); + } else { + return resp.getData(); + } + } + +} diff --git a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java index b876847f..8de4eeb8 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java @@ -24,8 +24,6 @@ import java.io.IOException; import java.io.InputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import java.util.Arrays; -import java.util.List; import javax.smartcardio.Card; import javax.smartcardio.CardChannel; @@ -34,8 +32,8 @@ import javax.smartcardio.CardTerminal; import javax.smartcardio.CommandAPDU; import javax.smartcardio.ResponseAPDU; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.smcc.util.ISO7816Utils; import at.gv.egiz.smcc.util.SMCCHelper; @@ -45,7 +43,7 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu /** * Logging facility. */ - private static Log log = LogFactory.getLog(STARCOSCard.class); + private final Logger log = LoggerFactory.getLogger(STARCOSCard.class); public static final byte[] MF = new byte[] { (byte) 0x3F, (byte) 0x00 }; @@ -131,30 +129,16 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu public static final byte KID_PIN_CARD = (byte) 0x01; - private static final PINSpec CARD_PIN_SPEC = - new PINSpec(4, 12, "[0-9]", - "at/gv/egiz/smcc/STARCOSCard", "card.pin", KID_PIN_CARD, null); - - private static final PINSpec SS_PIN_SPEC = - new PINSpec(6, 12, "[0-9]", - "at/gv/egiz/smcc/STARCOSCard", "sig.pin", KID_PIN_SS, AID_DF_SS); - - static { - if (SignatureCardFactory.ENFORCE_RECOMMENDED_PIN_LENGTH) { - CARD_PIN_SPEC.setRecLength(4); - SS_PIN_SPEC.setRecLength(6); - } - } - protected double version = 1.1; + protected PinInfo cardPinInfo; + protected PinInfo ssPinInfo; + /** * Creates a new instance. */ public STARCOSCard() { super("at/gv/egiz/smcc/STARCOSCard"); - pinSpecs.add(CARD_PIN_SPEC); - pinSpecs.add(SS_PIN_SPEC); } /* (non-Javadoc) @@ -163,7 +147,7 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu @Override public void init(Card card, CardTerminal cardTerminal) { super.init(card, cardTerminal); - + // determine application version CardChannel channel = getCardChannel(); try { @@ -179,17 +163,27 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu log.info("e-card version=" + version + " (" + generation + ")"); } } catch (CardException e) { - log.warn(e); + log.warn("Failed to execute command.", e); } catch (SignatureCardException e) { - log.warn(e); + log.warn("Failed to execute command.", e); + } + + cardPinInfo = new PinInfo(4, 12, "[0-9]", + "at/gv/egiz/smcc/STARCOSCard", "card.pin", KID_PIN_CARD, null, 10); + ssPinInfo = new PinInfo(6, 12, "[0-9]", + "at/gv/egiz/smcc/STARCOSCard", "sig.pin", KID_PIN_SS, AID_DF_SS, + (version < 1.2) ? 3 : 10); + + if (SignatureCardFactory.ENFORCE_RECOMMENDED_PIN_LENGTH) { + cardPinInfo.setRecLength(4); + ssPinInfo.setRecLength(6); } - } @Override @Exclusive public byte[] getCertificate(KeyboxName keyboxName) - throws SignatureCardException, InterruptedException { + throws SignatureCardException { byte[] aid; byte[] fid; @@ -233,8 +227,6 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu try { if ("IdentityLink".equals(infobox)) { - PINSpec spec = CARD_PIN_SPEC; - CardChannel channel = getCardChannel(); // SELECT application execSELECT_AID(channel, AID_INFOBOX); @@ -245,7 +237,7 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu try { return ISO7816Utils.readTransparentFileTLV(channel, -1, (byte) 0x30); } catch (SecurityStatusNotSatisfiedException e) { - verifyPINLoop(channel, spec, pinGUI); + verifyPINLoop(channel, cardPinInfo, pinGUI); } } @@ -295,7 +287,7 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu } } catch (CardException e) { - log.warn(e); + log.warn("Failed to execute command.", e); throw new SignatureCardException("Failed to access card.", e); } } @@ -368,14 +360,12 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu if (KeyboxName.SECURE_SIGNATURE_KEYPAIR.equals(keyboxName)) { - PINSpec spec = SS_PIN_SPEC; - // SELECT MF execSELECT_MF(channel); // SELECT application execSELECT_AID(channel, AID_DF_SS); // VERIFY - verifyPINLoop(channel, spec, provider); + verifyPINLoop(channel, ssPinInfo, provider); // MANAGE SECURITY ENVIRONMENT : SET DST execMSE(channel, 0x41, 0xb6, dst.toByteArray()); if (version < 1.2) { @@ -395,8 +385,6 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu } else if (KeyboxName.CERITIFIED_KEYPAIR.equals(keyboxName)) { - PINSpec spec = CARD_PIN_SPEC; - // SELECT application execSELECT_AID(channel, AID_DF_GS); // MANAGE SECURITY ENVIRONMENT : SET DST @@ -412,7 +400,7 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu // PERFORM SECURITY OPERATION : COMPUTE DIGITAL SIGNATURE return execPSO_COMPUTE_DIGITAL_SIGNATURE(channel, null); } catch (SecurityStatusNotSatisfiedException e) { - verifyPINLoop(channel, spec, provider); + verifyPINLoop(channel, cardPinInfo, provider); } } @@ -422,29 +410,29 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu } } catch (CardException e) { - log.warn(e); + log.warn("Failed to execute command.", e); throw new SignatureCardException("Failed to access card.", e); } } /* (non-Javadoc) - * @see at.gv.egiz.smcc.AbstractSignatureCard#verifyPIN(at.gv.egiz.smcc.PINSpec, at.gv.egiz.smcc.PINProvider) + * @see at.gv.egiz.smcc.AbstractSignatureCard#verifyPIN(at.gv.egiz.smcc.PinInfo, at.gv.egiz.smcc.PINProvider) */ @Override @Exclusive - public void verifyPIN(PINSpec pinSpec, PINGUI pinProvider) + public void verifyPIN(PinInfo pinInfo, PINGUI pinProvider) throws LockedException, NotActivatedException, CancelledException, TimeoutException, SignatureCardException, InterruptedException { CardChannel channel = getCardChannel(); try { - if (pinSpec.getContextAID() != null) { + if (pinInfo.getContextAID() != null) { // SELECT application - execSELECT_AID(channel, pinSpec.getContextAID()); + execSELECT_AID(channel, pinInfo.getContextAID()); } - verifyPINLoop(channel, pinSpec, pinProvider); + verifyPINLoop(channel, pinInfo, pinProvider); } catch (CardException e) { log.info("Failed to verify PIN.", e); throw new SignatureCardException("Failed to verify PIN.", e); @@ -453,22 +441,22 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu } /* (non-Javadoc) - * @see at.gv.egiz.smcc.AbstractSignatureCard#changePIN(at.gv.egiz.smcc.PINSpec, at.gv.egiz.smcc.ChangePINProvider) + * @see at.gv.egiz.smcc.AbstractSignatureCard#changePIN(at.gv.egiz.smcc.PinInfo, at.gv.egiz.smcc.ChangePINProvider) */ @Override @Exclusive - public void changePIN(PINSpec pinSpec, ModifyPINGUI pinGUI) + public void changePIN(PinInfo pinInfo, ModifyPINGUI pinGUI) throws LockedException, NotActivatedException, CancelledException, TimeoutException, SignatureCardException, InterruptedException { CardChannel channel = getCardChannel(); try { - if (pinSpec.getContextAID() != null) { + if (pinInfo.getContextAID() != null) { // SELECT application - execSELECT_AID(channel, pinSpec.getContextAID()); + execSELECT_AID(channel, pinInfo.getContextAID()); } - changePINLoop(channel, pinSpec, pinGUI); + changePINLoop(channel, pinInfo, pinGUI); } catch (CardException e) { log.info("Failed to change PIN.", e); throw new SignatureCardException("Failed to change PIN.", e); @@ -477,22 +465,22 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu } /* (non-Javadoc) - * @see at.gv.egiz.smcc.AbstractSignatureCard#activatePIN(at.gv.egiz.smcc.PINSpec, at.gv.egiz.smcc.PINProvider) + * @see at.gv.egiz.smcc.AbstractSignatureCard#activatePIN(at.gv.egiz.smcc.PinInfo, at.gv.egiz.smcc.PINProvider) */ @Override @Exclusive - public void activatePIN(PINSpec pinSpec, ModifyPINGUI activatePINGUI) + public void activatePIN(PinInfo pinInfo, ModifyPINGUI activatePINGUI) throws CancelledException, SignatureCardException, CancelledException, TimeoutException, InterruptedException { CardChannel channel = getCardChannel(); try { - if (pinSpec.getContextAID() != null) { + if (pinInfo.getContextAID() != null) { // SELECT application - execSELECT_AID(channel, pinSpec.getContextAID()); + execSELECT_AID(channel, pinInfo.getContextAID()); } - activatePIN(channel, pinSpec, activatePINGUI); + activatePIN(channel, pinInfo, activatePINGUI); } catch (CardException e) { log.info("Failed to activate PIN.", e); throw new SignatureCardException("Failed to activate PIN.", e); @@ -501,15 +489,15 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu } /* (non-Javadoc) - * @see at.gv.egiz.smcc.PINMgmtSignatureCard#unblockPIN(at.gv.egiz.smcc.PINSpec, at.gv.egiz.smcc.PINProvider) + * @see at.gv.egiz.smcc.PINMgmtSignatureCard#unblockPIN(at.gv.egiz.smcc.PinInfo, at.gv.egiz.smcc.PINProvider) */ @Override - public void unblockPIN(PINSpec pinSpec, ModifyPINGUI pukProvider) + public void unblockPIN(PinInfo pinInfo, ModifyPINGUI pukProvider) throws CancelledException, SignatureCardException, InterruptedException { CardChannel channel = getCardChannel(); try { - unblockPINLoop(channel, pinSpec, pukProvider); + unblockPINLoop(channel, pinInfo, pukProvider); } catch (CardException e) { log.info("Failed to activate PIN.", e); throw new SignatureCardException("Failed to activate PIN.", e); @@ -520,7 +508,7 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu public void reset() throws SignatureCardException { try { super.reset(); - log.debug("select MF (e-card workaround)"); + log.debug("Select MF (e-card workaround)."); CardChannel channel = getCardChannel(); ResponseAPDU resp = channel.transmit(new CommandAPDU(0x00, 0xA4, 0x00, 0x0C)); if (resp.getSW() != 0x9000) { @@ -533,41 +521,39 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu } /* (non-Javadoc) - * @see at.gv.egiz.smcc.PINMgmtSignatureCard#getPINSpecs() + * @see at.gv.egiz.smcc.PINMgmtSignatureCard#getPinInfos() */ @Override - public List<PINSpec> getPINSpecs() { - return Arrays.asList(new PINSpec[] {CARD_PIN_SPEC, SS_PIN_SPEC}); - } + public PinInfo[] getPinInfos() throws SignatureCardException { + + if (version >= 1.2) { + //check if card is activated + getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR); + } + + PinInfo[] pinInfos = new PinInfo[] {cardPinInfo, ssPinInfo}; - /* (non-Javadoc) - * @see at.gv.egiz.smcc.PINMgmtSignatureCard#getPINStatus(at.gv.egiz.smcc.PINSpec) - */ - @Override - public PIN_STATE getPINState(PINSpec pinSpec) throws SignatureCardException { - CardChannel channel = getCardChannel(); - - try { - if (pinSpec.getContextAID() != null) { - // SELECT AID - execSELECT_AID(channel, pinSpec.getContextAID()); + for (PinInfo pinInfo : pinInfos) { + if (pinInfo.getState() == PinInfo.STATE.UNKNOWN ) { + try { + log.debug("Query pin status for {}.", pinInfo.getLocalizedName()); + if (pinInfo.getContextAID() != null) { + execSELECT_AID(channel, pinInfo.getContextAID()); + } + verifyPIN(channel, pinInfo, null, 0); + } catch (Exception e) { + log.trace("Failed to execute command.", e); + // status already set by verifyPIN + } + } else if (log.isTraceEnabled()) { + log.trace("assume pin status {} to be up to date", pinInfo.getState()); } - verifyPIN(channel, pinSpec, null, 0); - return PIN_STATE.ACTIV; - } catch (InterruptedException e) { - return PIN_STATE.UNKNOWN; - } catch (LockedException e) { - return PIN_STATE.BLOCKED; - } catch (NotActivatedException e) { - return PIN_STATE.NOT_ACTIV; - } catch (CardException e) { - log.error("Failed to get PIN status.", e); - throw new SignatureCardException("Failed to get PIN status.", e); } - + return pinInfos; } + @Override public String toString() { return "e-card"; } @@ -576,110 +562,121 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu // PROTECTED METHODS (assume exclusive card access) //////////////////////////////////////////////////////////////////////// - protected void verifyPINLoop(CardChannel channel, PINSpec spec, PINGUI provider) + protected void verifyPINLoop(CardChannel channel, PinInfo pinInfo, PINGUI provider) throws LockedException, NotActivatedException, SignatureCardException, InterruptedException, CardException { - int retries = verifyPIN(channel, spec, null, -1); + int retries = verifyPIN(channel, pinInfo, null, -1); do { - retries = verifyPIN(channel, spec, provider, retries); + retries = verifyPIN(channel, pinInfo, provider, retries); } while (retries > 0); } - protected void changePINLoop(CardChannel channel, PINSpec spec, ModifyPINGUI provider) + protected void changePINLoop(CardChannel channel, PinInfo pinInfo, ModifyPINGUI provider) throws LockedException, NotActivatedException, SignatureCardException, InterruptedException, CardException { - int retries = verifyPIN(channel, spec, null, -1); + int retries = verifyPIN(channel, pinInfo, null, -1); do { - retries = changePIN(channel, spec, provider, retries); + retries = changePIN(channel, pinInfo, provider, retries); } while (retries > 0); } - protected void unblockPINLoop(CardChannel channel, PINSpec spec, ModifyPINGUI provider) + protected void unblockPINLoop(CardChannel channel, PinInfo pinInfo, ModifyPINGUI provider) throws LockedException, NotActivatedException, SignatureCardException, InterruptedException, CardException { //TODO get PUK retry counter from EF FID 0036 in MF int retries = -1; do { - retries = unblockPIN(channel, spec, provider, retries); + retries = unblockPIN(channel, pinInfo, provider, retries); } while (retries > 0); } - protected int verifyPIN(CardChannel channel, PINSpec pinSpec, + protected int verifyPIN(CardChannel channel, PinInfo pinInfo, PINGUI provider, int retries) throws SignatureCardException, LockedException, NotActivatedException, InterruptedException, CardException { VerifyAPDUSpec apduSpec = new VerifyAPDUSpec( new byte[] { - (byte) 0x00, (byte) 0x20, (byte) 0x00, pinSpec.getKID(), (byte) 0x08, + (byte) 0x00, (byte) 0x20, (byte) 0x00, pinInfo.getKID(), (byte) 0x08, (byte) 0x20, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff }, 1, VerifyAPDUSpec.PIN_FORMAT_BCD, 7, 4, 4); ResponseAPDU resp; if (provider != null) { - resp = reader.verify(channel, apduSpec, provider, pinSpec, retries); + resp = reader.verify(channel, apduSpec, provider, pinInfo, retries); } else { - resp = channel.transmit(new CommandAPDU(0x00, 0x20, 0x00, pinSpec.getKID())); + resp = channel.transmit(new CommandAPDU(0x00, 0x20, 0x00, pinInfo.getKID())); } if (resp.getSW() == 0x9000) { + pinInfo.setActive(pinInfo.maxRetries); return -1; } else if (resp.getSW() == 0x6983 || resp.getSW() == 0x63c0) { // authentication method blocked (0x63c0 returned by 'short' VERIFY) + pinInfo.setBlocked(); throw new LockedException(); } else if (resp.getSW() == 0x6984 || resp.getSW() == 0x6985) { // reference data not usable; conditions of use not satisfied + pinInfo.setNotActive(); throw new NotActivatedException(); } else if (resp.getSW() >> 4 == 0x63c) { + pinInfo.setActive(0x0f & resp.getSW()); return 0x0f & resp.getSW(); } else if (version >= 1.2 && resp.getSW() == 0x6400) { String msg = "VERIFY failed, card not activated. SW=0x6400"; log.error(msg); + pinInfo.setNotActive(); throw new SignatureCardException(msg); } else { String msg = "VERIFY failed. SW=" + Integer.toHexString(resp.getSW()); log.error(msg); + pinInfo.setUnknown(); throw new SignatureCardException(msg); } } - protected int changePIN(CardChannel channel, PINSpec pinSpec, + protected int changePIN(CardChannel channel, PinInfo pinInfo, ModifyPINGUI pinProvider, int retries) throws CancelledException, InterruptedException, CardException, SignatureCardException { ChangeReferenceDataAPDUSpec apduSpec = new ChangeReferenceDataAPDUSpec( new byte[] { - (byte) 0x00, (byte) 0x24, (byte) 0x00, pinSpec.getKID(), (byte) 0x10, + (byte) 0x00, (byte) 0x24, (byte) 0x00, pinInfo.getKID(), (byte) 0x10, (byte) 0x20, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x20, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff }, 1, VerifyAPDUSpec.PIN_FORMAT_BCD, 7, 4, 4, 8); - ResponseAPDU resp = reader.modify(channel, apduSpec, pinProvider, pinSpec, retries); + ResponseAPDU resp = reader.modify(channel, apduSpec, pinProvider, pinInfo, retries); if (resp.getSW() == 0x9000) { + pinInfo.setActive(pinInfo.maxRetries); return -1; } else if (resp.getSW() == 0x6983) { // authentication method blocked + pinInfo.setBlocked(); throw new LockedException(); } else if (resp.getSW() == 0x6984) { + pinInfo.setNotActive(); throw new NotActivatedException(); } else if (resp.getSW() >> 4 == 0x63c) { + pinInfo.setActive(0x0f & resp.getSW()); return 0x0f & resp.getSW(); } else { String msg = "CHANGE REFERENCE DATA failed. SW=" + Integer.toHexString(resp.getSW()); log.error(msg); + pinInfo.setUnknown(); throw new SignatureCardException(msg); } } - protected int activatePIN(CardChannel channel, PINSpec pinSpec, + protected int activatePIN(CardChannel channel, PinInfo pinInfo, ModifyPINGUI provider) throws SignatureCardException, InterruptedException, CardException { @@ -687,35 +684,37 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu if (version < 1.2) { NewReferenceDataAPDUSpec apduSpec = new NewReferenceDataAPDUSpec( new byte[] { - (byte) 0x00, (byte) 0x24, (byte) 0x01, pinSpec.getKID(), (byte) 0x08, + (byte) 0x00, (byte) 0x24, (byte) 0x01, pinInfo.getKID(), (byte) 0x08, (byte) 0x20, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff }, 1, VerifyAPDUSpec.PIN_FORMAT_BCD, 7, 4, 4); - resp = reader.modify(channel, apduSpec, provider, pinSpec); + resp = reader.modify(channel, apduSpec, provider, pinInfo); } else { NewReferenceDataAPDUSpec apduSpec = new NewReferenceDataAPDUSpec( new byte[] { - (byte) 0x00, (byte) 0x24, (byte) 0x00, pinSpec.getKID(), (byte) 0x10, + (byte) 0x00, (byte) 0x24, (byte) 0x00, pinInfo.getKID(), (byte) 0x10, (byte) 0x26, (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x20, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff }, 1, VerifyAPDUSpec.PIN_FORMAT_BCD, 7, 4, 4); apduSpec.setPinInsertionOffsetNew(8); - resp = reader.modify(channel, apduSpec, provider, pinSpec); + resp = reader.modify(channel, apduSpec, provider, pinInfo); } if (resp.getSW() == 0x9000) { + pinInfo.setActive(pinInfo.maxRetries); return -1; } else { String msg = "CHANGE REFERENCE DATA failed. SW=" + Integer.toHexString(resp.getSW()); log.error(msg); + pinInfo.setUnknown(); throw new SignatureCardException(msg); } } - protected int unblockPIN(CardChannel channel, PINSpec pinSpec, + protected int unblockPIN(CardChannel channel, PinInfo pinInfo, ModifyPINGUI provider, int retries) throws SignatureCardException, InterruptedException, CardException { @@ -726,27 +725,32 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu ResetRetryCounterAPDUSpec apduSpec = new ResetRetryCounterAPDUSpec( new byte[] { - (byte) 0x00, (byte) 0x2c, (byte) 0x00, pinSpec.getKID(), (byte) 0x10, + (byte) 0x00, (byte) 0x2c, (byte) 0x00, pinInfo.getKID(), (byte) 0x10, (byte) 0x20, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x20, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff }, 1, VerifyAPDUSpec.PIN_FORMAT_BCD, 7, 4, 4, 8); - ResponseAPDU resp = reader.modify(channel, apduSpec, provider, pinSpec, retries); + ResponseAPDU resp = reader.modify(channel, apduSpec, provider, pinInfo, retries); if (resp.getSW() == 0x9000) { + pinInfo.setActive(pinInfo.maxRetries); return -1; } else if (resp.getSW() == 0x6983) { // PUK blocked throw new LockedException(); } else if (resp.getSW() == 0x6984) { + // PIN not active + pinInfo.setNotActive(); throw new NotActivatedException(); } else if (resp.getSW() >> 4 == 0x63c) { + // wrong PUK, return PUK retries return 0x0f & resp.getSW(); } else { String msg = "RESET RETRY COUNTER failed. SW=" + Integer.toHexString(resp.getSW()); log.error(msg); + pinInfo.setUnknown(); throw new SignatureCardException(msg); } } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java b/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java index 73c7faa8..3318ab0f 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java @@ -42,8 +42,8 @@ import java.util.Locale; import javax.smartcardio.Card; import javax.smartcardio.CardTerminal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.smcc.pin.gui.PINGUI; @@ -71,7 +71,7 @@ public class SWCard implements SignatureCard { private static String swCardDir; - private static Log log = LogFactory.getLog(SWCard.class); + private final Logger log = LoggerFactory.getLogger(SWCard.class); private KeyStore certifiedKeyStore; @@ -170,7 +170,7 @@ public class SWCard implements SignatureCard { // try to load KeyStore file String fileName = getFileName(keyStoreFileName); - log.info("Trying to load KeyStore from file '" + fileName + "'."); + log.info("Trying to load KeyStore from file '{}'.", fileName); FileInputStream keyStoreFile; try { @@ -313,7 +313,7 @@ public class SWCard implements SignatureCard { if (password == null) { - PINSpec pinSpec = new PINSpec(0, -1, ".", "KeyStore-Password", (byte) 0x01, null); + PinInfo pinSpec = new PinInfo(0, -1, ".", "at/gv/egiz/smcc/SWCard", "sw.pin", (byte) 0x01, null, PinInfo.UNKNOWN_RETRIES); password = provider.providePIN(pinSpec, -1); @@ -331,7 +331,7 @@ public class SWCard implements SignatureCard { for (Enumeration<String> aliases = keyStore.aliases(); aliases .hasMoreElements() && privateKey == null;) { String alias = aliases.nextElement(); - log.debug("Found alias '" + alias + "' in keystore"); + log.debug("Found alias '{}' in keystore.", alias); if (keyStore.isKeyEntry(alias)) { Key key = null; while (key == null) { diff --git a/smcc/src/main/java/at/gv/egiz/smcc/SignatureCardFactory.java b/smcc/src/main/java/at/gv/egiz/smcc/SignatureCardFactory.java index 9165a7d8..2cd0cc8a 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/SignatureCardFactory.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/SignatureCardFactory.java @@ -25,8 +25,8 @@ import javax.smartcardio.ATR; import javax.smartcardio.Card; import javax.smartcardio.CardTerminal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A factory for creating {@link SignatureCard}s from {@link Card}s. @@ -127,7 +127,7 @@ public class SignatureCardFactory { /** * Logging facility. */ - private static Log log = LogFactory.getLog(SignatureCardFactory.class); + private final Logger log = LoggerFactory.getLogger(SignatureCardFactory.class); /** * The instance to be returned by {@link #getInstance()}. @@ -320,7 +320,62 @@ public class SignatureCardFactory { (byte) 0xff, (byte) 0xff, (byte) 0xff }, "at.gv.egiz.smcc.ITCard")); + // EstEID cards return different ATRs depending on the reader device + supportedCards.add(new SupportedCard( + // ATR + // (3B:5E:11:FF:45:73:74:45:49:44:20:76:65:72:20:31:2E:30) + new byte[] { (byte) 0x3b, (byte) 0x5e, (byte) 0x11, + (byte) 0xff, (byte) 0x45, (byte) 0x73, (byte) 0x74, + (byte) 0x45, (byte) 0x49, (byte) 0x44, (byte) 0x20, + (byte) 0x76, (byte) 0x65, (byte) 0x72, (byte) 0x20, + (byte) 0x31, (byte) 0x2e, (byte) 0x30 }, + // mask + // (ff:ff:ff:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:00:00:00:00) + new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff }, + "at.gv.egiz.smcc.EstEIDCard")); + + // EstEID cards return different ATRs depending on the reader device + supportedCards.add(new SupportedCard( + // ATR + // (3B:DE:18:FF:C0:80:B1:FE:45:1F:03:45:73:74:45:49:44:20:76:65:72:20:31:2E:30:2B) + new byte[] { (byte) 0x3b, (byte) 0xde, (byte) 0x18, + (byte) 0xff, (byte) 0xc0, (byte) 0x80, (byte) 0xb1, + (byte) 0xfe, (byte) 0x45, (byte) 0x1f, (byte) 0x03, + (byte) 0x45, (byte) 0x73, (byte) 0x74, (byte) 0x45, + (byte) 0x49, (byte) 0x44, (byte) 0x20, (byte) 0x76, + (byte) 0x65, (byte) 0x72, (byte) 0x20, (byte) 0x31, + (byte) 0x2e, (byte) 0x30, (byte) 0x2b }, + // mask + // (ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:00:00:00:00) + new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff }, + "at.gv.egiz.smcc.EstEIDCard")); + supportedCards.add(new SupportedCard( + // ATR (3B:7D:95:00:00:80:31:80:65:B0:83:11:C0:A9:83:00:90:00 - + // 00:00:00:00) + new byte[] { (byte) 0x3b, (byte) 0x7d, (byte) 0x95, + (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0x31, + (byte) 0x80, (byte) 0x65, (byte) 0xb0, (byte) 0x83, + (byte) 0x11, (byte) 0xc0, (byte) 0xa9, (byte) 0x83, + (byte) 0x00, (byte) 0x90, (byte) 0x00 }, + // mask + // (ff:ff:ff:00:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:00:00:00:00) + new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0x00, (byte) 0x00, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, + (byte) 0x00, (byte) 0xff, (byte) 0x00 }, + "at.gv.egiz.smcc.PtEidCard")); } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/ModifyPINGUI.java b/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/ModifyPINGUI.java index 00dc2d0e..2e0de76b 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/ModifyPINGUI.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/ModifyPINGUI.java @@ -17,17 +17,17 @@ package at.gv.egiz.smcc.pin.gui; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; public interface ModifyPINGUI extends ModifyPINProvider { - void modifyPINDirect(PINSpec spec, int retries) throws CancelledException, InterruptedException; + void modifyPINDirect(PinInfo pinInfo, int retries) throws CancelledException, InterruptedException; void finishDirect(); - void enterCurrentPIN(PINSpec spec, int retries); - void enterNewPIN(PINSpec spec); - void confirmNewPIN(PINSpec spec); + void enterCurrentPIN(PinInfo pinInfo, int retries); + void enterNewPIN(PinInfo pinInfo); + void confirmNewPIN(PinInfo pinInfo); void validKeyPressed(); void correctionButtonPressed(); void allKeysCleared(); diff --git a/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/ModifyPINProvider.java b/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/ModifyPINProvider.java index 36f0097d..7933214b 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/ModifyPINProvider.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/ModifyPINProvider.java @@ -17,7 +17,7 @@ package at.gv.egiz.smcc.pin.gui; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; /** @@ -39,10 +39,10 @@ public interface ModifyPINProvider { * @throws at.gv.egiz.smcc.CancelledException if cancelled by user * @throws java.lang.InterruptedException */ - public char[] provideCurrentPIN(PINSpec spec, int retries) + public char[] provideCurrentPIN(PinInfo pinInfo, int retries) throws CancelledException, InterruptedException; - public char[] provideNewPIN(PINSpec spec) + public char[] provideNewPIN(PinInfo pinInfo) throws CancelledException, InterruptedException; } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/PINGUI.java b/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/PINGUI.java index 5199977b..92b9f14d 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/PINGUI.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/PINGUI.java @@ -17,7 +17,7 @@ package at.gv.egiz.smcc.pin.gui; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; /** @@ -27,13 +27,13 @@ import at.gv.egiz.smcc.PINSpec; */ public interface PINGUI extends PINProvider { - void enterPINDirect(PINSpec spec, int retries) + void enterPINDirect(PinInfo pinInfo, int retries) throws CancelledException, InterruptedException; /** * @throws CancelledException, InterruptedException if signature-data dialog is interrupted or cancelled */ - void enterPIN(PINSpec spec, int retries) + void enterPIN(PinInfo pinInfo, int retries) throws CancelledException, InterruptedException; void validKeyPressed(); void correctionButtonPressed(); diff --git a/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/PINProvider.java b/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/PINProvider.java index 7443ee30..e8641797 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/PINProvider.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/pin/gui/PINProvider.java @@ -17,7 +17,7 @@ package at.gv.egiz.smcc.pin.gui; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; /** @@ -45,7 +45,7 @@ public interface PINProvider { * @throws at.gv.egiz.smcc.CancelledException * @throws java.lang.InterruptedException */ - char[] providePIN(PINSpec pinSpec, int retries) + char[] providePIN(PinInfo pinSpec, int retries) throws CancelledException, InterruptedException; } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/reader/CardReader.java b/smcc/src/main/java/at/gv/egiz/smcc/reader/CardReader.java index a1246dd6..6c5e939b 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/reader/CardReader.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/reader/CardReader.java @@ -23,7 +23,7 @@ import javax.smartcardio.ResponseAPDU; import at.gv.egiz.smcc.CancelledException; import at.gv.egiz.smcc.ChangeReferenceDataAPDUSpec; import at.gv.egiz.smcc.NewReferenceDataAPDUSpec; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.smcc.ResetRetryCounterAPDUSpec; import at.gv.egiz.smcc.SignatureCardException; import at.gv.egiz.smcc.VerifyAPDUSpec; @@ -38,7 +38,7 @@ import javax.smartcardio.Card; public interface CardReader { - String[] FEATURES = new String[]{"NO_FEATURE", + static final String[] FEATURES = new String[]{"NO_FEATURE", "FEATURE_VERIFY_PIN_START", "FEATURE_VERIFY_PIN_FINISH", "FEATURE_MODIFY_PIN_START", @@ -57,16 +57,16 @@ public interface CardReader { "FEATURE_GET_KEY", "FEATURE_IFD_DISPLAY_PROPERTIES"}; - Byte FEATURE_VERIFY_PIN_START = new Byte((byte) 0x01); - Byte FEATURE_VERIFY_PIN_FINISH = new Byte((byte) 0x02); - Byte FEATURE_MODIFY_PIN_START = new Byte((byte) 0x03); - Byte FEATURE_MODIFY_PIN_FINISH = new Byte((byte) 0x04); - Byte FEATURE_GET_KEY_PRESSED = new Byte((byte) 0x05); - Byte FEATURE_VERIFY_PIN_DIRECT = new Byte((byte) 0x06); - Byte FEATURE_MODIFY_PIN_DIRECT = new Byte((byte) 0x07); - Byte FEATURE_MCT_READER_DIRECT = new Byte((byte) 0x08); - Byte FEATURE_MCT_UNIVERSAL = new Byte((byte) 0x09); - Byte FEATURE_IFD_PIN_PROPERTIES = new Byte((byte) 0x0a); + static final Byte FEATURE_VERIFY_PIN_START = new Byte((byte) 0x01); + static final Byte FEATURE_VERIFY_PIN_FINISH = new Byte((byte) 0x02); + static final Byte FEATURE_MODIFY_PIN_START = new Byte((byte) 0x03); + static final Byte FEATURE_MODIFY_PIN_FINISH = new Byte((byte) 0x04); + static final Byte FEATURE_GET_KEY_PRESSED = new Byte((byte) 0x05); + static final Byte FEATURE_VERIFY_PIN_DIRECT = new Byte((byte) 0x06); + static final Byte FEATURE_MODIFY_PIN_DIRECT = new Byte((byte) 0x07); + static final Byte FEATURE_MCT_READER_DIRECT = new Byte((byte) 0x08); + static final Byte FEATURE_MCT_UNIVERSAL = new Byte((byte) 0x09); + static final Byte FEATURE_IFD_PIN_PROPERTIES = new Byte((byte) 0x0a); //TODO continue list @@ -75,18 +75,18 @@ public interface CardReader { boolean hasFeature(Byte feature); ResponseAPDU verify(CardChannel channel, VerifyAPDUSpec apduSpec, - PINGUI pinGUI, PINSpec pinSpec, int retries) + PINGUI pinGUI, PinInfo pinInfo, int retries) throws CancelledException, InterruptedException, CardException, SignatureCardException; ResponseAPDU modify(CardChannel channel, ChangeReferenceDataAPDUSpec apduSpec, - ModifyPINGUI pinGUI, PINSpec pinSpec, int retries) + ModifyPINGUI pinGUI, PinInfo pinInfo, int retries) throws CancelledException, InterruptedException, CardException, SignatureCardException; ResponseAPDU modify(CardChannel channel, NewReferenceDataAPDUSpec apduSpec, - ModifyPINGUI pinGUI, PINSpec pinSpec) + ModifyPINGUI pinGUI, PinInfo pinInfo) throws CancelledException, InterruptedException, CardException, SignatureCardException; ResponseAPDU modify(CardChannel channel, ResetRetryCounterAPDUSpec apduSpec, - ModifyPINGUI pinGUI, PINSpec pinSpec, int retries) + ModifyPINGUI pinGUI, PinInfo pinInfo, int retries) throws CancelledException, InterruptedException, CardException, SignatureCardException; } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/reader/DefaultCardReader.java b/smcc/src/main/java/at/gv/egiz/smcc/reader/DefaultCardReader.java index 03a794fe..cc25a63c 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/reader/DefaultCardReader.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/reader/DefaultCardReader.java @@ -23,12 +23,12 @@ import javax.smartcardio.CardException; import javax.smartcardio.CardTerminal; import javax.smartcardio.ResponseAPDU; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.smcc.ChangeReferenceDataAPDUSpec; import at.gv.egiz.smcc.NewReferenceDataAPDUSpec; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.smcc.ResetRetryCounterAPDUSpec; import at.gv.egiz.smcc.SignatureCardException; import at.gv.egiz.smcc.VerifyAPDUSpec; @@ -42,7 +42,7 @@ import at.gv.egiz.smcc.util.ISO7816Utils; */ public class DefaultCardReader implements CardReader { - protected final static Log log = LogFactory.getLog(DefaultCardReader.class); + private final Logger log = LoggerFactory.getLogger(DefaultCardReader.class); protected CardTerminal ct; protected String name; @@ -57,7 +57,7 @@ public class DefaultCardReader implements CardReader { @Override public ResponseAPDU verify(CardChannel channel, VerifyAPDUSpec apduSpec, - PINGUI pinGUI, PINSpec pinSpec, int retries) + PINGUI pinGUI, PinInfo pinSpec, int retries) throws SignatureCardException, CardException, InterruptedException { log.debug("VERIFY"); @@ -66,7 +66,7 @@ public class DefaultCardReader implements CardReader { @Override public ResponseAPDU modify(CardChannel channel, ChangeReferenceDataAPDUSpec apduSpec, - ModifyPINGUI pinGUI, PINSpec pinSpec, int retries) + ModifyPINGUI pinGUI, PinInfo pinSpec, int retries) throws SignatureCardException, CardException, InterruptedException { log.debug("MODIFY (CHANGE_REFERENCE_DATA)"); char[] oldPIN = pinGUI.provideCurrentPIN(pinSpec, retries); @@ -76,7 +76,7 @@ public class DefaultCardReader implements CardReader { @Override public ResponseAPDU modify(CardChannel channel, NewReferenceDataAPDUSpec apduSpec, - ModifyPINGUI pinGUI, PINSpec pinSpec) + ModifyPINGUI pinGUI, PinInfo pinSpec) throws SignatureCardException, CardException, InterruptedException { log.debug("MODIFY (NEW_REFERENCE_DATA)"); char[] newPIN = pinGUI.provideNewPIN(pinSpec); @@ -85,7 +85,7 @@ public class DefaultCardReader implements CardReader { @Override public ResponseAPDU modify(CardChannel channel, ResetRetryCounterAPDUSpec apduSpec, - ModifyPINGUI pinGUI, PINSpec pinSpec, int retries) + ModifyPINGUI pinGUI, PinInfo pinSpec, int retries) throws InterruptedException, CardException, SignatureCardException { log.debug("MODIFY (RESET_RETRY_COUNTER)"); //TODO diff --git a/smcc/src/main/java/at/gv/egiz/smcc/reader/PinpadCardReader.java b/smcc/src/main/java/at/gv/egiz/smcc/reader/PinpadCardReader.java index c2537af8..3584af53 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/reader/PinpadCardReader.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/reader/PinpadCardReader.java @@ -26,8 +26,8 @@ import javax.smartcardio.CardException; import javax.smartcardio.CardTerminal; import javax.smartcardio.ResponseAPDU; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.smcc.CancelledException; import at.gv.egiz.smcc.ChangeReferenceDataAPDUSpec; @@ -35,7 +35,7 @@ import at.gv.egiz.smcc.NewReferenceDataAPDUSpec; import at.gv.egiz.smcc.PINConfirmationException; import at.gv.egiz.smcc.PINFormatException; import at.gv.egiz.smcc.PINOperationAbortedException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.smcc.ResetRetryCounterAPDUSpec; import at.gv.egiz.smcc.SignatureCardException; import at.gv.egiz.smcc.TimeoutException; @@ -52,13 +52,13 @@ public class PinpadCardReader extends DefaultCardReader { public static final int PIN_ENTRY_POLLING_INTERVAL = 10; - protected final static Log log = LogFactory.getLog(PinpadCardReader.class); + private final Logger log = LoggerFactory.getLogger(PinpadCardReader.class); protected byte bEntryValidationCondition = 0x02; // validation key pressed protected byte bTimeOut = 0x3c; // 60sec (= max on ReinerSCT) protected byte bTimeOut2 = 0x00; // default (attention with SCM) - protected byte wPINMaxExtraDigitH = 0x00; // min pin length zero digits - protected byte wPINMaxExtraDigitL = 0x0c; // max pin length 12 digits + protected byte wPINMaxExtraDigitMin = 0x00; // min pin length zero digits + protected byte wPINMaxExtraDigitMax = 0x0c; // max pin length 12 digits /** * supported features and respective control codes @@ -99,21 +99,21 @@ public class PinpadCardReader extends DefaultCardReader { //Snow Leopard: Reiner-SCT cyberJack pinpad(a) 00 00 //display: REINER SCT CyberJack 00 00 if(name.startsWith("gemplus gempc pinpad") || name.startsWith("gemalto gempc pinpad")) { - log.debug("setting custom wPINMaxExtraDigitH (0x04) for " + name); - wPINMaxExtraDigitH = 0x04; - log.debug("setting custom wPINMaxExtraDigitL (0x08) for " + name); - wPINMaxExtraDigitL = 0x08; + log.trace("Setting custom wPINMaxExtraDigitH (0x04) for {}.", name); + wPINMaxExtraDigitMin = 0x04; + log.trace("Setting custom wPINMaxExtraDigitL (0x08) for {}.", name); + wPINMaxExtraDigitMax = 0x08; } else if (name.startsWith("omnikey cardman 3621")) { - log.debug("setting custom wPINMaxExtraDigitH (0x01) for " + name); - wPINMaxExtraDigitH = 0x01; + log.trace("Setting custom wPINMaxExtraDigitH (0x01) for {}.", name); + wPINMaxExtraDigitMin = 0x01; } else if (name.startsWith("scm spr 532") || name.startsWith("scm microsystems inc. sprx32 usb smart card reader")) { - log.debug("setting custom bTimeOut (0x3c) for " + name); + log.trace("Setting custom bTimeOut (0x3c) for {}.", name); bTimeOut = 0x3c; - log.debug("setting custom bTimeOut2 (0x0f) for " + name); + log.trace("Setting custom bTimeOut2 (0x0f) for {}.", name); bTimeOut2 = 0x0f; } else if (name.startsWith("cherry smartboard xx44")) { - log.debug("setting custom wPINMaxExtraDigitH (0x01) for " + name); - wPINMaxExtraDigitH = 0x01; + log.trace("Setting custom wPINMaxExtraDigitH (0x01) for {}.", name); + wPINMaxExtraDigitMin = 0x01; } } @@ -127,17 +127,17 @@ public class PinpadCardReader extends DefaultCardReader { private void VERIFY_PIN_START(Card icc, byte[] PIN_VERIFY) throws CardException { int ioctl = features.get(FEATURE_VERIFY_PIN_START); if (log.isTraceEnabled()) { - log.trace("VERIFY_PIN_START (" + Integer.toHexString(ioctl) + - ") " + SMCCHelper.toString(PIN_VERIFY)); + log.trace("VERIFY_PIN_START ({}) {}", Integer.toHexString(ioctl), + SMCCHelper.toString(PIN_VERIFY)); } byte[] resp = icc.transmitControlCommand(ioctl, PIN_VERIFY); if (resp != null && resp.length > 0) { if (resp[0] == (byte) 0x57) { - log.error("Invalid parameter in PIN_VERIFY structure"); + log.error("Invalid parameter in PIN_VERIFY structure."); throw new CardException("ERROR_INVALID_PARAMETER"); } else { - log.error("unexpected response to VERIFY_PIN_START: " + - SMCCHelper.toString(resp)); + log.error("Unexpected response to VERIFY_PIN_START: {}.", SMCCHelper + .toString(resp)); throw new CardException("unexpected response to VERIFY_PIN_START: " + SMCCHelper.toString(resp)); } @@ -153,7 +153,7 @@ public class PinpadCardReader extends DefaultCardReader { // } return resp[0]; } - log.error("unexpected response to GET_KEY_PRESSED: " + + log.error("Unexpected response to GET_KEY_PRESSED: {}.", SMCCHelper.toString(resp)); throw new CardException("unexpected response to GET_KEY_PRESSED: " + SMCCHelper.toString(resp)); @@ -162,16 +162,16 @@ public class PinpadCardReader extends DefaultCardReader { private byte[] VERIFY_PIN_FINISH(Card icc) throws CardException { int ioctl = features.get(FEATURE_VERIFY_PIN_FINISH); if (log.isTraceEnabled()) { - log.trace("VERIFY_PIN_FINISH (" + Integer.toHexString(ioctl) + ")"); + log.trace("VERIFY_PIN_FINISH ({})", Integer.toHexString(ioctl)); } byte[] resp = icc.transmitControlCommand(ioctl, new byte[0]); if (resp != null && resp.length == 2) { if (log.isTraceEnabled()) { - log.trace("response " + SMCCHelper.toString(resp)); + log.trace("response {}", SMCCHelper.toString(resp)); } return resp; } - log.error("unexpected response to VERIFY_PIN_FINISH: " + + log.error("Unexpected response to VERIFY_PIN_FINISH: {}.", SMCCHelper.toString(resp)); throw new CardException("unexpected response to VERIFY_PIN_FINISH: " + SMCCHelper.toString(resp)); @@ -186,10 +186,10 @@ public class PinpadCardReader extends DefaultCardReader { byte[] resp = icc.transmitControlCommand(ioctl, PIN_MODIFY); if (resp != null && resp.length > 0) { if (resp[0] == (byte) 0x57) { - log.error("Invalid parameter in PIN_MODIFY structure"); + log.error("Invalid parameter in PIN_MODIFY structure."); throw new CardException("ERROR_INVALID_PARAMETER"); } else { - log.error("unexpected response to MODIFY_PIN_START: " + + log.error("Unexpected response to MODIFY_PIN_START: {}.", SMCCHelper.toString(resp)); throw new CardException("unexpected response to MODIFY_PIN_START: " + SMCCHelper.toString(resp)); @@ -200,16 +200,16 @@ public class PinpadCardReader extends DefaultCardReader { private byte[] MODIFY_PIN_FINISH(Card icc) throws CardException { int ioctl = features.get(FEATURE_MODIFY_PIN_FINISH); if (log.isTraceEnabled()) { - log.trace("MODIFY_PIN_FINISH (" + Integer.toHexString(ioctl) + ")"); + log.trace("MODIFY_PIN_FINISH ({})", Integer.toHexString(ioctl)); } byte[] resp = icc.transmitControlCommand(ioctl, new byte[0]); if (resp != null && resp.length == 2) { if (log.isTraceEnabled()) { - log.trace("response " + SMCCHelper.toString(resp)); + log.trace("response {}", SMCCHelper.toString(resp)); } return resp; } - log.error("unexpected response to MODIFY_PIN_FINISH: " + + log.error("Unexpected response to MODIFY_PIN_FINISH: {}", SMCCHelper.toString(resp)); throw new CardException("unexpected response to MODIFY_PIN_FINISH: " + SMCCHelper.toString(resp)); @@ -218,12 +218,12 @@ public class PinpadCardReader extends DefaultCardReader { private byte[] VERIFY_PIN_DIRECT(Card icc, byte[] PIN_VERIFY) throws CardException { int ioctl = features.get(FEATURE_VERIFY_PIN_DIRECT); if (log.isTraceEnabled()) { - log.trace("VERIFY_PIN_DIRECT (" + Integer.toHexString(ioctl) + - ") " + SMCCHelper.toString(PIN_VERIFY)); + log.trace("VERIFY_PIN_DIRECT ({}) {}", Integer.toHexString(ioctl), + SMCCHelper.toString(PIN_VERIFY)); } byte[] resp = icc.transmitControlCommand(ioctl, PIN_VERIFY); if (log.isTraceEnabled()) { - log.trace("response " + SMCCHelper.toString(resp)); + log.trace("response {}", SMCCHelper.toString(resp)); } return resp; } @@ -233,7 +233,7 @@ public class PinpadCardReader extends DefaultCardReader { // pinGUI.enterPIN(pinSpec, retries); - log.debug("VERIFY_PIN_START [" + FEATURES[FEATURE_VERIFY_PIN_START] + "]"); + log.debug("VERIFY_PIN_START [{}]", FEATURES[FEATURE_VERIFY_PIN_START]); VERIFY_PIN_START(icc, PIN_VERIFY); byte resp; @@ -248,29 +248,29 @@ public class PinpadCardReader extends DefaultCardReader { } } } else if (resp == (byte) 0x0d) { - log.debug("GET_KEY_PRESSED: 0x0d (user confirmed)"); + log.trace("GET_KEY_PRESSED: 0x0d (user confirmed)"); break; } else if (resp == (byte) 0x2b) { log.trace("GET_KEY_PRESSED: 0x2b (user entered valid key 0-9)"); pinGUI.validKeyPressed(); } else if (resp == (byte) 0x1b) { - log.debug("GET_KEY_PRESSED: 0x1b (user cancelled VERIFY_PIN via cancel button)"); + log.trace("GET_KEY_PRESSED: 0x1b (user cancelled VERIFY_PIN via cancel button)"); break; // returns 0x6401 } else if (resp == (byte) 0x08) { - log.debug("GET_KEY_PRESSED: 0x08 (user pressed correction/backspace button)"); + log.trace("GET_KEY_PRESSED: 0x08 (user pressed correction/backspace button)"); pinGUI.correctionButtonPressed(); } else if (resp == (byte) 0x0e) { - log.debug("GET_KEY_PRESSED: 0x0e (timeout occured)"); + log.trace("GET_KEY_PRESSED: 0x0e (timeout occured)"); break; // return 0x6400 } else if (resp == (byte) 0x40) { - log.debug("GET_KEY_PRESSED: 0x40 (PIN_Operation_Aborted)"); + log.trace("GET_KEY_PRESSED: 0x40 (PIN_Operation_Aborted)"); throw new PINOperationAbortedException("PIN_Operation_Aborted (0x40)"); } else if (resp == (byte) 0x0a) { - log.debug("GET_KEY_PRESSED: 0x0a (all keys cleared"); + log.trace("GET_KEY_PRESSED: 0x0a (all keys cleared"); pinGUI.allKeysCleared(); } else { - log.error("unexpected response to GET_KEY_PRESSED: " + - Integer.toHexString(resp)); + log.error("Unexpected response to GET_KEY_PRESSED: {}.", Integer + .toHexString(resp)); throw new CardException("unexpected response to GET_KEY_PRESSED: " + Integer.toHexString(resp)); } @@ -283,7 +283,7 @@ public class PinpadCardReader extends DefaultCardReader { * does not display the first pin dialog (enterCurrentPIN or enterNewPIN, depends on bConfirmPIN), * since this is easier to do in calling modify() */ - private byte[] modifyPin(Card icc, byte[] PIN_MODIFY, ModifyPINGUI pinGUI, PINSpec pINSpec) + private byte[] modifyPin(Card icc, byte[] PIN_MODIFY, ModifyPINGUI pinGUI, PinInfo pINSpec) throws PINOperationAbortedException, CardException { byte pinConfirmations = (byte) 0x00; //b0: new pin not entered (0) / entered (1) @@ -298,7 +298,7 @@ public class PinpadCardReader extends DefaultCardReader { // pinGUI.enterCurrentPIN(pINSpec, retries); // } - log.debug("MODIFY_PIN_START [" + FEATURES[FEATURE_MODIFY_PIN_START] + "]"); + log.debug("MODIFY_PIN_START [{}]", FEATURES[FEATURE_MODIFY_PIN_START]); MODIFY_PIN_START(icc, PIN_MODIFY); byte resp; @@ -309,13 +309,13 @@ public class PinpadCardReader extends DefaultCardReader { try { wait(PIN_ENTRY_POLLING_INTERVAL); } catch (InterruptedException ex) { - log.error("interrupted in MODIFY_PIN"); + log.error("Interrupted in MODIFY_PIN"); } } } else if (resp == (byte) 0x0d) { if (log.isTraceEnabled()) { - log.trace("requested pin confirmations: 0b" + Integer.toBinaryString(bConfirmPIN & 0xff)); - log.trace("performed pin confirmations: 0b" + Integer.toBinaryString(pinConfirmations & 0xff)); + log.trace("requested pin confirmations: 0b{}", Integer.toBinaryString(bConfirmPIN & 0xff)); + log.trace("performed pin confirmations: 0b{}", Integer.toBinaryString(pinConfirmations & 0xff)); } log.debug("GET_KEY_PRESSED: 0x0d (user confirmed)"); if (pinConfirmations == bConfirmPIN) { @@ -337,23 +337,23 @@ public class PinpadCardReader extends DefaultCardReader { log.trace("GET_KEY_PRESSED: 0x2b (user entered valid key 0-9)"); pinGUI.validKeyPressed(); } else if (resp == (byte) 0x1b) { - log.debug("GET_KEY_PRESSED: 0x1b (user cancelled VERIFY_PIN via cancel button)"); + log.trace("GET_KEY_PRESSED: 0x1b (user cancelled VERIFY_PIN via cancel button)"); break; // returns 0x6401 } else if (resp == (byte) 0x08) { - log.debug("GET_KEY_PRESSED: 0x08 (user pressed correction/backspace button)"); + log.trace("GET_KEY_PRESSED: 0x08 (user pressed correction/backspace button)"); pinGUI.correctionButtonPressed(); } else if (resp == (byte) 0x0e) { - log.debug("GET_KEY_PRESSED: 0x0e (timeout occured)"); + log.trace("GET_KEY_PRESSED: 0x0e (timeout occured)"); break; // return 0x6400 } else if (resp == (byte) 0x40) { - log.debug("GET_KEY_PRESSED: 0x40 (PIN_Operation_Aborted)"); + log.trace("GET_KEY_PRESSED: 0x40 (PIN_Operation_Aborted)"); throw new PINOperationAbortedException("PIN_Operation_Aborted (0x40)"); } else if (resp == (byte) 0x0a) { - log.debug("GET_KEY_PRESSED: 0x0a (all keys cleared"); + log.trace("GET_KEY_PRESSED: 0x0a (all keys cleared"); pinGUI.allKeysCleared(); } else { - log.error("unexpected response to GET_KEY_PRESSED: " + - Integer.toHexString(resp)); + log.error("Unexpected response to GET_KEY_PRESSED: {}.", Integer + .toHexString(resp)); throw new CardException("unexpected response to GET_KEY_PRESSED: " + Integer.toHexString(resp)); } @@ -367,17 +367,17 @@ public class PinpadCardReader extends DefaultCardReader { private byte[] MODIFY_PIN_DIRECT(Card icc, byte[] PIN_MODIFY) throws CardException { int ioctl = features.get(FEATURE_MODIFY_PIN_DIRECT); if (log.isTraceEnabled()) { - log.trace("MODIFY_PIN_DIRECT (" + Integer.toHexString(ioctl) + - ") " + SMCCHelper.toString(PIN_MODIFY)); + log.trace("MODIFY_PIN_DIRECT ({}) {}", Integer.toHexString(ioctl), + SMCCHelper.toString(PIN_MODIFY)); } byte[] resp = icc.transmitControlCommand(ioctl, PIN_MODIFY); if (log.isTraceEnabled()) { - log.trace("response " + SMCCHelper.toString(resp)); + log.trace("response {}", SMCCHelper.toString(resp)); } return resp; } - protected byte[] createPINModifyStructure(NewReferenceDataAPDUSpec apduSpec, PINSpec pinSpec) { + protected byte[] createPINModifyStructure(NewReferenceDataAPDUSpec apduSpec, PinInfo pinSpec) { ByteArrayOutputStream s = new ByteArrayOutputStream(); // bTimeOut @@ -399,16 +399,17 @@ public class PinpadCardReader extends DefaultCardReader { s.write(0x00); // bInsertionOffsetNew s.write(apduSpec.getPinInsertionOffsetNew()); - // wPINMaxExtraDigit - s.write(Math.min(pinSpec.getMaxLength(), wPINMaxExtraDigitL)); - s.write(Math.max(pinSpec.getMinLength(), wPINMaxExtraDigitH)); + // wPINMaxExtraDigit (little endian) + s.write(Math.min(pinSpec.getMaxLength(), wPINMaxExtraDigitMax)); + s.write(Math.max(pinSpec.getMinLength(), wPINMaxExtraDigitMin)); // bConfirmPIN s.write(0x01); // bEntryValidationCondition s.write(bEntryValidationCondition); // bNumberMessage s.write(0x02); - // wLangId English (United States), see http://www.usb.org/developers/docs/USB_LANGIDs.pdf + // wLangId (little endian) + // English (United States), see http://www.usb.org/developers/docs/USB_LANGIDs.pdf s.write(0x09); s.write(0x04); // bMsgIndex1 @@ -440,7 +441,7 @@ public class PinpadCardReader extends DefaultCardReader { } - protected byte[] createPINModifyStructure(ChangeReferenceDataAPDUSpec apduSpec, PINSpec pinSpec) { + protected byte[] createPINModifyStructure(ChangeReferenceDataAPDUSpec apduSpec, PinInfo pinSpec) { //TODO bInsertionOffsetOld (0x00), bConfirmPIN (0x01), bNumberMessage (0x02), bMsgIndex1/2/3 ByteArrayOutputStream s = new ByteArrayOutputStream(); @@ -464,8 +465,8 @@ public class PinpadCardReader extends DefaultCardReader { // bInsertionOffsetNew s.write(apduSpec.getPinInsertionOffsetNew()); // wPINMaxExtraDigit - s.write(Math.min(pinSpec.getMaxLength(), wPINMaxExtraDigitL)); - s.write(Math.max(pinSpec.getMinLength(), wPINMaxExtraDigitH)); + s.write(Math.min(pinSpec.getMaxLength(), wPINMaxExtraDigitMax)); + s.write(Math.max(pinSpec.getMinLength(), wPINMaxExtraDigitMin)); // bConfirmPIN s.write(0x03); // bEntryValidationCondition @@ -504,7 +505,7 @@ public class PinpadCardReader extends DefaultCardReader { } - protected byte[] createPINVerifyStructure(VerifyAPDUSpec apduSpec, PINSpec pinSpec) { + protected byte[] createPINVerifyStructure(VerifyAPDUSpec apduSpec, PinInfo pinSpec) { ByteArrayOutputStream s = new ByteArrayOutputStream(); // bTimeOut @@ -522,14 +523,14 @@ public class PinpadCardReader extends DefaultCardReader { // bmPINLengthFormat s.write(// system unit = bit (0xF & apduSpec.getPinLengthPos())); - // wPINMaxExtraDigit - s.write(Math.min(pinSpec.getMaxLength(), wPINMaxExtraDigitL)); // max PIN length - s.write(Math.max(pinSpec.getMinLength(), wPINMaxExtraDigitH)); // min PIN length + // wPINMaxExtraDigit (little endian) + s.write(Math.min(pinSpec.getMaxLength(), wPINMaxExtraDigitMax)); // max PIN length + s.write(Math.max(pinSpec.getMinLength(), wPINMaxExtraDigitMin)); // min PIN length // bEntryValidationCondition s.write(bEntryValidationCondition); // bNumberMessage s.write(0x01); - // wLangId + // wLangId (little endian) s.write(0x09); s.write(0x04); // bMsgIndex @@ -558,7 +559,7 @@ public class PinpadCardReader extends DefaultCardReader { @Override public ResponseAPDU verify(CardChannel channel, VerifyAPDUSpec apduSpec, - PINGUI pinGUI, PINSpec pinSpec, int retries) + PINGUI pinGUI, PinInfo pinSpec, int retries) throws SignatureCardException, CardException, InterruptedException { ResponseAPDU resp = null; @@ -571,10 +572,10 @@ public class PinpadCardReader extends DefaultCardReader { resp = new ResponseAPDU(verifyPin(icc, s, pinGUI)); } else if (VERIFY_DIRECT) { pinGUI.enterPINDirect(pinSpec, retries); - log.debug("VERIFY_PIN_DIRECT [" + FEATURES[FEATURE_VERIFY_PIN_DIRECT] + "]"); + log.debug("VERIFY_PIN_DIRECT [{}]", FEATURES[FEATURE_VERIFY_PIN_DIRECT]); resp = new ResponseAPDU(VERIFY_PIN_DIRECT(icc, s)); } else { - log.warn("falling back to default pin-entry"); + log.warn("Falling back to default pin-entry."); return super.verify(channel, apduSpec, pinGUI, pinSpec, retries); } @@ -586,9 +587,9 @@ public class PinpadCardReader extends DefaultCardReader { log.debug("SPE operation was cancelled by the 'Cancel' button."); throw new CancelledException(); case 0x6403: - log.debug("User entered too short or too long PIN " - + "regarding MIN/MAX PIN length."); - throw new PINFormatException(); + log.debug("User entered too short or too long PIN " + + "regarding MIN/MAX PIN length."); + throw new PINFormatException(); case 0x6480: log.debug("SPE operation was aborted by the 'Cancel' operation " + "at the host system."); @@ -601,7 +602,7 @@ public class PinpadCardReader extends DefaultCardReader { @Override public ResponseAPDU modify(CardChannel channel, ChangeReferenceDataAPDUSpec apduSpec, - ModifyPINGUI pinGUI, PINSpec pinSpec, int retries) + ModifyPINGUI pinGUI, PinInfo pinSpec, int retries) throws SignatureCardException, CardException, InterruptedException { ResponseAPDU resp = null; @@ -614,10 +615,10 @@ public class PinpadCardReader extends DefaultCardReader { resp = new ResponseAPDU(modifyPin(icc, s, pinGUI, pinSpec)); } else if (MODIFY_DIRECT) { pinGUI.modifyPINDirect(pinSpec, retries); - log.debug("MODIFY_PIN_DIRECT [" + FEATURES[FEATURE_MODIFY_PIN_DIRECT] + "]"); + log.debug("MODIFY_PIN_DIRECT [{}]", FEATURES[FEATURE_MODIFY_PIN_DIRECT]); resp = new ResponseAPDU(MODIFY_PIN_DIRECT(icc, s)); } else { - log.warn("falling back to default pin-entry"); + log.warn("Falling back to default pin-entry."); return super.modify(channel, apduSpec, pinGUI, pinSpec, retries); } @@ -648,7 +649,7 @@ public class PinpadCardReader extends DefaultCardReader { @Override public ResponseAPDU modify(CardChannel channel, NewReferenceDataAPDUSpec apduSpec, - ModifyPINGUI pinGUI, PINSpec pinSpec) + ModifyPINGUI pinGUI, PinInfo pinSpec) throws SignatureCardException, CardException, InterruptedException { ResponseAPDU resp = null; @@ -661,10 +662,10 @@ public class PinpadCardReader extends DefaultCardReader { resp = new ResponseAPDU(modifyPin(icc, s, pinGUI, pinSpec)); } else if (MODIFY_DIRECT) { pinGUI.modifyPINDirect(pinSpec, -1); - log.debug("MODIFY_PIN_DIRECT [" + FEATURES[FEATURE_MODIFY_PIN_DIRECT] + "]"); + log.debug("MODIFY_PIN_DIRECT [{}]", FEATURES[FEATURE_MODIFY_PIN_DIRECT]); resp = new ResponseAPDU(MODIFY_PIN_DIRECT(icc, s)); } else { - log.warn("falling back to default pin-entry"); + log.warn("Falling back to default pin-entry."); return super.modify(channel, apduSpec, pinGUI, pinSpec); } @@ -695,7 +696,7 @@ public class PinpadCardReader extends DefaultCardReader { @Override public ResponseAPDU modify(CardChannel channel, ResetRetryCounterAPDUSpec apduSpec, - ModifyPINGUI pinGUI, PINSpec pinSpec, int retries) + ModifyPINGUI pinGUI, PinInfo pinSpec, int retries) throws InterruptedException, CardException, SignatureCardException { //TODO return modify(channel, (ChangeReferenceDataAPDUSpec) apduSpec, pinGUI, pinSpec, retries); diff --git a/smcc/src/main/java/at/gv/egiz/smcc/reader/ReaderFactory.java b/smcc/src/main/java/at/gv/egiz/smcc/reader/ReaderFactory.java index bf1730e9..0d0a8d8a 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/reader/ReaderFactory.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/reader/ReaderFactory.java @@ -25,8 +25,8 @@ import java.util.Map; import javax.smartcardio.Card; import javax.smartcardio.CardException; import javax.smartcardio.CardTerminal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -34,7 +34,7 @@ import org.apache.commons.logging.LogFactory; */ public class ReaderFactory { - protected final static Log log = LogFactory.getLog(ReaderFactory.class); + private final Logger log = LoggerFactory.getLogger(ReaderFactory.class); protected static SMCCConfiguration configuration; @@ -50,8 +50,9 @@ public class ReaderFactory { public static CardReader getReader(Card icc, CardTerminal ct) { + Logger log = LoggerFactory.getLogger(ReaderFactory.class); String name = ct.getName(); - log.info("creating reader " + name); + log.info("Creating reader : {}.", name); Map<Byte, Integer> features; if (configuration != null && configuration.isDisablePinpad()) { @@ -70,33 +71,31 @@ public class ReaderFactory { return reader; } - private static int CTL_CODE(int code) { + private static int SCARD_CTL_CODE(int code) { String os_name = System.getProperty("os.name").toLowerCase(); if (os_name.indexOf("windows") > -1) { - // cf. WinIOCTL.h return (0x31 << 16 | (code) << 2); } - // cf. reader.h return 0x42000000 + (code); } - static int IOCTL_GET_FEATURE_REQUEST = CTL_CODE(3400); + static int IOCTL_GET_FEATURE_REQUEST = SCARD_CTL_CODE(3400); private static Map<Byte, Integer> queryFeatures(Card icc) { + Logger log = LoggerFactory.getLogger(ReaderFactory.class); Map<Byte, Integer> features = new HashMap<Byte, Integer>(); - if (icc == null) { - log.warn("invalid card handle, cannot query ifd features"); + log.warn("Invalid card handle, cannot query ifd features."); } else { try { if (log.isTraceEnabled()) { - log.trace("GET_FEATURE_REQUEST " + Integer.toHexString(IOCTL_GET_FEATURE_REQUEST)); + log.trace("GET_FEATURE_REQUEST {}", Integer.toHexString(IOCTL_GET_FEATURE_REQUEST)); } byte[] resp = icc.transmitControlCommand(IOCTL_GET_FEATURE_REQUEST, new byte[0]); if (log.isTraceEnabled()) { - log.trace("Response TLV " + SMCCHelper.toString(resp)); + log.trace("Response TLV {}", SMCCHelper.toString(resp)); } // tag // length in bytes (always 4) @@ -108,15 +107,14 @@ public class ReaderFactory { ((0xff & resp[i + 4]) << 8) | (0xff & resp[i + 5]); if (log.isInfoEnabled()) { - log.info("IFD supports " + CardReader.FEATURES[feature.intValue()] + - ": " + Integer.toHexString(ioctl.intValue())); + log.info("IFD supports {}: {}", CardReader.FEATURES[feature + .intValue()], Integer.toHexString(ioctl.intValue())); } features.put(feature, ioctl); } } catch (CardException ex) { - log.debug("Failed to query IFD features: " + ex.getMessage()); - log.trace(ex); - log.info("IFD does not support secure pin entry"); + log.debug("Failed to query IFD features: {}", ex.getMessage(), ex); + log.info("IFD does not support secure pin entry."); } } return features; diff --git a/smcc/src/main/java/at/gv/egiz/smcc/util/ISO7816Utils.java b/smcc/src/main/java/at/gv/egiz/smcc/util/ISO7816Utils.java index fcd0b876..05249a5e 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/util/ISO7816Utils.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/util/ISO7816Utils.java @@ -286,12 +286,18 @@ public class ISO7816Utils { public static CommandAPDU createVerifyAPDU(VerifyAPDUSpec apduSpec, char[] pin) { // format pin - byte[] fpin = new byte[apduSpec.getPinLength()]; - byte[] mask = new byte[apduSpec.getPinLength()]; + int l = (apduSpec.getPinLength() > 0) ? apduSpec.getPinLength() : pin.length; + byte[] fpin = new byte[l]; + byte[] mask = new byte[l]; formatPIN(apduSpec.getPinFormat(), apduSpec.getPinJustification(), fpin, mask, pin); - byte[] apdu = apduSpec.getApdu(); - + byte[] template = apduSpec.getApdu(); + byte[] apdu = new byte[Math.max(template.length, 5 + apduSpec.getPinPosition() + l)]; + System.arraycopy(template, 0, apdu, 0, template.length); + if (template.length < 5) { + apdu[4] = (byte) (apdu.length - 5); + } + // insert formated pin insertPIN(apdu, apduSpec.getPinPosition() + 5, fpin, mask); @@ -307,13 +313,24 @@ public class ISO7816Utils { public static CommandAPDU createChangeReferenceDataAPDU( ChangeReferenceDataAPDUSpec apduSpec, char[] oldPin, char[] newPin) { + int lo = (apduSpec.getPinLength() > 0) ? apduSpec.getPinLength() : oldPin.length; + int ln = (apduSpec.getPinLength() > 0) ? apduSpec.getPinLength() : newPin.length; + // format old pin - byte[] fpin = new byte[apduSpec.getPinLength()]; - byte[] mask = new byte[apduSpec.getPinLength()]; + byte[] fpin = new byte[lo]; + byte[] mask = new byte[lo]; formatPIN(apduSpec.getPinFormat(), apduSpec.getPinJustification(), fpin, mask, oldPin); - byte[] apdu = apduSpec.getApdu(); - + byte[] template = apduSpec.getApdu(); + byte[] apdu = new byte[Math.max(template.length, + 5 + apduSpec.getPinPosition() + + Math.max(apduSpec.getPinInsertionOffsetOld() + lo, + apduSpec.getPinInsertionOffsetNew() + ln))]; + System.arraycopy(template, 0, apdu, 0, template.length); + if (template.length < 5) { + apdu[4] = (byte) (apdu.length - 5); + } + // insert formated old pin insertPIN(apdu, apduSpec.getPinPosition() + apduSpec.getPinInsertionOffsetOld() + 5, fpin, mask); @@ -324,8 +341,8 @@ public class ISO7816Utils { } // format new pin - fpin = new byte[apduSpec.getPinLength()]; - mask = new byte[apduSpec.getPinLength()]; + fpin = new byte[ln]; + mask = new byte[ln]; formatPIN(apduSpec.getPinFormat(), apduSpec.getPinJustification(), fpin, mask, newPin); // insert formated new pin @@ -345,12 +362,18 @@ public class ISO7816Utils { NewReferenceDataAPDUSpec apduSpec, char[] newPin) { // format old pin - byte[] fpin = new byte[apduSpec.getPinLength()]; - byte[] mask = new byte[apduSpec.getPinLength()]; + int l = (apduSpec.getPinLength() > 0) ? apduSpec.getPinLength() : newPin.length; + byte[] fpin = new byte[l]; + byte[] mask = new byte[l]; formatPIN(apduSpec.getPinFormat(), apduSpec.getPinJustification(), fpin, mask, newPin); - byte[] apdu = apduSpec.getApdu(); - + byte[] template = apduSpec.getApdu(); + byte[] apdu = new byte[Math.max(template.length, 5 + apduSpec.getPinPosition() + l)]; + System.arraycopy(template, 0, apdu, 0, template.length); + if (template.length < 5) { + apdu[4] = (byte) (apdu.length - 5); + } + // insert formated new pin insertPIN(apdu, apduSpec.getPinPosition() + apduSpec.getPinInsertionOffsetNew() + 5, fpin, mask); diff --git a/smcc/src/main/java/at/gv/egiz/smcc/util/SMCCHelper.java b/smcc/src/main/java/at/gv/egiz/smcc/util/SMCCHelper.java index f7d3bab7..a06fb624 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/util/SMCCHelper.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/util/SMCCHelper.java @@ -14,137 +14,137 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.smcc.util;
-
-import java.util.Locale;
-import java.util.Map;
-
-import javax.smartcardio.ATR;
-import javax.smartcardio.Card;
-import javax.smartcardio.CardTerminal;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.smcc.CardNotSupportedException;
-import at.gv.egiz.smcc.SignatureCard;
-import at.gv.egiz.smcc.SignatureCardFactory;
-
-public class SMCCHelper {
-
- public final static int NO_CARD = 0;
- public final static int PC_SC_NOT_SUPPORTED = 1;
- public final static int TERMINAL_NOT_PRESENT = 2;
- public final static int CARD_NOT_SUPPORTED = 3;
- public final static int CARD_FOUND = 4;
-
- private final static Log log = LogFactory.getLog(SMCCHelper.class);
-
- protected SmartCardIO smartCardIO = new SmartCardIO();
- protected int resultCode = NO_CARD;
- protected SignatureCard signatureCard = null;
- protected static boolean useSWCard = false;
-
- public SMCCHelper() {
- update();
- }
-
- public synchronized void update() {
- update(-1);
- }
-
- public synchronized void update(int sleep) {
- SignatureCardFactory factory = SignatureCardFactory.getInstance();
- if (useSWCard) {
- try {
- signatureCard = factory.createSignatureCard(null, null);
- resultCode = CARD_FOUND;
- } catch (CardNotSupportedException e) {
- resultCode = CARD_NOT_SUPPORTED;
- signatureCard = null;
- }
- return;
- }
- signatureCard = null;
- resultCode = NO_CARD;
- // find pcsc support
- if (smartCardIO.isPCSCSupported()) {
- // find supported card
- if (smartCardIO.isTerminalPresent()) {
- Map<CardTerminal, Card> newCards = null;
- if (sleep > 0) {
- smartCardIO.waitForInserted(sleep);
-
- }
- newCards = smartCardIO.getCards();
- for (CardTerminal cardTerminal : newCards.keySet()) {
- try {
- Card c = newCards.get(cardTerminal);
- if (c == null) {
- throw new CardNotSupportedException();
- }
- signatureCard = factory.createSignatureCard(c, cardTerminal);
- ATR atr = newCards.get(cardTerminal).getATR();
- log.trace("Found supported card (" + signatureCard.toString() + ") "
- + "in terminal '" + cardTerminal.getName() + "', ATR = "
- + toString(atr.getBytes()) + ".");
- resultCode = CARD_FOUND;
- break;
-
- } catch (CardNotSupportedException e) {
- Card c = newCards.get(cardTerminal);
- if (c != null) {
- ATR atr = c.getATR();
- log.info("Found unsupported card" + " in terminal '"
- + cardTerminal.getName() + "', ATR = "
- + toString(atr.getBytes()) + ".");
- } else {
- log.info("Found unsupported card in terminal '"
- + cardTerminal.getName() + "' without ATR");
- }
- resultCode = CARD_NOT_SUPPORTED;
- }
- }
- } else {
- resultCode = TERMINAL_NOT_PRESENT;
- }
- } else {
- resultCode = PC_SC_NOT_SUPPORTED;
- }
- }
-
- public synchronized SignatureCard getSignatureCard(Locale locale) {
- if (signatureCard != null) {
- signatureCard.setLocale(locale);
- }
- return signatureCard;
- }
-
- public int getResultCode() {
- return resultCode;
- }
-
- public static String toString(byte[] b) {
- StringBuffer sb = new StringBuffer();
- sb.append('[');
- if (b != null && b.length > 0) {
- sb.append(Integer.toHexString((b[0] & 240) >> 4));
- sb.append(Integer.toHexString(b[0] & 15));
- for (int i = 1; i < b.length; i++) {
- sb.append((i % 32 == 0) ? '\n' : ':');
- sb.append(Integer.toHexString((b[i] & 240) >> 4));
- sb.append(Integer.toHexString(b[i] & 15));
- }
- }
- sb.append(']');
- return sb.toString();
- }
-
- public static boolean isUseSWCard() {
- return useSWCard;
- }
-
- public static void setUseSWCard(boolean useSWCard) {
- SMCCHelper.useSWCard = useSWCard;
- }
-}
+package at.gv.egiz.smcc.util; + +import java.util.Locale; +import java.util.Map; + +import javax.smartcardio.Card; +import javax.smartcardio.CardTerminal; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.smcc.CardNotSupportedException; +import at.gv.egiz.smcc.SignatureCard; +import at.gv.egiz.smcc.SignatureCardFactory; + +public class SMCCHelper { + + public final static int NO_CARD = 0; + public final static int PC_SC_NOT_SUPPORTED = 1; + public final static int TERMINAL_NOT_PRESENT = 2; + public final static int CARD_NOT_SUPPORTED = 3; + public final static int CARD_FOUND = 4; + + private final Logger log = LoggerFactory.getLogger(SMCCHelper.class); + + protected SmartCardIO smartCardIO = new SmartCardIO(); + protected int resultCode = NO_CARD; + protected SignatureCard signatureCard = null; + protected static boolean useSWCard = false; + + public SMCCHelper() { + update(); + } + + public synchronized void update() { + update(-1); + } + + public synchronized void update(int sleep) { + SignatureCardFactory factory = SignatureCardFactory.getInstance(); + if (useSWCard) { + try { + signatureCard = factory.createSignatureCard(null, null); + resultCode = CARD_FOUND; + } catch (CardNotSupportedException e) { + resultCode = CARD_NOT_SUPPORTED; + signatureCard = null; + } + return; + } + signatureCard = null; + resultCode = NO_CARD; + // find pcsc support + if (smartCardIO.isPCSCSupported()) { + // find supported card + if (smartCardIO.isTerminalPresent()) { + Map<CardTerminal, Card> newCards = null; + if (sleep > 0) { + smartCardIO.waitForInserted(sleep); + + } + newCards = smartCardIO.getCards(); + for (CardTerminal cardTerminal : newCards.keySet()) { + try { + Card c = newCards.get(cardTerminal); + if (c == null) { + throw new CardNotSupportedException(); + } + signatureCard = factory.createSignatureCard(c, cardTerminal); + if (log.isTraceEnabled()) { + Object[] args = { signatureCard, cardTerminal.getName(), + toString(newCards.get(cardTerminal).getATR().getBytes()) }; + log.trace("Found supported card ({}) in terminal '{}', ATR = {}.", args); + } + resultCode = CARD_FOUND; + break; + + } catch (CardNotSupportedException e) { + Card c = newCards.get(cardTerminal); + if (c != null) { + Object[] args = { cardTerminal.getName(), + toString(c.getATR().getBytes()) }; + log.info("Found unsupported card in terminal '{}', ATR = {}.", + args); + } else { + log.info("Found unsupported card in terminal '{}' without ATR.", + cardTerminal.getName()); + } + resultCode = CARD_NOT_SUPPORTED; + } + } + } else { + resultCode = TERMINAL_NOT_PRESENT; + } + } else { + resultCode = PC_SC_NOT_SUPPORTED; + } + } + + public synchronized SignatureCard getSignatureCard(Locale locale) { + if (signatureCard != null) { + signatureCard.setLocale(locale); + } + return signatureCard; + } + + public int getResultCode() { + return resultCode; + } + + public static String toString(byte[] b) { + StringBuffer sb = new StringBuffer(); + sb.append('['); + if (b != null && b.length > 0) { + sb.append(Integer.toHexString((b[0] & 240) >> 4)); + sb.append(Integer.toHexString(b[0] & 15)); + for (int i = 1; i < b.length; i++) { + sb.append((i % 32 == 0) ? '\n' : ':'); + sb.append(Integer.toHexString((b[i] & 240) >> 4)); + sb.append(Integer.toHexString(b[i] & 15)); + } + } + sb.append(']'); + return sb.toString(); + } + + public static boolean isUseSWCard() { + return useSWCard; + } + + public static void setUseSWCard(boolean useSWCard) { + SMCCHelper.useSWCard = useSWCard; + } +} diff --git a/smcc/src/main/java/at/gv/egiz/smcc/util/SmartCardIO.java b/smcc/src/main/java/at/gv/egiz/smcc/util/SmartCardIO.java index b1866894..14ee7549 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/util/SmartCardIO.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/util/SmartCardIO.java @@ -14,191 +14,191 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.smcc.util;
-
+package at.gv.egiz.smcc.util; + import java.security.NoSuchAlgorithmException; -import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.smartcardio.Card;
-import javax.smartcardio.CardException;
-import javax.smartcardio.CardTerminal;
-import javax.smartcardio.CardTerminals;
-import javax.smartcardio.TerminalFactory;
-import javax.smartcardio.CardTerminals.State;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- *
- * @author mcentner
- */
-public class SmartCardIO {
-
- private static final int STATE_INITIALIZED = 1;
-
- private static final int STATE_TERMINAL_FACTORY = 2;
-
- private static final int STATE_TERMINALS = 3;
-
- private static Log log = LogFactory.getLog(SmartCardIO.class);
-
- final Map<CardTerminal, Card> terminalCard_ = new HashMap<CardTerminal, Card>();
-
- int state_ = STATE_INITIALIZED;
-
- TerminalFactory terminalFactory_ = null;
-
- CardTerminals cardTerminals_;
-
- private void updateTerminalFactory() {
+import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.smartcardio.Card; +import javax.smartcardio.CardException; +import javax.smartcardio.CardTerminal; +import javax.smartcardio.CardTerminals; +import javax.smartcardio.TerminalFactory; +import javax.smartcardio.CardTerminals.State; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author mcentner + */ +public class SmartCardIO { + + private static final int STATE_INITIALIZED = 1; + + private static final int STATE_TERMINAL_FACTORY = 2; + + private static final int STATE_TERMINALS = 3; + + private final Logger log = LoggerFactory.getLogger(SmartCardIO.class); + + final Map<CardTerminal, Card> terminalCard_ = new HashMap<CardTerminal, Card>(); + + int state_ = STATE_INITIALIZED; + + TerminalFactory terminalFactory_ = null; + + CardTerminals cardTerminals_; + + private void updateTerminalFactory() { TerminalFactory terminalFactory; try { terminalFactory = TerminalFactory.getInstance("PC/SC", null); } catch (NoSuchAlgorithmException e) { log.info("Failed to get TerminalFactory of type 'PC/SC'.", e); terminalFactory = TerminalFactory.getDefault(); - }
- log.debug("TerminalFactory : " + terminalFactory);
- if ("PC/SC".equals(terminalFactory.getType())) {
- terminalFactory_ = terminalFactory;
- }
- if(state_ < STATE_TERMINAL_FACTORY) {
- state_ = STATE_TERMINAL_FACTORY;
- }
- }
-
- public boolean isPCSCSupported() {
- if(state_ < STATE_TERMINAL_FACTORY) {
- updateTerminalFactory();
- }
- return terminalFactory_ != null;
- }
-
- private void updateCardTerminals() {
- if(terminalFactory_ != null) {
- cardTerminals_ = terminalFactory_.terminals();
- }
- log.debug("CardTerminals : " + cardTerminals_);
- if (state_ < STATE_TERMINALS) {
- state_ = STATE_TERMINALS;
- }
- }
-
- public CardTerminals getCardTerminals() {
- if(state_ < STATE_TERMINAL_FACTORY) {
- updateTerminalFactory();
- }
- if(state_ < STATE_TERMINALS) {
- updateCardTerminals();
- }
- return cardTerminals_;
- }
-
- public boolean isTerminalPresent() {
- CardTerminals cardTerminals = getCardTerminals();
- if (cardTerminals != null) {
- List<CardTerminal> terminals = null;
- try {
- terminals = cardTerminals.list(State.ALL);
-
- // logging
- if(log.isInfoEnabled()) {
- if (terminals == null || terminals.isEmpty()) {
- log.info("No card terminal found.");
- } else {
- StringBuffer msg = new StringBuffer();
- msg.append("Found " + terminals.size() + " card terminal(s):");
- for (CardTerminal terminal : terminals) {
- msg.append("\n " + terminal.getName());
- }
- log.info(msg.toString());
- }
- }
-
- return terminals != null && !terminals.isEmpty();
- } catch (CardException e) {
- log.info("Failed to list card terminals.", e);
- return false;
- }
- } else {
- return false;
- }
- }
-
- private Map<CardTerminal, Card> updateCards() {
-
- // clear card references if removed
- try {
- log.trace("terminals.list(State.CARD_REMOVAL)");
- for (CardTerminal terminal : cardTerminals_.list(CardTerminals.State.CARD_REMOVAL)) {
- Card card = terminalCard_.remove(terminal);
- log.trace("card removed : " + card);
- }
- } catch (CardException e) {
- log.debug(e);
- }
-
- // check inserted cards
- Map<CardTerminal, Card> newCards = new HashMap<CardTerminal, Card>();
- try {
- log.trace("terminals.list(State.CARD_INSERTION)");
- for (CardTerminal terminal : cardTerminals_.list(CardTerminals.State.CARD_INSERTION)) {
-
- Card card = null;
+ } + log.debug("TerminalFactory : {}.", terminalFactory); + if ("PC/SC".equals(terminalFactory.getType())) { + terminalFactory_ = terminalFactory; + } + if(state_ < STATE_TERMINAL_FACTORY) { + state_ = STATE_TERMINAL_FACTORY; + } + } + + public boolean isPCSCSupported() { + if(state_ < STATE_TERMINAL_FACTORY) { + updateTerminalFactory(); + } + return terminalFactory_ != null; + } + + private void updateCardTerminals() { + if(terminalFactory_ != null) { + cardTerminals_ = terminalFactory_.terminals(); + } + log.debug("CardTerminals : {}.", cardTerminals_); + if (state_ < STATE_TERMINALS) { + state_ = STATE_TERMINALS; + } + } + + public CardTerminals getCardTerminals() { + if(state_ < STATE_TERMINAL_FACTORY) { + updateTerminalFactory(); + } + if(state_ < STATE_TERMINALS) { + updateCardTerminals(); + } + return cardTerminals_; + } + + public boolean isTerminalPresent() { + CardTerminals cardTerminals = getCardTerminals(); + if (cardTerminals != null) { + List<CardTerminal> terminals = null; + try { + terminals = cardTerminals.list(State.ALL); + + // logging + if(log.isInfoEnabled()) { + if (terminals == null || terminals.isEmpty()) { + log.info("No card terminal found."); + } else { + StringBuffer msg = new StringBuffer(); + msg.append("Found " + terminals.size() + " card terminal(s):"); + for (CardTerminal terminal : terminals) { + msg.append("\n " + terminal.getName()); + } + log.info(msg.toString()); + } + } + + return terminals != null && !terminals.isEmpty(); + } catch (CardException e) { + log.info("Failed to list card terminals.", e); + return false; + } + } else { + return false; + } + } + + private Map<CardTerminal, Card> updateCards() { + + // clear card references if removed + try { + log.trace("terminals.list(State.CARD_REMOVAL)"); + for (CardTerminal terminal : cardTerminals_.list(CardTerminals.State.CARD_REMOVAL)) { + Card card = terminalCard_.remove(terminal); + log.trace("card removed : {}", card); + } + } catch (CardException e) { + log.debug("Failed to list terminals.", e); + } + + // check inserted cards + Map<CardTerminal, Card> newCards = new HashMap<CardTerminal, Card>(); + try { + log.trace("terminals.list(State.CARD_INSERTION)"); + for (CardTerminal terminal : cardTerminals_.list(CardTerminals.State.CARD_INSERTION)) { + + Card card = null; try { log.trace("Trying to connect to card."); - // try to connect to card
- card = terminal.connect("*");
- } catch (CardException e) {
- log.trace("Failed to connect to card.", e);
- }
-
- // have we seen this card before?
- if (terminalCard_.put(terminal, card) == null) {
- terminalCard_.put(terminal, card);
- newCards.put(terminal, card);
- log.trace("terminal '" + terminal + "' card inserted : " + card);
- }
- }
- } catch (CardException e) {
- log.debug(e);
- }
- return newCards;
-
- }
-
- public Map<CardTerminal, Card> getCards() {
- if(state_ < STATE_TERMINAL_FACTORY) {
- updateTerminalFactory();
- }
- if(state_ < STATE_TERMINALS) {
- updateCardTerminals();
- }
- updateCards();
- Map<CardTerminal, Card> terminalCard = new HashMap<CardTerminal, Card>();
- terminalCard.putAll(terminalCard_);
- return Collections.unmodifiableMap(terminalCard);
- }
-
- public Map<CardTerminal, Card> waitForInserted(int timeout) {
- if(state_ < STATE_TERMINAL_FACTORY) {
- updateTerminalFactory();
- }
- if(state_ < STATE_TERMINALS) {
- updateCardTerminals();
- }
- try {
- // just waiting for a short period of time to allow for abort
- cardTerminals_.waitForChange(timeout);
- } catch (CardException e) {
- log.debug("CardTerminals.waitForChange(" + timeout + ") failed.", e);
- }
- Map<CardTerminal, Card> newCards = new HashMap<CardTerminal, Card>();
- newCards.putAll(updateCards());
- return Collections.unmodifiableMap(newCards);
- }
-}
\ No newline at end of file + // try to connect to card + card = terminal.connect("*"); + } catch (CardException e) { + log.trace("Failed to connect to card.", e); + } + + // have we seen this card before? + if (terminalCard_.put(terminal, card) == null) { + terminalCard_.put(terminal, card); + newCards.put(terminal, card); + log.trace("terminal '{}' card inserted : {}", terminal, card); + } + } + } catch (CardException e) { + log.debug("Failed to list cards.", e); + } + return newCards; + + } + + public Map<CardTerminal, Card> getCards() { + if(state_ < STATE_TERMINAL_FACTORY) { + updateTerminalFactory(); + } + if(state_ < STATE_TERMINALS) { + updateCardTerminals(); + } + updateCards(); + Map<CardTerminal, Card> terminalCard = new HashMap<CardTerminal, Card>(); + terminalCard.putAll(terminalCard_); + return Collections.unmodifiableMap(terminalCard); + } + + public Map<CardTerminal, Card> waitForInserted(int timeout) { + if(state_ < STATE_TERMINAL_FACTORY) { + updateTerminalFactory(); + } + if(state_ < STATE_TERMINALS) { + updateCardTerminals(); + } + try { + // just waiting for a short period of time to allow for abort + cardTerminals_.waitForChange(timeout); + } catch (CardException e) { + log.debug("CardTerminals.waitForChange({}) failed.", timeout, e); + } + Map<CardTerminal, Card> newCards = new HashMap<CardTerminal, Card>(); + newCards.putAll(updateCards()); + return Collections.unmodifiableMap(newCards); + } +} diff --git a/smcc/src/main/resources/at/gv/egiz/smcc/EstEIDCard.properties b/smcc/src/main/resources/at/gv/egiz/smcc/EstEIDCard.properties new file mode 100644 index 00000000..e2deab5b --- /dev/null +++ b/smcc/src/main/resources/at/gv/egiz/smcc/EstEIDCard.properties @@ -0,0 +1 @@ +qs.pin.name=PIN
\ No newline at end of file diff --git a/smcc/src/main/resources/at/gv/egiz/smcc/PtEidCard.properties b/smcc/src/main/resources/at/gv/egiz/smcc/PtEidCard.properties new file mode 100644 index 00000000..c64bca9e --- /dev/null +++ b/smcc/src/main/resources/at/gv/egiz/smcc/PtEidCard.properties @@ -0,0 +1 @@ +sig.pin.name=PIN
\ No newline at end of file diff --git a/BKUApplet/src/main/resources/commons-logging.properties b/smcc/src/main/resources/at/gv/egiz/smcc/SWCard.properties index faa21c47..ba5212d4 100644 --- a/BKUApplet/src/main/resources/commons-logging.properties +++ b/smcc/src/main/resources/at/gv/egiz/smcc/SWCard.properties @@ -13,4 +13,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
\ No newline at end of file +sw.pin.name=KeyStore-Password +sw.pin.length=unlimited diff --git a/smcc/src/test/java/at/gv/egiz/smcc/CardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/CardTest.java index 44e48836..17a8a03f 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/CardTest.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/CardTest.java @@ -26,7 +26,6 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.security.NoSuchAlgorithmException; import java.util.Arrays; -import java.util.List; import javax.smartcardio.Card; @@ -38,7 +37,6 @@ import at.gv.egiz.smcc.pin.gui.DummyPINGUI; import at.gv.egiz.smcc.pin.gui.ModifyPINGUI; import at.gv.egiz.smcc.pin.gui.PINGUI; import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; -import org.junit.Ignore; @SuppressWarnings("restriction") public abstract class CardTest { @@ -144,7 +142,7 @@ public abstract class CardTest { PINGUI pinProvider = new DummyPINGUI() { @Override - public char[] providePIN(PINSpec spec, int retries) + public char[] providePIN(PinInfo spec, int retries) throws CancelledException, InterruptedException { try { @@ -174,7 +172,7 @@ public abstract class CardTest { PINGUI pinProvider = new DummyPINGUI() { @Override - public char[] providePIN(PINSpec spec, int retries) + public char[] providePIN(PinInfo spec, int retries) throws CancelledException, InterruptedException { try { @@ -195,13 +193,13 @@ public abstract class CardTest { } @Test - public void testGetPinSpecs() throws CardNotSupportedException { + public void testGetPinSpecs() throws CardNotSupportedException, SignatureCardException { PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard(); - List<PINSpec> specs = signatureCard.getPINSpecs(); + PinInfo[] specs = signatureCard.getPinInfos(); assertNotNull(specs); - assertTrue(specs.size() > 0); + assertTrue(specs.length > 0); } @@ -214,9 +212,9 @@ public abstract class CardTest { ModifyPINGUI pinProvider = new CancelChangePINProvider(); - List<PINSpec> specs = signatureCard.getPINSpecs(); + PinInfo[] specs = signatureCard.getPinInfos(); - signatureCard.activatePIN(specs.get(0), pinProvider); + signatureCard.activatePIN(specs[0], pinProvider); } }
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/A03CardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/A03CardTest.java index 3a8ac41c..4a94c623 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/A03CardTest.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/acos/A03CardTest.java @@ -32,7 +32,7 @@ import at.gv.egiz.smcc.NotActivatedException; import at.gv.egiz.smcc.PINFormatException; import at.gv.egiz.smcc.PINMgmtSignatureCard; import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.smcc.SignatureCard; import at.gv.egiz.smcc.SignatureCardException; import at.gv.egiz.smcc.SignatureCardFactory; @@ -70,7 +70,7 @@ public class A03CardTest extends ACOSCardTest { applDEC.setPin(ACOSApplDEC.KID_PIN_DEC, defaultPin); applDEC.setPin(A03ApplDEC.KID_PIN_INF, defaultPin); - for (PINSpec pinSpec : signatureCard.getPINSpecs()) { + for (PinInfo pinSpec : signatureCard.getPinInfos()) { char[] pin = defaultPin; diff --git a/smcc/src/test/java/at/gv/egiz/smcc/acos/A04CardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/acos/A04CardTest.java index 1cbea1b3..a7a5eef4 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/acos/A04CardTest.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/acos/A04CardTest.java @@ -36,7 +36,7 @@ import at.gv.egiz.smcc.LockedException; import at.gv.egiz.smcc.NotActivatedException; import at.gv.egiz.smcc.PINFormatException; import at.gv.egiz.smcc.PINMgmtSignatureCard; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.smcc.SignatureCard; import at.gv.egiz.smcc.SignatureCardException; import at.gv.egiz.smcc.SignatureCardFactory; @@ -80,7 +80,7 @@ public class A04CardTest extends ACOSCardTest { ACOSApplDEC applDEC = (ACOSApplDEC) card.getApplication(ACOSAppl.AID_DEC); applDEC.setPin(ACOSApplDEC.KID_PIN_DEC, defaultPin); - for (PINSpec pinSpec : signatureCard.getPINSpecs()) { + for (PinInfo pinSpec : signatureCard.getPinInfos()) { char[] pin = defaultPin; diff --git a/smcc/src/test/java/at/gv/egiz/smcc/card/CreateSignature.java b/smcc/src/test/java/at/gv/egiz/smcc/card/CreateSignature.java new file mode 100644 index 00000000..956bcc99 --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/card/CreateSignature.java @@ -0,0 +1,108 @@ +/* +* Copyright 2009 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.smcc.card; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.math.BigInteger; +import java.nio.charset.Charset; +import java.util.Formatter; +import java.util.Locale; + +import at.gv.egiz.smcc.CancelledException; +import at.gv.egiz.smcc.PinInfo; +import at.gv.egiz.smcc.SignatureCard; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.SignatureCard.KeyboxName; +import at.gv.egiz.smcc.pin.gui.PINGUI; +import at.gv.egiz.smcc.util.SMCCHelper; + +public class CreateSignature { + + /** + * @param args + * @throws Exception + */ + public static void main(String[] args) throws Exception { + + SMCCHelper helper = new SMCCHelper(); + + SignatureCard signatureCard = helper.getSignatureCard(Locale.getDefault()); + + if (signatureCard == null) { + return; + } + + InputStream data = new ByteArrayInputStream("just a test".getBytes(Charset.forName("UTF-8"))); + byte[] signature = createSignature(signatureCard, KeyboxName.SECURE_SIGNATURE_KEYPAIR, data); + Formatter printf = new Formatter(System.out); + printf.format("Signature: %1$x", new BigInteger(signature)); + + } + + public static byte[] createSignature(SignatureCard signatureCard, KeyboxName keyboxName, InputStream data) throws SignatureCardException, InterruptedException, IOException { + return signatureCard.createSignature(data, keyboxName, new ConsolePINGUI(), "http://www.w3.org/2000/09/xmldsig#rsa-sha1"); + } + + public static class ConsolePINGUI implements PINGUI { + + @Override + public void allKeysCleared() { + } + + @Override + public void correctionButtonPressed() { + } + + @Override + public void enterPIN(PinInfo spec, int retries) throws CancelledException, + InterruptedException { + } + + @Override + public void enterPINDirect(PinInfo spec, int retries) + throws CancelledException, InterruptedException { + } + + @Override + public void validKeyPressed() { + } + + @Override + public char[] providePIN(PinInfo pinSpec, int retries) + throws CancelledException, InterruptedException { + System.out.print("Enter " + pinSpec.getLocalizedName() + ": "); + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + String pin; + try { + pin = in.readLine(); + } catch (IOException e) { + throw new CancelledException(e); + } + if (pin == null || pin.length() == 0) { + throw new CancelledException(); + } + return pin.toCharArray(); + } + + } + +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/card/ReadCertiticate.java b/smcc/src/test/java/at/gv/egiz/smcc/card/ReadCertiticate.java new file mode 100644 index 00000000..38a4042a --- /dev/null +++ b/smcc/src/test/java/at/gv/egiz/smcc/card/ReadCertiticate.java @@ -0,0 +1,56 @@ +/* +* Copyright 2009 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.smcc.card; + +import java.io.ByteArrayInputStream; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.Locale; + +import at.gv.egiz.smcc.SignatureCard; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.SignatureCard.KeyboxName; +import at.gv.egiz.smcc.util.SMCCHelper; + +public class ReadCertiticate { + + public static void main(String[] args) throws Exception { + + SMCCHelper helper = new SMCCHelper(); + + SignatureCard signatureCard = helper.getSignatureCard(Locale.getDefault()); + + if (signatureCard == null) { + return; + } + + X509Certificate cert = readCertificate(signatureCard, KeyboxName.SECURE_SIGNATURE_KEYPAIR); + System.out.println(cert.toString()); + + } + + public static X509Certificate readCertificate(SignatureCard signatureCard, + KeyboxName keyboxName) throws SignatureCardException, + InterruptedException, CertificateException { + byte[] certificate = signatureCard.getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR); + CertificateFactory certificateFactory = CertificateFactory.getInstance("X509"); + return (X509Certificate) certificateFactory.generateCertificate(new ByteArrayInputStream(certificate)); + } + +} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/CancelChangePINProvider.java b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/CancelChangePINProvider.java index dffe7e29..1c720a14 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/CancelChangePINProvider.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/CancelChangePINProvider.java @@ -17,7 +17,7 @@ package at.gv.egiz.smcc.pin.gui; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; public class CancelChangePINProvider extends DummyChangePINGUI implements ModifyPINGUI { @@ -25,13 +25,13 @@ public class CancelChangePINProvider extends DummyChangePINGUI implements Modify } @Override - public char[] provideCurrentPIN(PINSpec spec, int retries) + public char[] provideCurrentPIN(PinInfo spec, int retries) throws CancelledException, InterruptedException { throw new CancelledException("cancelled by cancelPINProvider"); } @Override - public char[] provideNewPIN(PINSpec spec) + public char[] provideNewPIN(PinInfo spec) throws CancelledException, InterruptedException { throw new CancelledException("cancelled by cancelPINProvider"); } diff --git a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/CancelPINProvider.java b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/CancelPINProvider.java index 77f19345..7da3ec5c 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/CancelPINProvider.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/CancelPINProvider.java @@ -17,12 +17,12 @@ package at.gv.egiz.smcc.pin.gui; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; public class CancelPINProvider extends DummyPINGUI implements PINGUI { @Override - public char[] providePIN(PINSpec spec, int retries) + public char[] providePIN(PinInfo spec, int retries) throws CancelledException, InterruptedException { throw new CancelledException("cancelled by cancelPINProvider"); } diff --git a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/ChangePINProvider.java b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/ChangePINProvider.java index 5eb8b9a1..50bc0784 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/ChangePINProvider.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/ChangePINProvider.java @@ -17,7 +17,7 @@ package at.gv.egiz.smcc.pin.gui; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; public class ChangePINProvider extends DummyChangePINGUI implements ModifyPINGUI { @@ -35,14 +35,14 @@ public class ChangePINProvider extends DummyChangePINGUI implements ModifyPINGUI } @Override - public char[] provideCurrentPIN(PINSpec spec, int retries) + public char[] provideCurrentPIN(PinInfo spec, int retries) throws CancelledException, InterruptedException { provided++; return oldPin; } @Override - public char[] provideNewPIN(PINSpec spec) { + public char[] provideNewPIN(PinInfo spec) { return pin; } diff --git a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/DummyChangePINGUI.java b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/DummyChangePINGUI.java index fff89409..e6192417 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/DummyChangePINGUI.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/DummyChangePINGUI.java @@ -17,7 +17,7 @@ package at.gv.egiz.smcc.pin.gui; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; public abstract class DummyChangePINGUI implements ModifyPINGUI { @@ -47,22 +47,22 @@ public abstract class DummyChangePINGUI implements ModifyPINGUI { } @Override - public void modifyPINDirect(PINSpec spec, int retries) throws CancelledException, InterruptedException { + public void modifyPINDirect(PinInfo spec, int retries) throws CancelledException, InterruptedException { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void enterCurrentPIN(PINSpec spec, int retries) { + public void enterCurrentPIN(PinInfo spec, int retries) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void enterNewPIN(PINSpec spec) { + public void enterNewPIN(PinInfo spec) { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void confirmNewPIN(PINSpec spec) { + public void confirmNewPIN(PinInfo spec) { throw new UnsupportedOperationException("Not supported yet."); } }
\ No newline at end of file diff --git a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/DummyPINGUI.java b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/DummyPINGUI.java index 4d99b5c1..27d268c5 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/DummyPINGUI.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/DummyPINGUI.java @@ -17,17 +17,17 @@ package at.gv.egiz.smcc.pin.gui; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; public abstract class DummyPINGUI implements PINGUI { @Override - public void enterPINDirect(PINSpec spec, int retries) throws CancelledException, InterruptedException { + public void enterPINDirect(PinInfo spec, int retries) throws CancelledException, InterruptedException { throw new UnsupportedOperationException("Not supported yet."); } @Override - public void enterPIN(PINSpec spec, int retries) throws CancelledException, InterruptedException { + public void enterPIN(PinInfo spec, int retries) throws CancelledException, InterruptedException { throw new UnsupportedOperationException("Not supported yet."); } diff --git a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InterruptPINProvider.java b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InterruptPINProvider.java index 5706b888..814ced11 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InterruptPINProvider.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InterruptPINProvider.java @@ -17,7 +17,7 @@ package at.gv.egiz.smcc.pin.gui; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; @SuppressWarnings("restriction") public class InterruptPINProvider extends DummyPINGUI implements PINGUI { @@ -26,7 +26,7 @@ public class InterruptPINProvider extends DummyPINGUI implements PINGUI { } @Override - public char[] providePIN(PINSpec spec, int retries) + public char[] providePIN(PinInfo spec, int retries) throws CancelledException, InterruptedException { throw new InterruptedException("interrupted by cancelPINProvider"); } diff --git a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InvalidChangePINProvider.java b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InvalidChangePINProvider.java index 69c9f42a..53732d82 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InvalidChangePINProvider.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InvalidChangePINProvider.java @@ -17,7 +17,7 @@ package at.gv.egiz.smcc.pin.gui; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; public class InvalidChangePINProvider extends DummyChangePINGUI implements ModifyPINGUI { @@ -35,7 +35,7 @@ public class InvalidChangePINProvider extends DummyChangePINGUI implements Modif } @Override - public char[] provideCurrentPIN(PINSpec spec, int retries) + public char[] provideCurrentPIN(PinInfo spec, int retries) throws CancelledException, InterruptedException { if (provided >= numWrongTries) { throw new CancelledException("Number of wrong tries reached: " + provided); @@ -50,7 +50,7 @@ public class InvalidChangePINProvider extends DummyChangePINGUI implements Modif } @Override - public char[] provideNewPIN(PINSpec spec) { + public char[] provideNewPIN(PinInfo spec) { return pin; } } diff --git a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InvalidPINProvider.java b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InvalidPINProvider.java index db01fd0d..695ec964 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InvalidPINProvider.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/InvalidPINProvider.java @@ -17,7 +17,7 @@ package at.gv.egiz.smcc.pin.gui; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; public class InvalidPINProvider extends DummyPINGUI implements PINGUI { @@ -32,7 +32,7 @@ public class InvalidPINProvider extends DummyPINGUI implements PINGUI { } @Override - public char[] providePIN(PINSpec spec, int retries) + public char[] providePIN(PinInfo spec, int retries) throws CancelledException, InterruptedException { if (provided >= numWrongTries) { throw new CancelledException("Number of wrong tries reached: " + provided); diff --git a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/SMCCTestPINProvider.java b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/SMCCTestPINProvider.java index dffc90d7..e6fd67d5 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/SMCCTestPINProvider.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/pin/gui/SMCCTestPINProvider.java @@ -17,7 +17,7 @@ package at.gv.egiz.smcc.pin.gui; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; public class SMCCTestPINProvider extends DummyPINGUI implements PINGUI { @@ -29,7 +29,7 @@ public class SMCCTestPINProvider extends DummyPINGUI implements PINGUI { } @Override - public char[] providePIN(PINSpec spec, int retries) + public char[] providePIN(PinInfo spec, int retries) throws CancelledException, InterruptedException { provided++; return pin; diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardChannelEmul.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardChannelEmul.java index 2e0c54eb..f37f12dd 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardChannelEmul.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardChannelEmul.java @@ -364,7 +364,7 @@ public class STARCOSCardChannelEmul extends CardChannelEmul { } PIN pin; - if (currentAppl != null) { + if ((command.getP2() & 0x80) > 0 && currentAppl != null) { pin = currentAppl.pins.get(command.getP2()); } else { pin = globalPins.get(command.getP2()); @@ -388,7 +388,7 @@ public class STARCOSCardChannelEmul extends CardChannelEmul { if (response.getSW() == 0x9000) { PIN pin; - if (currentAppl != null) { + if ((command.getP2() & 0x80) > 0 && currentAppl != null) { pin = currentAppl.pins.get(command.getP2()); } else { pin = globalPins.get(command.getP2()); diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardTest.java index 154884d4..82e48d64 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardTest.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSCardTest.java @@ -41,7 +41,7 @@ import at.gv.egiz.smcc.NotActivatedException; import at.gv.egiz.smcc.PIN; import at.gv.egiz.smcc.PINFormatException; import at.gv.egiz.smcc.PINMgmtSignatureCard; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.smcc.SignatureCard; import at.gv.egiz.smcc.SignatureCardException; import at.gv.egiz.smcc.SignatureCardFactory; @@ -258,17 +258,17 @@ public class STARCOSCardTest extends CardTest { PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard( STARCOSCardEmul.DEFAULT_SS_PIN, STARCOSCardEmul.DEFAULT_SS_PIN, PIN.STATE_RESET); - for (PINSpec pinSpec : signatureCard.getPINSpecs()) { + for (PinInfo pinInfo : signatureCard.getPinInfos()) { char[] pin = "123456".toCharArray(); - for (int i = pinSpec.getMinLength(); i <= pinSpec.getMaxLength(); i++) { - signatureCard.verifyPIN(pinSpec, new SMCCTestPINProvider(pin)); + for (int i = pinInfo.getMinLength(); i <= pinInfo.getMaxLength(); i++) { + signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); char[] newPin = new char[i]; Arrays.fill(newPin, '0'); signatureCard - .changePIN(pinSpec, new ChangePINProvider(pin, newPin)); - signatureCard.verifyPIN(pinSpec, new SMCCTestPINProvider(newPin)); + .changePIN(pinInfo, new ChangePINProvider(pin, newPin)); + signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(newPin)); pin = newPin; } } @@ -283,20 +283,20 @@ public class STARCOSCardTest extends CardTest { PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard( null, null, PIN.STATE_PIN_NOTACTIVE); - for (PINSpec pinSpec : signatureCard.getPINSpecs()) { + for (PinInfo pinInfo : signatureCard.getPinInfos()) { - char[] pin = "1234567890".substring(0, pinSpec.getMinLength()).toCharArray(); + char[] pin = "1234567890".substring(0, pinInfo.getMinLength()).toCharArray(); boolean notActive = false; try { - signatureCard.verifyPIN(pinSpec, new SMCCTestPINProvider(pin)); + signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); } catch (NotActivatedException ex) { notActive = true; } assertTrue(notActive); - signatureCard.activatePIN(pinSpec, new ChangePINProvider(null, pin)); - signatureCard.verifyPIN(pinSpec, new SMCCTestPINProvider(pin)); + signatureCard.activatePIN(pinInfo, new ChangePINProvider(null, pin)); + signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); } } @@ -307,13 +307,13 @@ public class STARCOSCardTest extends CardTest { PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard(); - for (PINSpec pinSpec : signatureCard.getPINSpecs()) { + for (PinInfo pinInfo : signatureCard.getPinInfos()) { char[] invalidPin = "999999".toCharArray(); int numInvalidTries = 2; InvalidPINProvider invalidPinProvider = new InvalidPINProvider(invalidPin, numInvalidTries); try { - signatureCard.verifyPIN(pinSpec, invalidPinProvider); + signatureCard.verifyPIN(pinInfo, invalidPinProvider); } catch (CancelledException ex) { } finally { assertTrue(invalidPinProvider.getProvided() == numInvalidTries); @@ -328,7 +328,7 @@ public class STARCOSCardTest extends CardTest { PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard(); - for (PINSpec pinSpec : signatureCard.getPINSpecs()) { + for (PinInfo pinInfo : signatureCard.getPinInfos()) { char[] invalidPin = "999999".toCharArray(); int numInvalidTries = 2; @@ -336,7 +336,7 @@ public class STARCOSCardTest extends CardTest { new InvalidChangePINProvider(invalidPin, invalidPin, numInvalidTries); try { - signatureCard.changePIN(pinSpec, invalidPinProvider); + signatureCard.changePIN(pinInfo, invalidPinProvider); } catch (CancelledException ex) { } finally { assertTrue(invalidPinProvider.getProvided() == numInvalidTries); diff --git a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3CardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3CardTest.java index 06744c82..1d8507b2 100644 --- a/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3CardTest.java +++ b/smcc/src/test/java/at/gv/egiz/smcc/starcos/STARCOSG3CardTest.java @@ -24,7 +24,6 @@ import java.util.Arrays; import org.junit.Test; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.CardEmul; import at.gv.egiz.smcc.CardNotSupportedException; import at.gv.egiz.smcc.CardTerminalEmul; import at.gv.egiz.smcc.CardTest; @@ -34,12 +33,11 @@ import at.gv.egiz.smcc.NotActivatedException; import at.gv.egiz.smcc.PIN; import at.gv.egiz.smcc.PINFormatException; import at.gv.egiz.smcc.PINMgmtSignatureCard; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.smcc.SignatureCard; import at.gv.egiz.smcc.SignatureCardException; import at.gv.egiz.smcc.SignatureCardFactory; import at.gv.egiz.smcc.pin.gui.SMCCTestPINProvider; -import org.junit.Ignore; public class STARCOSG3CardTest extends CardTest { @@ -72,17 +70,17 @@ public class STARCOSG3CardTest extends CardTest { PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard( STARCOSG3CardEmul.DEFAULT_SS_PIN, STARCOSG3CardEmul.DEFAULT_SS_PIN, PIN.STATE_RESET); - for (PINSpec pinSpec : signatureCard.getPINSpecs()) { + for (PinInfo pinInfo : signatureCard.getPinInfos()) { char[] pin = "123456".toCharArray(); - for (int i = pinSpec.getMinLength(); i <= pinSpec.getMaxLength(); i++) { - signatureCard.verifyPIN(pinSpec, new SMCCTestPINProvider(pin)); + for (int i = pinInfo.getMinLength(); i <= pinInfo.getMaxLength(); i++) { + signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); char[] newPin = new char[i]; Arrays.fill(newPin, '0'); signatureCard - .changePIN(pinSpec, new ChangePINProvider(pin, newPin)); - signatureCard.verifyPIN(pinSpec, new SMCCTestPINProvider(newPin)); + .changePIN(pinInfo, new ChangePINProvider(pin, newPin)); + signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(newPin)); pin = newPin; } } @@ -97,21 +95,21 @@ public class STARCOSG3CardTest extends CardTest { PINMgmtSignatureCard signatureCard = (PINMgmtSignatureCard) createSignatureCard( STARCOSG3CardEmul.TRANSPORT_SS_PIN, STARCOSG3CardEmul.TRANSPORT_SS_PIN, PIN.STATE_PIN_NOTACTIVE); - for (PINSpec pinSpec : signatureCard.getPINSpecs()) { + for (PinInfo pinInfo : signatureCard.getPinInfos()) { - char[] pin = "123456789".substring(0, pinSpec.getMinLength()).toCharArray(); + char[] pin = "123456789".substring(0, pinInfo.getMinLength()).toCharArray(); char[] transportPIN = "123456".toCharArray(); boolean notActive = false; try { - signatureCard.verifyPIN(pinSpec, new SMCCTestPINProvider(pin)); + signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); } catch (NotActivatedException ex) { notActive = true; } assertTrue(notActive); - signatureCard.activatePIN(pinSpec, new ChangePINProvider(transportPIN, pin)); - signatureCard.verifyPIN(pinSpec, new SMCCTestPINProvider(pin)); + signatureCard.activatePIN(pinInfo, new ChangePINProvider(transportPIN, pin)); + signatureCard.verifyPIN(pinInfo, new SMCCTestPINProvider(pin)); } } diff --git a/smccSTAL/pom.xml b/smccSTAL/pom.xml index 22d6558a..5864e122 100644 --- a/smccSTAL/pom.xml +++ b/smccSTAL/pom.xml @@ -1,14 +1,14 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>smccSTAL</artifactId> <name>smcc STAL</name> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <build> <plugins> <plugin> @@ -24,25 +24,25 @@ <dependency> <groupId>at.gv.egiz</groupId> <artifactId>STAL</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>smcc</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUCommonGUI</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> </dependency> <dependency> <groupId>iaik</groupId> <artifactId>iaik_jce_me4se</artifactId> </dependency> <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> </dependency> </dependencies> </project>
\ No newline at end of file diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/AbstractPINProvider.java b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/AbstractPINProvider.java index 00738188..05f9c176 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/AbstractPINProvider.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/AbstractPINProvider.java @@ -17,11 +17,10 @@ package at.gv.egiz.bku.pin.gui; -import at.gv.egiz.smcc.pin.gui.PINProvider; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * common super class providing action listener for all PIN GUIs @@ -29,7 +28,7 @@ import org.apache.commons.logging.LogFactory; */ public abstract class AbstractPINProvider implements ActionListener { - protected static final Log log = LogFactory.getLog(AbstractPINProvider.class); + private final Logger log = LoggerFactory.getLogger(AbstractPINProvider.class); protected String action; protected boolean actionPerformed; @@ -40,7 +39,7 @@ public abstract class AbstractPINProvider implements ActionListener { this.wait(); } } catch (InterruptedException e) { - log.error("[" + Thread.currentThread().getName() + "] interrupt in waitForAction"); + log.error("[{}] interrupt in waitForAction.", Thread.currentThread().getName()); throw e; } actionPerformed = false; @@ -53,7 +52,7 @@ public abstract class AbstractPINProvider implements ActionListener { @Override public void actionPerformed(ActionEvent e) { - log.debug("[" + Thread.currentThread().getName() + "] action performed - " + e.getActionCommand()); + log.debug("[{}] action performed - {}", Thread.currentThread().getName(), e.getActionCommand()); action = e.getActionCommand(); actionPerformed(); } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINGUI.java b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINGUI.java index 81db0e90..0199dab0 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINGUI.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINGUI.java @@ -19,12 +19,12 @@ package at.gv.egiz.bku.pin.gui; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.smccstal.SecureViewer; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.smcc.pin.gui.PINGUI; import at.gv.egiz.stal.signedinfo.SignedInfoType; import java.security.DigestException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * The number of retries is not fixed and there is no way (?) to obtain this value. @@ -39,7 +39,7 @@ import org.apache.commons.logging.LogFactory; */ public class SignPINGUI extends SignPINProvider implements PINGUI { - protected static final Log log = LogFactory.getLog(SignPINGUI.class); + private final Logger log = LoggerFactory.getLogger(SignPINGUI.class); private boolean retry = false; @@ -48,7 +48,7 @@ public class SignPINGUI extends SignPINProvider implements PINGUI { } @Override - public void enterPINDirect(PINSpec spec, int retries) + public void enterPINDirect(PinInfo spec, int retries) throws CancelledException, InterruptedException { if (retry) { gui.showEnterPINDirect(spec, retries); @@ -60,7 +60,7 @@ public class SignPINGUI extends SignPINProvider implements PINGUI { } @Override - public void enterPIN(PINSpec spec, int retries) + public void enterPIN(PinInfo spec, int retries) throws CancelledException, InterruptedException { if (retry) { gui.showEnterPIN(spec, retries); @@ -71,7 +71,7 @@ public class SignPINGUI extends SignPINProvider implements PINGUI { } } - private void showSignatureData(PINSpec spec) + private void showSignatureData(PinInfo spec) throws CancelledException, InterruptedException { gui.showSignatureDataDialog(spec, @@ -80,20 +80,20 @@ public class SignPINGUI extends SignPINProvider implements PINGUI { this, "secureViewer"); do { - log.trace("[" + Thread.currentThread().getName() + "] wait for action"); + log.trace("[{}] wait for action.", Thread.currentThread().getName()); waitForAction(); - log.trace("[" + Thread.currentThread().getName() + "] received action " + action); + log.trace("[{}] received action {}.", Thread.currentThread().getName(), action); if ("secureViewer".equals(action)) { try { viewer.displayDataToBeSigned(signedInfo, this, "signatureData"); } catch (DigestException ex) { - log.error("Bad digest value: " + ex.getMessage()); + log.error("Bad digest value: {}", ex.getMessage()); gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH, new Object[]{ex.getMessage()}, this, "error"); } catch (Exception ex) { - log.error("Could not display hashdata inputs: " + + log.error("Could not display hashdata inputs: {}.", ex.getMessage()); gui.showErrorDialog(BKUGUIFacade.ERR_DISPLAY_HASHDATA, new Object[]{ex.getMessage()}, @@ -113,7 +113,7 @@ public class SignPINGUI extends SignPINProvider implements PINGUI { throw new CancelledException(spec.getLocalizedName() + " entry cancelled"); } else { - log.error("unknown action command " + action); + log.error("Unknown action command {}.", action); } } while (true); } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINProvider.java b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINProvider.java index fc1d39af..d09eebb9 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINProvider.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/SignPINProvider.java @@ -19,12 +19,12 @@ package at.gv.egiz.bku.pin.gui; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.smccstal.SecureViewer; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.smcc.pin.gui.PINProvider; import at.gv.egiz.stal.signedinfo.SignedInfoType; import java.security.DigestException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * The number of retries is not fixed and there is no way (?) to obtain this value. @@ -39,7 +39,7 @@ import org.apache.commons.logging.LogFactory; */ public class SignPINProvider extends AbstractPINProvider implements PINProvider { - protected static final Log log = LogFactory.getLog(SignPINProvider.class); + private final Logger log = LoggerFactory.getLogger(SignPINProvider.class); protected BKUGUIFacade gui; protected SecureViewer viewer; @@ -53,7 +53,7 @@ public class SignPINProvider extends AbstractPINProvider implements PINProvider } @Override - public char[] providePIN(PINSpec spec, int retries) + public char[] providePIN(PinInfo spec, int retries) throws CancelledException, InterruptedException { gui.showSignaturePINDialog(spec, (retry) ? retries : -1, @@ -62,20 +62,20 @@ public class SignPINProvider extends AbstractPINProvider implements PINProvider this, "secureViewer"); do { - log.trace("[" + Thread.currentThread().getName() + "] wait for action"); + log.trace("[{}] wait for action.", Thread.currentThread().getName()); waitForAction(); - log.trace("[" + Thread.currentThread().getName() + "] received action " + action); + log.trace("[{}] received action {}.", Thread.currentThread().getName(), action); if ("secureViewer".equals(action)) { try { viewer.displayDataToBeSigned(signedInfo, this, "pinEntry"); } catch (DigestException ex) { - log.error("Bad digest value: " + ex.getMessage()); + log.error("Bad digest value: {}", ex.getMessage()); gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH, new Object[]{ex.getMessage()}, this, "error"); } catch (Exception ex) { - log.error("Could not display hashdata inputs: " + + log.error("Could not display hashdata inputs: {}", ex.getMessage()); gui.showErrorDialog(BKUGUIFacade.ERR_DISPLAY_HASHDATA, new Object[]{ex.getMessage()}, @@ -98,7 +98,7 @@ public class SignPINProvider extends AbstractPINProvider implements PINProvider throw new CancelledException(spec.getLocalizedName() + " entry cancelled"); } else { - log.error("unknown action command " + action); + log.error("Unknown action command {}.", action); } } while (true); } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINGUI.java b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINGUI.java index dc21492e..89ab1e21 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINGUI.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINGUI.java @@ -18,10 +18,8 @@ package at.gv.egiz.bku.pin.gui; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.smcc.pin.gui.PINGUI; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * The number of retries is not fixed and there is no way (?) to obtain this value. @@ -36,8 +34,6 @@ import org.apache.commons.logging.LogFactory; */ public class VerifyPINGUI extends VerifyPINProvider implements PINGUI { - protected static final Log log = LogFactory.getLog(VerifyPINGUI.class); - private boolean retry = false; public VerifyPINGUI(BKUGUIFacade gui) { @@ -45,15 +41,15 @@ public class VerifyPINGUI extends VerifyPINProvider implements PINGUI { } @Override - public void enterPINDirect(PINSpec spec, int retries) + public void enterPINDirect(PinInfo pinInfo, int retries) throws CancelledException, InterruptedException { - gui.showEnterPINDirect(spec, (retry) ? retries : -1); + gui.showEnterPINDirect(pinInfo, (retry) ? retries : -1); retry = true; } @Override - public void enterPIN(PINSpec spec, int retries) { - gui.showEnterPIN(spec, (retry) ? retries : -1); + public void enterPIN(PinInfo pinInfo, int retries) { + gui.showEnterPIN(pinInfo, (retry) ? retries : -1); retry = true; } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINProvider.java b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINProvider.java index fda1e402..f9300932 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINProvider.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/pin/gui/VerifyPINProvider.java @@ -18,10 +18,10 @@ package at.gv.egiz.bku.pin.gui; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.smcc.pin.gui.PINProvider; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * The number of retries is not fixed and there is no way (?) to obtain this value. @@ -36,7 +36,7 @@ import org.apache.commons.logging.LogFactory; */ public class VerifyPINProvider extends AbstractPINProvider implements PINProvider { - protected static final Log log = LogFactory.getLog(VerifyPINProvider.class); + private final Logger log = LoggerFactory.getLogger(VerifyPINProvider.class); protected BKUGUIFacade gui; private boolean retry = false; @@ -46,26 +46,25 @@ public class VerifyPINProvider extends AbstractPINProvider implements PINProvide } @Override - public char[] providePIN(PINSpec spec, int retries) + public char[] providePIN(PinInfo spec, int retries) throws CancelledException, InterruptedException { gui.showVerifyPINDialog(spec, (retry) ? retries : -1, this, "verify", this, "cancel"); - log.trace("[" + Thread.currentThread().getName() + "] wait for action"); + log.trace("[{}] wait for action.", Thread.currentThread().getName()); waitForAction(); - log.trace("[" + Thread.currentThread().getName() + "] received action " + action); + log.trace("[{}] received action {}.", Thread.currentThread().getName(), action); + + gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT, + BKUGUIFacade.MESSAGE_WAIT); if ("cancel".equals(action)) { - gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT, - BKUGUIFacade.MESSAGE_WAIT); throw new CancelledException(spec.getLocalizedName() + " entry cancelled"); } - gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT, - BKUGUIFacade.MESSAGE_WAIT); retry = true; return gui.getPin(); } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java index 14b36e28..8400700f 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java @@ -22,8 +22,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.smcc.SignatureCard; @@ -43,7 +43,8 @@ import at.gv.egiz.stal.STALResponse; */ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements ActionListener, SMCCSTALRequestHandler { - protected static Log log = LogFactory.getLog(AbstractBKUWorker.class); + private final Logger log = LoggerFactory.getLogger(AbstractBKUWorker.class); + protected BKUGUIFacade gui; protected List<String> actionCommandList = new ArrayList<String>(); protected Boolean actionPerformed = false; @@ -68,7 +69,7 @@ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements Acti */ @Override public void actionPerformed(ActionEvent e) { - log.info("Action: " + e); + log.info("Action: {}.", e); if (actionCommandList != null) { if (actionCommandList.contains(e.getActionCommand())) { actionOccured(); @@ -83,7 +84,7 @@ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements Acti * @throws java.lang.InterruptedException */ protected synchronized void waitForAction() throws InterruptedException { - log.info("Waiting for Action"); + log.info("Waiting for Action."); while (!actionPerformed) { wait(); } @@ -91,7 +92,7 @@ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements Acti } protected synchronized void actionOccured() { - log.info("Received Action"); + log.info("Received Action."); actionPerformed = true; notifyAll(); } @@ -119,7 +120,6 @@ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements Acti try { waitForAction(); } catch (InterruptedException e) { - log.error(e); } return true; case SMCCHelper.TERMINAL_NOT_PRESENT: @@ -129,7 +129,6 @@ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements Acti try { waitForAction(); } catch (InterruptedException e) { - log.error(e); } return true; case SMCCHelper.CARD_NOT_SUPPORTED: @@ -178,10 +177,10 @@ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements Acti @Override public STALResponse handleRequest(STALRequest request) { if (request instanceof QuitRequest) { - log.info("Setting state to: finished for BKUWorker " + this); + log.info("Setting state to: finished for BKUWorker {}.", this); finished = true; } else { - log.error("Unexpected request to handle: " + request); + log.error("Unexpected request to handle: {}.", request); } return null; } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractRequestHandler.java index 98b21f79..940674f9 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractRequestHandler.java @@ -19,8 +19,8 @@ package at.gv.egiz.bku.smccstal; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.smcc.SignatureCard; @@ -29,8 +29,7 @@ import at.gv.egiz.stal.STALResponse; public abstract class AbstractRequestHandler implements SMCCSTALRequestHandler, ActionListener { - private final static Log log = LogFactory - .getLog(AbstractRequestHandler.class); + private final Logger log = LoggerFactory.getLogger(AbstractRequestHandler.class); protected SignatureCard card; protected BKUGUIFacade gui; 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 d0762da9..b8f85a60 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 @@ -24,8 +24,8 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.smcc.SignatureCard; @@ -37,7 +37,7 @@ import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.StatusRequest; public abstract class AbstractSMCCSTAL implements STAL { - private static Log log = LogFactory.getLog(AbstractSMCCSTAL.class); + private final Logger log = LoggerFactory.getLogger(AbstractSMCCSTAL.class); public final static int DEFAULT_MAX_RETRIES = 1; @@ -66,7 +66,7 @@ public abstract class AbstractSMCCSTAL implements STAL { private STALResponse getResponse(STALRequest request) throws InterruptedException { int retryCounter = 0; while (retryCounter < maxRetries) { - log.info("Retry #" + retryCounter + " of " + maxRetries); + log.info("Retry #{} of {}.", retryCounter, maxRetries); SMCCSTALRequestHandler handler = null; handler = handlerMap.get(request.getClass().getSimpleName()); if (handler != null) { @@ -80,7 +80,7 @@ public abstract class AbstractSMCCSTAL implements STAL { STALResponse response = handler.handleRequest(request); if (response != null) { if (response instanceof ErrorResponse) { - log.info("Got an error response"); + log.info("Got an error response."); ErrorResponse err = (ErrorResponse) response; if (unrecoverableErrors.contains(err.getErrorCode())) { return response; @@ -89,8 +89,8 @@ public abstract class AbstractSMCCSTAL implements STAL { signatureCard.disconnect(true); signatureCard = null; } else { - log.info("Exceeded max retries, returning error " - + err.getErrorMessage()); + log.info("Exceeded max retries, returning error {}.", err + .getErrorMessage()); return response; } } else { @@ -101,10 +101,10 @@ public abstract class AbstractSMCCSTAL implements STAL { return null; } } catch (InterruptedException e) { - log.info("Interrupt during request handling, do not retry"); + log.info("Interrupt during request handling, do not retry."); throw e; } catch (Exception e) { - log.info("Error while handling STAL request:", e); + log.info("Error while handling STAL request.", e); if (++retryCounter < maxRetries) { signatureCard.disconnect(true); signatureCard = null; @@ -114,7 +114,7 @@ public abstract class AbstractSMCCSTAL implements STAL { } } } else { - log.error("Cannot find a handler for STAL request: " + request); + log.error("Cannot find a handler for STAL request: {}.", request); return new ErrorResponse(); } } @@ -129,25 +129,24 @@ public abstract class AbstractSMCCSTAL implements STAL { */ @Override public List<STALResponse> handleRequest(List<? extends STALRequest> requestList) { - log.debug("Got request list containing " + requestList.size() - + " STAL requests"); + log.debug("Got request list containing {} STAL requests.", requestList.size()); List<STALResponse> responseList = new ArrayList<STALResponse>(requestList .size()); for (STALRequest request : requestList) { - log.info("Processing: " + request.getClass()); + log.info("Processing: {}.", request.getClass()); STALResponse response; try { response = getResponse(request); if (response != null) { responseList.add(response); if (response instanceof ErrorResponse) { - log.info("Got an error response, don't process remaining requests"); + log.info("Got an error response, don't process remaining requests."); break; } } } catch (InterruptedException ex) { - log.error("interrupted during request handling"); - throw new RuntimeException("interrupted during request handling", ex); + log.error("Interrupted during request handling."); + throw new RuntimeException("nterrupted during request handling", ex); } } @@ -156,12 +155,12 @@ public abstract class AbstractSMCCSTAL implements STAL { public void addRequestHandler(Class<? extends STALRequest> id, SMCCSTALRequestHandler handler) { - log.debug("Registering STAL request handler: " + id.getSimpleName()); + log.trace("Registering STAL request handler: {}.", id.getSimpleName()); handlerMap.put(id.getSimpleName(), handler); } public void removeRequestHandler(Class<? extends STALRequest> id) { - log.debug("De-registering STAL request handler: " + id.getSimpleName()); + log.trace("De-registering STAL request handler: {}", id.getSimpleName()); handlerMap.remove(id.getSimpleName()); } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java index b34ab862..a2042589 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java @@ -18,8 +18,8 @@ package at.gv.egiz.bku.smccstal; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.pin.gui.VerifyPINGUI; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.smcc.CancelledException; import at.gv.egiz.smcc.LockedException; @@ -34,7 +34,7 @@ import at.gv.egiz.stal.STALResponse; public class InfoBoxReadRequestHandler extends AbstractRequestHandler { - private static Log log = LogFactory.getLog(InfoBoxReadRequestHandler.class); + private final Logger log = LoggerFactory.getLogger(InfoBoxReadRequestHandler.class); // protected PINProviderFactory pinProviderFactory; @@ -46,7 +46,7 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler { try { if (infoBox.getInfoboxIdentifier().equals("IdentityLink")) { newSTALMessage("Message.RequestCaption", "Message.IdentityLink"); - log.debug("Handling identitylink infobox"); + log.debug("Handling identitylink infobox."); byte[] resp = card.getInfobox(infoBox.getInfoboxIdentifier(), new VerifyPINGUI(gui), infoBox.getDomainIdentifier()); @@ -58,7 +58,7 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler { resp = DomainIdConverter.convertDomainId(resp, infoBox .getDomainIdentifier()); } catch (Exception e) { - log.error("Cannot convert domain specific id", e); + log.error("Cannot convert domain specific id.", e); return new ErrorResponse(1000); } } @@ -68,7 +68,7 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler { } else if (SignatureCard.KeyboxName.CERITIFIED_KEYPAIR.equals(infoBox .getInfoboxIdentifier())) { newSTALMessage("Message.RequestCaption", "Message.CertifiedKeypair"); - log.debug("Handling certified keypair infobox"); + log.debug("Handling certified keypair infobox."); byte[] resp = card .getCertificate(SignatureCard.KeyboxName.CERITIFIED_KEYPAIR); if (resp == null) { @@ -81,7 +81,7 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler { .equals(infoBox.getInfoboxIdentifier())) { newSTALMessage("Message.RequestCaption", "Message.SecureSignatureKeypair"); - log.debug("Handling secure signature keypair infobox"); + log.debug("Handling secure signature keypair infobox."); byte[] resp = card .getCertificate(SignatureCard.KeyboxName.SECURE_SIGNATURE_KEYPAIR); if (resp == null) { @@ -92,8 +92,8 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler { return stalResp; } else { newSTALMessage("Message.RequestCaption", "Message.InfoboxReadRequest"); - log.warn("Unknown infobox identifier: " - + infoBox.getInfoboxIdentifier() + " trying generic request"); + log.warn("Unknown infobox identifier: {} trying generic request.", + infoBox.getInfoboxIdentifier()); byte[] resp = card.getInfobox(infoBox.getInfoboxIdentifier(), new VerifyPINGUI(gui), infoBox.getDomainIdentifier()); @@ -105,7 +105,7 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler { return stalResp; } } catch (IllegalArgumentException e) { - log.info("Infobox " + infoBox.getInfoboxIdentifier() + " not supported."); + log.info("Infobox {} not supported.", infoBox.getInfoboxIdentifier()); return new ErrorResponse(4002); } catch (NotActivatedException e) { log.info("Citizen card not activated.", e); @@ -122,14 +122,14 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler { BKUGUIFacade.MESSAGE_WAIT); return new ErrorResponse(6001); } catch (CancelledException cx) { - log.debug("User cancelled request", cx); + log.debug("User cancelled request.", cx); return new ErrorResponse(6001); } catch (SignatureCardException e) { - log.info("Error while reading infobox: " + e); + log.info("Error while reading infobox. " + e); return new ErrorResponse(4000); } } else { - log.fatal("Got unexpected STAL request: " + request); + log.error("Got unexpected STAL request: {}.", request); return new ErrorResponse(1000); } } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java index 5b436d16..52804f79 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java @@ -27,8 +27,8 @@ import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.smcc.CancelledException; import at.gv.egiz.smcc.LockedException; @@ -47,14 +47,15 @@ import at.gv.egiz.stal.signedinfo.SignedInfoType; public class SignRequestHandler extends AbstractRequestHandler { - private static Log log = LogFactory.getLog(SignRequestHandler.class); + private final Logger log = LoggerFactory.getLogger(SignRequestHandler.class); private static JAXBContext jaxbContext; static { try { jaxbContext = JAXBContext.newInstance(ObjectFactory.class.getPackage().getName()); } catch (JAXBException e) { - log.fatal("Cannot init jaxbContext", e); + Logger log = LoggerFactory.getLogger(SignRequestHandler.class); + log.error("Cannot init jaxbContext", e); } } @@ -75,7 +76,7 @@ public class SignRequestHandler extends AbstractRequestHandler { InputStream is = new ByteArrayInputStream(signReq.getSignedInfo()); JAXBElement<SignedInfoType> si = (JAXBElement<SignedInfoType>) unmarshaller.unmarshal(is); String signatureMethod = si.getValue().getSignatureMethod().getAlgorithm(); - log.debug("Found signature method: " + signatureMethod); + log.debug("Found signature method: {}.", signatureMethod); KeyboxName kb = SignatureCard.KeyboxName.getKeyboxName(signReq.getKeyIdentifier()); byte[] resp = card.createSignature(new ByteArrayInputStream(signReq.getSignedInfo()), kb, @@ -101,7 +102,7 @@ public class SignRequestHandler extends AbstractRequestHandler { BKUGUIFacade.MESSAGE_WAIT); return new ErrorResponse(6001); } catch (CancelledException cx) { - log.debug("User cancelled request"); + log.debug("User cancelled request."); return new ErrorResponse(6001); } catch (TimeoutException ex) { log.error("Timeout during pin entry"); @@ -116,14 +117,14 @@ public class SignRequestHandler extends AbstractRequestHandler { log.error("Error while creating signature: " + e); return new ErrorResponse(4000); } catch (JAXBException e) { - log.error("Cannot unmarshall signed info", e); + log.error("Cannot unmarshall signed info.", e); return new ErrorResponse(1000); } catch (IOException e) { log.error("Error while creating signature: " + e); return new ErrorResponse(4000); } } else { - log.fatal("Got unexpected STAL request: " + request); + log.error("Got unexpected STAL request: {}.", request); return new ErrorResponse(1000); } } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/StatusRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/StatusRequestHandler.java index 56b24920..470a8255 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/StatusRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/StatusRequestHandler.java @@ -24,8 +24,8 @@ import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.StatusRequest; import at.gv.egiz.stal.StatusResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -33,7 +33,7 @@ import org.apache.commons.logging.LogFactory; */ public class StatusRequestHandler extends AbstractRequestHandler { - protected static final Log log = LogFactory.getLog(StatusRequestHandler.class); + private final Logger log = LoggerFactory.getLogger(StatusRequestHandler.class); @Override public void init(SignatureCard sc, BKUGUIFacade gui) { @@ -45,13 +45,13 @@ public class StatusRequestHandler extends AbstractRequestHandler { public STALResponse handleRequest(STALRequest request) throws InterruptedException { if (request instanceof StatusRequest) { - log.info("handling STATUS request"); + log.info("Handling STATUS request."); SMCCHelper smccHelper = new SMCCHelper(); StatusResponse response = new StatusResponse(); if (log.isTraceEnabled()) { - log.trace("SMCC result code: " + smccHelper.getResultCode() + - ", cardReady: " + - (smccHelper.getResultCode() == SMCCHelper.CARD_FOUND)); + log.trace("SMCC result code: {}, cardReady: {}.", smccHelper + .getResultCode(), + (smccHelper.getResultCode() == SMCCHelper.CARD_FOUND)); } if (smccHelper.getResultCode() == SMCCHelper.CARD_FOUND) { response.setCardReady(Boolean.TRUE); @@ -60,7 +60,7 @@ public class StatusRequestHandler extends AbstractRequestHandler { } return response; } else { - log.error("Got unexpected STAL request: " + request); + log.error("Got unexpected STAL request: {}.", request); return new ErrorResponse(1000); } } diff --git a/smccSTALExt/pom.xml b/smccSTALExt/pom.xml index fd47a79b..2411ba8e 100644 --- a/smccSTALExt/pom.xml +++ b/smccSTALExt/pom.xml @@ -1,13 +1,13 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <groupId>at.gv.egiz</groupId> <artifactId>smccSTALExt</artifactId> - <version>1.2.14-SNAPSHOT</version> + <version>${project.parent.version}</version> <name>smcc STAL Extension</name> <dependencies> <dependency> @@ -16,6 +16,10 @@ <version>${project.parent.version}</version> </dependency> <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> <groupId>at.gv.egiz</groupId> <artifactId>BKUGuiExt</artifactId> <version>${project.parent.version}</version> diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINGUI.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINGUI.java index 26a24609..eadecc11 100644 --- a/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINGUI.java +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINGUI.java @@ -20,14 +20,14 @@ import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.PINManagementGUIFacade; import at.gv.egiz.bku.gui.PINManagementGUIFacade.DIALOG; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.smcc.pin.gui.ModifyPINGUI; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ManagementPINGUI extends ManagementPINProvider implements ModifyPINGUI { - protected static final Log log = LogFactory.getLog(ManagementPINGUI.class); + protected static final Logger log = LoggerFactory.getLogger(ManagementPINGUI.class); private boolean retry = false; @@ -36,7 +36,7 @@ public class ManagementPINGUI extends ManagementPINProvider implements ModifyPIN } @Override - public void modifyPINDirect(PINSpec spec, int retries) + public void modifyPINDirect(PinInfo spec, int retries) throws CancelledException, InterruptedException { gui.showModifyPINDirect(type, spec, (retry) ? retries : -1); retry = true; @@ -48,19 +48,19 @@ public class ManagementPINGUI extends ManagementPINProvider implements ModifyPIN } @Override - public void enterCurrentPIN(PINSpec spec, int retries) { + public void enterCurrentPIN(PinInfo spec, int retries) { gui.showEnterCurrentPIN(type, spec, (retry) ? retries : -1); retry = true; } @Override - public void enterNewPIN(PINSpec spec) { + public void enterNewPIN(PinInfo spec) { gui.showEnterNewPIN(type, spec); retry = true; } @Override - public void confirmNewPIN(PINSpec spec) { + public void confirmNewPIN(PinInfo spec) { gui.showConfirmNewPIN(type, spec); retry = true; } diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINProvider.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINProvider.java index 8d842d13..488ea754 100644 --- a/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINProvider.java +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINProvider.java @@ -19,14 +19,14 @@ package at.gv.egiz.bku.pin.gui; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.PINManagementGUIFacade; import at.gv.egiz.smcc.CancelledException; -import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.PinInfo; import at.gv.egiz.smcc.pin.gui.ModifyPINProvider; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ManagementPINProvider extends AbstractPINProvider implements ModifyPINProvider { - protected static final Log log = LogFactory.getLog(ManagementPINProvider.class); + private final Logger log = LoggerFactory.getLogger(ManagementPINProvider.class); protected PINManagementGUIFacade gui; protected PINManagementGUIFacade.DIALOG type; private boolean retry = false; @@ -37,16 +37,16 @@ public class ManagementPINProvider extends AbstractPINProvider implements Modify } @Override - public char[] provideCurrentPIN(PINSpec spec, int retries) + public char[] provideCurrentPIN(PinInfo spec, int retries) throws CancelledException, InterruptedException { gui.showPINDialog(type, spec, (retry) ? retries : -1, this, "change", this, "cancel"); - log.trace("[" + Thread.currentThread().getName() + "] wait for action"); + log.trace("[{}] wait for action.", Thread.currentThread().getName()); waitForAction(); - log.trace("[" + Thread.currentThread().getName() + "] received action " + action); + log.trace("[{}] received action {}.", Thread.currentThread().getName(), action); gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT, BKUGUIFacade.MESSAGE_WAIT); @@ -60,7 +60,7 @@ public class ManagementPINProvider extends AbstractPINProvider implements Modify } @Override - public char[] provideNewPIN(PINSpec spec) + public char[] provideNewPIN(PinInfo spec) throws CancelledException, InterruptedException { char[] pin = gui.getPin(); @@ -73,9 +73,9 @@ public class ManagementPINProvider extends AbstractPINProvider implements Modify this, "activate", this, "cancel"); - log.trace("[" + Thread.currentThread().getName() + "] wait for action"); + log.trace("[{}] wait for action.", Thread.currentThread().getName()); waitForAction(); - log.trace("[" + Thread.currentThread().getName() + "] received action " + action); + log.trace("[{}] received action {}.", Thread.currentThread().getName(), action); gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT, BKUGUIFacade.MESSAGE_WAIT); 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 index 533206b3..b39a451a 100644 --- a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java @@ -30,10 +30,9 @@ 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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; -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; @@ -57,7 +56,7 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler implements Ac /** * Logging facility. */ - private static Log log = LogFactory.getLog(CardMgmtRequestHandler.class); + private final Logger log = LoggerFactory.getLogger(CardMgmtRequestHandler.class); /** * The sequence counter. @@ -77,12 +76,13 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler implements Ac if (request instanceof APDUScriptRequest) { currentActivationScript++; - log.debug("handling APDU script " + 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."); + log.error("SignatureCard instance '{}' does not support card management requests.", + card.getClass().getName()); return new ErrorResponse(1000); } @@ -92,22 +92,22 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler implements Ac ((ActivationGUIFacade) gui).showActivationProgressDialog(currentActivationScript, script.size(), this, "cancel"); try { - log.trace("begin exclusive"); + log.trace("Begin exclusive."); icc.beginExclusive(); for (RequestScriptElement scriptElement : script) { ((ActivationGUIFacade) gui).incrementProgress(); if (scriptElement instanceof Command) { - log.trace("handling APDU script element COMMAND"); + log.trace("Handling APDU script element COMMAND."); Command command = (Command) scriptElement; CommandAPDU commandAPDU = new CommandAPDU(command.getCommandAPDU()); - log.trace("get basicchannel"); + log.trace("Get basicchannel."); CardChannel channel = icc.getBasicChannel(); sequenceNum = command.getSequence(); - log.debug("Transmit APDU (sequence=" + sequenceNum + ")"); + log.debug("Transmit APDU (sequence={}).", sequenceNum); log.trace(commandAPDU.toString()); ResponseAPDU responseAPDU = channel.transmit(commandAPDU); log.trace(responseAPDU.toString()); @@ -127,14 +127,14 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler implements Ac } else if (scriptElement instanceof Reset) { - log.trace("handling APDU script element RESET"); + log.trace("Handling APDU script element RESET."); sequenceNum = 0; card.reset(); javax.smartcardio.ATR atr = icc.getATR(); - log.trace("got ATR: " + atr.toString()); + log.trace("Got ATR: {}.", atr.toString()); responses.add(new ATR(atr.getBytes())); - log.trace("regain exclusive access to card"); + log.trace("Regain exclusive access to card."); icc = card.getCard(); icc.beginExclusive(); } @@ -148,22 +148,23 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler implements Ac log.info("Failed to reset smart card.", e); responses.add(new Response(sequenceNum, null, null, Response.RC_UNSPECIFIED)); } catch (RuntimeException e) { - log.error(e); + log.error(e.getMessage(), e); throw e; } finally { try { icc.endExclusive(); } catch (CardException e) { - log.info(e); + log.info(e.getMessage(), e); } } - log.trace("done handling APDU script " + currentActivationScript + ", return response containing " + responses.size() + " elements"); + log.trace("Done handling APDU script {}, return response containing {} elements.", + currentActivationScript, responses.size()); ((ActivationGUIFacade) gui).showIdleDialog(this, "cancel"); return new APDUScriptResponse(responses); } else { - log.error("Got unexpected STAL request: " + request); + log.error("Got unexpected STAL request: {}.", request); return new ErrorResponse(1000); } 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 index f87f43f7..961e7f26 100644 --- a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java @@ -16,16 +16,11 @@ */ 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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; -import at.gv.egiz.bku.gui.PINManagementGUI; import at.gv.egiz.bku.gui.PINManagementGUIFacade; -import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; import at.gv.egiz.bku.pin.gui.ManagementPINGUI; import at.gv.egiz.bku.pin.gui.VerifyPINGUI; import at.gv.egiz.smcc.CancelledException; @@ -35,11 +30,9 @@ 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.PinInfo; import at.gv.egiz.smcc.SignatureCardException; import at.gv.egiz.smcc.TimeoutException; -import at.gv.egiz.smcc.PINMgmtSignatureCard.PIN_STATE; -import at.gv.egiz.smcc.SignatureCard.KeyboxName; import at.gv.egiz.stal.ErrorResponse; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; @@ -52,9 +45,7 @@ import at.gv.egiz.stal.ext.PINManagementResponse; */ public class PINManagementRequestHandler extends AbstractRequestHandler { - protected static final Log log = LogFactory.getLog(PINManagementRequestHandler.class); - - protected Map<PINSpec, STATUS> pinStates = new HashMap<PINSpec, STATUS>(); + private final Logger log = LoggerFactory.getLogger(PINManagementRequestHandler.class); @Override public STALResponse handleRequest(STALRequest request) throws InterruptedException { @@ -62,27 +53,21 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { PINManagementGUIFacade gui = (PINManagementGUIFacade) this.gui; - PINSpec selectedPIN = null; + PinInfo selectedPIN = null; try { + PinInfo[] pinInfos = null; + if (card instanceof PINMgmtSignatureCard) { try { - // check if activated - card.getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR); - - // 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"); - - } catch (NotActivatedException ex) { - log.error("pin management not allowed, card not activated"); + pinInfos = ((PINMgmtSignatureCard) card).getPinInfos(); + gui.showPINManagementDialog(pinInfos, this, "activate_enterpin", + "change_enterpin", "unblock_enterpuk", "verify_enterpin", + this, "cancel"); + } catch (SignatureCardException ex) { + log.error("Card not activated, pin management not available (STARCOS G3)."); gui.showErrorDialog(PINManagementGUIFacade.ERR_CARD_NOTACTIVATED, null, this, "cancel"); } @@ -99,13 +84,16 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { waitForAction(); if ("cancel".equals(actionCommand)) { - log.debug("pin management cancel"); + log.debug("Pin management cancel."); return new PINManagementResponse(); } else { - selectedPIN = gui.getSelectedPINSpec(); + selectedPIN = gui.getSelectedPinInfo(); if (selectedPIN == null) { - throw new NullPointerException("no PIN selected for activation/change"); + log.error("No PIN selected for activation/change."); + gui.showErrorDialog(PINManagementGUIFacade.ERR_UNKNOWN_WITH_PARAM, + new Object[] {"no pin selected"}, this, "cancel"); + continue; } try { @@ -119,24 +107,24 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { verifyPIN(selectedPIN); } } catch (CancelledException ex) { - log.trace("cancelled"); + log.trace("Cancelled."); } catch (TimeoutException ex) { - log.error("Timeout during pin entry"); + 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); + log.error("{} locked.", selectedPIN.getLocalizedName()); +// 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); + log.error("{} not active.", selectedPIN.getLocalizedName()); +// updatePINState(selectedPIN, STATUS.NOT_ACTIV); gui.showErrorDialog(PINManagementGUIFacade.ERR_NOT_ACTIVE, new Object[] {selectedPIN.getLocalizedName()}, this, null); @@ -147,7 +135,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { // } catch (PINFormatException ex) { } catch (PINOperationAbortedException ex) { - log.error("pin operation aborted without further details"); + log.error("Pin operation aborted without further details."); gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_OPERATION_ABORTED, new Object[] {selectedPIN.getLocalizedName()}, this, null); @@ -156,18 +144,18 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { } // end if selectedPIN = null; - gui.showPINManagementDialog(pinStates, + gui.showPINManagementDialog(pinInfos, 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 (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, @@ -176,33 +164,33 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { return new ErrorResponse(1000); } } else { - log.error("Got unexpected STAL request: " + request); + log.error("Got unexpected STAL request: {}.", request); return new ErrorResponse(1000); } } - private void activatePIN(PINSpec selectedPIN) - throws InterruptedException, SignatureCardException, GetPINStatusException { + private void activatePIN(PinInfo selectedPIN) + throws InterruptedException, SignatureCardException { - log.info("activate " + selectedPIN.getLocalizedName()); + log.info("Activate {}.", selectedPIN.getLocalizedName()); ManagementPINGUI pinGUI = new ManagementPINGUI((PINManagementGUIFacade) gui, PINManagementGUIFacade.DIALOG.ACTIVATE); - boolean reentry; + boolean reentry = false; do { try { - reentry = false; ((PINMgmtSignatureCard) card).activatePIN(selectedPIN, pinGUI); } catch (PINConfirmationException ex) { reentry = true; - log.error("confirmation pin does not match new " + selectedPIN.getLocalizedName()); + log.error("Confirmation pin does not match new {}.", selectedPIN + .getLocalizedName()); gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_CONFIRMATION, new Object[] {selectedPIN.getLocalizedName()}, this, null); waitForAction(); } catch (PINFormatException ex) { reentry = true; - log.error("wrong format of new " + selectedPIN.getLocalizedName()); + log.error("Wrong format of new {}.", selectedPIN.getLocalizedName()); String pinSize = String.valueOf(selectedPIN.getMinLength()); if (selectedPIN.getMinLength() != selectedPIN.getMaxLength()) { pinSize += "-" + selectedPIN.getMaxLength(); @@ -214,7 +202,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { } } while (reentry); - updatePINState(selectedPIN, STATUS.ACTIV); +// updatePINState(selectedPIN, STATUS.ACTIV); gui.showMessageDialog(PINManagementGUIFacade.TITLE_ACTIVATE_SUCCESS, PINManagementGUIFacade.MESSAGE_ACTIVATE_SUCCESS, new Object[]{selectedPIN.getLocalizedName()}, @@ -222,20 +210,19 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { waitForAction(); } - private void verifyPIN(PINSpec selectedPIN) - throws InterruptedException, SignatureCardException, GetPINStatusException { + private void verifyPIN(PinInfo selectedPIN) + throws InterruptedException, SignatureCardException { - log.info("verify " + selectedPIN.getLocalizedName()); + log.info("Verify {}.", selectedPIN.getLocalizedName()); VerifyPINGUI pinGUI = new VerifyPINGUI(gui); - boolean reentry; + boolean reentry = false; do { try { - reentry = false; ((PINMgmtSignatureCard) card).verifyPIN(selectedPIN, pinGUI); } catch (PINFormatException ex) { reentry = true; - log.error("wrong format of new " + selectedPIN.getLocalizedName()); + log.error("Wrong format of new {}.", selectedPIN.getLocalizedName()); String pinSize = String.valueOf(selectedPIN.getMinLength()); if (selectedPIN.getMinLength() != selectedPIN.getMaxLength()) { pinSize += "-" + selectedPIN.getMaxLength(); @@ -247,31 +234,30 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { } } while (reentry); - updatePINState(selectedPIN, STATUS.ACTIV); +// updatePINState(selectedPIN, STATUS.ACTIV); } - private void changePIN(PINSpec selectedPIN) - throws SignatureCardException, GetPINStatusException, InterruptedException { + private void changePIN(PinInfo selectedPIN) + throws SignatureCardException, InterruptedException { - log.info("change " + selectedPIN.getLocalizedName()); + log.info("Change {}.", selectedPIN.getLocalizedName()); ManagementPINGUI pinGUI = new ManagementPINGUI((PINManagementGUIFacade) gui, PINManagementGUIFacade.DIALOG.CHANGE); - boolean reentry; + boolean reentry = false; do { try { - reentry = false; ((PINMgmtSignatureCard) card).changePIN(selectedPIN, pinGUI); } catch (PINConfirmationException ex) { reentry = true; - log.error("confirmation pin does not match new " + selectedPIN.getLocalizedName()); + log.error("Confirmation pin does not match new {}.", selectedPIN.getLocalizedName()); gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_CONFIRMATION, new Object[] {selectedPIN.getLocalizedName()}, this, null); waitForAction(); } catch (PINFormatException ex) { reentry = true; - log.error("wrong format of new " + selectedPIN.getLocalizedName()); + log.error("Wrong format of new {}.", selectedPIN.getLocalizedName()); String pinSize = String.valueOf(selectedPIN.getMinLength()); if (selectedPIN.getMinLength() != selectedPIN.getMaxLength()) { pinSize += "-" + selectedPIN.getMaxLength(); @@ -283,7 +269,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { } } while (reentry); - updatePINState(selectedPIN, STATUS.ACTIV); +// updatePINState(selectedPIN, STATUS.ACTIV); gui.showMessageDialog(PINManagementGUIFacade.TITLE_CHANGE_SUCCESS, PINManagementGUIFacade.MESSAGE_CHANGE_SUCCESS, new Object[]{selectedPIN.getLocalizedName()}, @@ -291,28 +277,28 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { waitForAction(); } - private void unblockPIN(PINSpec selectedPIN) - throws SignatureCardException, GetPINStatusException, InterruptedException { + private void unblockPIN(PinInfo selectedPIN) + throws SignatureCardException, InterruptedException { - log.info("unblock " + selectedPIN.getLocalizedName()); + log.info("Unblock {}.", selectedPIN.getLocalizedName()); ManagementPINGUI pinGUI = new ManagementPINGUI((PINManagementGUIFacade) gui, PINManagementGUIFacade.DIALOG.UNBLOCK); - boolean reentry; + boolean reentry = false; do { try { - reentry = false; ((PINMgmtSignatureCard) card).unblockPIN(selectedPIN, pinGUI); } catch (PINConfirmationException ex) { reentry = true; - log.error("confirmation pin does not match new " + selectedPIN.getLocalizedName()); + log.error("Confirmation pin does not match new {}.", selectedPIN + .getLocalizedName()); gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_CONFIRMATION, new Object[] {selectedPIN.getLocalizedName()}, this, null); waitForAction(); } catch (PINFormatException ex) { reentry = true; - log.error("wrong format of new " + selectedPIN.getLocalizedName()); + log.error("Wrong format of new {}.", selectedPIN.getLocalizedName()); String pinSize = String.valueOf(selectedPIN.getMinLength()); if (selectedPIN.getMinLength() != selectedPIN.getMaxLength()) { pinSize += "-" + selectedPIN.getMaxLength(); @@ -324,7 +310,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { } } while (reentry); - updatePINState(selectedPIN, STATUS.ACTIV); +// updatePINState(selectedPIN, STATUS.ACTIV); gui.showMessageDialog(PINManagementGUIFacade.TITLE_UNBLOCK_SUCCESS, PINManagementGUIFacade.MESSAGE_UNBLOCK_SUCCESS, new Object[]{selectedPIN.getLocalizedName()}, @@ -344,28 +330,28 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { * @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); - } - } +// 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/utils/pom.xml b/utils/pom.xml index 78238397..89e5f5c0 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -1,37 +1,20 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> - <artifactId>bku</artifactId> + <artifactId>mocca</artifactId> <groupId>at.gv.egiz</groupId> - <version>1.2.14-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>at.gv.egiz</groupId> <artifactId>utils</artifactId> <name>BKU Utils</name> <packaging>jar</packaging> - <version>1.2.14-SNAPSHOT</version> + <version>${parent.version}</version> <url>http://bku.egiz.gv.at</url> - <build> - <plugins> - <!-- - the unpack goal binds by default to process-sources | also works - until phase prepare-package <plugin> - <artifactId>maven-dependency-plugin</artifactId> <executions> - <execution> <id>unpack</id> <goals> <goal>unpack</goal> </goals> - <configuration> - <outputDirectory>${project.build.outputDirectory}</outputDirectory> - <excludes>META-INF\/</excludes> <artifactItems> <artifactItem> - <groupId>at.gv.egiz</groupId> <artifactId>slbinding</artifactId> - <type>jar</type> </artifactItem> <artifactItem> - <groupId>at.gv.egiz</groupId> <artifactId>idlink</artifactId> - <type>jar</type> </artifactItem> </artifactItems> </configuration> - </execution> </executions> </plugin --> - </plugins> - </build> <dependencies> <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> </dependency> <dependency> <groupId>iaik</groupId> @@ -51,27 +34,4 @@ <artifactId>jaxb-impl</artifactId> </dependency> </dependencies> - <!-- - add dependencies to determine build order of BKU modules | (scope - provided -> don't include dependencies in assembly) <dependencies> - <dependency> <groupId>at.gv.egiz</groupId> - <artifactId>slbinding</artifactId> <version>1.0.0-SNAPSHOTOT</version> - <scope>provided</scope> </dependency> <dependency> - <groupId>at.gv.egiz</groupId> <artifactId>idlink</artifactId> - <versio1.0.0-SNAPSHOTSHOT</version> <scope>provided</scope> </dependency> - </dependencies --> - <!-- - repositories> <repository> <id>maven2-repository.dev.java.net</id> - <name>Java.net Maven 2 Repository</name> - <url>http://download.java.net/maven/2</url> </repository> <repository> - <id>maven-repository.dev.java.net</id> <name>Java.net Maven 1 - Repository (legacy)</name> <url>http://download.java.net/maven/1</url> - <layout>legacy</layout> </repository> </repositories> - <pluginRepositories> <pluginRepository> - <id>maven2-repository.dev.java.net</id> <name>Java.net Maven 2 - Repository</name> <url>http://download.java.net/maven/2</url> - </pluginRepository> <pluginRepository> - <id>maven-repository.dev.java.net</id> <name>Java.net Maven 1 - Repository (legacy)</name> <url>http://download.java.net/maven/1</url> - <layout>legacy</layout> </pluginRepository> </pluginRepositories --> </project> diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AccessAuthorizationType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AccessAuthorizationType.java index 53a93ab9..6327a489 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AccessAuthorizationType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AccessAuthorizationType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AllSignatoriesType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AllSignatoriesType.java index 61b2e5cf..476ffcfd 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AllSignatoriesType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AllSignatoriesType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AnyChildrenType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AnyChildrenType.java index 4ed236fd..b20b5221 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AnyChildrenType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AnyChildrenType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // @@ -44,7 +28,7 @@ import org.w3c.dom.Element; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence maxOccurs="unbounded" minOccurs="0"> - * <any/> + * <any processContents='lax'/> * </sequence> * </restriction> * </complexContent> diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AnyMixedChildrenType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AnyMixedChildrenType.java index bff6c7ca..3358a3df 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AnyMixedChildrenType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AnyMixedChildrenType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // @@ -46,7 +30,7 @@ import org.w3c.dom.Element; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence maxOccurs="unbounded" minOccurs="0"> - * <any/> + * <any processContents='lax'/> * </sequence> * </restriction> * </complexContent> @@ -86,9 +70,9 @@ public class AnyMixedChildrenType { * * <p> * Objects of the following type(s) are allowed in the list + * {@link String } * {@link Element } * {@link Object } - * {@link String } * * */ diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AuthenticationClassType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AuthenticationClassType.java index d07d5cc1..fcae976c 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AuthenticationClassType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/AuthenticationClassType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64ContentType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64ContentType.java index 641a12d0..4a49a511 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64ContentType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64ContentType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64OptRefContentType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64OptRefContentType.java index fe183a4f..6c06f607 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64OptRefContentType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64OptRefContentType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLContentType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLContentType.java index 096f8451..ac7a589b 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLContentType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLContentType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLLocRefContentType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLLocRefContentType.java index 7b93bb99..9b33d94b 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLLocRefContentType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLLocRefContentType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLLocRefOptRefContentType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLLocRefOptRefContentType.java index 2b0b0552..4c2043e1 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLLocRefOptRefContentType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLLocRefOptRefContentType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLLocRefReqRefContentType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLLocRefReqRefContentType.java index ab9e985e..90d9972c 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLLocRefReqRefContentType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLLocRefReqRefContentType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLOptRefContentType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLOptRefContentType.java index 9f3ebef8..fb07d24a 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLOptRefContentType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/Base64XMLOptRefContentType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/BindingType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/BindingType.java index e2cedd56..dd965cd4 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/BindingType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/BindingType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSDataObjectOptionalMetaType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSDataObjectOptionalMetaType.java index 20ab8505..eb949e30 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSDataObjectOptionalMetaType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSDataObjectOptionalMetaType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSDataObjectRequiredMetaType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSDataObjectRequiredMetaType.java index 14809176..97114732 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSDataObjectRequiredMetaType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSDataObjectRequiredMetaType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSEncryptedContentType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSEncryptedContentType.java index f38e8b10..41b5021a 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSEncryptedContentType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSEncryptedContentType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSRecipientPublicKeyType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSRecipientPublicKeyType.java index fdd71d1e..1f11cb09 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSRecipientPublicKeyType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSRecipientPublicKeyType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSToBeEncryptedType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSToBeEncryptedType.java index 951b5ed8..e1d59e02 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSToBeEncryptedType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CMSToBeEncryptedType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CheckResultType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CheckResultType.java index b01cf5aa..313f4e83 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CheckResultType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CheckResultType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateCMSSignatureRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateCMSSignatureRequestType.java index d9473e8e..338d7a7e 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateCMSSignatureRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateCMSSignatureRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateCMSSignatureResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateCMSSignatureResponseType.java index bc9886a3..2d2bff80 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateCMSSignatureResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateCMSSignatureResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashInfoRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashInfoRequestType.java index cfbed898..41c22ad9 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashInfoRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashInfoRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashInfoResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashInfoResponseType.java index 755a12ef..f597e64d 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashInfoResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashInfoResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashRequestType.java index 5fe80ad7..e28b3140 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashResponseType.java index 702f7177..a57be745 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateHashResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateXMLSignatureRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateXMLSignatureRequestType.java index 71f6c0c2..53a07560 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateXMLSignatureRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateXMLSignatureRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateXMLSignatureResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateXMLSignatureResponseType.java index e72991d4..76061703 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateXMLSignatureResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/CreateXMLSignatureResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // @@ -41,7 +25,7 @@ import org.w3c.dom.Element; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <any/> + * <any processContents='lax'/> * </sequence> * </restriction> * </complexContent> diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DataObjectAssociationType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DataObjectAssociationType.java index 7e3fee76..8599e603 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DataObjectAssociationType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DataObjectAssociationType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DataObjectInfoType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DataObjectInfoType.java index f3a9ee5f..5079d167 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DataObjectInfoType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DataObjectInfoType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptCMSRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptCMSRequestType.java index d6b51d59..e25aafbd 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptCMSRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptCMSRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptCMSResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptCMSResponseType.java index d98e29bb..98f11f48 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptCMSResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptCMSResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptXMLRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptXMLRequestType.java index 7372130b..2fe50f26 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptXMLRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptXMLRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptXMLResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptXMLResponseType.java index 15ee4c08..286229e3 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptXMLResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/DecryptXMLResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptCMSRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptCMSRequestType.java index 1630df92..7d821677 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptCMSRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptCMSRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptCMSResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptCMSResponseType.java index 1c27b997..9fdba94e 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptCMSResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptCMSResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptXMLRequest.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptXMLRequest.java index e03b78d2..7cc0dee1 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptXMLRequest.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptXMLRequest.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptXMLRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptXMLRequestType.java index e027452c..34b958c3 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptXMLRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptXMLRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptXMLResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptXMLResponseType.java index dfbd62ee..84ee9326 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptXMLResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptXMLResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // @@ -49,7 +33,7 @@ import org.w3c.dom.Element; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <any/> + * <any processContents='lax'/> * </sequence> * </restriction> * </complexContent> @@ -140,7 +124,7 @@ public class EncryptXMLResponseType { * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <any/> + * <any processContents='lax'/> * </sequence> * </restriction> * </complexContent> diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptedDataType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptedDataType.java index 62931009..36d0cc1b 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptedDataType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptedDataType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptionInfoType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptionInfoType.java index 84fe5c49..8d070c9a 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptionInfoType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/EncryptionInfoType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ErrorResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ErrorResponseType.java index bea8704b..67a813a9 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ErrorResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ErrorResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetPropertiesRequest.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetPropertiesRequest.java index c18c8c6e..d769b093 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetPropertiesRequest.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetPropertiesRequest.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetPropertiesRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetPropertiesRequestType.java index 6e390ce1..82421d07 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetPropertiesRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetPropertiesRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetPropertiesResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetPropertiesResponseType.java index 0f546d88..f8546135 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetPropertiesResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetPropertiesResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // @@ -51,7 +35,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; * <element name="KeyboxIdentifier" type="{http://www.buergerkarte.at/namespaces/securitylayer/1.2#}QualifiedBoxIdentifierType" maxOccurs="unbounded" minOccurs="0"/> * <element name="Binding" type="{http://www.buergerkarte.at/namespaces/securitylayer/1.2#}BindingType" maxOccurs="unbounded"/> * <element name="ProtocolVersion" type="{http://www.w3.org/2001/XMLSchema}token" maxOccurs="unbounded"/> - * <any/> + * <any namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetStatusRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetStatusRequestType.java index 50c159a9..abbd20c0 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetStatusRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetStatusRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetStatusResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetStatusResponseType.java index 41ba23b8..3376cfa4 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetStatusResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/GetStatusResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/HashDataType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/HashDataType.java index de03f034..8e2fb253 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/HashDataType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/HashDataType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxAssocArrayPairType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxAssocArrayPairType.java index 996777e1..403a4c93 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxAssocArrayPairType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxAssocArrayPairType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxAvailableRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxAvailableRequestType.java index d7d12767..d9b419da 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxAvailableRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxAvailableRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxAvailableResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxAvailableResponseType.java index a3fb3b36..02154bb2 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxAvailableResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxAvailableResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxCreateRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxCreateRequestType.java index 0eaebd7b..3ef3c245 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxCreateRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxCreateRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxCreateResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxCreateResponseType.java index 16558710..b38bea30 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxCreateResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxCreateResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxDeleteRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxDeleteRequestType.java index 99a342d2..0c0b2fb0 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxDeleteRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxDeleteRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxDeleteResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxDeleteResponseType.java index 2ca2af9d..8a9abc98 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxDeleteResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxDeleteResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadDataAssocArrayType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadDataAssocArrayType.java index 2b410a53..bc43d8b5 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadDataAssocArrayType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadDataAssocArrayType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadParamsAssocArrayType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadParamsAssocArrayType.java index e9ec5140..656080a4 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadParamsAssocArrayType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadParamsAssocArrayType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadParamsBinaryFileType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadParamsBinaryFileType.java index 7d454835..5f301804 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadParamsBinaryFileType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadParamsBinaryFileType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadRequestType.java index cc155ba8..b32174e7 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadResponseType.java index 74ed20d6..feb8454b 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxReadResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxTypeType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxTypeType.java index b316a512..c599529c 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxTypeType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxTypeType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxUpdateParamsAssocArrayType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxUpdateParamsAssocArrayType.java index c952a6b8..847803b1 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxUpdateParamsAssocArrayType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxUpdateParamsAssocArrayType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxUpdateRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxUpdateRequestType.java index d7d3262a..79e5bd9d 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxUpdateRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxUpdateRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxUpdateResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxUpdateResponseType.java index 3f956cfb..b7f32196 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxUpdateResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/InfoboxUpdateResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ManifestRefsCheckResultInfoType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ManifestRefsCheckResultInfoType.java index 37b3fc92..f4e7e5bf 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ManifestRefsCheckResultInfoType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ManifestRefsCheckResultInfoType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // @@ -50,7 +34,7 @@ import org.w3c.dom.Element; * <sequence> * <element name="ReferringSigReference" type="{http://www.w3.org/2001/XMLSchema}positiveInteger"/> * <element name="FailedReference" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" maxOccurs="unbounded" minOccurs="0"/> - * <any/> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> @@ -66,8 +50,8 @@ import org.w3c.dom.Element; public class ManifestRefsCheckResultInfoType { @XmlElementRefs({ - @XmlElementRef(name = "FailedReference", namespace = "http://www.buergerkarte.at/namespaces/securitylayer/1.2#", type = JAXBElement.class), - @XmlElementRef(name = "ReferringSigReference", namespace = "http://www.buergerkarte.at/namespaces/securitylayer/1.2#", type = JAXBElement.class) + @XmlElementRef(name = "ReferringSigReference", namespace = "http://www.buergerkarte.at/namespaces/securitylayer/1.2#", type = JAXBElement.class), + @XmlElementRef(name = "FailedReference", namespace = "http://www.buergerkarte.at/namespaces/securitylayer/1.2#", type = JAXBElement.class) }) @XmlMixed @XmlAnyElement(lax = true) @@ -91,9 +75,9 @@ public class ManifestRefsCheckResultInfoType { * * <p> * Objects of the following type(s) are allowed in the list - * {@link Element } * {@link String } * {@link JAXBElement }{@code <}{@link BigInteger }{@code >} + * {@link Element } * {@link JAXBElement }{@code <}{@link BigInteger }{@code >} * {@link Object } * diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ManifestRefsCheckResultType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ManifestRefsCheckResultType.java index 9c36a603..bbe1bbea 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ManifestRefsCheckResultType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ManifestRefsCheckResultType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/MetaInfoType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/MetaInfoType.java index 50d81319..4f707af6 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/MetaInfoType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/MetaInfoType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // @@ -47,7 +31,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; * <sequence> * <element name="MimeType" type="{http://www.buergerkarte.at/namespaces/securitylayer/1.2#}MimeTypeType"/> * <element name="Description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <any/> + * <any namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/NullOperationRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/NullOperationRequestType.java index 3df4df31..956698a3 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/NullOperationRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/NullOperationRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/NullOperationResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/NullOperationResponseType.java index 84bade8d..e2a9c64e 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/NullOperationResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/NullOperationResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ObjectFactory.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ObjectFactory.java index 7c3db055..187c95e7 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ObjectFactory.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ObjectFactory.java @@ -687,7 +687,7 @@ public class ObjectFactory { * Create an instance of {@link at.buergerkarte.namespaces.securitylayer._1.CreateXMLSignatureResponseType } * */ - public at.buergerkarte.namespaces.securitylayer._1.CreateXMLSignatureResponseType createCreateXMLSignatureResponseType() { + public at.gv.egiz.slbinding.impl.CreateXMLSignatureResponseType createCreateXMLSignatureResponseType() { return new at.gv.egiz.slbinding.impl.CreateXMLSignatureResponseType(); } @@ -1204,8 +1204,8 @@ public class ObjectFactory { * */ @XmlElementDecl(namespace = "http://www.buergerkarte.at/namespaces/securitylayer/1.2#", name = "CreateXMLSignatureResponse") - public JAXBElement<at.buergerkarte.namespaces.securitylayer._1.CreateXMLSignatureResponseType> createCreateXMLSignatureResponse(at.buergerkarte.namespaces.securitylayer._1.CreateXMLSignatureResponseType value) { - return new JAXBElement<at.buergerkarte.namespaces.securitylayer._1.CreateXMLSignatureResponseType>(_CreateXMLSignatureResponse_QNAME, ((Class) at.gv.egiz.slbinding.impl.CreateXMLSignatureResponseType.class), null, ((at.gv.egiz.slbinding.impl.CreateXMLSignatureResponseType) value)); + public JAXBElement<CreateXMLSignatureResponseType> createCreateXMLSignatureResponse(at.gv.egiz.slbinding.impl.CreateXMLSignatureResponseType value) { + return new JAXBElement<CreateXMLSignatureResponseType>(_CreateXMLSignatureResponse_QNAME, CreateXMLSignatureResponseType.class, null, value); } /** diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/QualifiedBoxIdentifierType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/QualifiedBoxIdentifierType.java index 0912608b..9e294a52 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/QualifiedBoxIdentifierType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/QualifiedBoxIdentifierType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ReferencesCheckResultInfoType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ReferencesCheckResultInfoType.java index 4446361e..ae523465 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ReferencesCheckResultInfoType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ReferencesCheckResultInfoType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // @@ -48,7 +32,7 @@ import org.w3c.dom.Element; * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="FailedReference" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" maxOccurs="unbounded" minOccurs="0"/> - * <any/> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> @@ -86,8 +70,8 @@ public class ReferencesCheckResultInfoType { * * <p> * Objects of the following type(s) are allowed in the list - * {@link Element } * {@link String } + * {@link Element } * {@link JAXBElement }{@code <}{@link BigInteger }{@code >} * {@link Object } * diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ReferencesCheckResultType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ReferencesCheckResultType.java index 79a2a0c4..8f73e74a 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ReferencesCheckResultType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ReferencesCheckResultType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/RequesterIDType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/RequesterIDType.java index 8b8257e5..bdeb6fcb 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/RequesterIDType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/RequesterIDType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ReturnResultType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ReturnResultType.java index 8deef3c5..8bff4dcf 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ReturnResultType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ReturnResultType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/SignatureInfoCreationType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/SignatureInfoCreationType.java index ca5a6f6f..7a291aa8 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/SignatureInfoCreationType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/SignatureInfoCreationType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/SignatureInfoVerificationType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/SignatureInfoVerificationType.java index 64fc4295..f56fad1b 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/SignatureInfoVerificationType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/SignatureInfoVerificationType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/SignatureLocationType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/SignatureLocationType.java index f98af421..5fa2d9a8 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/SignatureLocationType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/SignatureLocationType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ToBeEncryptedType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ToBeEncryptedType.java index 18c8f0ca..cd1f287c 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ToBeEncryptedType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/ToBeEncryptedType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/TokenStatusType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/TokenStatusType.java index 7e92572b..ba8ba4b6 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/TokenStatusType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/TokenStatusType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/TransformsInfoType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/TransformsInfoType.java index e4a8f48e..4a8f0fd4 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/TransformsInfoType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/TransformsInfoType.java @@ -1,38 +1,18 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // package at.buergerkarte.namespaces.securitylayer._1; -import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlType; import org.w3._2000._09.xmldsig_.TransformsType; -import org.w3c.dom.Element; /** @@ -62,9 +42,8 @@ import org.w3c.dom.Element; }) public class TransformsInfoType { - @XmlElementRef(name = "Transforms", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class) - @XmlAnyElement(lax = true) - protected Object transforms; + @XmlElement(name = "Transforms", namespace = "http://www.w3.org/2000/09/xmldsig#") + protected TransformsType transforms; @XmlElement(name = "FinalDataMetaInfo", required = true) protected MetaInfoType finalDataMetaInfo; @@ -73,12 +52,10 @@ public class TransformsInfoType { * * @return * possible object is - * {@link JAXBElement }{@code <}{@link String }{@code >} - * {@link Object } - * {@link Element } + * {@link TransformsType } * */ - public Object getTransforms() { + public TransformsType getTransforms() { return transforms; } @@ -87,12 +64,10 @@ public class TransformsInfoType { * * @param value * allowed object is - * {@link JAXBElement }{@code <}{@link String }{@code >} - * {@link Object } - * {@link Element } + * {@link TransformsType } * */ - public void setTransforms(Object value) { + public void setTransforms(TransformsType value) { this.transforms = value; } diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/UserConfirmationSimpleType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/UserConfirmationSimpleType.java index 9419a284..0a21f86e 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/UserConfirmationSimpleType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/UserConfirmationSimpleType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/UserConfirmationType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/UserConfirmationType.java index 33d2b530..ae5662fb 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/UserConfirmationType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/UserConfirmationType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerificationResultType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerificationResultType.java index e484619f..9b142a5e 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerificationResultType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerificationResultType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyCMSSignatureRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyCMSSignatureRequestType.java index 8d6701e5..7cd799e3 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyCMSSignatureRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyCMSSignatureRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyCMSSignatureResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyCMSSignatureResponseType.java index ab44ec4d..3521f828 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyCMSSignatureResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyCMSSignatureResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // @@ -63,9 +47,9 @@ import org.w3._2000._09.xmldsig_.KeyInfoType; public class VerifyCMSSignatureResponseType { @XmlElementRefs({ + @XmlElementRef(name = "SignatureCheck", namespace = "http://www.buergerkarte.at/namespaces/securitylayer/1.2#", type = JAXBElement.class), @XmlElementRef(name = "CertificateCheck", namespace = "http://www.buergerkarte.at/namespaces/securitylayer/1.2#", type = JAXBElement.class), - @XmlElementRef(name = "SignerInfo", namespace = "http://www.buergerkarte.at/namespaces/securitylayer/1.2#", type = JAXBElement.class), - @XmlElementRef(name = "SignatureCheck", namespace = "http://www.buergerkarte.at/namespaces/securitylayer/1.2#", type = JAXBElement.class) + @XmlElementRef(name = "SignerInfo", namespace = "http://www.buergerkarte.at/namespaces/securitylayer/1.2#", type = JAXBElement.class) }) protected List<JAXBElement<?>> signerInfoAndSignatureCheckAndCertificateCheck; diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyHashInfoRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyHashInfoRequestType.java index 7b1c143d..07ede93a 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyHashInfoRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyHashInfoRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyHashRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyHashRequestType.java index ba7adb76..adc0bbbe 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyHashRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyHashRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyHashResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyHashResponseType.java index d277ebe3..e015c4b0 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyHashResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyHashResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyXMLSignatureRequestType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyXMLSignatureRequestType.java index c7ee75d4..c68b2205 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyXMLSignatureRequestType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyXMLSignatureRequestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyXMLSignatureResponseType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyXMLSignatureResponseType.java index b0106756..78456913 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyXMLSignatureResponseType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/VerifyXMLSignatureResponseType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLContentType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLContentType.java index f45220ed..d549a576 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLContentType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLContentType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLRecipientPublicKeyType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLRecipientPublicKeyType.java index a862050f..6e223f89 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLRecipientPublicKeyType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLRecipientPublicKeyType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLToBeEncryptedNewContentType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLToBeEncryptedNewContentType.java index fe1fb6db..a8e1ad8b 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLToBeEncryptedNewContentType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLToBeEncryptedNewContentType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLToBeEncryptedNewType.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLToBeEncryptedNewType.java index 7e65a1b7..6d877ec1 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLToBeEncryptedNewType.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/XMLToBeEncryptedNewType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // diff --git a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/package-info.java b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/package-info.java index 666834ce..c0a6582d 100644 --- a/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/package-info.java +++ b/utils/src/main/java/at/buergerkarte/namespaces/securitylayer/_1/package-info.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.25 at 10:41:37 AM GMT +// Generated on: 2010.02.26 at 12:32:35 PM MEZ // @javax.xml.bind.annotation.XmlSchema(namespace = "http://www.buergerkarte.at/namespaces/securitylayer/1.2#", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/AbstractAddressType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/AbstractAddressType.java index ab531403..8d02c692 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/AbstractAddressType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/AbstractAddressType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -57,6 +41,7 @@ import javax.xml.namespace.QName; * <element name="Identification" type="{http://reference.e-government.gv.at/namespace/persondata/20020228#}IdentificationType" maxOccurs="unbounded"/> * </sequence> * <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" /> + * <anyAttribute namespace='##other'/> * </restriction> * </complexContent> * </complexType> diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/AbstractPersonType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/AbstractPersonType.java index 1efb7ed5..2ad23e16 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/AbstractPersonType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/AbstractPersonType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -57,6 +41,7 @@ import javax.xml.namespace.QName; * <element name="Identification" type="{http://reference.e-government.gv.at/namespace/persondata/20020228#}IdentificationType" maxOccurs="unbounded"/> * </sequence> * <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" /> + * <anyAttribute namespace='##other'/> * </restriction> * </complexContent> * </complexType> diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/CorporateBodyType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/CorporateBodyType.java index 2474b618..b90dd571 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/CorporateBodyType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/CorporateBodyType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -54,8 +38,9 @@ import org.w3c.dom.Element; * <element name="AlternativeName" type="{http://www.w3.org/2001/XMLSchema}token" maxOccurs="unbounded" minOccurs="0"/> * <element name="LegalForm" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/> * <element name="Organisation" type="{http://www.w3.org/2001/XMLSchema}token" minOccurs="0"/> - * <any/> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * </sequence> + * <anyAttribute namespace='##other'/> * </extension> * </complexContent> * </complexType> diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/DefinedAlternativeNameTypeType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/DefinedAlternativeNameTypeType.java index 938136b7..5fe8bd3c 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/DefinedAlternativeNameTypeType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/DefinedAlternativeNameTypeType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/DefinedRelationType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/DefinedRelationType.java index 972db662..ae1c26af 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/DefinedRelationType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/DefinedRelationType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/IdentificationType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/IdentificationType.java index ae647fb5..a00b5029 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/IdentificationType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/IdentificationType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -67,9 +51,10 @@ import org.w3c.dom.Element; * </element> * <element name="Type" type="{http://www.w3.org/2001/XMLSchema}anyURI"/> * <element name="Authority" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/> - * <any/> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * </sequence> * <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" /> + * <anyAttribute namespace='##other'/> * </restriction> * </complexContent> * </complexType> diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/InternetAddressType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/InternetAddressType.java index 4787d299..dcfe1996 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/InternetAddressType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/InternetAddressType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -32,7 +16,6 @@ import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; -import org.w3._2000._09.xmldsig_.KeyInfoType; import org.w3c.dom.Element; @@ -50,8 +33,9 @@ import org.w3c.dom.Element; * <sequence minOccurs="0"> * <element ref="{http://www.w3.org/2000/09/xmldsig#}KeyInfo" minOccurs="0"/> * <element name="Address" type="{http://www.w3.org/2001/XMLSchema}anyURI"/> - * <any/> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * </sequence> + * <anyAttribute namespace='##other'/> * </extension> * </complexContent> * </complexType> @@ -69,8 +53,8 @@ public class InternetAddressType extends AbstractAddressType { - @XmlElement(name = "KeyInfo", namespace = "http://www.w3.org/2000/09/xmldsig#") - protected KeyInfoType keyInfo; + @XmlAnyElement + protected Element keyInfo; @XmlElement(name = "Address") @XmlSchemaType(name = "anyURI") protected String address; @@ -82,10 +66,10 @@ public class InternetAddressType * * @return * possible object is - * {@link KeyInfoType } + * {@link Element } * */ - public KeyInfoType getKeyInfo() { + public Element getKeyInfo() { return keyInfo; } @@ -94,10 +78,10 @@ public class InternetAddressType * * @param value * allowed object is - * {@link KeyInfoType } + * {@link Element } * */ - public void setKeyInfo(KeyInfoType value) { + public void setKeyInfo(Element value) { this.keyInfo = value; } diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/MaritalStatusType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/MaritalStatusType.java index 06a0cf72..32e22fe8 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/MaritalStatusType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/MaritalStatusType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/MobileTelcomNumberType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/MobileTelcomNumberType.java index 3ee9e156..795e28aa 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/MobileTelcomNumberType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/MobileTelcomNumberType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/ObjectFactory.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/ObjectFactory.java index 53e21a04..80d861b9 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/ObjectFactory.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/ObjectFactory.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -47,26 +31,26 @@ import javax.xml.namespace.QName; @XmlRegistry public class ObjectFactory { - private final static QName _NationalNumber_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "NationalNumber"); private final static QName _TypedPostalAddress_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "TypedPostalAddress"); + private final static QName _NationalNumber_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "NationalNumber"); private final static QName _Extension_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "Extension"); - private final static QName _Address_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "Address"); private final static QName _PhysicalPerson_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "PhysicalPerson"); - private final static QName _InternationalCountryCode_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "InternationalCountryCode"); private final static QName _CorporateBody_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "CorporateBody"); private final static QName _Mobile_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "Mobile"); - private final static QName _Person_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "Person"); private final static QName _AreaCityCode_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "AreaCityCode"); - private final static QName _Pager_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "Pager"); private final static QName _TTYTDD_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "TTYTDD"); + private final static QName _Telephone_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "Telephone"); + private final static QName _PersonName_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "PersonName"); + private final static QName _InternetAddress_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "InternetAddress"); + private final static QName _Address_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "Address"); + private final static QName _InternationalCountryCode_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "InternationalCountryCode"); + private final static QName _Person_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "Person"); + private final static QName _Pager_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "Pager"); private final static QName _PersonData_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "PersonData"); - private final static QName _SubscriberNumber_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "SubscriberNumber"); private final static QName _Fax_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "Fax"); - private final static QName _PersonName_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "PersonName"); - private final static QName _Telephone_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "Telephone"); + private final static QName _SubscriberNumber_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "SubscriberNumber"); private final static QName _PostalAddress_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "PostalAddress"); private final static QName _TelephoneAddress_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "TelephoneAddress"); - private final static QName _InternetAddress_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "InternetAddress"); private final static QName _FormattedNumber_QNAME = new QName("http://reference.e-government.gv.at/namespace/persondata/20020228#", "FormattedNumber"); /** @@ -77,27 +61,19 @@ public class ObjectFactory { } /** - * Create an instance of {@link PersonDataType } - * - */ - public PersonDataType createPersonDataType() { - return new PersonDataType(); - } - - /** - * Create an instance of {@link PhysicalPersonType } + * Create an instance of {@link MobileTelcomNumberType } * */ - public PhysicalPersonType createPhysicalPersonType() { - return new PhysicalPersonType(); + public MobileTelcomNumberType createMobileTelcomNumberType() { + return new MobileTelcomNumberType(); } /** - * Create an instance of {@link PersonNameType.Affix } + * Create an instance of {@link TelephoneAddressType } * */ - public PersonNameType.Affix createPersonNameTypeAffix() { - return new PersonNameType.Affix(); + public TelephoneAddressType createTelephoneAddressType() { + return new TelephoneAddressType(); } /** @@ -109,148 +85,147 @@ public class ObjectFactory { } /** - * Create an instance of {@link TypedPostalAddressType } + * Create an instance of {@link PhysicalPersonType } * */ - public TypedPostalAddressType createTypedPostalAddressType() { - return new TypedPostalAddressType(); + public PhysicalPersonType createPhysicalPersonType() { + return new PhysicalPersonType(); } /** - * Create an instance of {@link TelcomNumberType } + * Create an instance of {@link PhysicalPersonType.RelatedPerson } * */ - public TelcomNumberType createTelcomNumberType() { - return new TelcomNumberType(); + public PhysicalPersonType.RelatedPerson createPhysicalPersonTypeRelatedPerson() { + return new PhysicalPersonType.RelatedPerson(); } /** - * Create an instance of {@link PhysicalPersonType.AlternativeName } + * Create an instance of {@link IdentificationType } * */ - public PhysicalPersonType.AlternativeName createPhysicalPersonTypeAlternativeName() { - return new PhysicalPersonType.AlternativeName(); + public IdentificationType createIdentificationType() { + return new IdentificationType(); } /** - * Create an instance of {@link TelephoneAddressType } + * Create an instance of {@link TelcomNumberListType } * */ - public TelephoneAddressType createTelephoneAddressType() { - return new TelephoneAddressType(); + public TelcomNumberListType createTelcomNumberListType() { + return new TelcomNumberListType(); } /** - * Create an instance of {@link MobileTelcomNumberType } + * Create an instance of {@link PersonDataType.AdditionalData } * */ - public MobileTelcomNumberType createMobileTelcomNumberType() { - return new MobileTelcomNumberType(); + public PersonDataType.AdditionalData createPersonDataTypeAdditionalData() { + return new PersonDataType.AdditionalData(); } /** - * Create an instance of {@link TelcomNumberListType } + * Create an instance of {@link IdentificationType.Value } * */ - public TelcomNumberListType createTelcomNumberListType() { - return new TelcomNumberListType(); + public IdentificationType.Value createIdentificationTypeValue() { + return new IdentificationType.Value(); } /** - * Create an instance of {@link CorporateBodyType } + * Create an instance of {@link PhysicalPersonType.AlternativeName } * */ - public CorporateBodyType createCorporateBodyType() { - return new CorporateBodyType(); + public PhysicalPersonType.AlternativeName createPhysicalPersonTypeAlternativeName() { + return new PhysicalPersonType.AlternativeName(); } /** - * Create an instance of {@link PhysicalPersonType.RelatedPerson } + * Create an instance of {@link PersonNameType.FamilyName } * */ - public PhysicalPersonType.RelatedPerson createPhysicalPersonTypeRelatedPerson() { - return new PhysicalPersonType.RelatedPerson(); + public PersonNameType.FamilyName createPersonNameTypeFamilyName() { + return new PersonNameType.FamilyName(); } /** - * Create an instance of {@link PersonNameType.FormattedName } + * Create an instance of {@link PersonNameType } * */ - public PersonNameType.FormattedName createPersonNameTypeFormattedName() { - return new PersonNameType.FormattedName(); + public PersonNameType createPersonNameType() { + return new PersonNameType(); } /** - * Create an instance of {@link PersonNameType } + * Create an instance of {@link PostalAddressType.Recipient } * */ - public PersonNameType createPersonNameType() { - return new PersonNameType(); + public PostalAddressType.Recipient createPostalAddressTypeRecipient() { + return new PostalAddressType.Recipient(); } /** - * Create an instance of {@link PostalAddressType.DeliveryAddress } + * Create an instance of {@link PersonNameType.Affix } * */ - public PostalAddressType.DeliveryAddress createPostalAddressTypeDeliveryAddress() { - return new PostalAddressType.DeliveryAddress(); + public PersonNameType.Affix createPersonNameTypeAffix() { + return new PersonNameType.Affix(); } /** - * Create an instance of {@link PersonNameType.FamilyName } + * Create an instance of {@link TypedPostalAddressType } * */ - public PersonNameType.FamilyName createPersonNameTypeFamilyName() { - return new PersonNameType.FamilyName(); + public TypedPostalAddressType createTypedPostalAddressType() { + return new TypedPostalAddressType(); } /** - * Create an instance of {@link PersonDataType.AdditionalData } + * Create an instance of {@link InternetAddressType } * */ - public PersonDataType.AdditionalData createPersonDataTypeAdditionalData() { - return new PersonDataType.AdditionalData(); + public InternetAddressType createInternetAddressType() { + return new InternetAddressType(); } /** - * Create an instance of {@link PostalAddressType.Recipient } + * Create an instance of {@link CorporateBodyType } * */ - public PostalAddressType.Recipient createPostalAddressTypeRecipient() { - return new PostalAddressType.Recipient(); + public CorporateBodyType createCorporateBodyType() { + return new CorporateBodyType(); } /** - * Create an instance of {@link IdentificationType.Value } + * Create an instance of {@link PersonNameType.FormattedName } * */ - public IdentificationType.Value createIdentificationTypeValue() { - return new IdentificationType.Value(); + public PersonNameType.FormattedName createPersonNameTypeFormattedName() { + return new PersonNameType.FormattedName(); } /** - * Create an instance of {@link IdentificationType } + * Create an instance of {@link TelcomNumberType } * */ - public IdentificationType createIdentificationType() { - return new IdentificationType(); + public TelcomNumberType createTelcomNumberType() { + return new TelcomNumberType(); } /** - * Create an instance of {@link InternetAddressType } + * Create an instance of {@link PersonDataType } * */ - public InternetAddressType createInternetAddressType() { - return new InternetAddressType(); + public PersonDataType createPersonDataType() { + return new PersonDataType(); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * Create an instance of {@link PostalAddressType.DeliveryAddress } * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "NationalNumber") - public JAXBElement<String> createNationalNumber(String value) { - return new JAXBElement<String>(_NationalNumber_QNAME, String.class, null, value); + public PostalAddressType.DeliveryAddress createPostalAddressTypeDeliveryAddress() { + return new PostalAddressType.DeliveryAddress(); } /** @@ -266,18 +241,18 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "Extension") - public JAXBElement<String> createExtension(String value) { - return new JAXBElement<String>(_Extension_QNAME, String.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "NationalNumber") + public JAXBElement<String> createNationalNumber(String value) { + return new JAXBElement<String>(_NationalNumber_QNAME, String.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link AbstractAddressType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "Address") - public JAXBElement<AbstractAddressType> createAddress(AbstractAddressType value) { - return new JAXBElement<AbstractAddressType>(_Address_QNAME, AbstractAddressType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "Extension") + public JAXBElement<String> createExtension(String value) { + return new JAXBElement<String>(_Extension_QNAME, String.class, null, value); } /** @@ -290,15 +265,6 @@ public class ObjectFactory { } /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "InternationalCountryCode") - public JAXBElement<String> createInternationalCountryCode(String value) { - return new JAXBElement<String>(_InternationalCountryCode_QNAME, String.class, null, value); - } - - /** * Create an instance of {@link JAXBElement }{@code <}{@link CorporateBodyType }{@code >}} * */ @@ -317,15 +283,6 @@ public class ObjectFactory { } /** - * Create an instance of {@link JAXBElement }{@code <}{@link AbstractPersonType }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "Person") - public JAXBElement<AbstractPersonType> createPerson(AbstractPersonType value) { - return new JAXBElement<AbstractPersonType>(_Person_QNAME, AbstractPersonType.class, null, value); - } - - /** * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} * */ @@ -338,63 +295,99 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link TelcomNumberType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "Pager") - public JAXBElement<TelcomNumberType> createPager(TelcomNumberType value) { - return new JAXBElement<TelcomNumberType>(_Pager_QNAME, TelcomNumberType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "TTYTDD") + public JAXBElement<TelcomNumberType> createTTYTDD(TelcomNumberType value) { + return new JAXBElement<TelcomNumberType>(_TTYTDD_QNAME, TelcomNumberType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link TelcomNumberType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "TTYTDD") - public JAXBElement<TelcomNumberType> createTTYTDD(TelcomNumberType value) { - return new JAXBElement<TelcomNumberType>(_TTYTDD_QNAME, TelcomNumberType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "Telephone") + public JAXBElement<TelcomNumberType> createTelephone(TelcomNumberType value) { + return new JAXBElement<TelcomNumberType>(_Telephone_QNAME, TelcomNumberType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link PersonDataType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link PersonNameType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "PersonData") - public JAXBElement<PersonDataType> createPersonData(PersonDataType value) { - return new JAXBElement<PersonDataType>(_PersonData_QNAME, PersonDataType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "PersonName") + public JAXBElement<PersonNameType> createPersonName(PersonNameType value) { + return new JAXBElement<PersonNameType>(_PersonName_QNAME, PersonNameType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link InternetAddressType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "InternetAddress") + public JAXBElement<InternetAddressType> createInternetAddress(InternetAddressType value) { + return new JAXBElement<InternetAddressType>(_InternetAddress_QNAME, InternetAddressType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link AbstractAddressType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "Address") + public JAXBElement<AbstractAddressType> createAddress(AbstractAddressType value) { + return new JAXBElement<AbstractAddressType>(_Address_QNAME, AbstractAddressType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "SubscriberNumber") - public JAXBElement<String> createSubscriberNumber(String value) { - return new JAXBElement<String>(_SubscriberNumber_QNAME, String.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "InternationalCountryCode") + public JAXBElement<String> createInternationalCountryCode(String value) { + return new JAXBElement<String>(_InternationalCountryCode_QNAME, String.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link AbstractPersonType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "Person") + public JAXBElement<AbstractPersonType> createPerson(AbstractPersonType value) { + return new JAXBElement<AbstractPersonType>(_Person_QNAME, AbstractPersonType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link TelcomNumberType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "Fax") - public JAXBElement<TelcomNumberType> createFax(TelcomNumberType value) { - return new JAXBElement<TelcomNumberType>(_Fax_QNAME, TelcomNumberType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "Pager") + public JAXBElement<TelcomNumberType> createPager(TelcomNumberType value) { + return new JAXBElement<TelcomNumberType>(_Pager_QNAME, TelcomNumberType.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link PersonNameType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link PersonDataType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "PersonName") - public JAXBElement<PersonNameType> createPersonName(PersonNameType value) { - return new JAXBElement<PersonNameType>(_PersonName_QNAME, PersonNameType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "PersonData") + public JAXBElement<PersonDataType> createPersonData(PersonDataType value) { + return new JAXBElement<PersonDataType>(_PersonData_QNAME, PersonDataType.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link TelcomNumberType }{@code >}} * */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "Telephone") - public JAXBElement<TelcomNumberType> createTelephone(TelcomNumberType value) { - return new JAXBElement<TelcomNumberType>(_Telephone_QNAME, TelcomNumberType.class, null, value); + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "Fax") + public JAXBElement<TelcomNumberType> createFax(TelcomNumberType value) { + return new JAXBElement<TelcomNumberType>(_Fax_QNAME, TelcomNumberType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "SubscriberNumber") + public JAXBElement<String> createSubscriberNumber(String value) { + return new JAXBElement<String>(_SubscriberNumber_QNAME, String.class, null, value); } /** @@ -416,15 +409,6 @@ public class ObjectFactory { } /** - * Create an instance of {@link JAXBElement }{@code <}{@link InternetAddressType }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", name = "InternetAddress") - public JAXBElement<InternetAddressType> createInternetAddress(InternetAddressType value) { - return new JAXBElement<InternetAddressType>(_InternetAddress_QNAME, InternetAddressType.class, null, value); - } - - /** * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} * */ diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PersonDataType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PersonDataType.java index 345e03ab..863c1e3c 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PersonDataType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PersonDataType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -32,7 +16,6 @@ import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlMixed; import javax.xml.bind.annotation.XmlType; -import org.w3._2000._09.xmldsig_.SignatureType; import org.w3c.dom.Element; @@ -56,13 +39,14 @@ import org.w3c.dom.Element; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence maxOccurs="unbounded" minOccurs="0"> - * <any/> + * <any processContents='lax'/> * </sequence> * </restriction> * </complexContent> * </complexType> * </element> * </sequence> + * <anyAttribute namespace='##other'/> * </extension> * </complexContent> * </complexType> @@ -85,8 +69,8 @@ public class PersonDataType protected AbstractPersonType person; @XmlElement(name = "Address") protected List<AbstractAddressType> address; - @XmlElement(name = "Signature", namespace = "http://www.w3.org/2000/09/xmldsig#") - protected List<SignatureType> signature; + @XmlAnyElement + protected List<Element> signature; @XmlElement(name = "AdditionalData") protected PersonDataType.AdditionalData additionalData; @@ -161,13 +145,13 @@ public class PersonDataType * * <p> * Objects of the following type(s) are allowed in the list - * {@link SignatureType } + * {@link Element } * * */ - public List<SignatureType> getSignature() { + public List<Element> getSignature() { if (signature == null) { - signature = new ArrayList<SignatureType>(); + signature = new ArrayList<Element>(); } return this.signature; } @@ -207,7 +191,7 @@ public class PersonDataType * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence maxOccurs="unbounded" minOccurs="0"> - * <any/> + * <any processContents='lax'/> * </sequence> * </restriction> * </complexContent> @@ -244,8 +228,8 @@ public class PersonDataType * * <p> * Objects of the following type(s) are allowed in the list - * {@link Object } * {@link String } + * {@link Object } * {@link Element } * * diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PersonNameType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PersonNameType.java index 5534897c..d54fbc27 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PersonNameType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PersonNameType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PhysicalPersonType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PhysicalPersonType.java index e3b31fd2..45904d91 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PhysicalPersonType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PhysicalPersonType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -79,8 +63,9 @@ import org.w3c.dom.Element; * </complexContent> * </complexType> * </element> - * <any/> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * </sequence> + * <anyAttribute namespace='##other'/> * </extension> * </complexContent> * </complexType> diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PostalAddressType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PostalAddressType.java index bdda75c2..08301039 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PostalAddressType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/PostalAddressType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/SexType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/SexType.java index c6231233..9b3ae45c 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/SexType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/SexType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TelcomNumberListType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TelcomNumberListType.java index 6a2cc863..e17a9399 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TelcomNumberListType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TelcomNumberListType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TelcomNumberType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TelcomNumberType.java index 8b4aa3aa..b1723ab2 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TelcomNumberType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TelcomNumberType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TelephoneAddressType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TelephoneAddressType.java index 9facdf9a..7b1f53c8 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TelephoneAddressType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TelephoneAddressType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -49,8 +33,9 @@ import org.w3c.dom.Element; * <sequence minOccurs="0"> * <element name="Type" type="{http://www.w3.org/2001/XMLSchema}anyURI" maxOccurs="unbounded" minOccurs="0"/> * <element name="Number" type="{http://reference.e-government.gv.at/namespace/persondata/20020228#}TelcomNumberType"/> - * <any/> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * </sequence> + * <anyAttribute namespace='##other'/> * </extension> * </complexContent> * </complexType> diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TypedPostalAddressType.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TypedPostalAddressType.java index 3184b3e7..0b29343a 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TypedPostalAddressType.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/TypedPostalAddressType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -49,8 +33,9 @@ import org.w3c.dom.Element; * <sequence minOccurs="0"> * <element name="Type" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/> * <element ref="{http://reference.e-government.gv.at/namespace/persondata/20020228#}PostalAddress"/> - * <any/> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * </sequence> + * <anyAttribute namespace='##other'/> * </extension> * </complexContent> * </complexType> diff --git a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/package-info.java b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/package-info.java index f95c7b54..13d0045a 100644 --- a/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/package-info.java +++ b/utils/src/main/java/at/gv/e_government/reference/namespace/persondata/_20020228_/package-info.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:43:54 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @javax.xml.bind.annotation.XmlSchema(namespace = "http://reference.e-government.gv.at/namespace/persondata/20020228#", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) diff --git a/utils/src/main/java/at/gv/egiz/bku/utils/ClasspathURLStreamHandler.java b/utils/src/main/java/at/gv/egiz/bku/utils/ClasspathURLStreamHandler.java new file mode 100644 index 00000000..1cd46fb5 --- /dev/null +++ b/utils/src/main/java/at/gv/egiz/bku/utils/ClasspathURLStreamHandler.java @@ -0,0 +1,34 @@ +/* +* Copyright 2009 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.utils; + +import java.io.IOException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; + +public class ClasspathURLStreamHandler extends URLStreamHandler { + + @Override + protected URLConnection openConnection(URL u) throws IOException { + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + URL resource = classLoader.getResource(u.getPath()); + return resource.openConnection(); + } + +} diff --git a/utils/src/main/java/at/gv/egiz/bku/utils/DebugInputStream.java b/utils/src/main/java/at/gv/egiz/bku/utils/DebugInputStream.java new file mode 100644 index 00000000..b65baf5b --- /dev/null +++ b/utils/src/main/java/at/gv/egiz/bku/utils/DebugInputStream.java @@ -0,0 +1,59 @@ +/* +* Copyright 2009 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.utils; + +import java.io.ByteArrayOutputStream; +import java.io.FilterInputStream; +import java.io.IOException; +import java.io.InputStream; + +public class DebugInputStream extends FilterInputStream { + + private ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + + public DebugInputStream(InputStream in) { + super(in); + } + + /* (non-Javadoc) + * @see java.io.FilterInputStream#read() + */ + @Override + public int read() throws IOException { + int b = super.read(); + buffer.write(b); + return b; + } + + /* (non-Javadoc) + * @see java.io.FilterInputStream#read(byte[], int, int) + */ + @Override + public int read(byte[] b, int off, int len) throws IOException { + int l = super.read(b, off, len); + if (l > 0) { + buffer.write(b, off, l); + } + return l; + } + + public byte[] getBufferedBytes() { + return buffer.toByteArray(); + } + +} diff --git a/utils/src/main/java/at/gv/egiz/bku/utils/binding/Protocol.java b/utils/src/main/java/at/gv/egiz/bku/utils/binding/Protocol.java index f0504697..574d17a9 100644 --- a/utils/src/main/java/at/gv/egiz/bku/utils/binding/Protocol.java +++ b/utils/src/main/java/at/gv/egiz/bku/utils/binding/Protocol.java @@ -17,7 +17,7 @@ package at.gv.egiz.bku.utils.binding;
public enum Protocol {
- HTTP("http"), HTTPS("https");
+ HTTP("http"), HTTPS("https"), SAML("saml");
private String name;
@@ -35,6 +35,9 @@ public enum Protocol { }
if (HTTPS.toString().equalsIgnoreCase(protocol)) {
return HTTPS;
+ } + if (SAML.toString().equalsIgnoreCase(protocol)) { + return SAML; }
return null;
}
diff --git a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/HTTPURLProtocolHandlerImpl.java b/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/HTTPURLProtocolHandlerImpl.java index dfe7d5e6..51288a9f 100644 --- a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/HTTPURLProtocolHandlerImpl.java +++ b/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/HTTPURLProtocolHandlerImpl.java @@ -17,7 +17,6 @@ package at.gv.egiz.bku.utils.urldereferencer; import java.io.IOException; -import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.security.InvalidParameterException; @@ -26,86 +25,55 @@ import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLSocketFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class HTTPURLProtocolHandlerImpl implements URLProtocolHandler { - private static Log log = LogFactory.getLog(HTTPURLProtocolHandlerImpl.class); + private final Logger log = LoggerFactory.getLogger(HTTPURLProtocolHandlerImpl.class); public final static String HTTP = "http"; public final static String HTTPS = "https"; - public final static String FORMDATA = "formdata"; - public final static String[] PROTOCOLS = { HTTP, HTTPS, FORMDATA }; + + public final static String[] PROTOCOLS = { HTTP, HTTPS }; private HostnameVerifier hostnameVerifier; private SSLSocketFactory sslSocketFactory; - public StreamData dereference(String aUrl, URLDereferencerContext aContext) + public StreamData dereference(String url) throws IOException { - String urlString = aUrl.toLowerCase().trim(); - if (urlString.startsWith(FORMDATA)) { - log.debug("Requested to dereference a formdata url"); - return dereferenceFormData(aUrl, aContext); - } - - URL url = new URL(aUrl); - if ((!HTTP.equalsIgnoreCase(url.getProtocol()) && (!HTTPS - .equalsIgnoreCase(url.getProtocol())))) { - throw new InvalidParameterException("Url " + aUrl + " not supported"); + URL u = new URL(url); + if ((!HTTP.equalsIgnoreCase(u.getProtocol()) && (!HTTPS + .equalsIgnoreCase(u.getProtocol())))) { + throw new InvalidParameterException("Url " + url + " not supported"); } - return dereferenceHTTP(url); + return dereferenceHTTP(u); } protected StreamData dereferenceHTTP(URL url) throws IOException { - log.debug("Dereferencing url: " + url); + log.info("Dereferencing URL: '{}'.", url); HttpURLConnection httpConn = (HttpURLConnection) url.openConnection(); if (httpConn instanceof HttpsURLConnection) { - log.trace("Detected ssl connection"); + log.trace("Detected ssl connection."); HttpsURLConnection https = (HttpsURLConnection) httpConn; if (sslSocketFactory != null) { - log.debug("Setting custom ssl socket factory for ssl connection"); + log.debug("Setting custom ssl socket factory for ssl connection."); https.setSSLSocketFactory(sslSocketFactory); } else { - log.trace("No custom socket factory set"); + log.trace("No custom socket factory set."); } if (hostnameVerifier != null) { - log.debug("Setting custom hostname verifier"); + log.debug("Setting custom hostname verifier."); https.setHostnameVerifier(hostnameVerifier); } } else { - log.trace("No secure connection with: "+url+ " class="+httpConn.getClass()); + log.trace("No secure connection with: {} class={}.", url, httpConn.getClass()); } - log.trace("Successfully opened connection"); + log.trace("Successfully opened connection."); return new StreamData(url.toString(), httpConn.getContentType(), httpConn .getInputStream()); } - /** - * - * @param aUrl - * @param aContext - * @return - * @throws IOException if the data cannot be found or reading the stream failed. - */ - protected StreamData dereferenceFormData(String aUrl, - URLDereferencerContext aContext) throws IOException { - log.debug("Dereferencing formdata url: " + aUrl); - String[] parts = aUrl.split(":", 2); - FormDataURLSupplier supplier = (FormDataURLSupplier) aContext - .getProperty(FormDataURLSupplier.PROPERTY_KEY_NAME); - if (supplier == null) { - throw new NullPointerException( - "No FormdataUrlSupplier found in provided context"); - } - String contentType = supplier.getFormDataContentType(parts[1]); - InputStream is = supplier.getFormData(parts[1]); - if (is != null) { - return new StreamData(aUrl, contentType, is); - } - throw new IOException("Cannot dereference url: formdata not found"); - } - @Override public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { this.hostnameVerifier = hostnameVerifier; @@ -116,4 +84,4 @@ public class HTTPURLProtocolHandlerImpl implements URLProtocolHandler { this.sslSocketFactory = socketFactory; } -}
\ No newline at end of file +} diff --git a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/SimpleFormDataContextImpl.java b/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/SimpleFormDataContextImpl.java deleted file mode 100644 index e9da9c81..00000000 --- a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/SimpleFormDataContextImpl.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.utils.urldereferencer;
-
-public class SimpleFormDataContextImpl implements URLDereferencerContext {
- protected FormDataURLSupplier formdata;
-
- /**
- *
- * @param formdata must not be null
- */
- public SimpleFormDataContextImpl(FormDataURLSupplier formdata) {
- if (formdata == null) {
- throw new NullPointerException("FormdataURLSupplier must not be null");
- }
- this.formdata = formdata;
- }
-
- @Override
- public Object getProperty(Object key) {
- if (key.equals(FormDataURLSupplier.PROPERTY_KEY_NAME)) {
- return formdata;
- }
- return null;
- }
-
-}
diff --git a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URIResolverAdapter.java b/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URIResolverAdapter.java index 2d11010e..0dccbe8f 100644 --- a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URIResolverAdapter.java +++ b/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URIResolverAdapter.java @@ -14,83 +14,73 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.utils.urldereferencer;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Adapter to make the Urldereferencer work as URIResolver for
- * Stylesheettransforms.
- *
- * @author wbauer
- *
- */
-public class URIResolverAdapter implements URIResolver {
-
- private static Log log = LogFactory.getLog(URIResolverAdapter.class);
-
- private URLDereferencer urlDereferencer;
- private URLDereferencerContext ctx;
-
- /**
- *
- * @param deferecencer
- * must not be null
- * @param ctx may be null
- */
- public URIResolverAdapter(URLDereferencer deferecencer,
- URLDereferencerContext ctx) {
- if (deferecencer == null) {
- throw new NullPointerException("Urlderefencer must not be set to null");
- }
- this.urlDereferencer = deferecencer;
- this.ctx = ctx;
- }
-
- @Override
- public Source resolve(String href, String base) throws TransformerException {
- log.debug("Resolving href: "+href+" base: "+base);
- try {
- URI baseUri = null;
- URI hrefUri = new URI(href);
- if (base != null) {
- baseUri = new URI(base);
- }
- URI abs;
- if (baseUri != null) {
- abs = baseUri.resolve(hrefUri);
- } else {
- abs = hrefUri;
- }
- if (!abs.isAbsolute()) {
- throw new TransformerException("Only absolute URLs are supported");
- }
- return new StreamSource(urlDereferencer.dereference(abs.toString(), ctx)
- .getStream());
- } catch (URISyntaxException e) {
- throw new TransformerException("Cannot resolve URI: base:" + base
- + " href:" + href, e);
- } catch (IOException iox) {
- throw new TransformerException("Cannot resolve URI: base:" + base
- + " href:" + href, iox);
- }
- }
-
- public URLDereferencerContext getCtx() {
- return ctx;
- }
-
- public void setCtx(URLDereferencerContext ctx) {
- this.ctx = ctx;
- }
-}
+package at.gv.egiz.bku.utils.urldereferencer; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.xml.transform.Source; +import javax.xml.transform.TransformerException; +import javax.xml.transform.URIResolver; +import javax.xml.transform.stream.StreamSource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Adapter to make the Urldereferencer work as URIResolver for + * Stylesheettransforms. + * + * @author wbauer + * + */ +public class URIResolverAdapter implements URIResolver { + + private final Logger log = LoggerFactory.getLogger(URIResolverAdapter.class); + + private URLDereferencer urlDereferencer; + + /** + * + * @param deferecencer + * must not be null + * @param ctx may be null + */ + public URIResolverAdapter(URLDereferencer deferecencer) { + if (deferecencer == null) { + throw new NullPointerException("Urlderefencer must not be set to null"); + } + this.urlDereferencer = deferecencer; + } + + @Override + public Source resolve(String href, String base) throws TransformerException { + log.debug("Resolving href: {} base: {}", href, base); + try { + URI baseUri = null; + URI hrefUri = new URI(href); + if (base != null) { + baseUri = new URI(base); + } + URI abs; + if (baseUri != null) { + abs = baseUri.resolve(hrefUri); + } else { + abs = hrefUri; + } + if (!abs.isAbsolute()) { + throw new TransformerException("Only absolute URLs are supported"); + } + return new StreamSource(urlDereferencer.dereference(abs.toString()) + .getStream()); + } catch (URISyntaxException e) { + throw new TransformerException("Cannot resolve URI: base:" + base + + " href:" + href, e); + } catch (IOException iox) { + throw new TransformerException("Cannot resolve URI: base:" + base + + " href:" + href, iox); + } + } + +} diff --git a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URLDereferencer.java b/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URLDereferencer.java index 7361ec26..468610e4 100644 --- a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URLDereferencer.java +++ b/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URLDereferencer.java @@ -1,5 +1,5 @@ /* -* Copyright 2008 Federal Chancellery Austria and +* Copyright 2009 Federal Chancellery Austria and * Graz University of Technology * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,95 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.utils.urldereferencer;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.HashMap;
-import java.util.Map;
-import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.SSLSocketFactory; -
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Class used to dereference (external URLs).
- *
- * @author wbauer
- *
- */
-public class URLDereferencer {
-
- private static Log log = LogFactory.getLog(URLDereferencer.class);
-
- private static URLDereferencer instance = new URLDereferencer();
-
- private Map<String, URLProtocolHandler> handlerMap = new HashMap<String, URLProtocolHandler>();
+package at.gv.egiz.bku.utils.urldereferencer; - private HostnameVerifier hostnameVerifier; - private SSLSocketFactory sslSocketFactory; -
- private URLDereferencer() {
- registerHandlers();
- }
-
- /**
- *
- * @param aUrl
- * must not be null
- * @param aContext
- * @throws MalformedURLException
- * if the protocol is not supported - * @throws IOException if the url cannot be dereferenced (e.g. formdata not provided) - *
- */
- public StreamData dereference(String aUrl, URLDereferencerContext aContext)
- throws IOException {
- log.debug("Looking for handler for URL: " + aUrl);
- int i = aUrl.indexOf(":");
- if (i == -1) {
- throw new MalformedURLException("Invalid url: " + aUrl);
- }
- String protocol = aUrl.substring(0, i).toLowerCase().trim();
- URLProtocolHandler handler = handlerMap.get(protocol);
- if (handler == null) {
- throw new MalformedURLException("No handler for protocol: " + protocol
- + " found");
- } - handler.setHostnameVerifier(hostnameVerifier); - handler.setSSLSocketFactory(sslSocketFactory);
- return handler.dereference(aUrl, aContext);
- }
-
- /**
- * Registers a handler for a protocol.
- *
- * @param aProtocol
- * @param aHandler
- * may be set to null to disable this protocol
- */
- public void registerHandler(String aProtocol, URLProtocolHandler aHandler) {
- handlerMap.put(aProtocol.toLowerCase(), aHandler);
- }
-
- public static URLDereferencer getInstance() {
- return instance;
- }
-
- protected void registerHandlers() {
- URLProtocolHandler handler = new HTTPURLProtocolHandlerImpl();
- for (String proto : HTTPURLProtocolHandlerImpl.PROTOCOLS) {
- handlerMap.put(proto, handler);
- }
- } +import java.io.IOException; + +public interface URLDereferencer { - public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { - this.hostnameVerifier = hostnameVerifier; - } + public StreamData dereference(String aUrl) throws IOException; - public void setSSLSocketFactory(SSLSocketFactory socketFactory) { - this.sslSocketFactory = socketFactory; - }
-}
\ No newline at end of file +} diff --git a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URLDereferencerImpl.java b/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URLDereferencerImpl.java new file mode 100644 index 00000000..d1a68c46 --- /dev/null +++ b/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URLDereferencerImpl.java @@ -0,0 +1,108 @@ +/* +* 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.utils.urldereferencer; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.util.HashMap; +import java.util.Map; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLSocketFactory; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Class used to dereference (external URLs). + * + * @author wbauer + * + */ +public class URLDereferencerImpl implements URLDereferencer { + + private final Logger log = LoggerFactory.getLogger(URLDereferencerImpl.class); + + private static URLDereferencerImpl instance = new URLDereferencerImpl(); + + private Map<String, URLProtocolHandler> handlerMap = new HashMap<String, URLProtocolHandler>(); + + private HostnameVerifier hostnameVerifier; + private SSLSocketFactory sslSocketFactory; + + private URLDereferencerImpl() { + registerHandlers(); + } + + /** + * + * @param aUrl + * must not be null + * @throws MalformedURLException + * if the protocol is not supported + * @throws IOException if the url cannot be dereferenced (e.g. formdata not provided) + * + */ + @Override + public StreamData dereference(String aUrl) + throws IOException { + log.debug("Looking for handler for URL: {}.", aUrl); + int i = aUrl.indexOf(":"); + if (i == -1) { + throw new MalformedURLException("Invalid url: " + aUrl); + } + String protocol = aUrl.substring(0, i).toLowerCase().trim(); + URLProtocolHandler handler = handlerMap.get(protocol); + if (handler == null) { + throw new MalformedURLException("No handler for protocol: " + protocol + + " found"); + } + handler.setHostnameVerifier(hostnameVerifier); + handler.setSSLSocketFactory(sslSocketFactory); + return handler.dereference(aUrl); + } + + /** + * Registers a handler for a protocol. + * + * @param aProtocol + * @param aHandler + * may be set to null to disable this protocol + */ + public void registerHandler(String aProtocol, URLProtocolHandler aHandler) { + handlerMap.put(aProtocol.toLowerCase(), aHandler); + } + + public static URLDereferencerImpl getInstance() { + return instance; + } + + protected void registerHandlers() { + URLProtocolHandler handler = new HTTPURLProtocolHandlerImpl(); + for (String proto : HTTPURLProtocolHandlerImpl.PROTOCOLS) { + handlerMap.put(proto, handler); + } + } + + public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { + this.hostnameVerifier = hostnameVerifier; + } + + public void setSSLSocketFactory(SSLSocketFactory socketFactory) { + this.sslSocketFactory = socketFactory; + } +} diff --git a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URLProtocolHandler.java b/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URLProtocolHandler.java index f886bd4e..1da1ad71 100644 --- a/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URLProtocolHandler.java +++ b/utils/src/main/java/at/gv/egiz/bku/utils/urldereferencer/URLProtocolHandler.java @@ -17,7 +17,6 @@ package at.gv.egiz.bku.utils.urldereferencer;
import java.io.IOException;
-import java.net.MalformedURLException;
import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLSocketFactory; @@ -26,12 +25,11 @@ import javax.net.ssl.SSLSocketFactory; public interface URLProtocolHandler {
/**
*
- * @param aUrl
- * @param aContext
+ * @param url
* @return the streamdata of this url or null if the url cannot be resolved.
* @throws IOException
*/
- public StreamData dereference(String aUrl, URLDereferencerContext aContext) throws IOException; + public StreamData dereference(String url) throws IOException; public void setSSLSocketFactory(SSLSocketFactory socketFactory); diff --git a/utils/src/main/java/at/gv/egiz/idlink/CompressedIdentityLinkFactory.java b/utils/src/main/java/at/gv/egiz/idlink/CompressedIdentityLinkFactory.java index 31e5163a..5df8657f 100644 --- a/utils/src/main/java/at/gv/egiz/idlink/CompressedIdentityLinkFactory.java +++ b/utils/src/main/java/at/gv/egiz/idlink/CompressedIdentityLinkFactory.java @@ -52,7 +52,6 @@ import at.gv.egiz.idlink.ans1.IdentityLink; import at.gv.egiz.idlink.ans1.PersonData; import at.gv.egiz.idlink.ans1.PhysicalPersonData; import at.gv.egiz.marshal.MarshallerFactory; -import at.gv.egiz.marshal.NamespacePrefixMapperImpl; import at.gv.egiz.xmldsig.KeyTypeNotSupportedException; import at.gv.egiz.xmldsig.KeyValueFactory; diff --git a/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkFactory.java b/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkFactory.java index 38597446..30fa0777 100644 --- a/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkFactory.java +++ b/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkFactory.java @@ -70,14 +70,15 @@ import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import oasis.names.tc.saml._1_0.assertion.AnyType; import oasis.names.tc.saml._1_0.assertion.AssertionType; import oasis.names.tc.saml._1_0.assertion.AttributeStatementType; import oasis.names.tc.saml._1_0.assertion.AttributeType; import oasis.names.tc.saml._1_0.assertion.SubjectConfirmationType; import oasis.names.tc.saml._1_0.assertion.SubjectType; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -88,14 +89,12 @@ import at.gv.e_government.reference.namespace.persondata._20020228_.PhysicalPers import at.gv.e_government.reference.namespace.persondata._20020228_.IdentificationType.Value; import at.gv.e_government.reference.namespace.persondata._20020228_.PersonNameType.FamilyName; import at.gv.egiz.marshal.MarshallerFactory; -import at.gv.egiz.marshal.NamespacePrefixMapperImpl; import at.gv.egiz.xmldsig.KeyTypeNotSupportedException; import at.gv.egiz.xmldsig.KeyValueFactory; -import oasis.names.tc.saml._1_0.assertion.AnyType; public class IdentityLinkFactory { - private static Log log = LogFactory.getLog(IdentityLinkFactory.class); + private final Logger log = LoggerFactory.getLogger(IdentityLinkFactory.class); /** * The instance returned by {@link #getInstance()}. @@ -380,7 +379,7 @@ public class IdentityLinkFactory { log.debug(writer.toString()); } catch (Exception e) { - log.debug(e); + log.debug("Logging assertion failed.", e); } } diff --git a/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkTransformer.java b/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkTransformer.java index 8bee5fa4..a5b97a87 100644 --- a/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkTransformer.java +++ b/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkTransformer.java @@ -14,11 +14,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.idlink;
-
+package at.gv.egiz.idlink; + import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; +import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -28,11 +29,12 @@ import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.stream.StreamSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -41,99 +43,94 @@ import org.w3c.dom.Text; import at.gv.egiz.bku.utils.urldereferencer.StreamData; import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; -
+ public class IdentityLinkTransformer { - protected static Log log = LogFactory.getLog(IdentityLinkTransformer.class);
-
- /**
- * The transformer factory.
- */
- private static SAXTransformerFactory factory;
-
- /**
- * The instance to be returned by {@link #getInstance()}.
- */
- private static IdentityLinkTransformer instance;
-
- /**
- * Returns an instance of this <code>IdentityLinkTransfomer</code>.
- *
- * @return an instance of this <code>IdentityLinkTransformer</code>
- */
- public static IdentityLinkTransformer getInstance() {
- if (instance == null) {
- instance = new IdentityLinkTransformer();
- factory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
- }
- return instance;
- }
-
- /**
- * Sets the given <code>domainIdentifier</code> on the corresponding
- * node of the given <code>idLink</code>.
- * <p>This method may be used to cope with a flaw in the IssuerTemplate-Stylesheets
- * used to transform a <code>CompressedIdentitiyLink</code> into an
- * <code>IdentityLink</code>. Some IssuerTemplate-Stylesheets do not
- * consider the <code>pr:Type</code> element value of the
- * <code>CompressedIdentityLink</code> and render a <code>pr:Type</code>
- * element value of <code>urn:publicid:gv.at:baseid</code>
- * into the <code>IdentityLink</code> structure. This method allows to
- * set the <code>pr:Type</code> element value on the given <code>idLink</code>
- * after the transformation.
- * </p>
- *
- * @param idLink the <code>IdentityLink</code> element or one of it's ancestors.
- * Must not be <code>null</code>.
- *
- * @param domainIdentifier the value to be set for the <code>pr:Type</code> element
- *
- * @throws NullPointerException if <code>idLink</code> is <code>null</code>.
- */
- public static void setDomainIdentifier(Node idLink, String domainIdentifier) {
-
- Element element;
- if (idLink instanceof Element) {
- element = (Element) idLink;
- } else if (idLink instanceof Document) {
- element = ((Document) idLink).getDocumentElement();
- } else if (idLink != null) {
- Document document = idLink.getOwnerDocument();
- element = document.getDocumentElement();
- } else {
- throw new NullPointerException("Parameter 'idLink' must no be null.");
- }
-
- NodeList nodeList = element.getElementsByTagNameNS(
- "http://reference.e-government.gv.at/namespace/persondata/20020228#",
- "Type");
-
- for (int i = 0; i < nodeList.getLength(); i++) {
- if (nodeList.item(i) instanceof Element) {
- Element typeElement = (Element) nodeList.item(i);
- NodeList children = typeElement.getChildNodes();
- for (int j = 0; j < children.getLength(); j++) {
- if (children.item(j) instanceof Text) {
- ((Text) children.item(j)).setNodeValue(domainIdentifier);
- }
- }
- }
- }
-
- }
-
+ private final Logger log = LoggerFactory.getLogger(IdentityLinkTransformer.class); + /** - * Mapping of issuer template URIs to transformation templates. + * The transformer factory. + */ + private TransformerFactory factory = SAXTransformerFactory.newInstance(); + + /** + * The URLDereferencer used to dereference style-sheet URLs. + */ + private URLDereferencer urlDereferencer; + + /** + * @return the urlDereferencer + */ + public URLDereferencer getUrlDereferencer() { + return urlDereferencer; + } + + /** + * @param urlDereferencer the urlDereferencer to set */ - private Map<String, Templates> templates = new HashMap<String, Templates>();
-
- /**
- * Private constructor.
- */
- private IdentityLinkTransformer() {
+ public void setUrlDereferencer(URLDereferencer urlDereferencer) { + this.urlDereferencer = urlDereferencer; } /** + * Sets the given <code>domainIdentifier</code> on the corresponding + * node of the given <code>idLink</code>. + * <p>This method may be used to cope with a flaw in the IssuerTemplate-Stylesheets + * used to transform a <code>CompressedIdentitiyLink</code> into an + * <code>IdentityLink</code>. Some IssuerTemplate-Stylesheets do not + * consider the <code>pr:Type</code> element value of the + * <code>CompressedIdentityLink</code> and render a <code>pr:Type</code> + * element value of <code>urn:publicid:gv.at:baseid</code> + * into the <code>IdentityLink</code> structure. This method allows to + * set the <code>pr:Type</code> element value on the given <code>idLink</code> + * after the transformation. + * </p> + * + * @param idLink the <code>IdentityLink</code> element or one of it's ancestors. + * Must not be <code>null</code>. + * + * @param domainIdentifier the value to be set for the <code>pr:Type</code> element + * + * @throws NullPointerException if <code>idLink</code> is <code>null</code>. + */ + public static void setDomainIdentifier(Node idLink, String domainIdentifier) { + + Element element; + if (idLink instanceof Element) { + element = (Element) idLink; + } else if (idLink instanceof Document) { + element = ((Document) idLink).getDocumentElement(); + } else if (idLink != null) { + Document document = idLink.getOwnerDocument(); + element = document.getDocumentElement(); + } else { + throw new NullPointerException("Parameter 'idLink' must no be null."); + } + + NodeList nodeList = element.getElementsByTagNameNS( + "http://reference.e-government.gv.at/namespace/persondata/20020228#", + "Type"); + + for (int i = 0; i < nodeList.getLength(); i++) { + if (nodeList.item(i) instanceof Element) { + Element typeElement = (Element) nodeList.item(i); + NodeList children = typeElement.getChildNodes(); + for (int j = 0; j < children.getLength(); j++) { + if (children.item(j) instanceof Text) { + ((Text) children.item(j)).setNodeValue(domainIdentifier); + } + } + } + } + + } + + /** + * Mapping of issuer template URIs to transformation templates. + */ + private Map<String, Templates> templates = Collections.synchronizedMap(new HashMap<String, Templates>()); + + /** * Transforms an identity link <code>source</code> to <code>result</code> with * the given issuer template from the <code>stylesheetURL</code>. * @@ -154,7 +151,7 @@ public class IdentityLinkTransformer { * stylesheet fails. * @throws TransformerException * if transforming the identity link fails. - */
+ */ public void transformIdLink(String stylesheetURL, Source source, Result result) throws IOException, TransformerException { Templates templ = templates.get(stylesheetURL); @@ -168,8 +165,7 @@ public class IdentityLinkTransformer { throw new MalformedURLException("Protocol " + url.getProtocol() + " not supported for IssuerTemplate URL."); } - URLDereferencer dereferencer = URLDereferencer.getInstance(); - StreamData data = dereferencer.dereference(url.toExternalForm(), null); + StreamData data = urlDereferencer.dereference(url.toExternalForm()); log.trace("Trying to create issuer template."); templ = factory.newTemplates(new StreamSource(data.getStream())); @@ -183,6 +179,6 @@ public class IdentityLinkTransformer { transformer.transform(source, result); - }
-
-}
+ } + +} diff --git a/utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java b/utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java index 3ac0a86e..6cc79ae5 100644 --- a/utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java +++ b/utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java @@ -20,8 +20,8 @@ import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.PropertyException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -29,23 +29,22 @@ import org.apache.commons.logging.LogFactory; */ public class MarshallerFactory { - private static final Log log = LogFactory.getLog(MarshallerFactory.class); - public static Marshaller createMarshaller(JAXBContext ctx, boolean formattedOutput, boolean fragment) throws JAXBException { + Logger log = LoggerFactory.getLogger(MarshallerFactory.class); Marshaller m = ctx.createMarshaller(); try { if (formattedOutput) { - log.trace("setting marshaller property FORMATTED_OUTPUT"); + log.trace("Setting marshaller property FORMATTED_OUTPUT."); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); } if (fragment) { - log.trace("setting marshaller property FRAGMENT"); + log.trace("Setting marshaller property FRAGMENT."); m.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); } - log.trace("setting marshaller property NamespacePrefixMapper"); + log.trace("Setting marshaller property NamespacePrefixMapper."); m.setProperty("com.sun.xml.bind.namespacePrefixMapper", new NamespacePrefixMapperImpl()); } catch (PropertyException ex) { - log.info("failed to set marshaller property: " + ex.getMessage()); + log.info("Failed to set marshaller property: {}.", ex.getMessage()); } return m; } diff --git a/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java b/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java index e0698977..dc2a5c95 100644 --- a/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java +++ b/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java @@ -21,8 +21,8 @@ import java.util.HashMap; import java.util.Map; import com.sun.xml.bind.marshaller.NamespacePrefixMapper; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory; */ public class NamespacePrefixMapperImpl extends NamespacePrefixMapper { - private static final Log log = LogFactory.getLog(NamespacePrefixMapperImpl.class); + private final Logger log = LoggerFactory.getLogger(NamespacePrefixMapperImpl.class); protected static final Map<String, String> prefixMap = new HashMap<String, String>(); @@ -51,9 +51,7 @@ public class NamespacePrefixMapperImpl extends NamespacePrefixMapper { @Override public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) { - if (log.isTraceEnabled()) { - log.trace("prefix for namespace " + namespaceUri + " requested"); - } + log.trace("Prefix for namespace {} reqested.", namespaceUri); String prefix = prefixMap.get(namespaceUri); diff --git a/utils/src/main/java/at/gv/egiz/org/apache/tomcat/util/http/AcceptLanguage.java b/utils/src/main/java/at/gv/egiz/org/apache/tomcat/util/http/AcceptLanguage.java index 231966ac..396fb6d9 100644 --- a/utils/src/main/java/at/gv/egiz/org/apache/tomcat/util/http/AcceptLanguage.java +++ b/utils/src/main/java/at/gv/egiz/org/apache/tomcat/util/http/AcceptLanguage.java @@ -35,6 +35,7 @@ import java.util.Vector; * @author Harish Prabandham * @author costin@eng.sun.com */ +@SuppressWarnings("unchecked") public class AcceptLanguage { public static Locale getLocale(String acceptLanguage) { diff --git a/utils/src/main/java/at/gv/egiz/slbinding/RedirectEventFilter.java b/utils/src/main/java/at/gv/egiz/slbinding/RedirectEventFilter.java index 5fe84aae..d3bc4f39 100644 --- a/utils/src/main/java/at/gv/egiz/slbinding/RedirectEventFilter.java +++ b/utils/src/main/java/at/gv/egiz/slbinding/RedirectEventFilter.java @@ -30,8 +30,6 @@ import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.XMLEvent; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /* * TODO: don't set redirect stream from caller (caller does not know whether redirection will be triggered) @@ -40,7 +38,6 @@ import org.apache.commons.logging.LogFactory; public class RedirectEventFilter implements EventFilter { public static final String DEFAULT_ENCODING = "UTF-8"; - private static Log log = LogFactory.getLog(RedirectEventFilter.class); protected XMLEventWriter redirectWriter = null; protected Set<QName> redirectTriggers = null; private int depth = -1; diff --git a/utils/src/main/java/at/gv/egiz/slbinding/RedirectUnmarshallerListener.java b/utils/src/main/java/at/gv/egiz/slbinding/RedirectUnmarshallerListener.java index 08c12146..7670d024 100644 --- a/utils/src/main/java/at/gv/egiz/slbinding/RedirectUnmarshallerListener.java +++ b/utils/src/main/java/at/gv/egiz/slbinding/RedirectUnmarshallerListener.java @@ -23,8 +23,8 @@ package at.gv.egiz.slbinding; import javax.xml.bind.Unmarshaller; import javax.xml.stream.XMLStreamException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Enables event redirection before marshalling a target of type RedirectCallback. @@ -34,7 +34,7 @@ import org.apache.commons.logging.LogFactory; */ public class RedirectUnmarshallerListener extends Unmarshaller.Listener { - private static Log log = LogFactory.getLog(RedirectUnmarshallerListener.class); + private final Logger log = LoggerFactory.getLogger(RedirectUnmarshallerListener.class); protected RedirectEventFilter eventFilter; public RedirectUnmarshallerListener(RedirectEventFilter eventFilter) { diff --git a/utils/src/main/java/at/gv/egiz/slbinding/SLUnmarshaller.java b/utils/src/main/java/at/gv/egiz/slbinding/SLUnmarshaller.java new file mode 100644 index 00000000..0a4ee9f3 --- /dev/null +++ b/utils/src/main/java/at/gv/egiz/slbinding/SLUnmarshaller.java @@ -0,0 +1,263 @@ +/* +* Copyright 2009 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.slbinding; + +import java.io.IOException; +import java.net.URL; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; + +import javax.xml.XMLConstants; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.UnmarshalException; +import javax.xml.bind.Unmarshaller; +import javax.xml.bind.ValidationEvent; +import javax.xml.stream.XMLEventReader; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.transform.Source; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.xml.sax.SAXException; + +import at.gv.egiz.bku.utils.ClasspathURLStreamHandler; +import at.gv.egiz.validation.ReportingValidationEventHandler; + +public class SLUnmarshaller { + + /** + * Logging facility. + */ + private final Logger log = LoggerFactory.getLogger(SLUnmarshaller.class); + + private static class DefaultSchema { + + /** + * Schema files required for Security Layer command validation. + */ + public static final String[] SCHEMA_FILES = new String[] { + "classpath:at/gv/egiz/bku/slschema/xml.xsd", + "classpath:at/gv/egiz/bku/slschema/xmldsig-core-schema.xsd", + "classpath:at/gv/egiz/bku/slschema/Core-1.2.xsd", + "classpath:at/gv/egiz/bku/slschema/Core.20020225.xsd", + "classpath:at/gv/egiz/bku/slschema/Core.20020831.xsd" }; + + private static final Schema SCHEMA; + + static { + try { + SCHEMA = createSchema(Arrays.asList(SCHEMA_FILES)); + } catch (IOException e) { + Logger log = LoggerFactory.getLogger(SLUnmarshaller.class); + log.error("Failed to load security layer schema.", e); + throw new RuntimeException(e); + } catch (SAXException e) { + Logger log = LoggerFactory.getLogger(SLUnmarshaller.class); + log.error("Failed to load security layer schema.", e); + throw new RuntimeException(e); + } + + } + } + + public static Collection<String> getDefaultSchemaUrls() { + return Collections.unmodifiableList(Arrays.asList(DefaultSchema.SCHEMA_FILES)); + } + + private static Schema createSchema(Collection<String> schemaUrls) throws SAXException, IOException { + Logger log = LoggerFactory.getLogger(SLUnmarshaller.class); + Source[] sources = new Source[schemaUrls.size()]; + Iterator<String> urls = schemaUrls.iterator(); + StringBuilder sb = null; + if (log.isDebugEnabled()) { + sb = new StringBuilder(); + sb.append("Created schema using URLs: "); + } + for (int i = 0; i < sources.length && urls.hasNext(); i++) { + String url = urls.next(); + if (url != null && url.startsWith("classpath:")) { + URL schemaUrl = new URL(null, url, new ClasspathURLStreamHandler()); + sources[i] = new StreamSource(schemaUrl.openStream()); + } else { + sources[i] = new StreamSource(url); + } + if (sb != null) { + sb.append(url); + if (urls.hasNext()) { + sb.append(", "); + } + } + } + SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + Schema schema = schemaFactory.newSchema(sources); + if (sb != null) { + log.debug(sb.toString()); + } + return schema; + } + + private static class DefaultContext { + + private static final String[] packageNames = { + at.buergerkarte.namespaces.securitylayer._1.ObjectFactory.class.getPackage().getName(), + org.w3._2000._09.xmldsig_.ObjectFactory.class.getPackage().getName(), + at.buergerkarte.namespaces.cardchannel.ObjectFactory.class.getPackage().getName(), + at.buergerkarte.namespaces.securitylayer._20020225_.ObjectFactory.class.getPackage().getName(), + at.buergerkarte.namespaces.securitylayer._20020831_.ObjectFactory.class.getPackage().getName() + }; + + private static final JAXBContext CONTEXT; + + static { + try { + CONTEXT = createJAXBContext(Arrays.asList(packageNames)); + } catch (JAXBException e) { + Logger log = LoggerFactory.getLogger(SLUnmarshaller.class); + log.error("Failed to setup JAXBContext security layer request/response.", e); + throw new RuntimeException(e); + } + } + + } + + public static Collection<String> getDefaultJAXBContextPackageNames() { + return Collections.unmodifiableList(Arrays.asList(DefaultContext.packageNames)); + } + + private static JAXBContext createJAXBContext(Collection<String> packageNames) throws JAXBException { + StringBuilder contextPath = new StringBuilder(); + for (String pkg : packageNames) { + if (contextPath.length() > 0) { + contextPath.append(':'); + } + contextPath.append(pkg); + } + return JAXBContext.newInstance(contextPath.toString()); + } + + /** + * Schema for Security Layer command validation. + */ + protected Schema slSchema = DefaultSchema.SCHEMA; + + /** + * The JAXBContext. + */ + protected JAXBContext jaxbContext = DefaultContext.CONTEXT; + + /** + * Returns the schema used for validation. + * + * @return the slSchema + */ + public Schema getSlSchema() { + return slSchema; + } + + /** + * Sets the schema for validation. + * + * @param slSchema the slSchema to set + */ + public void setSlSchema(Schema slSchema) { + this.slSchema = slSchema; + } + + /** + * Sets the schema created from the given {@code schemaUrls}. + * + * @param schemaUrls a collection of URLs of schema files (supports {@code classpath:} URLs) + * @throws SAXException if schema creation fails + * @throws IOException if an error occurs upon dereferencing the given {@code schemaUrls} + */ + public void setSchemaUrls(Collection<String> schemaUrls) throws SAXException, IOException { + slSchema = createSchema(schemaUrls); + } + + /** + * @return the jaxbContext + */ + public JAXBContext getJaxbContext() { + return jaxbContext; + } + + /** + * @param jaxbContext the jaxbContext to set + */ + public void setJaxbContext(JAXBContext jaxbContext) { + this.jaxbContext = jaxbContext; + } + + /** + * Sets the JAXBContext for unmarshalling using the given {@code packageNames}. + * + * @param packageNames a collection of java package names + * @throws JAXBException if creating the JAXBContext with the given {@code packageNames} fails + */ + public void setJaxbContextPackageNames(Collection<String> packageNames) throws JAXBException { + this.jaxbContext = createJAXBContext(packageNames); + } + + public Object unmarshal(Source source) throws XMLStreamException, JAXBException { + + ReportingValidationEventHandler validationEventHandler = new ReportingValidationEventHandler(); + + XMLInputFactory inputFactory = XMLInputFactory.newInstance(); + XMLEventReader eventReader = inputFactory.createXMLEventReader(source); + RedirectEventFilter redirectEventFilter = new RedirectEventFilter(); + XMLEventReader filteredReader = inputFactory.createFilteredReader(eventReader, redirectEventFilter); + + Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); + unmarshaller.setEventHandler(validationEventHandler); + + unmarshaller.setListener(new RedirectUnmarshallerListener(redirectEventFilter)); + unmarshaller.setSchema(slSchema); + + Object object; + try { + log.trace("Before unmarshal()."); + object = unmarshaller.unmarshal(filteredReader); + log.trace("After unmarshal()."); + } catch (UnmarshalException e) { + if (log.isDebugEnabled()) { + log.debug("Failed to unmarshall security layer message.", e); + } else { + log.info("Failed to unmarshall security layer message." + e.getMessage()); + } + + if (validationEventHandler.getErrorEvent() != null) { + ValidationEvent errorEvent = validationEventHandler.getErrorEvent(); + if (e.getLinkedException() == null) { + e.setLinkedException(errorEvent.getLinkedException()); + } + } + throw e; + } + + return object; + + } + +} diff --git a/utils/src/main/java/at/gv/egiz/slbinding/impl/CreateXMLSignatureResponseType.java b/utils/src/main/java/at/gv/egiz/slbinding/impl/CreateXMLSignatureResponseType.java index 47c00a84..dd107c3e 100644 --- a/utils/src/main/java/at/gv/egiz/slbinding/impl/CreateXMLSignatureResponseType.java +++ b/utils/src/main/java/at/gv/egiz/slbinding/impl/CreateXMLSignatureResponseType.java @@ -1,18 +1,22 @@ /* - * 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. +* 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.slbinding.impl; @@ -23,8 +27,8 @@ import java.io.UnsupportedEncodingException; import javax.xml.bind.annotation.XmlTransient; import javax.xml.stream.XMLStreamException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -32,40 +36,34 @@ import org.apache.commons.logging.LogFactory; */ public class CreateXMLSignatureResponseType extends at.buergerkarte.namespaces.securitylayer._1.CreateXMLSignatureResponseType implements RedirectCallback { - @XmlTransient - private static Log log = LogFactory.getLog(CreateXMLSignatureResponseType.class); - @XmlTransient - protected ByteArrayOutputStream redirectOS = null; + @XmlTransient + private final Logger log = LoggerFactory.getLogger(CreateXMLSignatureResponseType.class); + @XmlTransient + protected ByteArrayOutputStream redirectOS = null; - @Override - public void enableRedirect(RedirectEventFilter filter) throws XMLStreamException { - if (log.isDebugEnabled()) { - log.debug("enabling event redirection for " + CreateXMLSignatureResponseType.class.getName()); + @Override + public void enableRedirect(RedirectEventFilter filter) throws XMLStreamException { + log.trace("enabling event redirection for XMLContentType"); + redirectOS = new ByteArrayOutputStream(); + filter.setRedirectStream(redirectOS); } - redirectOS = new ByteArrayOutputStream(); - filter.setRedirectStream(redirectOS); - } - @Override - public void disableRedirect(RedirectEventFilter filter) throws XMLStreamException { - if (log.isDebugEnabled()) { - log.debug("disabling event redirection for " + CreateXMLSignatureResponseType.class.getName()); + @Override + public void disableRedirect(RedirectEventFilter filter) throws XMLStreamException { + log.trace("disabling event redirection for XMLContentType"); + filter.flushRedirectStream(); + filter.setRedirectStream(null); + if (log.isTraceEnabled()) { + try { + log.trace("redirected events (UTF-8): " + redirectOS.toString("UTF-8")); + } catch (UnsupportedEncodingException ex) { + log.error("failed to log redirected events", ex); + } + } } - filter.flushRedirectStream(); - filter.setRedirectStream(null); - - if (log.isDebugEnabled()) { - try { - log.debug("redirected events (UTF-8): " + redirectOS.toString("UTF-8")); - } catch (UnsupportedEncodingException ex) { - log.debug("failed to log redirected events", ex); - } + @Override + public ByteArrayOutputStream getRedirectedStream() { + return redirectOS; } - } - - @Override - public ByteArrayOutputStream getRedirectedStream() { - return redirectOS; - } } diff --git a/utils/src/main/java/at/gv/egiz/slbinding/impl/SignatureLocationType.java b/utils/src/main/java/at/gv/egiz/slbinding/impl/SignatureLocationType.java index 494e6972..bde9b22a 100644 --- a/utils/src/main/java/at/gv/egiz/slbinding/impl/SignatureLocationType.java +++ b/utils/src/main/java/at/gv/egiz/slbinding/impl/SignatureLocationType.java @@ -23,8 +23,8 @@ package at.gv.egiz.slbinding.impl; import at.gv.egiz.slbinding.*; import javax.xml.bind.annotation.XmlTransient; import javax.xml.namespace.NamespaceContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -33,7 +33,7 @@ import org.apache.commons.logging.LogFactory; public class SignatureLocationType extends at.buergerkarte.namespaces.securitylayer._1.SignatureLocationType implements NamespaceContextCallback { @XmlTransient - private static Log log = LogFactory.getLog(SignatureLocationType.class); + private final Logger log = LoggerFactory.getLogger(SignatureLocationType.class); @XmlTransient protected NamespaceContext namespaceContext; @@ -44,7 +44,7 @@ public class SignatureLocationType extends at.buergerkarte.namespaces.securityla @Override public void preserveNamespaceContext(RedirectEventFilter filter) { - log.debug("preserving namespace context for SignatureLocationType"); + log.trace("preserving namespace context for SignatureLocationType"); namespaceContext = filter.getCurrentNamespaceContext(); } } diff --git a/utils/src/main/java/at/gv/egiz/slbinding/impl/TransformsInfoType.java b/utils/src/main/java/at/gv/egiz/slbinding/impl/TransformsInfoType.java index b1de9406..4b3a6f79 100644 --- a/utils/src/main/java/at/gv/egiz/slbinding/impl/TransformsInfoType.java +++ b/utils/src/main/java/at/gv/egiz/slbinding/impl/TransformsInfoType.java @@ -26,11 +26,10 @@ import java.io.UnsupportedEncodingException; import java.util.HashSet; import java.util.Set; import javax.xml.bind.annotation.XmlTransient; -import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -39,7 +38,7 @@ import org.apache.commons.logging.LogFactory; public class TransformsInfoType extends at.buergerkarte.namespaces.securitylayer._1.TransformsInfoType implements RedirectCallback { @XmlTransient - private static Log log = LogFactory.getLog(TransformsInfoType.class); + private final Logger log = LoggerFactory.getLogger(TransformsInfoType.class); @XmlTransient private static final Set<QName> redirectTriggers = initRedirectTriggers(); @XmlTransient @@ -53,21 +52,21 @@ public class TransformsInfoType extends at.buergerkarte.namespaces.securitylayer @Override public void enableRedirect(RedirectEventFilter filter) throws XMLStreamException { - log.debug("enabling event redirection for TransformsInfoType"); + log.trace("enabling event redirection for TransformsInfoType"); redirectOS = new ByteArrayOutputStream(); filter.setRedirectStream(redirectOS, redirectTriggers); } @Override public void disableRedirect(RedirectEventFilter filter) throws XMLStreamException { - log.debug("disabling event redirection for TransformsInfoType"); + log.trace("disabling event redirection for TransformsInfoType"); filter.flushRedirectStream(); filter.setRedirectStream(null); - if (log.isDebugEnabled()) { + if (log.isTraceEnabled()) { try { - log.debug("redirected events (UTF-8): " + redirectOS.toString("UTF-8")); + log.trace("redirected events (UTF-8): " + redirectOS.toString("UTF-8")); } catch (UnsupportedEncodingException ex) { - log.debug("failed to log redirected events", ex); + log.error("failed to log redirected events", ex); } } } diff --git a/utils/src/main/java/at/gv/egiz/slbinding/impl/XMLContentType.java b/utils/src/main/java/at/gv/egiz/slbinding/impl/XMLContentType.java index fd52e378..88515067 100644 --- a/utils/src/main/java/at/gv/egiz/slbinding/impl/XMLContentType.java +++ b/utils/src/main/java/at/gv/egiz/slbinding/impl/XMLContentType.java @@ -27,8 +27,8 @@ import java.io.UnsupportedEncodingException; import javax.xml.bind.annotation.XmlTransient; import javax.xml.stream.XMLStreamException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -37,27 +37,27 @@ import org.apache.commons.logging.LogFactory; public class XMLContentType extends at.buergerkarte.namespaces.securitylayer._1.XMLContentType implements RedirectCallback { @XmlTransient - private static Log log = LogFactory.getLog(XMLContentType.class); + private final Logger log = LoggerFactory.getLogger(XMLContentType.class); @XmlTransient protected ByteArrayOutputStream redirectOS = null; @Override public void enableRedirect(RedirectEventFilter filter) throws XMLStreamException { - log.debug("enabling event redirection for XMLContentType"); + log.trace("enabling event redirection for XMLContentType"); redirectOS = new ByteArrayOutputStream(); filter.setRedirectStream(redirectOS); } @Override public void disableRedirect(RedirectEventFilter filter) throws XMLStreamException { - log.debug("disabling event redirection for XMLContentType"); + log.trace("disabling event redirection for XMLContentType"); filter.flushRedirectStream(); filter.setRedirectStream(null); - if (log.isDebugEnabled()) { + if (log.isTraceEnabled()) { try { - log.debug("redirected events (UTF-8): " + redirectOS.toString("UTF-8")); + log.trace("redirected events (UTF-8): " + redirectOS.toString("UTF-8")); } catch (UnsupportedEncodingException ex) { - log.debug("failed to log redirected events", ex); + log.error("failed to log redirected events", ex); } } } diff --git a/utils/src/main/java/at/gv/egiz/validation/ReportingValidationEventHandler.java b/utils/src/main/java/at/gv/egiz/validation/ReportingValidationEventHandler.java index 6543c333..32826b16 100644 --- a/utils/src/main/java/at/gv/egiz/validation/ReportingValidationEventHandler.java +++ b/utils/src/main/java/at/gv/egiz/validation/ReportingValidationEventHandler.java @@ -18,8 +18,8 @@ package at.gv.egiz.validation; import javax.xml.bind.ValidationEvent; import javax.xml.bind.ValidationEventHandler; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -27,7 +27,7 @@ import org.apache.commons.logging.LogFactory; */ public class ReportingValidationEventHandler implements ValidationEventHandler { - protected static final Log log = LogFactory.getLog(ReportingValidationEventHandler.class); + private final Logger log = LoggerFactory.getLogger(ReportingValidationEventHandler.class); protected ValidationEvent errorEvent; diff --git a/utils/src/main/java/at/gv/egiz/xades/QualifyingPropertiesException.java b/utils/src/main/java/at/gv/egiz/xades/QualifyingPropertiesException.java index e892a13b..3aba7cd2 100644 --- a/utils/src/main/java/at/gv/egiz/xades/QualifyingPropertiesException.java +++ b/utils/src/main/java/at/gv/egiz/xades/QualifyingPropertiesException.java @@ -18,23 +18,22 @@ package at.gv.egiz.xades; public class QualifyingPropertiesException extends Exception {
- public QualifyingPropertiesException() {
- // TODO Auto-generated constructor stub
+ private static final long serialVersionUID = 1L; + + public QualifyingPropertiesException() { + super();
}
public QualifyingPropertiesException(String message) {
super(message);
- // TODO Auto-generated constructor stub
}
public QualifyingPropertiesException(Throwable cause) {
super(cause);
- // TODO Auto-generated constructor stub
}
public QualifyingPropertiesException(String message, Throwable cause) {
super(message, cause);
- // TODO Auto-generated constructor stub
}
}
diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ActionType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ActionType.java index d2b96381..d5a84e81 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ActionType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ActionType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AdviceType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AdviceType.java index d2630fac..6009576c 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AdviceType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AdviceType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // @@ -72,10 +72,10 @@ public class AdviceType { * * <p> * Objects of the following type(s) are allowed in the list - * {@link Element } - * {@link JAXBElement }{@code <}{@link AssertionType }{@code >} - * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link Object } + * {@link JAXBElement }{@code <}{@link String }{@code >} + * {@link JAXBElement }{@code <}{@link AssertionType }{@code >} + * {@link Element } * * */ diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AnyType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AnyType.java index a9f7dd8d..b9b3773c 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AnyType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AnyType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // @@ -18,14 +18,6 @@ import javax.xml.bind.annotation.XmlType; /** - * This type is introduced to avoid the DOM Element binding of - * AttributeValue and SubjectConfirmationData, specified as - * <pre> - * <element name="AttributeValue" type="anyType"/> - * <element name="SubjectConfirmationData" type="anyType"/> - * </pre> - * in the original SAML 1.0 Assertion schema. - * * <p>Java class for AnyType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AssertionType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AssertionType.java index 2a108984..314ff36e 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AssertionType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AssertionType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // @@ -13,13 +13,14 @@ import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.datatype.XMLGregorianCalendar; -import org.w3._2000._09.xmldsig_.SignatureType; +import org.w3c.dom.Element; /** @@ -69,15 +70,15 @@ public class AssertionType { @XmlElement(name = "Advice") protected AdviceType advice; @XmlElements({ + @XmlElement(name = "AuthenticationStatement", type = AuthenticationStatementType.class), @XmlElement(name = "Statement"), @XmlElement(name = "AttributeStatement", type = AttributeStatementType.class), @XmlElement(name = "SubjectStatement", type = SubjectStatementAbstractType.class), - @XmlElement(name = "AuthorizationDecisionStatement", type = AuthorizationDecisionStatementType.class), - @XmlElement(name = "AuthenticationStatement", type = AuthenticationStatementType.class) + @XmlElement(name = "AuthorizationDecisionStatement", type = AuthorizationDecisionStatementType.class) }) protected List<StatementAbstractType> statementOrSubjectStatementOrAuthenticationStatement; - @XmlElement(name = "Signature", namespace = "http://www.w3.org/2000/09/xmldsig#") - protected SignatureType signature; + @XmlAnyElement + protected Element signature; @XmlAttribute(name = "MajorVersion", required = true) protected BigInteger majorVersion; @XmlAttribute(name = "MinorVersion", required = true) @@ -156,11 +157,11 @@ public class AssertionType { * * <p> * Objects of the following type(s) are allowed in the list + * {@link AuthenticationStatementType } * {@link StatementAbstractType } * {@link AttributeStatementType } * {@link SubjectStatementAbstractType } * {@link AuthorizationDecisionStatementType } - * {@link AuthenticationStatementType } * * */ @@ -176,10 +177,10 @@ public class AssertionType { * * @return * possible object is - * {@link SignatureType } + * {@link Element } * */ - public SignatureType getSignature() { + public Element getSignature() { return signature; } @@ -188,10 +189,10 @@ public class AssertionType { * * @param value * allowed object is - * {@link SignatureType } + * {@link Element } * */ - public void setSignature(SignatureType value) { + public void setSignature(Element value) { this.signature = value; } diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AttributeDesignatorType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AttributeDesignatorType.java index 12bd8738..fc111d12 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AttributeDesignatorType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AttributeDesignatorType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AttributeStatementType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AttributeStatementType.java index f710b74b..ad518a96 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AttributeStatementType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AttributeStatementType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AttributeType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AttributeType.java index 31d258a9..d6f13089 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AttributeType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AttributeType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AudienceRestrictionConditionType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AudienceRestrictionConditionType.java index 61091b73..2492fb97 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AudienceRestrictionConditionType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AudienceRestrictionConditionType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AuthenticationStatementType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AuthenticationStatementType.java index 93c24117..6a3910af 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AuthenticationStatementType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AuthenticationStatementType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AuthorityBindingType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AuthorityBindingType.java index 8663f35a..259a9349 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AuthorityBindingType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AuthorityBindingType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AuthorizationDecisionStatementType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AuthorizationDecisionStatementType.java index b6b37c90..9e5bdd45 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AuthorizationDecisionStatementType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/AuthorizationDecisionStatementType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ConditionAbstractType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ConditionAbstractType.java index 965bb4bd..9055688b 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ConditionAbstractType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ConditionAbstractType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ConditionsType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ConditionsType.java index 42c1e1af..c62de41b 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ConditionsType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ConditionsType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/DecisionType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/DecisionType.java index e5efbf0a..1a06a4ca 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/DecisionType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/DecisionType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/EvidenceType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/EvidenceType.java index 74f74440..89f09632 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/EvidenceType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/EvidenceType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/NameIdentifierType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/NameIdentifierType.java index 34fed5d2..73d2dbcb 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/NameIdentifierType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/NameIdentifierType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ObjectFactory.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ObjectFactory.java index d5165b71..6ea9f265 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ObjectFactory.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/ObjectFactory.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // @@ -64,19 +64,19 @@ public class ObjectFactory { } /** - * Create an instance of {@link AnyType } + * Create an instance of {@link AssertionType } * */ - public AnyType createAnyType() { - return new AnyType(); + public AssertionType createAssertionType() { + return new AssertionType(); } /** - * Create an instance of {@link ActionType } + * Create an instance of {@link EvidenceType } * */ - public ActionType createActionType() { - return new ActionType(); + public EvidenceType createEvidenceType() { + return new EvidenceType(); } /** @@ -88,11 +88,19 @@ public class ObjectFactory { } /** - * Create an instance of {@link SubjectConfirmationType } + * Create an instance of {@link ActionType } * */ - public SubjectConfirmationType createSubjectConfirmationType() { - return new SubjectConfirmationType(); + public ActionType createActionType() { + return new ActionType(); + } + + /** + * Create an instance of {@link NameIdentifierType } + * + */ + public NameIdentifierType createNameIdentifierType() { + return new NameIdentifierType(); } /** @@ -104,11 +112,11 @@ public class ObjectFactory { } /** - * Create an instance of {@link AudienceRestrictionConditionType } + * Create an instance of {@link AuthorizationDecisionStatementType } * */ - public AudienceRestrictionConditionType createAudienceRestrictionConditionType() { - return new AudienceRestrictionConditionType(); + public AuthorizationDecisionStatementType createAuthorizationDecisionStatementType() { + return new AuthorizationDecisionStatementType(); } /** @@ -120,19 +128,27 @@ public class ObjectFactory { } /** - * Create an instance of {@link AssertionType } + * Create an instance of {@link AnyType } * */ - public AssertionType createAssertionType() { - return new AssertionType(); + public AnyType createAnyType() { + return new AnyType(); } /** - * Create an instance of {@link AuthorityBindingType } + * Create an instance of {@link AudienceRestrictionConditionType } * */ - public AuthorityBindingType createAuthorityBindingType() { - return new AuthorityBindingType(); + public AudienceRestrictionConditionType createAudienceRestrictionConditionType() { + return new AudienceRestrictionConditionType(); + } + + /** + * Create an instance of {@link AttributeStatementType } + * + */ + public AttributeStatementType createAttributeStatementType() { + return new AttributeStatementType(); } /** @@ -144,19 +160,19 @@ public class ObjectFactory { } /** - * Create an instance of {@link AdviceType } + * Create an instance of {@link SubjectConfirmationType } * */ - public AdviceType createAdviceType() { - return new AdviceType(); + public SubjectConfirmationType createSubjectConfirmationType() { + return new SubjectConfirmationType(); } /** - * Create an instance of {@link EvidenceType } + * Create an instance of {@link SubjectType } * */ - public EvidenceType createEvidenceType() { - return new EvidenceType(); + public SubjectType createSubjectType() { + return new SubjectType(); } /** @@ -168,35 +184,19 @@ public class ObjectFactory { } /** - * Create an instance of {@link AttributeStatementType } - * - */ - public AttributeStatementType createAttributeStatementType() { - return new AttributeStatementType(); - } - - /** - * Create an instance of {@link NameIdentifierType } - * - */ - public NameIdentifierType createNameIdentifierType() { - return new NameIdentifierType(); - } - - /** - * Create an instance of {@link AuthorizationDecisionStatementType } + * Create an instance of {@link AuthorityBindingType } * */ - public AuthorizationDecisionStatementType createAuthorizationDecisionStatementType() { - return new AuthorizationDecisionStatementType(); + public AuthorityBindingType createAuthorityBindingType() { + return new AuthorityBindingType(); } /** - * Create an instance of {@link SubjectType } + * Create an instance of {@link AdviceType } * */ - public SubjectType createSubjectType() { - return new SubjectType(); + public AdviceType createAdviceType() { + return new AdviceType(); } /** diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/StatementAbstractType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/StatementAbstractType.java index eabd815f..e29030c9 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/StatementAbstractType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/StatementAbstractType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectConfirmationType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectConfirmationType.java index d7bd8856..0b13dd6e 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectConfirmationType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectConfirmationType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // @@ -12,10 +12,11 @@ import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; -import org.w3._2000._09.xmldsig_.KeyInfoType; +import org.w3c.dom.Element; /** @@ -52,8 +53,8 @@ public class SubjectConfirmationType { protected List<String> confirmationMethod; @XmlElement(name = "SubjectConfirmationData") protected AnyType subjectConfirmationData; - @XmlElement(name = "KeyInfo", namespace = "http://www.w3.org/2000/09/xmldsig#") - protected KeyInfoType keyInfo; + @XmlAnyElement + protected Element keyInfo; /** * Gets the value of the confirmationMethod property. @@ -113,10 +114,10 @@ public class SubjectConfirmationType { * * @return * possible object is - * {@link KeyInfoType } + * {@link Element } * */ - public KeyInfoType getKeyInfo() { + public Element getKeyInfo() { return keyInfo; } @@ -125,10 +126,10 @@ public class SubjectConfirmationType { * * @param value * allowed object is - * {@link KeyInfoType } + * {@link Element } * */ - public void setKeyInfo(KeyInfoType value) { + public void setKeyInfo(Element value) { this.keyInfo = value; } diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectLocalityType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectLocalityType.java index 1515d535..2ffa9d9d 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectLocalityType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectLocalityType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectStatementAbstractType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectStatementAbstractType.java index 07916c14..99f503fa 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectStatementAbstractType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectStatementAbstractType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectType.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectType.java index 646339c8..abb08c4d 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectType.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/SubjectType.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // @@ -48,8 +48,8 @@ import javax.xml.bind.annotation.XmlType; public class SubjectType { @XmlElementRefs({ - @XmlElementRef(name = "NameIdentifier", namespace = "urn:oasis:names:tc:SAML:1.0:assertion", type = JAXBElement.class), - @XmlElementRef(name = "SubjectConfirmation", namespace = "urn:oasis:names:tc:SAML:1.0:assertion", type = JAXBElement.class) + @XmlElementRef(name = "SubjectConfirmation", namespace = "urn:oasis:names:tc:SAML:1.0:assertion", type = JAXBElement.class), + @XmlElementRef(name = "NameIdentifier", namespace = "urn:oasis:names:tc:SAML:1.0:assertion", type = JAXBElement.class) }) protected List<JAXBElement<?>> content; @@ -59,8 +59,8 @@ public class SubjectType { * <p> * You are getting this "catch-all" property because of the following reason: * The field name "SubjectConfirmation" is used by two different parts of a schema. See: - * line 94 of file:/home/clemens/workspace/schema-base/src/main/schema/oasis-sstc-saml-schema-assertion-1.0.xsd - * line 92 of file:/home/clemens/workspace/schema-base/src/main/schema/oasis-sstc-saml-schema-assertion-1.0.xsd + * line 98 of file:/Users/clemens/Documents/workspace/schema-base/src/main/schema/oasis-sstc-saml-schema-assertion-1.0.xsd + * line 96 of file:/Users/clemens/Documents/workspace/schema-base/src/main/schema/oasis-sstc-saml-schema-assertion-1.0.xsd * <p> * To get rid of this property, apply a property customization to one * of both of the following declarations to change their names: @@ -81,8 +81,8 @@ public class SubjectType { * * <p> * Objects of the following type(s) are allowed in the list - * {@link JAXBElement }{@code <}{@link NameIdentifierType }{@code >} * {@link JAXBElement }{@code <}{@link SubjectConfirmationType }{@code >} + * {@link JAXBElement }{@code <}{@link NameIdentifierType }{@code >} * * */ diff --git a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/package-info.java b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/package-info.java index 4eb7ece2..75f6af85 100644 --- a/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/package-info.java +++ b/utils/src/main/java/oasis/names/tc/saml/_1_0/assertion/package-info.java @@ -1,8 +1,8 @@ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.12.23 at 03:26:53 PM GMT +// Generated on: 2010.02.24 at 05:41:17 PM MEZ // @javax.xml.bind.annotation.XmlSchema(namespace = "urn:oasis:names:tc:SAML:1.0:assertion", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/CanonicalizationMethodType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/CanonicalizationMethodType.java index 675ded2d..c2c257aa 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/CanonicalizationMethodType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/CanonicalizationMethodType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -45,7 +29,7 @@ import javax.xml.bind.annotation.XmlType; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <any/> + * <any maxOccurs="unbounded" minOccurs="0"/> * </sequence> * <attribute name="Algorithm" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" /> * </restriction> diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/DSAKeyValueType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/DSAKeyValueType.java index 6a9916f1..fe83fbb8 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/DSAKeyValueType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/DSAKeyValueType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/DigestMethodType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/DigestMethodType.java index 8a93927c..f1c1480b 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/DigestMethodType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/DigestMethodType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -46,7 +30,7 @@ import org.w3c.dom.Element; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <any/> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * </sequence> * <attribute name="Algorithm" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" /> * </restriction> @@ -87,9 +71,9 @@ public class DigestMethodType { * * <p> * Objects of the following type(s) are allowed in the list - * {@link Element } * {@link String } * {@link Object } + * {@link Element } * * */ diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/KeyInfoType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/KeyInfoType.java index 982d4dc5..e2339e56 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/KeyInfoType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/KeyInfoType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -59,7 +43,7 @@ import org.w3c.dom.Element; * <element ref="{http://www.w3.org/2000/09/xmldsig#}PGPData"/> * <element ref="{http://www.w3.org/2000/09/xmldsig#}SPKIData"/> * <element ref="{http://www.w3.org/2000/09/xmldsig#}MgmtData"/> - * <any/> + * <any processContents='lax' namespace='##other'/> * </choice> * <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" /> * </restriction> @@ -76,13 +60,13 @@ import org.w3c.dom.Element; public class KeyInfoType { @XmlElementRefs({ - @XmlElementRef(name = "KeyName", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), - @XmlElementRef(name = "PGPData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), - @XmlElementRef(name = "X509Data", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), - @XmlElementRef(name = "SPKIData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), @XmlElementRef(name = "MgmtData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), + @XmlElementRef(name = "RetrievalMethod", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), + @XmlElementRef(name = "X509Data", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), + @XmlElementRef(name = "PGPData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), + @XmlElementRef(name = "KeyName", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), @XmlElementRef(name = "KeyValue", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), - @XmlElementRef(name = "RetrievalMethod", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class) + @XmlElementRef(name = "SPKIData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class) }) @XmlMixed @XmlAnyElement(lax = true) @@ -111,16 +95,16 @@ public class KeyInfoType { * * <p> * Objects of the following type(s) are allowed in the list - * {@link JAXBElement }{@code <}{@link String }{@code >} - * {@link JAXBElement }{@code <}{@link PGPDataType }{@code >} * {@link Element } - * {@link JAXBElement }{@code <}{@link X509DataType }{@code >} + * {@link JAXBElement }{@code <}{@link String }{@code >} + * {@link JAXBElement }{@code <}{@link RetrievalMethodType }{@code >} * {@link String } + * {@link JAXBElement }{@code <}{@link X509DataType }{@code >} * {@link Object } - * {@link JAXBElement }{@code <}{@link SPKIDataType }{@code >} + * {@link JAXBElement }{@code <}{@link PGPDataType }{@code >} * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link JAXBElement }{@code <}{@link KeyValueType }{@code >} - * {@link JAXBElement }{@code <}{@link RetrievalMethodType }{@code >} + * {@link JAXBElement }{@code <}{@link SPKIDataType }{@code >} * * */ diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/KeyValueType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/KeyValueType.java index 8bfa9f17..6d4e7b40 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/KeyValueType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/KeyValueType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -49,7 +33,7 @@ import org.w3c.dom.Element; * <choice> * <element ref="{http://www.w3.org/2000/09/xmldsig#}DSAKeyValue"/> * <element ref="{http://www.w3.org/2000/09/xmldsig#}RSAKeyValue"/> - * <any/> + * <any processContents='lax' namespace='##other'/> * </choice> * </restriction> * </complexContent> @@ -90,10 +74,10 @@ public class KeyValueType { * * <p> * Objects of the following type(s) are allowed in the list - * {@link JAXBElement }{@code <}{@link DSAKeyValueType }{@code >} - * {@link String } * {@link Object } * {@link Element } + * {@link JAXBElement }{@code <}{@link DSAKeyValueType }{@code >} + * {@link String } * {@link JAXBElement }{@code <}{@link RSAKeyValueType }{@code >} * * diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ManifestType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ManifestType.java index b8e2d049..414dba2f 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ManifestType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ManifestType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectFactory.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectFactory.java index fae77451..b0379614 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectFactory.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectFactory.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -48,6 +32,8 @@ import javax.xml.namespace.QName; @XmlRegistry public class ObjectFactory { + private final static QName _PGPDataTypePGPKeyID_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "PGPKeyID"); + private final static QName _PGPDataTypePGPKeyPacket_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "PGPKeyPacket"); private final static QName _Signature_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Signature"); private final static QName _PGPData_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "PGPData"); private final static QName _DSAKeyValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "DSAKeyValue"); @@ -57,31 +43,29 @@ public class ObjectFactory { private final static QName _CanonicalizationMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "CanonicalizationMethod"); private final static QName _Object_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Object"); private final static QName _SignatureProperty_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureProperty"); + private final static QName _Transforms_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Transforms"); private final static QName _SignatureValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureValue"); private final static QName _Manifest_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Manifest"); - private final static QName _Transforms_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Transforms"); private final static QName _Transform_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Transform"); private final static QName _X509Data_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509Data"); private final static QName _SignatureMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureMethod"); private final static QName _KeyInfo_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "KeyInfo"); private final static QName _DigestValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "DigestValue"); private final static QName _DigestMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "DigestMethod"); - private final static QName _SignatureProperties_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureProperties"); private final static QName _MgmtData_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "MgmtData"); + private final static QName _SignatureProperties_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureProperties"); private final static QName _KeyName_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "KeyName"); private final static QName _KeyValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "KeyValue"); private final static QName _Reference_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Reference"); private final static QName _RSAKeyValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "RSAKeyValue"); private final static QName _TransformTypeXPath_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "XPath"); - private final static QName _SPKIDataTypeSPKISexp_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SPKISexp"); private final static QName _SignatureMethodTypeHMACOutputLength_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "HMACOutputLength"); private final static QName _X509DataTypeX509IssuerSerial_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509IssuerSerial"); private final static QName _X509DataTypeX509Certificate_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509Certificate"); private final static QName _X509DataTypeX509SKI_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509SKI"); private final static QName _X509DataTypeX509SubjectName_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509SubjectName"); private final static QName _X509DataTypeX509CRL_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509CRL"); - private final static QName _PGPDataTypePGPKeyID_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "PGPKeyID"); - private final static QName _PGPDataTypePGPKeyPacket_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "PGPKeyPacket"); + private final static QName _SPKIDataTypeSPKISexp_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SPKISexp"); /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.w3._2000._09.xmldsig_ @@ -91,11 +75,27 @@ public class ObjectFactory { } /** - * Create an instance of {@link RetrievalMethodType } + * Create an instance of {@link DigestMethodType } * */ - public RetrievalMethodType createRetrievalMethodType() { - return new RetrievalMethodType(); + public DigestMethodType createDigestMethodType() { + return new DigestMethodType(); + } + + /** + * Create an instance of {@link ManifestType } + * + */ + public ManifestType createManifestType() { + return new ManifestType(); + } + + /** + * Create an instance of {@link TransformType } + * + */ + public TransformType createTransformType() { + return new TransformType(); } /** @@ -107,164 +107,165 @@ public class ObjectFactory { } /** - * Create an instance of {@link DSAKeyValueType } + * Create an instance of {@link ReferenceType } * */ - public DSAKeyValueType createDSAKeyValueType() { - return new DSAKeyValueType(); + public ReferenceType createReferenceType() { + return new ReferenceType(); } /** - * Create an instance of {@link DigestMethodType } + * Create an instance of {@link KeyValueType } * */ - public DigestMethodType createDigestMethodType() { - return new DigestMethodType(); + public KeyValueType createKeyValueType() { + return new KeyValueType(); } /** - * Create an instance of {@link SignaturePropertiesType } + * Create an instance of {@link PGPDataType } * */ - public SignaturePropertiesType createSignaturePropertiesType() { - return new SignaturePropertiesType(); + public PGPDataType createPGPDataType() { + return new PGPDataType(); } /** - * Create an instance of {@link ObjectType } + * Create an instance of {@link SignatureType } * */ - public ObjectType createObjectType() { - return new ObjectType(); + public SignatureType createSignatureType() { + return new SignatureType(); } /** - * Create an instance of {@link X509DataType } + * Create an instance of {@link DSAKeyValueType } * */ - public X509DataType createX509DataType() { - return new X509DataType(); + public DSAKeyValueType createDSAKeyValueType() { + return new DSAKeyValueType(); } /** - * Create an instance of {@link ReferenceType } + * Create an instance of {@link SignatureValueType } * */ - public ReferenceType createReferenceType() { - return new ReferenceType(); + public SignatureValueType createSignatureValueType() { + return new SignatureValueType(); } /** - * Create an instance of {@link CanonicalizationMethodType } + * Create an instance of {@link SignaturePropertiesType } * */ - public CanonicalizationMethodType createCanonicalizationMethodType() { - return new CanonicalizationMethodType(); + public SignaturePropertiesType createSignaturePropertiesType() { + return new SignaturePropertiesType(); } /** - * Create an instance of {@link TransformType } + * Create an instance of {@link SignaturePropertyType } * */ - public TransformType createTransformType() { -// return new at.gv.egiz.slbinding.impl.TransformType(); - return new TransformType(); + public SignaturePropertyType createSignaturePropertyType() { + return new SignaturePropertyType(); } /** - * Create an instance of {@link SignatureMethodType } + * Create an instance of {@link RetrievalMethodType } * */ - public SignatureMethodType createSignatureMethodType() { - return new SignatureMethodType(); + public RetrievalMethodType createRetrievalMethodType() { + return new RetrievalMethodType(); } /** - * Create an instance of {@link PGPDataType } + * Create an instance of {@link X509IssuerSerialType } * */ - public PGPDataType createPGPDataType() { - return new PGPDataType(); + public X509IssuerSerialType createX509IssuerSerialType() { + return new X509IssuerSerialType(); } /** - * Create an instance of {@link KeyInfoType } + * Create an instance of {@link SPKIDataType } * */ - public KeyInfoType createKeyInfoType() { - return new KeyInfoType(); + public SPKIDataType createSPKIDataType() { + return new SPKIDataType(); } /** - * Create an instance of {@link RSAKeyValueType } + * Create an instance of {@link ObjectType } * */ - public RSAKeyValueType createRSAKeyValueType() { - return new RSAKeyValueType(); + public ObjectType createObjectType() { + return new ObjectType(); } /** - * Create an instance of {@link KeyValueType } + * Create an instance of {@link KeyInfoType } * */ - public KeyValueType createKeyValueType() { - return new KeyValueType(); + public KeyInfoType createKeyInfoType() { + return new KeyInfoType(); } /** - * Create an instance of {@link SignaturePropertyType } + * Create an instance of {@link TransformsType } * */ - public SignaturePropertyType createSignaturePropertyType() { - return new SignaturePropertyType(); + public TransformsType createTransformsType() { + return new TransformsType(); } /** - * Create an instance of {@link ManifestType } + * Create an instance of {@link SignatureMethodType } * */ - public ManifestType createManifestType() { - return new ManifestType(); + public SignatureMethodType createSignatureMethodType() { + return new SignatureMethodType(); } /** - * Create an instance of {@link SignatureType } + * Create an instance of {@link X509DataType } * */ - public SignatureType createSignatureType() { - return new SignatureType(); + public X509DataType createX509DataType() { + return new X509DataType(); } /** - * Create an instance of {@link TransformsType } + * Create an instance of {@link CanonicalizationMethodType } * */ - public TransformsType createTransformsType() { - return new TransformsType(); + public CanonicalizationMethodType createCanonicalizationMethodType() { + return new CanonicalizationMethodType(); } /** - * Create an instance of {@link SignatureValueType } + * Create an instance of {@link RSAKeyValueType } * */ - public SignatureValueType createSignatureValueType() { - return new SignatureValueType(); + public RSAKeyValueType createRSAKeyValueType() { + return new RSAKeyValueType(); } /** - * Create an instance of {@link X509IssuerSerialType } + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} * */ - public X509IssuerSerialType createX509IssuerSerialType() { - return new X509IssuerSerialType(); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPKeyID", scope = PGPDataType.class) + public JAXBElement<byte[]> createPGPDataTypePGPKeyID(byte[] value) { + return new JAXBElement<byte[]>(_PGPDataTypePGPKeyID_QNAME, byte[].class, PGPDataType.class, ((byte[]) value)); } /** - * Create an instance of {@link SPKIDataType } + * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} * */ - public SPKIDataType createSPKIDataType() { - return new SPKIDataType(); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPKeyPacket", scope = PGPDataType.class) + public JAXBElement<byte[]> createPGPDataTypePGPKeyPacket(byte[] value) { + return new JAXBElement<byte[]>(_PGPDataTypePGPKeyPacket_QNAME, byte[].class, PGPDataType.class, ((byte[]) value)); } /** @@ -349,6 +350,15 @@ public class ObjectFactory { } /** + * Create an instance of {@link JAXBElement }{@code <}{@link TransformsType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Transforms") + public JAXBElement<TransformsType> createTransforms(TransformsType value) { + return new JAXBElement<TransformsType>(_Transforms_QNAME, TransformsType.class, null, value); + } + + /** * Create an instance of {@link JAXBElement }{@code <}{@link SignatureValueType }{@code >}} * */ @@ -367,15 +377,6 @@ public class ObjectFactory { } /** - * Create an instance of {@link JAXBElement }{@code <}{@link TransformsType }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Transforms") - public JAXBElement<TransformsType> createTransforms(TransformsType value) { - return new JAXBElement<TransformsType>(_Transforms_QNAME, TransformsType.class, null, value); - } - - /** * Create an instance of {@link JAXBElement }{@code <}{@link TransformType }{@code >}} * */ @@ -430,21 +431,21 @@ public class ObjectFactory { } /** - * Create an instance of {@link JAXBElement }{@code <}{@link SignaturePropertiesType }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureProperties") - public JAXBElement<SignaturePropertiesType> createSignatureProperties(SignaturePropertiesType value) { - return new JAXBElement<SignaturePropertiesType>(_SignatureProperties_QNAME, SignaturePropertiesType.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "MgmtData") + public JAXBElement<String> createMgmtData(String value) { + return new JAXBElement<String>(_MgmtData_QNAME, String.class, null, value); } /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * Create an instance of {@link JAXBElement }{@code <}{@link SignaturePropertiesType }{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "MgmtData") - public JAXBElement<String> createMgmtData(String value) { - return new JAXBElement<String>(_MgmtData_QNAME, String.class, null, value); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureProperties") + public JAXBElement<SignaturePropertiesType> createSignatureProperties(SignaturePropertiesType value) { + return new JAXBElement<SignaturePropertiesType>(_SignatureProperties_QNAME, SignaturePropertiesType.class, null, value); } /** @@ -493,15 +494,6 @@ public class ObjectFactory { } /** - * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} - * - */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SPKISexp", scope = SPKIDataType.class) - public JAXBElement<byte[]> createSPKIDataTypeSPKISexp(byte[] value) { - return new JAXBElement<byte[]>(_SPKIDataTypeSPKISexp_QNAME, byte[].class, SPKIDataType.class, ((byte[]) value)); - } - - /** * Create an instance of {@link JAXBElement }{@code <}{@link BigInteger }{@code >}} * */ @@ -559,18 +551,9 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} * */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPKeyID", scope = PGPDataType.class) - public JAXBElement<byte[]> createPGPDataTypePGPKeyID(byte[] value) { - return new JAXBElement<byte[]>(_PGPDataTypePGPKeyID_QNAME, byte[].class, PGPDataType.class, ((byte[]) value)); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}} - * - */ - @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPKeyPacket", scope = PGPDataType.class) - public JAXBElement<byte[]> createPGPDataTypePGPKeyPacket(byte[] value) { - return new JAXBElement<byte[]>(_PGPDataTypePGPKeyPacket_QNAME, byte[].class, PGPDataType.class, ((byte[]) value)); + @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SPKISexp", scope = SPKIDataType.class) + public JAXBElement<byte[]> createSPKIDataTypeSPKISexp(byte[] value) { + return new JAXBElement<byte[]>(_SPKIDataTypeSPKISexp_QNAME, byte[].class, SPKIDataType.class, ((byte[]) value)); } } diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectType.java index f63304c2..de805aee 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -49,7 +33,7 @@ import org.w3c.dom.Element; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence maxOccurs="unbounded" minOccurs="0"> - * <any/> + * <any processContents='lax'/> * </sequence> * <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" /> * <attribute name="MimeType" type="{http://www.w3.org/2001/XMLSchema}string" /> @@ -99,9 +83,9 @@ public class ObjectType { * * <p> * Objects of the following type(s) are allowed in the list - * {@link Element } * {@link String } * {@link Object } + * {@link Element } * * */ diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/PGPDataType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/PGPDataType.java index 3f173371..43791f92 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/PGPDataType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/PGPDataType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -49,11 +33,11 @@ import org.w3c.dom.Element; * <sequence> * <element name="PGPKeyID" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/> * <element name="PGPKeyPacket" type="{http://www.w3.org/2001/XMLSchema}base64Binary" minOccurs="0"/> - * <any/> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * </sequence> * <sequence> * <element name="PGPKeyPacket" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/> - * <any/> + * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * </sequence> * </choice> * </restriction> @@ -70,8 +54,8 @@ import org.w3c.dom.Element; public class PGPDataType { @XmlElementRefs({ - @XmlElementRef(name = "PGPKeyID", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), - @XmlElementRef(name = "PGPKeyPacket", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class) + @XmlElementRef(name = "PGPKeyPacket", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), + @XmlElementRef(name = "PGPKeyID", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class) }) @XmlAnyElement(lax = true) protected List<Object> content; @@ -82,8 +66,8 @@ public class PGPDataType { * <p> * You are getting this "catch-all" property because of the following reason: * The field name "PGPKeyPacket" is used by two different parts of a schema. See: - * line 208 of file:/home/clemens/workspace/bku/schema-base/src/main/schema/xmldsig-core-schema.xsd - * line 203 of file:/home/clemens/workspace/bku/schema-base/src/main/schema/xmldsig-core-schema.xsd + * line 218 of http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd + * line 213 of http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd * <p> * To get rid of this property, apply a property customization to one * of both of the following declarations to change their names: @@ -104,10 +88,10 @@ public class PGPDataType { * * <p> * Objects of the following type(s) are allowed in the list - * {@link JAXBElement }{@code <}{@link byte[]}{@code >} * {@link Object } * {@link Element } * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} * * */ diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/RSAKeyValueType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/RSAKeyValueType.java index dd456bb5..74e9fa62 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/RSAKeyValueType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/RSAKeyValueType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ReferenceType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ReferenceType.java index 9c005a02..47f51aa8 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ReferenceType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ReferenceType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/RetrievalMethodType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/RetrievalMethodType.java index 179e3e2c..37b6717b 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/RetrievalMethodType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/RetrievalMethodType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SPKIDataType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SPKIDataType.java index ec0ae5dc..2e2f904c 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SPKIDataType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SPKIDataType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -46,7 +30,7 @@ import org.w3c.dom.Element; * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence maxOccurs="unbounded"> * <element name="SPKISexp" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/> - * <any/> + * <any processContents='lax' namespace='##other' minOccurs="0"/> * </sequence> * </restriction> * </complexContent> @@ -83,9 +67,9 @@ public class SPKIDataType { * * <p> * Objects of the following type(s) are allowed in the list - * {@link JAXBElement }{@code <}{@link byte[]}{@code >} - * {@link Element } * {@link Object } + * {@link Element } + * {@link JAXBElement }{@code <}{@link byte[]}{@code >} * * */ diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignatureMethodType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignatureMethodType.java index b915a92f..6d73cea0 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignatureMethodType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignatureMethodType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -49,7 +33,7 @@ import javax.xml.bind.annotation.XmlType; * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="HMACOutputLength" type="{http://www.w3.org/2000/09/xmldsig#}HMACOutputLengthType" minOccurs="0"/> - * <any/> + * <any namespace='##other' maxOccurs="unbounded" minOccurs="0"/> * </sequence> * <attribute name="Algorithm" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" /> * </restriction> @@ -91,9 +75,9 @@ public class SignatureMethodType { * * <p> * Objects of the following type(s) are allowed in the list - * {@link JAXBElement }{@code <}{@link BigInteger }{@code >} * {@link String } * {@link Object } + * {@link JAXBElement }{@code <}{@link BigInteger }{@code >} * * */ diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignaturePropertiesType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignaturePropertiesType.java index 722d3587..49527d45 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignaturePropertiesType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignaturePropertiesType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignaturePropertyType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignaturePropertyType.java index 10f15721..09838725 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignaturePropertyType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignaturePropertyType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -49,7 +33,7 @@ import org.w3c.dom.Element; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <choice maxOccurs="unbounded"> - * <any/> + * <any processContents='lax' namespace='##other'/> * </choice> * <attribute name="Target" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" /> * <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" /> @@ -96,9 +80,9 @@ public class SignaturePropertyType { * * <p> * Objects of the following type(s) are allowed in the list - * {@link Element } * {@link String } * {@link Object } + * {@link Element } * * */ diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignatureType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignatureType.java index ce71624b..0611c217 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignatureType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignatureType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -28,6 +12,7 @@ import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlID; @@ -35,6 +20,7 @@ import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.w3c.dom.Element; /** @@ -73,8 +59,8 @@ public class SignatureType { protected SignedInfoType signedInfo; @XmlElement(name = "SignatureValue", required = true) protected SignatureValueType signatureValue; - @XmlElement(name = "KeyInfo") - protected KeyInfoType keyInfo; + @XmlAnyElement + protected Element keyInfo; @XmlElement(name = "Object") protected List<ObjectType> object; @XmlAttribute(name = "Id") @@ -136,10 +122,10 @@ public class SignatureType { * * @return * possible object is - * {@link KeyInfoType } + * {@link Element } * */ - public KeyInfoType getKeyInfo() { + public Element getKeyInfo() { return keyInfo; } @@ -148,10 +134,10 @@ public class SignatureType { * * @param value * allowed object is - * {@link KeyInfoType } + * {@link Element } * */ - public void setKeyInfo(KeyInfoType value) { + public void setKeyInfo(Element value) { this.keyInfo = value; } diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignatureValueType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignatureValueType.java index 764a2092..b18f01d6 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignatureValueType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignatureValueType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignedInfoType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignedInfoType.java index b045e668..db7d2d3c 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignedInfoType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/SignedInfoType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformType.java index 5cfb679a..3e81e118 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -48,7 +32,7 @@ import org.w3c.dom.Element; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <choice maxOccurs="unbounded" minOccurs="0"> - * <any/> + * <any processContents='lax' namespace='##other'/> * <element name="XPath" type="{http://www.w3.org/2001/XMLSchema}string"/> * </choice> * <attribute name="Algorithm" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" /> @@ -91,10 +75,10 @@ public class TransformType { * * <p> * Objects of the following type(s) are allowed in the list - * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link Object } - * {@link String } * {@link Element } + * {@link JAXBElement }{@code <}{@link String }{@code >} + * {@link String } * * */ diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformsType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformsType.java index c7044c4c..29205150 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformsType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformsType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -57,7 +41,7 @@ import javax.xml.bind.annotation.XmlType; }) public class TransformsType { - @XmlElement(name = "Transform", required = true) //, type=at.gv.egiz.slbinding.impl.TransformType.class) + @XmlElement(name = "Transform", required = true) protected List<TransformType> transform; /** diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/X509DataType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/X509DataType.java index 4c60f131..fcf07b84 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/X509DataType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/X509DataType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @@ -52,7 +36,7 @@ import org.w3c.dom.Element; * <element name="X509SubjectName" type="{http://www.w3.org/2001/XMLSchema}string"/> * <element name="X509Certificate" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/> * <element name="X509CRL" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/> - * <any/> + * <any processContents='lax' namespace='##other'/> * </choice> * </sequence> * </restriction> @@ -69,11 +53,11 @@ import org.w3c.dom.Element; public class X509DataType { @XmlElementRefs({ - @XmlElementRef(name = "X509SubjectName", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), - @XmlElementRef(name = "X509CRL", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), @XmlElementRef(name = "X509SKI", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), + @XmlElementRef(name = "X509IssuerSerial", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), + @XmlElementRef(name = "X509CRL", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), @XmlElementRef(name = "X509Certificate", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class), - @XmlElementRef(name = "X509IssuerSerial", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class) + @XmlElementRef(name = "X509SubjectName", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class) }) @XmlAnyElement(lax = true) protected List<Object> x509IssuerSerialOrX509SKIOrX509SubjectName; @@ -96,13 +80,13 @@ public class X509DataType { * * <p> * Objects of the following type(s) are allowed in the list - * {@link JAXBElement }{@code <}{@link String }{@code >} - * {@link Element } * {@link JAXBElement }{@code <}{@link byte[]}{@code >} + * {@link Element } + * {@link JAXBElement }{@code <}{@link X509IssuerSerialType }{@code >} * {@link JAXBElement }{@code <}{@link byte[]}{@code >} * {@link Object } * {@link JAXBElement }{@code <}{@link byte[]}{@code >} - * {@link JAXBElement }{@code <}{@link X509IssuerSerialType }{@code >} + * {@link JAXBElement }{@code <}{@link String }{@code >} * * */ diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/X509IssuerSerialType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/X509IssuerSerialType.java index dfb0c353..bb5957b9 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/X509IssuerSerialType.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/X509IssuerSerialType.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/package-info.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/package-info.java index f7f42cb4..db9f2dc4 100644 --- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/package-info.java +++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/package-info.java @@ -1,24 +1,8 @@ -/* -* 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. -*/ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-520 +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2008.07.21 at 09:30:44 AM GMT +// Generated on: 2010.02.24 at 05:42:21 PM MEZ // @javax.xml.bind.annotation.XmlSchema(namespace = "http://www.w3.org/2000/09/xmldsig#", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) diff --git a/bkucommon/src/main/resources/at/gv/egiz/bku/slcommands/schema/Core-1.2.xsd b/utils/src/main/resources/at/gv/egiz/bku/slschema/Core-1.2.xsd index 594e4415..1ea7b047 100644 --- a/bkucommon/src/main/resources/at/gv/egiz/bku/slcommands/schema/Core-1.2.xsd +++ b/utils/src/main/resources/at/gv/egiz/bku/slschema/Core-1.2.xsd @@ -114,7 +114,7 @@ <xsd:element name="CreateXMLSignatureResponse" type="CreateXMLSignatureResponseType"/>
<xsd:complexType name="CreateXMLSignatureResponseType">
<xsd:sequence>
- <xsd:any namespace="##any" processContents="lax"/>
+ <xsd:any namespace="##any" processContents="lax" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<!--###################################################################### -->
diff --git a/bkucommon/src/main/resources/at/gv/egiz/bku/slcommands/schema/Core.20020225.xsd b/utils/src/main/resources/at/gv/egiz/bku/slschema/Core.20020225.xsd index 76d1d7cb..76d1d7cb 100644 --- a/bkucommon/src/main/resources/at/gv/egiz/bku/slcommands/schema/Core.20020225.xsd +++ b/utils/src/main/resources/at/gv/egiz/bku/slschema/Core.20020225.xsd diff --git a/bkucommon/src/main/resources/at/gv/egiz/bku/slcommands/schema/Core.20020831.xsd b/utils/src/main/resources/at/gv/egiz/bku/slschema/Core.20020831.xsd index 6759d791..6759d791 100644 --- a/bkucommon/src/main/resources/at/gv/egiz/bku/slcommands/schema/Core.20020831.xsd +++ b/utils/src/main/resources/at/gv/egiz/bku/slschema/Core.20020831.xsd diff --git a/bkucommon/src/main/resources/at/gv/egiz/bku/slcommands/schema/xml.xsd b/utils/src/main/resources/at/gv/egiz/bku/slschema/xml.xsd index eeb9db56..eeb9db56 100644 --- a/bkucommon/src/main/resources/at/gv/egiz/bku/slcommands/schema/xml.xsd +++ b/utils/src/main/resources/at/gv/egiz/bku/slschema/xml.xsd diff --git a/utils/src/main/resources/at/gv/egiz/bku/slschema/xmldsig-core-schema.xsd b/utils/src/main/resources/at/gv/egiz/bku/slschema/xmldsig-core-schema.xsd new file mode 100644 index 00000000..8422fdfa --- /dev/null +++ b/utils/src/main/resources/at/gv/egiz/bku/slschema/xmldsig-core-schema.xsd @@ -0,0 +1,308 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Schema for XML Signatures + http://www.w3.org/2000/09/xmldsig# + $Revision: 1.1 $ on $Date: 2002/02/08 20:32:26 $ by $Author: reagle $ + + Copyright 2001 The Internet Society and W3C (Massachusetts Institute + of Technology, Institut National de Recherche en Informatique et en + Automatique, Keio University). All Rights Reserved. + http://www.w3.org/Consortium/Legal/ + + This document is governed by the W3C Software License [1] as described + in the FAQ [2]. + + [1] http://www.w3.org/Consortium/Legal/copyright-software-19980720 + [2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD +--> + + +<schema xmlns="http://www.w3.org/2001/XMLSchema" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + targetNamespace="http://www.w3.org/2000/09/xmldsig#" + version="0.1" elementFormDefault="qualified"> + +<!-- Basic Types Defined for Signatures --> + +<simpleType name="CryptoBinary"> + <restriction base="base64Binary"> + </restriction> +</simpleType> + +<!-- Start Signature --> + +<element name="Signature" type="ds:SignatureType"/> +<complexType name="SignatureType"> + <sequence> + <element ref="ds:SignedInfo"/> + <element ref="ds:SignatureValue"/> + <element ref="ds:KeyInfo" minOccurs="0"/> + <element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + <attribute name="Id" type="ID" use="optional"/> +</complexType> + + <element name="SignatureValue" type="ds:SignatureValueType"/> + <complexType name="SignatureValueType"> + <simpleContent> + <extension base="base64Binary"> + <attribute name="Id" type="ID" use="optional"/> + </extension> + </simpleContent> + </complexType> + +<!-- Start SignedInfo --> + +<element name="SignedInfo" type="ds:SignedInfoType"/> +<complexType name="SignedInfoType"> + <sequence> + <element ref="ds:CanonicalizationMethod"/> + <element ref="ds:SignatureMethod"/> + <element ref="ds:Reference" maxOccurs="unbounded"/> + </sequence> + <attribute name="Id" type="ID" use="optional"/> +</complexType> + + <element name="CanonicalizationMethod" type="ds:CanonicalizationMethodType"/> + <complexType name="CanonicalizationMethodType" mixed="true"> + <sequence> + <any namespace="##any" minOccurs="0" maxOccurs="unbounded"/> + <!-- (0,unbounded) elements from (1,1) namespace --> + </sequence> + <attribute name="Algorithm" type="anyURI" use="required"/> + </complexType> + + <element name="SignatureMethod" type="ds:SignatureMethodType"/> + <complexType name="SignatureMethodType" mixed="true"> + <sequence> + <element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/> + <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/> + <!-- (0,unbounded) elements from (1,1) external namespace --> + </sequence> + <attribute name="Algorithm" type="anyURI" use="required"/> + </complexType> + +<!-- Start Reference --> + +<element name="Reference" type="ds:ReferenceType"/> +<complexType name="ReferenceType"> + <sequence> + <element ref="ds:Transforms" minOccurs="0"/> + <element ref="ds:DigestMethod"/> + <element ref="ds:DigestValue"/> + </sequence> + <attribute name="Id" type="ID" use="optional"/> + <attribute name="URI" type="anyURI" use="optional"/> + <attribute name="Type" type="anyURI" use="optional"/> +</complexType> + + <element name="Transforms" type="ds:TransformsType"/> + <complexType name="TransformsType"> + <sequence> + <element ref="ds:Transform" maxOccurs="unbounded"/> + </sequence> + </complexType> + + <element name="Transform" type="ds:TransformType"/> + <complexType name="TransformType" mixed="true"> + <choice minOccurs="0" maxOccurs="unbounded"> + <any namespace="##other" processContents="lax"/> + <!-- (1,1) elements from (0,unbounded) namespaces --> + <element name="XPath" type="string"/> + </choice> + <attribute name="Algorithm" type="anyURI" use="required"/> + </complexType> + +<!-- End Reference --> + +<element name="DigestMethod" type="ds:DigestMethodType"/> +<complexType name="DigestMethodType" mixed="true"> + <sequence> + <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + <attribute name="Algorithm" type="anyURI" use="required"/> +</complexType> + +<element name="DigestValue" type="ds:DigestValueType"/> +<simpleType name="DigestValueType"> + <restriction base="base64Binary"/> +</simpleType> + +<!-- End SignedInfo --> + +<!-- Start KeyInfo --> + +<element name="KeyInfo" type="ds:KeyInfoType"/> +<complexType name="KeyInfoType" mixed="true"> + <choice maxOccurs="unbounded"> + <element ref="ds:KeyName"/> + <element ref="ds:KeyValue"/> + <element ref="ds:RetrievalMethod"/> + <element ref="ds:X509Data"/> + <element ref="ds:PGPData"/> + <element ref="ds:SPKIData"/> + <element ref="ds:MgmtData"/> + <any processContents="lax" namespace="##other"/> + <!-- (1,1) elements from (0,unbounded) namespaces --> + </choice> + <attribute name="Id" type="ID" use="optional"/> +</complexType> + + <element name="KeyName" type="string"/> + <element name="MgmtData" type="string"/> + + <element name="KeyValue" type="ds:KeyValueType"/> + <complexType name="KeyValueType" mixed="true"> + <choice> + <element ref="ds:DSAKeyValue"/> + <element ref="ds:RSAKeyValue"/> + <any namespace="##other" processContents="lax"/> + </choice> + </complexType> + + <element name="RetrievalMethod" type="ds:RetrievalMethodType"/> + <complexType name="RetrievalMethodType"> + <sequence> + <element ref="ds:Transforms" minOccurs="0"/> + </sequence> + <attribute name="URI" type="anyURI"/> + <attribute name="Type" type="anyURI" use="optional"/> + </complexType> + +<!-- Start X509Data --> + +<element name="X509Data" type="ds:X509DataType"/> +<complexType name="X509DataType"> + <sequence maxOccurs="unbounded"> + <choice> + <element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/> + <element name="X509SKI" type="base64Binary"/> + <element name="X509SubjectName" type="string"/> + <element name="X509Certificate" type="base64Binary"/> + <element name="X509CRL" type="base64Binary"/> + <any namespace="##other" processContents="lax"/> + </choice> + </sequence> +</complexType> + +<complexType name="X509IssuerSerialType"> + <sequence> + <element name="X509IssuerName" type="string"/> + <element name="X509SerialNumber" type="integer"/> + </sequence> +</complexType> + +<!-- End X509Data --> + +<!-- Begin PGPData --> + +<element name="PGPData" type="ds:PGPDataType"/> +<complexType name="PGPDataType"> + <choice> + <sequence> + <element name="PGPKeyID" type="base64Binary"/> + <element name="PGPKeyPacket" type="base64Binary" minOccurs="0"/> + <any namespace="##other" processContents="lax" minOccurs="0" + maxOccurs="unbounded"/> + </sequence> + <sequence> + <element name="PGPKeyPacket" type="base64Binary"/> + <any namespace="##other" processContents="lax" minOccurs="0" + maxOccurs="unbounded"/> + </sequence> + </choice> +</complexType> + +<!-- End PGPData --> + +<!-- Begin SPKIData --> + +<element name="SPKIData" type="ds:SPKIDataType"/> +<complexType name="SPKIDataType"> + <sequence maxOccurs="unbounded"> + <element name="SPKISexp" type="base64Binary"/> + <any namespace="##other" processContents="lax" minOccurs="0"/> + </sequence> +</complexType> + +<!-- End SPKIData --> + +<!-- End KeyInfo --> + +<!-- Start Object (Manifest, SignatureProperty) --> + +<element name="Object" type="ds:ObjectType"/> +<complexType name="ObjectType" mixed="true"> + <sequence minOccurs="0" maxOccurs="unbounded"> + <any namespace="##any" processContents="lax"/> + </sequence> + <attribute name="Id" type="ID" use="optional"/> + <attribute name="MimeType" type="string" use="optional"/> <!-- add a grep facet --> + <attribute name="Encoding" type="anyURI" use="optional"/> +</complexType> + +<element name="Manifest" type="ds:ManifestType"/> +<complexType name="ManifestType"> + <sequence> + <element ref="ds:Reference" maxOccurs="unbounded"/> + </sequence> + <attribute name="Id" type="ID" use="optional"/> +</complexType> + +<element name="SignatureProperties" type="ds:SignaturePropertiesType"/> +<complexType name="SignaturePropertiesType"> + <sequence> + <element ref="ds:SignatureProperty" maxOccurs="unbounded"/> + </sequence> + <attribute name="Id" type="ID" use="optional"/> +</complexType> + + <element name="SignatureProperty" type="ds:SignaturePropertyType"/> + <complexType name="SignaturePropertyType" mixed="true"> + <choice maxOccurs="unbounded"> + <any namespace="##other" processContents="lax"/> + <!-- (1,1) elements from (1,unbounded) namespaces --> + </choice> + <attribute name="Target" type="anyURI" use="required"/> + <attribute name="Id" type="ID" use="optional"/> + </complexType> + +<!-- End Object (Manifest, SignatureProperty) --> + +<!-- Start Algorithm Parameters --> + +<simpleType name="HMACOutputLengthType"> + <restriction base="integer"/> +</simpleType> + +<!-- Start KeyValue Element-types --> + +<element name="DSAKeyValue" type="ds:DSAKeyValueType"/> +<complexType name="DSAKeyValueType"> + <sequence> + <sequence minOccurs="0"> + <element name="P" type="ds:CryptoBinary"/> + <element name="Q" type="ds:CryptoBinary"/> + </sequence> + <element name="G" type="ds:CryptoBinary" minOccurs="0"/> + <element name="Y" type="ds:CryptoBinary"/> + <element name="J" type="ds:CryptoBinary" minOccurs="0"/> + <sequence minOccurs="0"> + <element name="Seed" type="ds:CryptoBinary"/> + <element name="PgenCounter" type="ds:CryptoBinary"/> + </sequence> + </sequence> +</complexType> + +<element name="RSAKeyValue" type="ds:RSAKeyValueType"/> +<complexType name="RSAKeyValueType"> + <sequence> + <element name="Modulus" type="ds:CryptoBinary"/> + <element name="Exponent" type="ds:CryptoBinary"/> + </sequence> +</complexType> + +<!-- End KeyValue Element-types --> + +<!-- End Signature --> + +</schema> diff --git a/utils/src/main/resources/at/gv/egiz/slbinding/impl/jaxb.index b/utils/src/main/resources/at/gv/egiz/slbinding/impl/jaxb.index deleted file mode 100644 index 6d52df61..00000000 --- a/utils/src/main/resources/at/gv/egiz/slbinding/impl/jaxb.index +++ /dev/null @@ -1,3 +0,0 @@ -# add top-level types explicitly to jaxb context, otherwise the unmarshaller won't find them. -# cf. http://forums.java.net/jive/thread.jspa?threadID=75778&tstart=0 -CreateXMLSignatureResponseType
\ No newline at end of file diff --git a/utils/src/test/java/at/gv/egiz/idlink/IdentityLink.java b/utils/src/test/java/at/gv/egiz/idlink/IdentityLink.java index a97a468e..f47d79bc 100644 --- a/utils/src/test/java/at/gv/egiz/idlink/IdentityLink.java +++ b/utils/src/test/java/at/gv/egiz/idlink/IdentityLink.java @@ -19,7 +19,6 @@ package at.gv.egiz.idlink; import iaik.xml.crypto.XSecProvider; import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.security.InvalidAlgorithmParameterException; @@ -44,11 +43,7 @@ import javax.xml.crypto.MarshalException; import javax.xml.crypto.dsig.XMLSignatureException; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; import oasis.names.tc.saml._1_0.assertion.AssertionType; import oasis.names.tc.saml._1_0.assertion.AttributeStatementType; diff --git a/utils/src/test/java/at/gv/egiz/slbinding/RedirectTest.java b/utils/src/test/java/at/gv/egiz/slbinding/RedirectTest.java index 7c8c206a..bdabedba 100644 --- a/utils/src/test/java/at/gv/egiz/slbinding/RedirectTest.java +++ b/utils/src/test/java/at/gv/egiz/slbinding/RedirectTest.java @@ -52,8 +52,6 @@ import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import static org.junit.Assert.*; -import org.w3._2000._09.xmldsig_.TransformType; -import org.w3._2000._09.xmldsig_.TransformsType; /** * @@ -80,13 +78,6 @@ public class RedirectTest { JAXBContext jaxbContext = JAXBContext.newInstance(slPkg + ":" + dsigPkg); Unmarshaller um = jaxbContext.createUnmarshaller(); -// SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); -// File schemaFile = new File(FILENAME_REQ_SCHEMA); -// Schema TestRequestLaxSchema = schemaFactory.newSchema(schemaFile); -// // validate request -// um.setSchema(TestRequestLaxSchema); - - FileInputStream fis = new FileInputStream(FILENAME_REQ); InputStream is = new BufferedInputStream(fis); @@ -97,24 +88,13 @@ public class RedirectTest { um.setListener(new RedirectUnmarshallerListener(contentFilter)); -// List<Class> redirectTriggers = Arrays.asList(new Class[]{XMLContentType.class, TransformsType.class}); -// Set<Class<? extends RedirectCallback>> redirectTriggers = new HashSet<Class<? extends RedirectCallback>>(); //{XMLContentType.class, TransformsType.class -// redirectTriggers.add(XMLContentType.class); -// redirectTriggers.add(TransformsType.class); -// ByteArrayRedirectCallback.registerRedirectTriggers(redirectTriggers); -// -// Set<Class<? extends RedirectCallback>> preserveNSContextTriggers = new HashSet<Class<? extends RedirectCallback>>(); -//// preserveNSContextTriggers.add(TransformsType.class); -// preserveNSContextTriggers.add(SignatureInfoCreationType.SignatureLocation.class); -// ByteArrayRedirectCallback.registerPreserveContextTriggers(preserveNSContextTriggers); - - JAXBElement<CreateXMLSignatureRequestType> req = (JAXBElement<CreateXMLSignatureRequestType>) um.unmarshal(filteredReader); + JAXBElement<?> req = (JAXBElement<?>) um.unmarshal(filteredReader); is.close(); FileOutputStream fos = new FileOutputStream(FILENAME_REQ + "_redirect.txt"); OutputStream os = new BufferedOutputStream(fos); - CreateXMLSignatureRequestType request = req.getValue(); + CreateXMLSignatureRequestType request = (CreateXMLSignatureRequestType) req.getValue(); List<DataObjectInfoType> dataObjectInfos = request.getDataObjectInfo(); Iterator<DataObjectInfoType> doiIt = dataObjectInfos.iterator(); while (doiIt.hasNext()) { @@ -133,29 +113,8 @@ public class RedirectTest { Iterator<TransformsInfoType> tiIt = transformsInfos.iterator(); while (tiIt.hasNext()) { at.gv.egiz.slbinding.impl.TransformsInfoType ti = (at.gv.egiz.slbinding.impl.TransformsInfoType) tiIt.next(); -// TransformsInfoType ti = tiIt.next(); assertNotNull(ti); System.out.println("found sl:TransformsInfo: " + ti.getClass().getName()); //at.gv.egiz.slbinding.impl.TransformsInfoType TransformsInfo"); -// TransformsType ts = ti.getTransforms(); -// assertNotNull(ts); -// System.out.println("found dsig:Transforms " + ts.getClass().getName()); //org.w3._2000._09.xmldsig_.TransformsType dsig:Transforms"); -// List<TransformType> tL = ts.getTransform(); -// assertNotNull(tL); -// System.out.println("found " + tL.size() + " org.w3._2000._09.xmldsig_.TransformType dsig:Transform"); -// for (TransformType t : tL) { -// if (t instanceof at.gv.egiz.slbinding.impl.TransformType) { -// System.out.println("found at.gv.egiz.slbinding.impl.TransformType"); -// byte[] redirectedBytes = ((at.gv.egiz.slbinding.impl.TransformType) t).getRedirectedStream().toByteArray(); -// if (redirectedBytes != null && redirectedBytes.length > 0) { -// System.out.println("reading redirected stream..."); -// os.write("--- redirected Transform ---".getBytes()); -// os.write(redirectedBytes); -// os.write("\n".getBytes()); -// } else { -// System.out.println("no redirected stream"); -// } -// } -// } ByteArrayOutputStream dsigTransforms = ti.getRedirectedStream(); os.write("--- redirected TransformsInfo content ---".getBytes()); @@ -177,16 +136,6 @@ public class RedirectTest { } SignatureInfoCreationType si = request.getSignatureInfo(); if (si != null) { -// Base64XMLOptRefContentType sigEnv = si.getSignatureEnvironment(); -// XMLContentType sigEnvXML = sigEnv.getXMLContent(); -// if (sigEnvXML != null) { -// System.out.println("found SignatureEnvironment XMLContent"); -// ByteArrayOutputStream xmlContent = sigEnvXML.getRedirectedStream(); -// os.write(xmlContent.toByteArray()); -// os.write("\n".getBytes()); -// } -// -// SignatureInfoCreationType.SignatureLocation sigLocation = si.getSignatureLocation(); SignatureLocationType sigLocation = (SignatureLocationType) si.getSignatureLocation(); assertNotNull(sigLocation); System.out.println("found at.gv.egiz.slbinding.impl.SignatureLocationType SignatureLocation"); diff --git a/utils/src/test/java/at/gv/egiz/slbinding/UnmarshallCXSRTest.java b/utils/src/test/java/at/gv/egiz/slbinding/UnmarshallCXSRTest.java new file mode 100644 index 00000000..0025c312 --- /dev/null +++ b/utils/src/test/java/at/gv/egiz/slbinding/UnmarshallCXSRTest.java @@ -0,0 +1,53 @@ +/* +* Copyright 2009 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.slbinding; + +import java.io.InputStream; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.stream.XMLStreamException; +import javax.xml.transform.stream.StreamSource; + +import org.junit.Test; + +import at.gv.egiz.slbinding.impl.CreateXMLSignatureResponseType; +import static org.junit.Assert.*; + +public class UnmarshallCXSRTest { + + @Test + public void testUnmarshallCreateXMLSignatureResponse() throws XMLStreamException, JAXBException { + + ClassLoader cl = UnmarshallCXSRTest.class.getClassLoader(); + InputStream s = cl.getResourceAsStream("at/gv/egiz/slbinding/CreateXMLSignatureResponse.xml"); + + assertNotNull(s); + + SLUnmarshaller unmarshaller = new SLUnmarshaller(); + Object object = unmarshaller.unmarshal(new StreamSource(s)); + + assertTrue(object.getClass().getName(), object instanceof JAXBElement<?>); + + Object value = ((JAXBElement<?>) object).getValue(); + + assertTrue(value.getClass().getName(), value instanceof CreateXMLSignatureResponseType); + + } + +} diff --git a/utils/src/test/java/cardchannel/UnmarshalTest.java b/utils/src/test/java/cardchannel/UnmarshalTest.java index 998dd9e6..f1ed0c9d 100644 --- a/utils/src/test/java/cardchannel/UnmarshalTest.java +++ b/utils/src/test/java/cardchannel/UnmarshalTest.java @@ -29,7 +29,6 @@ import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import org.junit.Ignore; import org.junit.Test; -import static org.junit.Assert.*; /** * @@ -42,12 +41,11 @@ public class UnmarshalTest { JAXBContext ctx = JAXBContext.newInstance(ObjectFactory.class); Unmarshaller um = ctx.createUnmarshaller(); - JAXBElement<ScriptType> script = (JAXBElement<ScriptType>) um.unmarshal(new File("src/test/cardchannel/script.xml")); + JAXBElement<?> script = (JAXBElement<?>) um.unmarshal(new File("src/test/cardchannel/script.xml")); - ScriptType scriptT = script.getValue(); + ScriptType scriptT = (ScriptType) script.getValue(); System.out.println("script " + scriptT.getClass()); List<Object> resetOrCommandAPDUOrVerifyAPDU = scriptT.getResetOrCommandAPDUOrVerifyAPDU(); -// assertEquals(3, resetOrCommandAPDUOrVerifyAPDU.size()); for (Object object : resetOrCommandAPDUOrVerifyAPDU) { System.out.println("script contains: " + object.getClass()); } @@ -65,7 +63,7 @@ public class UnmarshalTest { s.getResetOrCommandAPDUOrVerifyAPDU().add(r); JAXBElement<ScriptType> script = of.createScript(s); - m.marshal(script, new File("src/test/cardchannel/marshalled.xml")); + m.marshal(script, System.out); } } diff --git a/utils/src/test/java/saml/KeyValueAttributeTypeTest.java b/utils/src/test/java/saml/KeyValueAttributeTypeTest.java index 2df04ce6..f3f1da0b 100644 --- a/utils/src/test/java/saml/KeyValueAttributeTypeTest.java +++ b/utils/src/test/java/saml/KeyValueAttributeTypeTest.java @@ -17,9 +17,7 @@ package saml; -import java.io.BufferedInputStream; import java.io.File; -import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.List; import javax.xml.bind.JAXBContext; @@ -27,7 +25,6 @@ import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; -import javax.xml.namespace.QName; import oasis.names.tc.saml._1_0.assertion.AnyType; import oasis.names.tc.saml._1_0.assertion.AssertionType; import oasis.names.tc.saml._1_0.assertion.AttributeStatementType; @@ -38,7 +35,6 @@ import oasis.names.tc.saml._1_0.assertion.StatementAbstractType; import oasis.names.tc.saml._1_0.assertion.SubjectType; import org.junit.Ignore; import org.junit.Test; -import org.w3._2000._09.xmldsig_.KeyValueType; import org.w3._2000._09.xmldsig_.RSAKeyValueType; import org.w3c.dom.Element; @@ -54,8 +50,9 @@ public class KeyValueAttributeTypeTest { JAXBContext ctx = JAXBContext.newInstance(ObjectFactory.class, org.w3._2000._09.xmldsig_.ObjectFactory.class); Unmarshaller um = ctx.createUnmarshaller(); - JAXBElement<AssertionType> assertion = (JAXBElement<AssertionType>) um.unmarshal(new File("/home/clemens/workspace/schema-base/src/main/schema/test/saml10.xml")); - List<StatementAbstractType> statements = assertion.getValue().getStatementOrSubjectStatementOrAuthenticationStatement(); + JAXBElement<?> assertion = (JAXBElement<?>) um.unmarshal(new File("/home/clemens/workspace/schema-base/src/main/schema/test/saml10.xml")); + AssertionType value = (AssertionType) assertion.getValue(); + List<StatementAbstractType> statements = ((AssertionType) value).getStatementOrSubjectStatementOrAuthenticationStatement(); for (StatementAbstractType stmt : statements) { if (stmt instanceof AttributeStatementType) { System.out.println("AttributeStatement"); diff --git a/utils/src/test/resources/at/gv/egiz/slbinding/CreateXMLSignatureResponse.xml b/utils/src/test/resources/at/gv/egiz/slbinding/CreateXMLSignatureResponse.xml new file mode 100644 index 00000000..ab08c5ca --- /dev/null +++ b/utils/src/test/resources/at/gv/egiz/slbinding/CreateXMLSignatureResponse.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?><sl:CreateXMLSignatureResponse xmlns:sl="http://www.buergerkarte.at/namespaces/securitylayer/1.2#" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Signature Id="Signature-e5381f3d-1" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:SignedInfo Id="SignedInfo-e5381f3d-1"><dsig:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><dsig:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1"/><dsig:Reference Id="Reference-e5381f3d-1" URI="test.txt"><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><dsig:DigestValue>7Dp/5KcvUfCnkohkOOzvFaeAIRc=</dsig:DigestValue></dsig:Reference><dsig:Reference Id="Reference-e5381f3d-2" Type="http://uri.etsi.org/01903/v1.1.1#SignedProperties" URI="#xmlns(xades=http://uri.etsi.org/01903/v1.1.1%23)%20xpointer(id('Object-e5381f3d-1')/child::xades:QualifyingProperties/child::xades:SignedProperties)"><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><dsig:DigestValue>fCbFrz0xI0wiN+PPn4leURvfdIo=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo><dsig:SignatureValue Id="SignatureValue-e5381f3d-1">Zozx+mW/lHUO8q02DBK3Aud/sSpVdWGjfBScZDBjuzLyQyrRlXH2xo3lij5/xJa0</dsig:SignatureValue><dsig:KeyInfo><dsig:X509Data><dsig:X509Certificate>MIIDdzCCAd+gAwIBAgIRMqGxalf5fUuhqgSjs+IArBMwDQYJKoZIhvcNAQEFBQAw +TTESMBAGA1UEAwwJVlNpZyBDQSAyMSowKAYDVQQKDCFIYXVwdHZlcmJhbmQgw7Zz +dGVyci4gU296aWFsdmVycy4xCzAJBgNVBAYTAkFUMB4XDTA2MTEwODA1MjYxN1oX +DTExMTEwODA1MjYxN1owYTEXMBUGA1UEAwwOTWFydGluIENlbnRuZXIxKjAoBgNV +BAoMIUhhdXB0dmVyYmFuZCDDtnN0ZXJyLiBTb3ppYWx2ZXJzLjENMAsGA1UECwwE +VlNpZzELMAkGA1UEBhMCQVQwSTATBgcqhkjOPQIBBggqhkjOPQMBAQMyAASZohyZ +R1JDH+sANEROtE5LQFFepjfo5Xk7eRtrpnfa1MFhEOfYXxElEInOVFU049+jgZgw +gZUwEwYDVR0jBAwwCoAISGl1XDyvIyowEQYDVR0OBAoECESRXVYYhLE8MA4GA1Ud +DwEB/wQEAwIGwDAWBgNVHSAEDzANMAsGCSooAAoBBAFmADBDBggrBgEFBQcBAQQ3 +MDUwMwYIKwYBBQUHMAGGJ2h0dHA6Ly9vY3NwLmVjYXJkLnNvemlhbHZlcnNpY2hl +cnVuZy5hdDANBgkqhkiG9w0BAQUFAAOCAYEAPTDL/MLfmNw0VcHqny3lNi30hL8z +OtyiwQRo7QFA98Pm+8WPyQjyK0UVIej+NZVIVSU7WdYWVuu+au8bd3B10WBikLMl +QfEWqYDHGp+bfB4GB4WVeS78tNmXaacXjzLqae/KLALRn/dVBN/acf3C+Ey3kSYw +/96J+qgbaowlT18OvUTs1ABHgut1x31hLIgTj0R5nzfOOUXXnUN+rWm5SuaNMTHW +NMNhM6Y4jfACOsudmboeIZfgrmbDtCa2lLU95Mct2dcbBsnMRFUYoZc+9eEI/xCH +JdzFZp1DAyqzb6Y84YUr+QDCxJT5BVdU0zTI73t0ls64556ifsfq/2sixHeQgMSM +z/qQfPUC9so32sDPNHHNbKVYx9m0VpPwekWXBEVJWFffQbPe55deZ+uVFLOG4y0G +c+o3eXV2Vs9te1OoA+KRow8kjL7iil06DNOddeDQVPj7zqRQtoLKMLTJflfZp5pd +UPEZNM5Pw92T501vzHO9JNv5f/Wp3PTskBNJ</dsig:X509Certificate></dsig:X509Data></dsig:KeyInfo><dsig:Object Id="Object-e5381f3d-1"><xades:QualifyingProperties xmlns:xades="http://uri.etsi.org/01903/v1.1.1#" Target="#Signature-e5381f3d-1" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:sl="http://www.buergerkarte.at/namespaces/securitylayer/1.2#"><xades:SignedProperties Id="SignedProperties-e5381f3d-1"><xades:SignedSignatureProperties><xades:SigningTime>2010-04-20T06:08:36Z</xades:SigningTime><xades:SigningCertificate><xades:Cert><xades:CertDigest><xades:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><xades:DigestValue>GF2imE3FjjqwM8BH0RY+VjtiAI8=</xades:DigestValue></xades:CertDigest><xades:IssuerSerial><dsig:X509IssuerName>C=AT,O=Hauptverband österr. Sozialvers.,CN=VSig CA 2</dsig:X509IssuerName><dsig:X509SerialNumber>17229045246817736659347185373920056355859</dsig:X509SerialNumber></xades:IssuerSerial></xades:Cert></xades:SigningCertificate><xades:SignaturePolicyIdentifier><xades:SignaturePolicyImplied/></xades:SignaturePolicyIdentifier></xades:SignedSignatureProperties><xades:SignedDataObjectProperties><xades:DataObjectFormat ObjectReference="#Reference-e5381f3d-1"><xades:MimeType>text/plain</xades:MimeType></xades:DataObjectFormat></xades:SignedDataObjectProperties></xades:SignedProperties></xades:QualifyingProperties></dsig:Object></dsig:Signature></sl:CreateXMLSignatureResponse>
\ No newline at end of file diff --git a/utils/src/test/resources/commons-logging.properties b/utils/src/test/resources/commons-logging.properties deleted file mode 100644 index 29292562..00000000 --- a/utils/src/test/resources/commons-logging.properties +++ /dev/null @@ -1 +0,0 @@ -org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger diff --git a/utils/src/test/resources/log4j.properties b/utils/src/test/resources/log4j.properties index d9065c14..358a8d73 100644 --- a/utils/src/test/resources/log4j.properties +++ b/utils/src/test/resources/log4j.properties @@ -1,5 +1,5 @@ # loglever DEBUG, appender STDOUT -log4j.rootLogger=DEBUG, STDOUT +log4j.rootLogger=INFO, STDOUT #log4j.logger.at.gv.egiz.slbinding.RedirectEventFilter=DEBUG, STDOUT # STDOUT appender |