diff options
Diffstat (limited to 'spss.server/src/at/gv/egovernment/moa/spss/server/config')
-rw-r--r-- | spss.server/src/at/gv/egovernment/moa/spss/server/config/ConfigurationPartsBuilder.java | 74 | ||||
-rw-r--r-- | spss.server/src/at/gv/egovernment/moa/spss/server/config/TrustProfile.java | 17 |
2 files changed, 70 insertions, 21 deletions
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 <code>TrustProfile</code>. * * @param id The ID of the <code>TrustProfile</code> to create. * @param uri The URI of the <code>TrustProfile</code> to create. + * @param signerCertsUri The URI of the location of the allowed signer + * certificates of the <code>TrustProfile</code> 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 <code>TrustProfile</code>. + * + * @return The URI of <code>TrustProfile</code>. + */ + public String getSignerCertsUri() { + return signerCertsUri; + } } |