From c09f1913c1ac92c76b1baaba705d09c52eeec7db Mon Sep 17 00:00:00 2001 From: gregor Date: Fri, 15 Jul 2005 13:22:13 +0000 Subject: =?UTF-8?q?Fix=20f=C3=BCr=20Bug=20267=20erstellt.=20Noch=20absolut?= =?UTF-8?q?=20ungetestet.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@381 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../server/config/ConfigurationPartsBuilder.java | 74 ++++++++++++++++------ .../moa/spss/server/config/TrustProfile.java | 17 ++++- 2 files changed, 70 insertions(+), 21 deletions(-) (limited to 'spss.server/src/at/gv/egovernment/moa/spss/server/config') diff --git a/spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java b/spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java index 1e966911b..33e9daca1 100644 --- a/spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java +++ b/spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java @@ -827,32 +827,66 @@ public class ConfigurationPartsBuilder { while ((profileElem = (Element) profileIter.nextNode()) != null) { String id = profileElem.getAttribute("id"); String uriStr = profileElem.getAttribute("uri"); - - try { - URI uri = new URI(uriStr); - TrustProfile profile; - File profileDir; - + String signerCertsUriStr = profileElem.getAttribute("signerCertsUri"); + + boolean createTrustProfile = true; + + URI uri = null; + try + { + uri = new URI(uriStr); if (!uri.isAbsolute()) { // make it absolute to the config file uri = new URI(configRoot.toURL() + uriStr); } + } + catch (URIException e) { + warn("config.14", new Object[] { "uri", id, uriStr }, e); + createTrustProfile = false; + } + catch (MalformedURLException e) + { + warn("config.15", new Object[] {id}, e); + createTrustProfile = false; + } - profileDir = new File(uri.getPath()); - if (!profileDir.exists() || !profileDir.isDirectory()) { - warn("config.27", new Object[] { id }); - } + File profileDir = new File(uri.getPath()); + if (!profileDir.exists() || !profileDir.isDirectory()) { + warn("config.27", new Object[] { "uri", id }); + createTrustProfile = false; + } - if (trustProfiles.containsKey(id)) { - warn("config.04", new Object[] { "TrustProfile", id }); - } else { - profile = new TrustProfile(id, uri.toString()); - trustProfiles.put(id, profile); + if (trustProfiles.containsKey(id)) { + warn("config.04", new Object[] { "TrustProfile", id }); + createTrustProfile = false; + } + + URI signerCertsUri = null; + if (signerCertsUriStr != null && !"".equals(signerCertsUriStr)) + { + try + { + signerCertsUri = new URI(signerCertsUriStr); + if (!signerCertsUri.isAbsolute()) uri = new URI(configRoot.toURL() + signerCertsUriStr); + + File signerCertsDir = new File(signerCertsUri.getPath()); + if (!signerCertsDir.exists() || !signerCertsDir.isDirectory()) { + warn("config.27", new Object[] { "signerCertsUri", id }); + createTrustProfile = false; + } } - - } catch (URIException e) { - warn("config.14", new Object[] { id, uriStr }, e); - } catch (MalformedURLException e) { - warn("config.15", null, e); + catch (URIException e) { + warn("config.14", new Object[] { "signerCertsUri", id, uriStr }, e); + createTrustProfile = false; + } + catch (MalformedURLException e) { + warn("config.15", new Object[] {id}, e); + createTrustProfile = false; + } + } + + if (createTrustProfile) { + TrustProfile profile = new TrustProfile(id, uri.toString(), signerCertsUri.toString()); + trustProfiles.put(id, profile); } } diff --git a/spss.server/src/at/gv/egovernment/moa/spss/server/config/TrustProfile.java b/spss.server/src/at/gv/egovernment/moa/spss/server/config/TrustProfile.java index 6ba33be63..929d5ce2b 100644 --- a/spss.server/src/at/gv/egovernment/moa/spss/server/config/TrustProfile.java +++ b/spss.server/src/at/gv/egovernment/moa/spss/server/config/TrustProfile.java @@ -11,16 +11,21 @@ public class TrustProfile { private String id; /** The URI giving the location of the trust profile. */ private String uri; + /** The URI giving the location of the allowed signer certificates. */ + private String signerCertsUri; /** * Create a TrustProfile. * * @param id The ID of the TrustProfile to create. * @param uri The URI of the TrustProfile to create. + * @param signerCertsUri The URI of the location of the allowed signer + * certificates of the TrustProfile to create. */ - public TrustProfile(String id, String uri) { + public TrustProfile(String id, String uri, String signerCertsUri) { this.id = id; this.uri = uri; + this.signerCertsUri = signerCertsUri; } /** @@ -40,4 +45,14 @@ public class TrustProfile { public String getUri() { return uri; } + + /** + * Return the URI giving the location of the allowed signer certificates + * of this TrustProfile. + * + * @return The URI of TrustProfile. + */ + public String getSignerCertsUri() { + return signerCertsUri; + } } -- cgit v1.2.3