[java-identity-provider] 01/03: IDP-1575 Push Path awareness into the trustore

Rod Widdowson rdw at steadingsoftware.com
Mon Jun 22 15:56:25 UTC 2020


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=27d461237e4cd68341ec19d60b5418903b9dadf8

commit 27d461237e4cd68341ec19d60b5418903b9dadf8
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Jun 16 11:26:20 2020 +0100

    IDP-1575 Push Path awareness into the trustore
    
    https://issues.shibboleth.net/jira/browse/IDP-1595
---
 .../net/shibboleth/idp/installer/plugin/impl/TrustStore.java   |  9 ++++-----
 .../shibboleth/idp/installer/plugin/impl/TrustStoreTest.java   | 10 +++++-----
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/TrustStore.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/TrustStore.java
index 228ca94ac..27344b4c8 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/TrustStore.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/plugin/impl/TrustStore.java
@@ -59,7 +59,7 @@ public final class TrustStore extends AbstractInitializableComponent {
     @Nonnull private final Logger log = LoggerFactory.getLogger(TrustStore.class);
     
     /** Where the IdP is installed.  */
-    @NonnullAfterInit private String idpHome;
+    @NonnullAfterInit private Path idpHome;
     
     /** The plugin this is the trust store for. */
     @NonnullAfterInit private String pluginId;
@@ -84,7 +84,7 @@ public final class TrustStore extends AbstractInitializableComponent {
     /** Set the IdPHome.
      * @param what The idpHome to set.
      */
-    public void setIdpHome(final String what) {
+    public void setIdpHome(final Path what) {
         ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
         idpHome = what;
     }
@@ -237,13 +237,12 @@ public final class TrustStore extends AbstractInitializableComponent {
             throw new ComponentInitializationException("Plugin IN not set up");
         }
         
-        final Path home = Path.of(idpHome);
-        if (!Files.exists(home)) {
+        if (!Files.exists(idpHome)) {
             throw new ComponentInitializationException("IdP home '" + idpHome + "' does not exist");
         }
 
         try {
-            final Path parent = home.resolve("credentials").resolve(pluginId);
+            final Path parent = idpHome.resolve("credentials").resolve(pluginId);
             if (!Files.exists(parent)) {
                 log.info("Plugin {}: Trust store folder does not exist, creating", pluginId);
                 Files.createDirectories(parent);
diff --git a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/TrustStoreTest.java b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/TrustStoreTest.java
index 68b1f7982..ff54cb1be 100644
--- a/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/TrustStoreTest.java
+++ b/idp-installer/src/test/java/net/shibboleth/idp/installer/plugin/impl/TrustStoreTest.java
@@ -76,7 +76,7 @@ public class TrustStoreTest {
 
     @Test public void signatureAbsentTest() throws ComponentInitializationException, IOException {
         final TrustStore ts = new TrustStore();
-        ts.setIdpHome(dir.toString());
+        ts.setIdpHome(dir);
         ts.setPluginId(pluginId);
         ts.initialize();
         try (InputStream sigStream = TrustStoreTest.class.getResourceAsStream("/net/shibboleth/idp/installer/plugin/shib.ico.asc")) {
@@ -95,7 +95,7 @@ public class TrustStoreTest {
     @Test public void signaturePresentTest() throws ComponentInitializationException, IOException {
         populateKeyStore();
         final TrustStore ts = new TrustStore();
-        ts.setIdpHome(dir.toString());
+        ts.setIdpHome(dir);
         ts.setPluginId(pluginId);
         ts.initialize();
         try( final InputStream sigStream = TrustStoreTest.class.getResourceAsStream("/net/shibboleth/idp/installer/plugin/shib.ico.asc")) {
@@ -107,7 +107,7 @@ public class TrustStoreTest {
     @Test public void signingTest()  throws ComponentInitializationException, IOException {
         populateKeyStore();
         final TrustStore ts = new TrustStore();
-        ts.setIdpHome(dir.toString());
+        ts.setIdpHome(dir);
         ts.setPluginId(pluginId);
         ts.initialize();
         try( final InputStream sigStream = TrustStoreTest.class.getResourceAsStream("/net/shibboleth/idp/installer/plugin/shib.ico.asc");
@@ -129,14 +129,14 @@ public class TrustStoreTest {
             signature = TrustStore.signatureOf(sigStream);
         }
         TrustStore ts = new TrustStore();
-        ts.setIdpHome(dir.toString());
+        ts.setIdpHome(dir);
         ts.setPluginId(pluginId);
         ts.initialize();
         assertTrue(ts.contains(signature));
         ts.saveStore();
 
         ts = new TrustStore();
-        ts.setIdpHome(dir.toString());
+        ts.setIdpHome(dir);
         ts.setPluginId(pluginId);
         ts.initialize();
         assertTrue(ts.contains(signature));

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list