From 4387153c6f65b55d576e1890c5b582237227369e Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 27 Feb 2009 18:10:57 +0000 Subject: 1.1-rc2 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@310 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUOnline/src/main/webapp/PINManagement.jsp | 79 +++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 BKUOnline/src/main/webapp/PINManagement.jsp (limited to 'BKUOnline/src/main/webapp/PINManagement.jsp') diff --git a/BKUOnline/src/main/webapp/PINManagement.jsp b/BKUOnline/src/main/webapp/PINManagement.jsp new file mode 100644 index 00000000..0f08f64b --- /dev/null +++ b/BKUOnline/src/main/webapp/PINManagement.jsp @@ -0,0 +1,79 @@ + +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" + import="at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage"%> + + + + + + MOCCA PIN Management + + + + + + + + + <% + String locale = request.getParameter("locale"); + if (locale == null) { + String acceptLanguage = request.getHeader("Accept-Language"); + locale = AcceptLanguage.getLocale(acceptLanguage).toString(); + } + String widthP = request.getParameter("appletWidth"); + String heightP = request.getParameter("appletHeight"); + int width = (widthP == null) ? 295 + : Integer.parseInt(widthP); + int height = (heightP == null) ? 195 + : Integer.parseInt(heightP); + String guiStyle = request.getParameter("appletGuiStyle"); + if (guiStyle == null) { + guiStyle = "advanced"; + } + String backgroundImg = request.getParameter("appletBackground"); + %> + + + + -- cgit v1.2.3 From a94eadabb2c0e524023619734ebb88162fb38c5c Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 9 Mar 2009 17:25:29 +0000 Subject: AppletPageAlternative git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@313 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../egiz/bku/online/webapp/BKURequestHandler.java | 33 ++++++-- .../gv/egiz/bku/online/webapp/ResultServlet.java | 1 - BKUOnline/src/main/webapp/PINManagement.jsp | 2 +- BKUOnline/src/main/webapp/SLRequestForm.html | 8 +- BKUOnline/src/main/webapp/WEB-INF/web.xml | 4 + BKUOnline/src/main/webapp/appletAlternative.jsp | 87 ++++++++++++++++++++++ .../src/main/webapp/css/appletAlternative.css | 12 +++ 7 files changed, 136 insertions(+), 11 deletions(-) create mode 100644 BKUOnline/src/main/webapp/appletAlternative.jsp create mode 100644 BKUOnline/src/main/webapp/css/appletAlternative.css (limited to 'BKUOnline/src/main/webapp/PINManagement.jsp') 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 b858083b..4b275298 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 @@ -45,7 +45,9 @@ import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage; * */ public class BKURequestHandler extends SpringBKUServlet { - public static final String BKU_APPLET_JSP = "BKUApplet"; + + public static final String APPLET_PAGE_P = "appletPage"; + public static final String APPLET_PAGE_DEFAULT = "BKUApplet"; private static final long serialVersionUID = 1L; @@ -69,7 +71,7 @@ public class BKURequestHandler extends SpringBKUServlet { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException { - log.debug("Received new request"); + log.debug("Received SecurityLayer request"); HttpSession session = req.getSession(false); if (session != null) { @@ -79,9 +81,9 @@ public class BKURequestHandler extends SpringBKUServlet { IdFactory.getInstance().createId(session.getId())); if (bp != null) { log.debug("Found binding processor, using this one"); - RequestDispatcher dispatcher = getServletContext().getNamedDispatcher( - BKU_APPLET_JSP); - log.debug("forward to applet"); + String appletPage = (String) session.getAttribute(APPLET_PAGE_P); + RequestDispatcher dispatcher = getServletContext().getNamedDispatcher(appletPage); + log.debug("forward to applet " + appletPage); dispatcher.forward(req, resp); return; } @@ -121,6 +123,15 @@ public class BKURequestHandler extends SpringBKUServlet { getBindingProcessorManager().process(bindingProcessor); log.trace("Trying to find applet parameters in request"); + + String appletPage = getStringFromStream(bindingProcessor + .getFormData(APPLET_PAGE_P), charset); + if (appletPage == null) { + appletPage = APPLET_PAGE_DEFAULT; + } + log.trace("requested appletPage " + appletPage); + session.setAttribute(APPLET_PAGE_P, appletPage); + String width = getStringFromStream(bindingProcessor .getFormData("appletWidth"), charset); String height = getStringFromStream(bindingProcessor @@ -186,10 +197,16 @@ public class BKURequestHandler extends SpringBKUServlet { log.info("Got redirect URL "+redirectUrl+". Deferring browser redirect."); session.setAttribute(REDIRECT_URL_SESSION_ATTRIBUTE, redirectUrl); } - // TODO error if no dispatcher found RequestDispatcher dispatcher = getServletContext().getNamedDispatcher( - BKU_APPLET_JSP); - log.debug("forward to applet"); + appletPage); + if (dispatcher == null) { + log.warn("requested AppletPage " + appletPage + " not configured"); + appletPage = APPLET_PAGE_DEFAULT; + session.setAttribute(APPLET_PAGE_P, APPLET_PAGE_DEFAULT); + dispatcher = getServletContext().getNamedDispatcher( + appletPage); + } + log.debug("forward to applet " + appletPage); dispatcher.forward(req, resp); } 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 7855b73c..a4d3e5d1 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 @@ -116,7 +116,6 @@ public class ResultServlet extends SpringBKUServlet { return; } resp.setStatus(bp.getResponseCode()); -// log.info("ALLOW CACHING OF RESULT PAGE"); resp.setHeader("Cache-Control", "no-store"); // HTTP 1.1 resp.setHeader("Pragma", "no-cache"); // HTTP 1.0 resp.setDateHeader("Expires", 0); diff --git a/BKUOnline/src/main/webapp/PINManagement.jsp b/BKUOnline/src/main/webapp/PINManagement.jsp index 0f08f64b..d62dc09b 100644 --- a/BKUOnline/src/main/webapp/PINManagement.jsp +++ b/BKUOnline/src/main/webapp/PINManagement.jsp @@ -41,7 +41,7 @@ String heightP = request.getParameter("appletHeight"); int width = (widthP == null) ? 295 : Integer.parseInt(widthP); - int height = (heightP == null) ? 195 + int height = (heightP == null) ? 200 : Integer.parseInt(heightP); String guiStyle = request.getParameter("appletGuiStyle"); if (guiStyle == null) { diff --git a/BKUOnline/src/main/webapp/SLRequestForm.html b/BKUOnline/src/main/webapp/SLRequestForm.html index 2aed5298..9ff7b68a 100644 --- a/BKUOnline/src/main/webapp/SLRequestForm.html +++ b/BKUOnline/src/main/webapp/SLRequestForm.html @@ -131,12 +131,18 @@

