From bb1b12ac5b240629e16ea1c7a50891e99f4adc14 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 27 Aug 2015 11:32:05 +0200 Subject: Use test- and productive TrustStore configurations in one IDP instance - every service configuration could select its preferred TrustStore --- .../config/ConfigurationMigrationUtils.java | 43 ++++++++++++++++++---- .../config/MOAIDConfigurationConstants.java | 4 +- .../db/dao/config/deprecated/TestCredentials.java | 40 +++++++++++++++++++- .../db/dao/config/deprecated/VerifyAuthBlock.java | 21 +++++++++++ .../dao/config/deprecated/VerifyIdentityLink.java | 18 +++++++++ 5 files changed, 116 insertions(+), 10 deletions(-) (limited to 'id/server/moa-id-commons/src/main/java') diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java index 05de581d2..38a111707 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/ConfigurationMigrationUtils.java @@ -270,7 +270,11 @@ public class ConfigurationMigrationUtils { } result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_OIDs, oids); - } + } + + result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_USETESTIDLTRUSTSTORE, String.valueOf(oaauth.getTestCredentials().isUseTestIDLTrustStore())); + result.put(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_USETESTAUTHBLOCKTRUSTSTORE, String.valueOf(oaauth.getTestCredentials().isUseTestAuthBlockTrustStore())); + } //convert foreign bPK @@ -856,10 +860,12 @@ public class ConfigurationMigrationUtils { } authoa.setMandates(mandates); - if (Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_ENABLED))) { - TestCredentials testing = authoa.getTestCredentials(); - testing = new TestCredentials(); - authoa.setTestCredentials(testing); + TestCredentials testing = authoa.getTestCredentials(); + if (Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_ENABLED))) { + if (testing == null) { + testing = new TestCredentials(); + authoa.setTestCredentials(testing); + } testing.setEnableTestCredentials(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_ENABLED))); if (oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_OIDs) != null) { @@ -868,15 +874,29 @@ public class ConfigurationMigrationUtils { testing.setCredentialOID(testCredentialOIDs); } - } else { - TestCredentials testing = authoa.getTestCredentials(); + } else { if (testing != null) { testing.setEnableTestCredentials(false); } } - + + if (testing == null) { + testing = new TestCredentials(); + authoa.setTestCredentials(testing); + } + + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_USETESTIDLTRUSTSTORE))) + testing.setUseTestIDLTrustStore(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_USETESTIDLTRUSTSTORE))); + else + testing.setUseTestIDLTrustStore(false); + if (MiscUtil.isNotEmpty(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_USETESTAUTHBLOCKTRUSTSTORE))) + testing.setUseTestAuthBlockTrustStore(Boolean.parseBoolean(oa.get(MOAIDConfigurationConstants.SERVICE_AUTH_TESTCREDENTIALS_USETESTAUTHBLOCKTRUSTSTORE))); + else + testing.setUseTestAuthBlockTrustStore(false); + + EncBPKInformation bPKEncDec = authoa.getEncBPKInformation(); if (bPKEncDec == null) { bPKEncDec = new EncBPKInformation(); @@ -1188,6 +1208,9 @@ public class ConfigurationMigrationUtils { if (authblock != null) { result.put(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_AUTHBLOCK_PROD, authblock.getTrustProfileID()); + result.put(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_AUTHBLOCK_TEST, + authblock.getTestTrustProfileID()); + List list = authblock.getVerifyTransformsInfoProfileID(); if (list.size() == 1) @@ -1203,6 +1226,8 @@ public class ConfigurationMigrationUtils { if (idl != null) { result.put(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_IDL_PROD, idl.getTrustProfileID()); + result.put(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_IDL_TEST, + idl.getTestTrustProfileID()); } } @@ -1721,12 +1746,14 @@ public class ConfigurationMigrationUtils { dbmoasp.setVerifyIdentityLink(moaidl); } moaidl.setTrustProfileID(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_IDL_PROD)); + moaidl.setTestTrustProfileID(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_IDL_TEST)); VerifyAuthBlock moaauth = dbmoasp.getVerifyAuthBlock(); if (moaauth == null) { moaauth = new VerifyAuthBlock(); dbmoasp.setVerifyAuthBlock(moaauth); } moaauth.setTrustProfileID(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_AUTHBLOCK_PROD)); + moaauth.setTestTrustProfileID(moaconfig.get(MOAIDConfigurationConstants.GENERAL_AUTH_MOASP_TRUSTPROFILE_AUTHBLOCK_TEST)); if (moaauth.getVerifyTransformsInfoProfileID() == null) { moaauth.setVerifyTransformsInfoProfileID(new ArrayList()); diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java index 07c3151a2..c338c65ba 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/config/MOAIDConfigurationConstants.java @@ -107,7 +107,9 @@ public final class MOAIDConfigurationConstants extends MOAIDConstants { private static final String SERVICE_AUTH_TESTCREDENTIALS = AUTH + "." + TESTCREDENTIALS; public static final String SERVICE_AUTH_TESTCREDENTIALS_ENABLED = SERVICE_AUTH_TESTCREDENTIALS + ".enabled"; public static final String SERVICE_AUTH_TESTCREDENTIALS_OIDs = SERVICE_AUTH_TESTCREDENTIALS + ".oids"; - + public static final String SERVICE_AUTH_TESTCREDENTIALS_USETESTIDLTRUSTSTORE = SERVICE_AUTH_TESTCREDENTIALS + "useTestIDLTrustStore"; + public static final String SERVICE_AUTH_TESTCREDENTIALS_USETESTAUTHBLOCKTRUSTSTORE = SERVICE_AUTH_TESTCREDENTIALS + "useTestAuthBlockTrustStore"; + private static final String SERVICE_AUTH_MANDATES = AUTH + "." + MANDATES; public static final String SERVICE_AUTH_MANDATES_OVS = SERVICE_AUTH_MANDATES + ".ovs"; public static final String SERVICE_AUTH_MANDATES_OVS_USE = SERVICE_AUTH_MANDATES_OVS + ".use"; diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/TestCredentials.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/TestCredentials.java index e3bd00912..2e80cb0d5 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/TestCredentials.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/TestCredentials.java @@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import com.sun.tools.xjc.runtime.ZeroOneBooleanAdapter; @@ -82,6 +83,13 @@ public class TestCredentials protected Long hjid; protected transient List credentialOIDItems; + @XmlTransient + protected boolean useTestIDLTrustStore; + + @XmlTransient + protected boolean useTestAuthBlockTrustStore; + + /** * Gets the value of the credentialOID property. * @@ -203,7 +211,37 @@ public class TestCredentials } } - public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { + + + /** + * @return the useTestIDLTrustStore + */ + public boolean isUseTestIDLTrustStore() { + return useTestIDLTrustStore; + } + + /** + * @param useTestIDLTrustStore the useTestIDLTrustStore to set + */ + public void setUseTestIDLTrustStore(boolean useTestIDLTrustStore) { + this.useTestIDLTrustStore = useTestIDLTrustStore; + } + + /** + * @return the useTestAuthBlockTrustStore + */ + public boolean isUseTestAuthBlockTrustStore() { + return useTestAuthBlockTrustStore; + } + + /** + * @param useTestAuthBlockTrustStore the useTestAuthBlockTrustStore to set + */ + public void setUseTestAuthBlockTrustStore(boolean useTestAuthBlockTrustStore) { + this.useTestAuthBlockTrustStore = useTestAuthBlockTrustStore; + } + + public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) { if (!(object instanceof TestCredentials)) { return false; } diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyAuthBlock.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyAuthBlock.java index ecfb6b701..155863b03 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyAuthBlock.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyAuthBlock.java @@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import org.jvnet.hyperjaxb3.item.ItemUtils; import org.jvnet.jaxb2_commons.lang.Equals; @@ -80,6 +81,10 @@ public class VerifyAuthBlock protected Long hjid; protected transient List verifyTransformsInfoProfileIDItems; + @XmlTransient + protected String TestTrustProfileID; + + /** * Gets the value of the trustProfileID property. * @@ -106,7 +111,23 @@ public class VerifyAuthBlock this.trustProfileID = value; } + + /** + * @return the testTrustProfileID + */ + public String getTestTrustProfileID() { + return TestTrustProfileID; + } + + /** + * @param testTrustProfileID the testTrustProfileID to set + */ + public void setTestTrustProfileID(String testTrustProfileID) { + TestTrustProfileID = testTrustProfileID; + } + + /** * Gets the value of the verifyTransformsInfoProfileID property. * *

diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyIdentityLink.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyIdentityLink.java index 5b54bf5f2..ac7ad96cc 100644 --- a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyIdentityLink.java +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/config/deprecated/VerifyIdentityLink.java @@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import org.jvnet.jaxb2_commons.lang.Equals; import org.jvnet.jaxb2_commons.lang.EqualsStrategy; @@ -68,6 +69,9 @@ public class VerifyIdentityLink @XmlAttribute(name = "Hjid") protected Long hjid; + @XmlTransient + protected String TestTrustProfileID; + /** * Gets the value of the trustProfileID property. * @@ -110,6 +114,20 @@ public class VerifyIdentityLink } /** + * @return the testTrustProfileID + */ + public String getTestTrustProfileID() { + return TestTrustProfileID; + } + + /** + * @param testTrustProfileID the testTrustProfileID to set + */ + public void setTestTrustProfileID(String testTrustProfileID) { + TestTrustProfileID = testTrustProfileID; + } + + /** * Sets the value of the hjid property. * * @param value -- cgit v1.2.3