summaryrefslogtreecommitdiffstats
path: root/base/server/cms/src
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2014-04-22 14:22:51 -0400
committerEndi S. Dewata <edewata@redhat.com>2014-04-25 18:58:19 -0400
commitf28a2010262a39f3702e681c69133b72a06bce78 (patch)
tree11d13dda0b1f6e9d21e765b230e52f1cec694add /base/server/cms/src
parent7528c80cc37e550fc52f274f625f93f8f03bf99d (diff)
Refactored SystemConfigService (part 8).
The TPS-specific code to finalize the configuration has been moved into a separate method. Ticket #890
Diffstat (limited to 'base/server/cms/src')
-rw-r--r--base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java69
1 files changed, 37 insertions, 32 deletions
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 e75a172cd..9f34eb88c 100644
--- a/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java
+++ b/base/server/cms/src/org/dogtagpki/server/rest/SystemConfigService.java
@@ -258,38 +258,7 @@ public class SystemConfigService extends PKIService implements SystemConfigResou
}
if (csType.equals("TPS")) {
- try {
- ConfigurationUtils.addProfilesToTPSUser(data.getAdminUID());
-
- URI secdomainURI = new URI(data.getSecurityDomainUri());
-
- // register TPS with CA
- URI caURI = new URI(data.getCaUri());
- ConfigurationUtils.registerUser(secdomainURI, caURI, "ca");
-
- // register TPS with TKS
- URI tksURI = new URI(data.getTksUri());
- ConfigurationUtils.registerUser(secdomainURI, tksURI, "tks");
-
- if (data.getEnableServerSideKeyGen().equalsIgnoreCase("true")) {
- URI kraURI = new URI(data.getKraUri());
- ConfigurationUtils.registerUser(secdomainURI, kraURI, "kra");
- String transportCert = ConfigurationUtils.getTransportCert(secdomainURI, kraURI);
- ConfigurationUtils.exportTransportCert(secdomainURI, tksURI, transportCert);
- }
-
- // generate shared secret from the tks
- ConfigurationUtils.getSharedSecret(
- tksURI.getHost(),
- tksURI.getPort(),
- Boolean.getBoolean(data.getImportSharedSecret()));
-
- } catch (URISyntaxException e) {
- throw new BadRequestException("Invalid URI for CA, TKS or KRA");
- } catch (Exception e) {
- e.printStackTrace();
- throw new PKIException("Errors in registering TPS to CA, TKS or KRA: " + e);
- }
+ finalizeTPSConfiguration(data);
}
cs.putInteger("cs.state", 1);
@@ -718,6 +687,42 @@ public class SystemConfigService extends PKIService implements SystemConfigResou
}
}
+ public void finalizeTPSConfiguration(ConfigurationRequest request) {
+ try {
+ ConfigurationUtils.addProfilesToTPSUser(request.getAdminUID());
+
+ URI secdomainURI = new URI(request.getSecurityDomainUri());
+
+ // register TPS with CA
+ URI caURI = new URI(request.getCaUri());
+ ConfigurationUtils.registerUser(secdomainURI, caURI, "ca");
+
+ // register TPS with TKS
+ URI tksURI = new URI(request.getTksUri());
+ ConfigurationUtils.registerUser(secdomainURI, tksURI, "tks");
+
+ if (request.getEnableServerSideKeyGen().equalsIgnoreCase("true")) {
+ URI kraURI = new URI(request.getKraUri());
+ ConfigurationUtils.registerUser(secdomainURI, kraURI, "kra");
+ String transportCert = ConfigurationUtils.getTransportCert(secdomainURI, kraURI);
+ ConfigurationUtils.exportTransportCert(secdomainURI, tksURI, transportCert);
+ }
+
+ // generate shared secret from the tks
+ ConfigurationUtils.getSharedSecret(
+ tksURI.getHost(),
+ tksURI.getPort(),
+ Boolean.getBoolean(request.getImportSharedSecret()));
+
+ } catch (URISyntaxException e) {
+ throw new BadRequestException("Invalid URI for CA, TKS or KRA");
+
+ } catch (Exception e) {
+ CMS.debug(e);
+ throw new PKIException("Errors in registering TPS to CA, TKS or KRA: " + e);
+ }
+ }
+
public void configureAdministrator(ConfigurationRequest data, ConfigurationResponse response) {
if (!data.getIsClone().equals("true")) {
try {