- +

+ + Default + Alternative +

+ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + + + MOCCA Applet + + + + + + + + + <% + // min W/H (for de locale): 145px/145px with gui style 'tiny' + // (vs. 152px on linux) + int width = session.getAttribute("appletWidth") == null ? 190 + : (Integer) session.getAttribute("appletWidth"); //230 for workshop demo integration + int height = session.getAttribute("appletHeight") == null ? 130 + : (Integer) session.getAttribute("appletHeight"); + String backgroundImg = (String) session.getAttribute("appletBackground"); + String guiStyle = (String) session.getAttribute("appletGuiStyle"); + String locale = (String) session.getAttribute("locale"); + String extension = (String) session.getAttribute("extension"); + + String appletClass, appletArchive; + if ("activation".equals(extension)) { + appletArchive = "BKUAppletExt.jar"; + appletClass = "at.gv.egiz.bku.online.applet.ActivationApplet.class"; + } else if ("pin".equals(extension)) { + appletArchive = "BKUAppletExt.jar"; + appletClass = "at.gv.egiz.bku.online.applet.PINManagementApplet.class"; + } else { + appletArchive = "BKUApplet.jar"; + appletClass = "at.gv.egiz.bku.online.applet.BKUApplet.class"; + } + appletArchive = "BKUAppletExt.jar"; + appletClass = "at.gv.egiz.bku.online.applet.ActivationApplet.class"; + %> + + + + diff --git a/BKUOnline/src/main/webapp/css/appletAlternative.css b/BKUOnline/src/main/webapp/css/appletAlternative.css new file mode 100644 index 00000000..ce11f1b2 --- /dev/null +++ b/BKUOnline/src/main/webapp/css/appletAlternative.css @@ -0,0 +1,12 @@ +root { + display: block; +} + +body { + background: #ffffff; + background-image: url(../img/mocca-t_s.png); + padding: 0; + margin: 0; + border-style: none; +} + -- cgit v1.2.3 From 8b2cc798b260b3034142cb1b13084ad1b7646ae6 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 21 Aug 2009 16:02:45 +0000 Subject: icons 2.0 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@464 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUOnline/pom.xml | 2 +- BKUOnline/src/main/webapp/PINManagement.jsp | 2 +- BKUOnline/src/main/webapp/SLRequestForm.html | 2 ++ BKUOnline/src/main/webapp/applet.jsp | 4 ++-- BKUOnline/src/main/webapp/img/BackgroundChipperling.png | Bin 2041 -> 0 bytes BKUOnline/src/main/webapp/img/BackgroundEcard.png | Bin 31706 -> 0 bytes BKUOnline/src/main/webapp/img/BackgroundMocca.png | Bin 1287 -> 0 bytes BKUOnline/src/main/webapp/img/ChipperlingCutoff.png | Bin 1522 -> 0 bytes BKUOnline/src/main/webapp/img/chip16.ico | Bin 0 -> 1150 bytes BKUOnline/src/main/webapp/img/chip32.png | Bin 0 -> 1753 bytes BKUOnline/src/main/webapp/img/favicon.ico | Bin 2238 -> 0 bytes BKUOnline/src/main/webapp/img/mocca-t_s.png | Bin 8976 -> 0 bytes BKUOnline/src/main/webapp/index.html | 6 +++--- BKUOnline/src/main/webapp/js/deployJava.js | 2 +- 14 files changed, 10 insertions(+), 8 deletions(-) delete mode 100644 BKUOnline/src/main/webapp/img/BackgroundChipperling.png delete mode 100644 BKUOnline/src/main/webapp/img/BackgroundEcard.png delete mode 100644 BKUOnline/src/main/webapp/img/BackgroundMocca.png delete mode 100644 BKUOnline/src/main/webapp/img/ChipperlingCutoff.png create mode 100644 BKUOnline/src/main/webapp/img/chip16.ico create mode 100644 BKUOnline/src/main/webapp/img/chip32.png delete mode 100644 BKUOnline/src/main/webapp/img/favicon.ico delete mode 100644 BKUOnline/src/main/webapp/img/mocca-t_s.png (limited to 'BKUOnline/src/main/webapp/PINManagement.jsp') diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index 705a1300..b0a9d80e 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -39,7 +39,7 @@ BKUHelp at.gv.egiz - 1.0 + 1.1-SNAPSHOT commons-logging diff --git a/BKUOnline/src/main/webapp/PINManagement.jsp b/BKUOnline/src/main/webapp/PINManagement.jsp index d62dc09b..454174e7 100644 --- a/BKUOnline/src/main/webapp/PINManagement.jsp +++ b/BKUOnline/src/main/webapp/PINManagement.jsp @@ -23,7 +23,7 @@ MOCCA PIN Management - + diff --git a/BKUOnline/src/main/webapp/SLRequestForm.html b/BKUOnline/src/main/webapp/SLRequestForm.html index b3aeb8e0..997a3c82 100644 --- a/BKUOnline/src/main/webapp/SLRequestForm.html +++ b/BKUOnline/src/main/webapp/SLRequestForm.html @@ -19,6 +19,7 @@ Security-Layer v1.2 Request Formular + + + + diff --git a/BKUOnline/src/main/webapp/applet.jsp b/BKUOnline/src/main/webapp/applet.jsp index 09792c9a..31f3362b 100644 --- a/BKUOnline/src/main/webapp/applet.jsp +++ b/BKUOnline/src/main/webapp/applet.jsp @@ -71,8 +71,12 @@ } %> - + + + + -- cgit v1.2.3 From 4a334069beb85654e3cb35aef7e4508e04127036 Mon Sep 17 00:00:00 2001 From: mcentner Date: Tue, 26 Jan 2010 16:22:56 +0000 Subject: MOCCA 1.2.11 with SHA-2 enabled. git-svn-id: https://joinup.ec.europa.eu/svn/mocca/branches/mocca-1.2.11-sha2/mocca-1.2.11@599 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUFonts/.classpath | 2 +- BKUFonts/.project | 4 +- BKULocal/src/main/resources/log4j.properties | 2 + BKUOnline/src/main/webapp/PINManagement.jsp | 3 +- .../src/main/webapp/WEB-INF/applicationContext.xml | 83 +++++++++++-------- .../gv/egiz/bku/binding/DataUrlConnectionImpl.java | 7 +- .../gv/egiz/bku/slcommands/SLCommandFactory.java | 54 ++++++------ .../impl/AbstractInfoboxCommandImpl.java | 21 ++++- .../egiz/bku/slcommands/impl/InfoboxFactory.java | 95 ++++------------------ .../java/moaspss/TestCreateAndVerifySignature.java | 4 +- bkucommon/src/test/resources/MOA-SPSS-1.3.wsdl | 2 +- 11 files changed, 128 insertions(+), 149 deletions(-) (limited to 'BKUOnline/src/main/webapp/PINManagement.jsp') diff --git a/BKUFonts/.classpath b/BKUFonts/.classpath index d2236dff..54382402 100644 --- a/BKUFonts/.classpath +++ b/BKUFonts/.classpath @@ -2,7 +2,7 @@ - + diff --git a/BKUFonts/.project b/BKUFonts/.project index 484ff825..62c74cfb 100644 --- a/BKUFonts/.project +++ b/BKUFonts/.project @@ -16,12 +16,12 @@ - org.maven.ide.eclipse.maven2Builder + org.eclipse.wst.validation.validationbuilder - org.eclipse.wst.validation.validationbuilder + org.maven.ide.eclipse.maven2Builder diff --git a/BKULocal/src/main/resources/log4j.properties b/BKULocal/src/main/resources/log4j.properties index 86ddc7b4..a56f2683 100644 --- a/BKULocal/src/main/resources/log4j.properties +++ b/BKULocal/src/main/resources/log4j.properties @@ -17,6 +17,8 @@ # loglever DEBUG, appender STDOUT log4j.rootLogger=DEBUG, STDOUT +log4j.logger.at.gv.egiz.smcc=TRACE + # STDOUT appender log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout diff --git a/BKUOnline/src/main/webapp/PINManagement.jsp b/BKUOnline/src/main/webapp/PINManagement.jsp index 3555f99e..e48b8405 100644 --- a/BKUOnline/src/main/webapp/PINManagement.jsp +++ b/BKUOnline/src/main/webapp/PINManagement.jsp @@ -75,7 +75,8 @@ HelpURL : '../help/', SessionID : '<%=request.getSession().getId()%>', RedirectURL : '../', - RedirectTarget: '_parent' + RedirectTarget: '_parent', + EnforceRecommendedPINLength: 'true' }; var version = '1.6.0_04'; deployJava.runApplet(attributes, parameters, version); diff --git a/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml b/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml index 0324030e..fb3cae63 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml +++ b/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml @@ -30,47 +30,64 @@ - - - - - - - - + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + 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..82c1be53 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 @@ -274,7 +274,12 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { 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 + : "UTF-8"); + // Note, using UTF-8 as fallback for decoding is safe. + // If the request was x-www-form-urlencoded, + // UTF-8 has been used for encoding of non-ASCII characters. + // If the request was multipart/form-data and contains any transfer parameters, + // the data URL request is going to be multipart/form-data encoded (see below). while ((len = reader.read(cbuf)) != -1) { urlEnc.write(cbuf, 0, len); } 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 8e3f6ece..6e84867e 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 @@ -87,6 +87,11 @@ public class SLCommandFactory { */ private Map> slRequestTypeMap = new HashMap>(); + /** + * The mapping of a requests's qualified name to a concrete command factories. + */ + private Map slCommandFactories = new HashMap(); + /** * Configures the singleton instance with command implementations * @param commandImplMap @@ -101,7 +106,19 @@ public class SLCommandFactory { slRequestTypeMap.put(key, impl); } } - + + public void setConcreteFactories(Map 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); + } + slCommandFactories = factories; + } + /** * Register an {@link SLCommand} implementation class of a Security Layer * command with the given namespaceUri and localname @@ -363,37 +380,16 @@ public class SLCommandFactory { log.info("Unsupported security layer request version : " + qName.getNamespaceURI()); throw new SLVersionException(qName.getNamespaceURI()); } - - Class 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.getName() + " 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); + 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()}); } - slCommand.init(context, (JAXBElement) object); - - return slCommand; + return concreteFactory.createSLCommand(context, (JAXBElement) object); } } \ No newline at end of file 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..b8e4030d 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 @@ -32,6 +32,25 @@ public abstract class AbstractInfoboxCommandImpl extends SLCommandImpl { * 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) @@ -40,7 +59,7 @@ public abstract class AbstractInfoboxCommandImpl extends SLCommandImpl { 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/InfoboxFactory.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/InfoboxFactory.java index e9736f6d..fdf94297 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,7 +17,6 @@ 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; @@ -39,68 +38,24 @@ public class InfoboxFactory { private static Log log = LogFactory.getLog(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> 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 infoboxImplMap) throws ClassNotFoundException { - HashMap> implMap = new HashMap>(); - ClassLoader cl = getClass().getClassLoader(); - for (String key : infoboxImplMap.keySet()) { - Class impl = (Class) cl.loadClass(infoboxImplMap.get(key)); - log.debug("Registering infobox '" + key + "' implementation '" + impl.getCanonicalName() + "'."); - implMap.put(key, impl); - } - implementations = implMap; - } - + private HashMap infoboxFactories = new HashMap(); + /** - * Returns the configured implementation class for the given - * infoboxIdentifier. - * - * @param infoboxIdentifier - * the infobox identifier - * - * @return the implementation class for the given infobox identifier or - * null if there is no implementation class configured + * @param infoboxFactories the infoboxFactories to set */ - public Class getImplClass(String infoboxIdentifier) { - if (implementations != null) { - return implementations.get(infoboxIdentifier); - } else { - return null; + public void setInfoboxFactories( + HashMap 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); } + this.infoboxFactories = factories; } /** @@ -119,31 +74,15 @@ public class InfoboxFactory { */ public Infobox createInfobox(String infoboxIdentifier) throws SLCommandException, SLRuntimeException { - Class implClass = getImplClass(infoboxIdentifier); - if (implClass == null) { - // infobox not supported + 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/test/java/moaspss/TestCreateAndVerifySignature.java b/bkucommon/src/test/java/moaspss/TestCreateAndVerifySignature.java index 8d995530..a9397d31 100644 --- a/bkucommon/src/test/java/moaspss/TestCreateAndVerifySignature.java +++ b/bkucommon/src/test/java/moaspss/TestCreateAndVerifySignature.java @@ -33,7 +33,7 @@ import org.xml.sax.SAXException; import at.buergerkarte.namespaces.securitylayer._1.ErrorResponseType; -@Ignore +//@Ignore public class TestCreateAndVerifySignature { protected Element parseCreateXMLSignatureRequest(InputStream is) @@ -141,7 +141,7 @@ public class TestCreateAndVerifySignature { } MOASPClient spClient = new MOASPClient(); - JAXBElement verifySignature = spClient.verifySignature(cxsResp, ".", "qualifiedSignature"); + JAXBElement verifySignature = spClient.verifySignature(cxsResp, ".", "qualifiedSignature+Test"); VerifyXMLSignatureResponseType vxsResp = verifySignature.getValue(); int signatureCheck = vxsResp.getSignatureCheck().getCode().intValue(); if (signatureCheck != 0) { diff --git a/bkucommon/src/test/resources/MOA-SPSS-1.3.wsdl b/bkucommon/src/test/resources/MOA-SPSS-1.3.wsdl index 8ec61420..25accfce 100644 --- a/bkucommon/src/test/resources/MOA-SPSS-1.3.wsdl +++ b/bkucommon/src/test/resources/MOA-SPSS-1.3.wsdl @@ -51,7 +51,7 @@ - + -- cgit v1.2.3