diff options
4 files changed, 19 insertions, 16 deletions
diff --git a/base/common/functional/src/com/netscape/cms/servlet/test/ConfigurationTest.java b/base/common/functional/src/com/netscape/cms/servlet/test/ConfigurationTest.java index 69994fa38..0416853da 100644 --- a/base/common/functional/src/com/netscape/cms/servlet/test/ConfigurationTest.java +++ b/base/common/functional/src/com/netscape/cms/servlet/test/ConfigurationTest.java @@ -62,6 +62,7 @@ import com.netscape.certsrv.system.ConfigurationRequest; import com.netscape.certsrv.system.ConfigurationResponse; import com.netscape.certsrv.system.SystemCertData; import com.netscape.certsrv.system.SystemConfigClient; +import com.netscape.cmsutil.crypto.CryptoUtil; import com.netscape.cmsutil.util.Utils; /** @@ -251,7 +252,7 @@ public class ConfigurationTest { data.setSecurityDomainName("Testca2 security domain"); data.setClone("false"); data.setHierarchy("root"); - data.setToken(ConfigurationRequest.TOKEN_DEFAULT); + data.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME); data.setSubsystemName("test ca subsystem"); data.setDsHost(host); @@ -353,7 +354,7 @@ public class ConfigurationTest { data.setClone("false"); data.setHierarchy("join"); - data.setToken(ConfigurationRequest.TOKEN_DEFAULT); + data.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME); data.setSubsystemName("test subca subsystem"); data.setDsHost(host); @@ -455,7 +456,7 @@ public class ConfigurationTest { data.setClone("false"); data.setHierarchy("join"); - data.setToken(ConfigurationRequest.TOKEN_DEFAULT); + data.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME); data.setSubsystemName("test external ca subsystem"); data.setDsHost(host); @@ -557,7 +558,7 @@ public class ConfigurationTest { data.setClone("false"); data.setHierarchy("join"); - data.setToken(ConfigurationRequest.TOKEN_DEFAULT); + data.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME); data.setSubsystemName("test external ca subsystem"); data.setDsHost(host); @@ -681,7 +682,7 @@ public class ConfigurationTest { data.setP12Password("redhat123"); data.setHierarchy("root"); - data.setToken(ConfigurationRequest.TOKEN_DEFAULT); + data.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME); data.setSubsystemName("test clone ca subsystem"); data.setDsHost(host); @@ -724,7 +725,7 @@ public class ConfigurationTest { data.setSecurityDomainPassword("redhat123"); data.setClone("false"); - data.setToken(ConfigurationRequest.TOKEN_DEFAULT); + data.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME); data.setSubsystemName("test kra subsystem"); data.setDsHost(host); @@ -827,7 +828,7 @@ public class ConfigurationTest { data.setSecurityDomainPassword("redhat123"); data.setClone("false"); - data.setToken(ConfigurationRequest.TOKEN_DEFAULT); + data.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME); data.setSubsystemName("test ocsp subsystem"); data.setDsHost(host); @@ -919,7 +920,7 @@ public class ConfigurationTest { data.setSecurityDomainPassword("redhat123"); data.setClone("false"); - data.setToken(ConfigurationRequest.TOKEN_DEFAULT); + data.setToken(CryptoUtil.INTERNAL_TOKEN_FULL_NAME); data.setSubsystemName("test tks subsystem"); data.setDsHost(host); diff --git a/base/common/src/com/netscape/certsrv/system/ConfigurationRequest.java b/base/common/src/com/netscape/certsrv/system/ConfigurationRequest.java index cd9d3c8ba..2ac1f5a15 100644 --- a/base/common/src/com/netscape/certsrv/system/ConfigurationRequest.java +++ b/base/common/src/com/netscape/certsrv/system/ConfigurationRequest.java @@ -28,6 +28,8 @@ import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import com.netscape.cmsutil.crypto.CryptoUtil; + /** * @author alee * @@ -37,7 +39,6 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; public class ConfigurationRequest { //defaults - public static final String TOKEN_DEFAULT = "Internal Key Storage Token"; public static final String NEW_DOMAIN = "newdomain"; public static final String EXISTING_DOMAIN = "existingdomain"; public static final String NEW_SUBDOMAIN = "newsubdomain"; @@ -45,7 +46,7 @@ public class ConfigurationRequest { @XmlElement protected String pin; - @XmlElement(defaultValue=TOKEN_DEFAULT) + @XmlElement(defaultValue=CryptoUtil.INTERNAL_TOKEN_FULL_NAME) protected String token; @XmlElement diff --git a/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java b/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java index 40f4b5834..963df4d05 100644 --- a/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java +++ b/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java @@ -151,7 +151,7 @@ public class SystemConfigService extends PKIService implements SystemConfigResou CMS.debug("=== Token Authentication ==="); String token = data.getToken(); if (token == null) { - token = ConfigurationRequest.TOKEN_DEFAULT; + token = CryptoUtil.INTERNAL_TOKEN_FULL_NAME; } loginToken(data, token); @@ -877,7 +877,7 @@ public class SystemConfigService extends PKIService implements SystemConfigResou CMS.debug("SystemConfigService: get configuration entries from master"); ConfigurationUtils.getConfigEntriesFromMaster(); - if (token.equals(ConfigurationRequest.TOKEN_DEFAULT)) { + if (token.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME)) { if (!data.getSystemCertsImported()) { CMS.debug("SystemConfigService: restore certificates from P12 file"); String p12File = data.getP12File(); @@ -1019,7 +1019,7 @@ public class SystemConfigService extends PKIService implements SystemConfigResou public void loginToken(ConfigurationRequest data, String token) { cs.putString("preop.module.token", token); - if (! token.equals(ConfigurationRequest.TOKEN_DEFAULT)) { + if (! token.equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME)) { try { CryptoManager cryptoManager = CryptoManager.getInstance(); CryptoToken ctoken = cryptoManager.getTokenByName(token); @@ -1130,7 +1130,7 @@ public class SystemConfigService extends PKIService implements SystemConfigResou throw new BadRequestException("Invalid clone URI: " + cloneUri, e); } - if (data.getToken().equals(ConfigurationRequest.TOKEN_DEFAULT)) { + if (data.getToken().equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME)) { if (!data.getSystemCertsImported()) { if (data.getP12File() == null) { throw new BadRequestException("P12 filename not provided"); @@ -1210,7 +1210,7 @@ public class SystemConfigService extends PKIService implements SystemConfigResou } if ((data.getBackupKeys() != null) && data.getBackupKeys().equals("true")) { - if (! data.getToken().equals(ConfigurationRequest.TOKEN_DEFAULT)) { + if (! data.getToken().equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME)) { throw new BadRequestException("HSMs cannot publish private keys to PKCS #12 files"); } diff --git a/base/tps/src/org/dogtagpki/server/tps/rest/TPSInstallerService.java b/base/tps/src/org/dogtagpki/server/tps/rest/TPSInstallerService.java index 8fd24c8d8..7a2228879 100644 --- a/base/tps/src/org/dogtagpki/server/tps/rest/TPSInstallerService.java +++ b/base/tps/src/org/dogtagpki/server/tps/rest/TPSInstallerService.java @@ -31,6 +31,7 @@ import com.netscape.certsrv.base.PKIException; import com.netscape.certsrv.system.ConfigurationRequest; import com.netscape.certsrv.system.SystemCertData; import com.netscape.cms.servlet.csadmin.ConfigurationUtils; +import com.netscape.cmsutil.crypto.CryptoUtil; /** * @author alee @@ -50,7 +51,7 @@ public class TPSInstallerService extends SystemConfigService { // get token prefix, if applicable String tokPrefix = ""; - if (!request.getToken().equals(ConfigurationRequest.TOKEN_DEFAULT) && + if (!request.getToken().equals(CryptoUtil.INTERNAL_TOKEN_FULL_NAME) && !request.getToken().equals("internal")) { tokPrefix = request.getToken() + ":"; } |
