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 --- .../id/configuration/data/GeneralMOAIDConfig.java | 33 ++++++++++++++ .../data/oa/OAAuthenticationData.java | 50 +++++++++++++++++++++- .../struts/action/EditGeneralConfigAction.java | 3 ++ .../validation/moaconfig/MOAConfigValidator.java | 25 +++++++++++ 4 files changed, 109 insertions(+), 2 deletions(-) (limited to 'id/ConfigWebTool/src/main/java/at/gv/egovernment/moa') diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java index bcf99d246..83795567c 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/GeneralMOAIDConfig.java @@ -81,6 +81,9 @@ public class GeneralMOAIDConfig { private List authTransformList = null; private String moaspssIdlTrustProfile = null; + private String moaspssIdlTrustProfileTest = null; + private String moaspssAuthTrustProfileTest = null; + private String mandateURL = null; private boolean protocolActiveSAML1 = false; @@ -184,6 +187,7 @@ public class GeneralMOAIDConfig { VerifyAuthBlock authblock = moaspss.getVerifyAuthBlock(); if (authblock != null) { moaspssAuthTrustProfile = authblock.getTrustProfileID(); + moaspssAuthTrustProfileTest = authblock.getTestTrustProfileID(); List list = authblock.getVerifyTransformsInfoProfileID(); if (list.size() == 1) @@ -197,6 +201,7 @@ public class GeneralMOAIDConfig { VerifyIdentityLink idl = moaspss.getVerifyIdentityLink(); if (idl != null) { moaspssIdlTrustProfile = idl.getTrustProfileID(); + moaspssIdlTrustProfileTest = idl.getTestTrustProfileID(); } } @@ -928,6 +933,34 @@ public class GeneralMOAIDConfig { public void setPublicURLPrefix(String publicURLPrefix) { this.publicURLPrefix = publicURLPrefix; } + + /** + * @return the moaspssIdlTrustProfileTest + */ + public String getMoaspssIdlTrustProfileTest() { + return moaspssIdlTrustProfileTest; + } + + /** + * @param moaspssIdlTrustProfileTest the moaspssIdlTrustProfileTest to set + */ + public void setMoaspssIdlTrustProfileTest(String moaspssIdlTrustProfileTest) { + this.moaspssIdlTrustProfileTest = moaspssIdlTrustProfileTest; + } + + /** + * @return the moaspssAuthTrustProfileTest + */ + public String getMoaspssAuthTrustProfileTest() { + return moaspssAuthTrustProfileTest; + } + + /** + * @param moaspssAuthTrustProfileTest the moaspssAuthTrustProfileTest to set + */ + public void setMoaspssAuthTrustProfileTest(String moaspssAuthTrustProfileTest) { + this.moaspssAuthTrustProfileTest = moaspssAuthTrustProfileTest; + } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java index 0c633f312..9b0172a24 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/data/oa/OAAuthenticationData.java @@ -70,7 +70,9 @@ public class OAAuthenticationData implements IOnlineApplicationData { private Map transformations; private boolean enableTestCredentials = false; - private List testCredentialOIDs = null; + private List testCredentialOIDs = null; + private boolean useTestIDLValidationTrustStore = false; + private boolean useTestAuthblockValidationTrustStore = false; /** * @@ -210,7 +212,9 @@ public class OAAuthenticationData implements IOnlineApplicationData { enableTestCredentials = oaauth.getTestCredentials().isEnableTestCredentials(); testCredentialOIDs = new ArrayList(); testCredentialOIDs.addAll(oaauth.getTestCredentials().getCredentialOID()); - + + useTestAuthblockValidationTrustStore = oaauth.getTestCredentials().isUseTestAuthBlockTrustStore(); + useTestIDLValidationTrustStore = oaauth.getTestCredentials().isUseTestIDLTrustStore(); } return null; @@ -332,6 +336,17 @@ public class OAAuthenticationData implements IOnlineApplicationData { } + TestCredentials testing = authoa.getTestCredentials(); + if (testing == null) { + testing = new TestCredentials(); + authoa.setTestCredentials(testing); + + } + testing.setUseTestAuthBlockTrustStore(useTestAuthblockValidationTrustStore); + testing.setUseTestIDLTrustStore(useTestIDLValidationTrustStore); + + + return null; } @@ -614,5 +629,36 @@ public class OAAuthenticationData implements IOnlineApplicationData { this.testCredentialOIDs.add(oidList[i].trim()); } } + + /** + * @return the useTestIDLValidationTrustStore + */ + public boolean isUseTestIDLValidationTrustStore() { + return useTestIDLValidationTrustStore; + } + + /** + * @param useTestIDLValidationTrustStore the useTestIDLValidationTrustStore to set + */ + public void setUseTestIDLValidationTrustStore( + boolean useTestIDLValidationTrustStore) { + this.useTestIDLValidationTrustStore = useTestIDLValidationTrustStore; + } + + /** + * @return the useTestAuthblockValidationTrustStore + */ + public boolean isUseTestAuthblockValidationTrustStore() { + return useTestAuthblockValidationTrustStore; + } + + /** + * @param useTestAuthblockValidationTrustStore the useTestAuthblockValidationTrustStore to set + */ + public void setUseTestAuthblockValidationTrustStore( + boolean useTestAuthblockValidationTrustStore) { + this.useTestAuthblockValidationTrustStore = useTestAuthblockValidationTrustStore; + } + } diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java index 13256a6a0..725a2eded 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java @@ -586,12 +586,15 @@ public class EditGeneralConfigAction extends BasicAction { dbmoasp.setVerifyIdentityLink(moaidl); } moaidl.setTrustProfileID(moaconfig.getMoaspssIdlTrustProfile()); + moaidl.setTestTrustProfileID(moaconfig.getMoaspssIdlTrustProfileTest()); + VerifyAuthBlock moaauth = dbmoasp.getVerifyAuthBlock(); if (moaauth == null) { moaauth = new VerifyAuthBlock(); dbmoasp.setVerifyAuthBlock(moaauth); } moaauth.setTrustProfileID(moaconfig.getMoaspssAuthTrustProfile()); + moaauth.setTestTrustProfileID(moaconfig.getMoaspssAuthTrustProfileTest()); if (moaauth.getVerifyTransformsInfoProfileID() != null && moaauth.getVerifyTransformsInfoProfileID().size() > 0) diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java index 73f5e098f..95502cedb 100644 --- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java +++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/validation/moaconfig/MOAConfigValidator.java @@ -207,6 +207,31 @@ public class MOAConfigValidator { } } + check = form.getMoaspssAuthTrustProfileTest(); + if (MiscUtil.isEmpty(check)) { + log.info("Empty MOA-SP/SS Test-Authblock TrustProfile"); + errors.add(LanguageHelper.getErrorString("validation.general.moasp.auth.trustprofile.test.empty", request)); + } else { + if (ValidationHelper.containsPotentialCSSCharacter(check, false)) { + log.info("Test-Authblock TrustProfile is not valid: " +check); + errors.add(LanguageHelper.getErrorString("validation.general.moasp.auth.trustprofile.test.valid", + new Object[] {ValidationHelper.getPotentialCSSCharacter(false)}, request )); + } + } + + check = form.getMoaspssIdlTrustProfileTest(); + if (MiscUtil.isEmpty(check)) { + log.info("Empty MOA-SP/SS Test-IdentityLink TrustProfile"); + errors.add(LanguageHelper.getErrorString("validation.general.moasp.idl.trustprofile.test.empty", request)); + } else { + if (ValidationHelper.containsPotentialCSSCharacter(check, false)) { + log.info("Test-IdentityLink TrustProfile is not valid: " +check); + errors.add(LanguageHelper.getErrorString("validation.general.moasp.idl.trustprofile.test.valid", + new Object[] {ValidationHelper.getPotentialCSSCharacter(false)}, request )); + } + } + + check = form.getMoaspssURL(); if (MiscUtil.isNotEmpty(check)) { if (!ValidationHelper.validateURL(check)) { -- cgit v1.2.3