summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/certsrv/system/ConfigurationRequest.java
blob: 217f84b903f7890b02fe547f3bb37ec5e9848d70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// (C) 2012 Red Hat, Inc.
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.system;

import java.util.Collection;

import javax.ws.rs.core.MultivaluedMap;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * @author alee
 *
 */
@XmlRootElement(name="ConfigurationRequest")
@XmlAccessorType(XmlAccessType.FIELD)
public class ConfigurationRequest {
    private static final String PIN = "pin";
    private static final String TOKEN = "token";
    private static final String TOKEN_PASSWORD = "tokenPassword";
    private static final String SECURITY_DOMAIN_TYPE = "securityDomainType";
    private static final String SECURITY_DOMAIN_URI = "securityDomainUri";
    private static final String SECURITY_DOMAIN_NAME = "securityDomainName";
    private static final String SECURITY_DOMAIN_USER = "securityDomainUser";
    private static final String SECURITY_DOMAIN_PASSWORD = "securityDomainPassword";
    private static final String IS_CLONE = "isClone";
    private static final String CLONE_URI = "cloneUri";
    private static final String SUBSYSTEM_NAME = "subsystemName";
    private static final String P12_FILE = "p12File";
    private static final String P12_PASSWORD = "p12Password";
    private static final String HIERARCHY = "hierarchy";
    private static final String DSHOST = "dsHost";
    private static final String DSPORT = "dsPort";
    private static final String BASEDN = "basedn";
    private static final String BINDDN = "binddn";
    private static final String DATABASE = "database";
    private static final String SECURECONN = "secureConn";
    private static final String REMOVEDATA = "removeData";
    private static final String MASTER_REPLICATION_PORT = "masterReplicationPort";
    private static final String CLONE_REPLICATION_PORT = "cloneReplicationPort";
    private static final String REPLICATE_SCHEMA = "replicateSchema";
    private static final String REPLICATION_SECURITY = "replicationSecurity";
    private static final String ISSUING_CA = "issuingCa";
    private static final String BACKUP_KEYS = "backupKeys";
    private static final String BACKUP_FILE = "backupFile";
    private static final String BACKUP_PASSWORD = "backupPassword";
    private static final String ADMIN_UID = "adminUid";
    private static final String ADMIN_EMAIL = "adminEmail";
    private static final String ADMIN_PASSWORD = "adminPassword";
    private static final String ADMIN_CERT_REQUEST = "adminCertRequest";
    private static final String ADMIN_CERT_REQUEST_TYPE = "adminCertRequestType";
    private static final String ADMIN_SUBJECT_DN = "adminSubjectDN";
    private static final String ADMIN_NAME = "adminName";
    private static final String ADMIN_PROFILE_ID = "adminProfileID";
    private static final String IMPORT_ADMIN_CERT = "importAdminCert";
    private static final String ADMIN_CERT = "adminCert";
    private static final String STEP_TWO = "stepTwo";
    private static final String GENERATE_SERVER_CERT = "generateServerCert";

    //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";

    @XmlElement
    protected String pin;

    @XmlElement(defaultValue=TOKEN_DEFAULT)
    protected String token;

    @XmlElement
    protected String tokenPassword;

    @XmlElement
    protected String securityDomainType;

    @XmlElement
    protected String securityDomainUri;

    @XmlElement
    protected String securityDomainName;

    @XmlElement
    protected String securityDomainUser;

    @XmlElement
    protected String securityDomainPassword;

    @XmlElement(defaultValue="false")
    protected String isClone;

    @XmlElement
    protected String cloneUri;

    @XmlElement
    protected String subsystemName;

    @XmlElement
    protected String p12File;

    @XmlElement
    protected String p12Password;

    @XmlElement
    protected String hierarchy;

    @XmlElement
    protected String dsHost;

    @XmlElement
    protected String dsPort;

    @XmlElement
    protected String baseDN;

    @XmlElement
    protected String bindDN;

    @XmlElement
    protected String bindpwd;

    @XmlElement
    protected String database;

    @XmlElement(defaultValue = "off")
    protected String secureConn;

    @XmlElement
    protected String removeData;

    @XmlElement
    protected String masterReplicationPort;

    @XmlElement
    protected String cloneReplicationPort;

    @XmlElement
    protected String replicateSchema;

    @XmlElement
    protected String replicationSecurity;

    @XmlElementRef
    protected Collection<SystemCertData> systemCerts;

    @XmlElement
    protected String issuingCA;

    @XmlElement
    protected String backupKeys;

    @XmlElement
    protected String backupPassword;

    @XmlElement
    protected String backupFile;

    @XmlElement
    protected String adminUID;

    @XmlElement
    protected String adminPassword;

    @XmlElement
    protected String adminEmail;

    @XmlElement
    protected String adminCertRequest;

    @XmlElement
    protected String adminCertRequestType;

    @XmlElement
    protected String adminSubjectDN;

    @XmlElement
    protected String adminName;

    @XmlElement
    protected String adminProfileID;

    @XmlElement(defaultValue = "false")
    protected String importAdminCert;

    @XmlElement
    protected String adminCert;

    @XmlElement
    protected String stepTwo;

    @XmlElement(defaultValue = "true")
    protected String generateServerCert;

    public ConfigurationRequest() {
        // required for JAXB
    }

    public ConfigurationRequest(MultivaluedMap<String, String> form) {
        pin = form.getFirst(PIN);
        token = form.getFirst(TOKEN);
        tokenPassword = form.getFirst(TOKEN_PASSWORD);
        securityDomainType = form.getFirst(SECURITY_DOMAIN_TYPE);
        securityDomainUri = form.getFirst(SECURITY_DOMAIN_URI);
        securityDomainName = form.getFirst(SECURITY_DOMAIN_NAME);
        securityDomainUser = form.getFirst(SECURITY_DOMAIN_USER);
        securityDomainPassword = form.getFirst(SECURITY_DOMAIN_PASSWORD);
        isClone = form.getFirst(IS_CLONE);
        cloneUri = form.getFirst(CLONE_URI);
        subsystemName = form.getFirst(SUBSYSTEM_NAME);
        p12File = form.getFirst(P12_FILE);
        p12Password = form.getFirst(P12_PASSWORD);
        hierarchy = form.getFirst(HIERARCHY);
        dsHost = form.getFirst(DSHOST);
        dsPort = form.getFirst(DSPORT);
        baseDN = form.getFirst(BASEDN);
        bindDN = form.getFirst(BINDDN);
        database = form.getFirst(DATABASE);
        secureConn = form.getFirst(SECURECONN);
        removeData = form.getFirst(REMOVEDATA);
        masterReplicationPort = form.getFirst(MASTER_REPLICATION_PORT);
        cloneReplicationPort = form.getFirst(CLONE_REPLICATION_PORT);
        replicateSchema = form.getFirst(REPLICATE_SCHEMA);
        replicationSecurity = form.getFirst(REPLICATION_SECURITY);
        //TODO - figure out how to get the cert requests
        issuingCA = form.getFirst(ISSUING_CA);
        backupFile = form.getFirst(BACKUP_FILE);
        backupPassword = form.getFirst(BACKUP_PASSWORD);
        backupKeys = form.getFirst(BACKUP_KEYS);
        adminUID = form.getFirst(ADMIN_UID);
        adminEmail = form.getFirst(ADMIN_EMAIL);
        adminPassword = form.getFirst(ADMIN_PASSWORD);
        adminCertRequest = form.getFirst(ADMIN_CERT_REQUEST);
        adminCertRequestType = form.getFirst(ADMIN_CERT_REQUEST_TYPE);
        adminSubjectDN = form.getFirst(ADMIN_SUBJECT_DN);
        adminName = form.getFirst(ADMIN_NAME);
        adminProfileID = form.getFirst(ADMIN_PROFILE_ID);
        adminCert = form.getFirst(ADMIN_CERT);
        importAdminCert = form.getFirst(IMPORT_ADMIN_CERT);
        stepTwo = form.getFirst(STEP_TWO);
        generateServerCert = form.getFirst(GENERATE_SERVER_CERT);
    }


    public String getSubsystemName() {
        return subsystemName;
    }

    public void setSubsystemName(String subsystemName) {
        this.subsystemName = subsystemName;
    }

    public String getPin() {
        return pin;
    }

    public void setPin(String pin) {
        this.pin = pin;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getSecurityDomainType() {
        return securityDomainType;
    }

    public void setSecurityDomainType(String securityDomainType) {
        this.securityDomainType = securityDomainType;
    }

    public String getSecurityDomainUri() {
        return securityDomainUri;
    }

    public void setSecurityDomainUri(String securityDomainUri) {
        this.securityDomainUri = securityDomainUri;
    }

    public String getSecurityDomainName() {
        return securityDomainName;
    }

    public void setSecurityDomainName(String securityDomainName) {
        this.securityDomainName = securityDomainName;
    }

    public String getSecurityDomainUser() {
        return securityDomainUser;
    }

    public void setSecurityDomainUser(String securityDomainUser) {
        this.securityDomainUser = securityDomainUser;
    }

    public String getSecurityDomainPassword() {
        return securityDomainPassword;
    }

    public void setSecurityDomainPassword(String securityDomainPassword) {
        this.securityDomainPassword = securityDomainPassword;
    }

    public String getIsClone() {
        return isClone;
    }

    public void setIsClone(String isClone) {
        this.isClone = isClone;
    }

    public String getCloneUri() {
        return cloneUri;
    }

    public void setCloneUri(String cloneUri) {
        this.cloneUri = cloneUri;
    }

    /**
     * @return the p12File
     */
    public String getP12File() {
        return p12File;
    }

    /**
     * @param p12File the p12File to set
     */
    public void setP12File(String p12File) {
        this.p12File = p12File;
    }

    /**
     * @return the p12Password
     */
    public String getP12Password() {
        return p12Password;
    }

    /**
     * @param p12Password the p12Password to set
     */
    public void setP12Password(String p12Password) {
        this.p12Password = p12Password;
    }

    /**
     * @return the tokenPassword
     */
    public String getTokenPassword() {
        return tokenPassword;
    }

    /**
     * @param tokenPassword the tokenPassword to set
     */
    public void setTokenPassword(String tokenPassword) {
        this.tokenPassword = tokenPassword;
    }

    /**
     * @return the hierarchy
     */
    public String getHierarchy() {
        return hierarchy;
    }

    /**
     * @param hierarchy the hierarchy to set
     */
    public void setHierarchy(String hierarchy) {
        this.hierarchy = hierarchy;
    }

    /**
     * @return the dsHost
     */
    public String getDsHost() {
        return dsHost;
    }

    /**
     * @param dsHost the dsHost to set
     */
    public void setDsHost(String dsHost) {
        this.dsHost = dsHost;
    }

    /**
     * @return the dsPort
     */
    public String getDsPort() {
        return dsPort;
    }

    /**
     * @param dsPort the dsPort to set
     */
    public void setDsPort(String dsPort) {
        this.dsPort = dsPort;
    }

    /**
     * @return the baseDN
     */
    public String getBaseDN() {
        return baseDN;
    }

    /**
     * @param baseDN the baseDN to set
     */
    public void setBaseDN(String baseDN) {
        this.baseDN = baseDN;
    }

    /**
     * @return the bindDN
     */
    public String getBindDN() {
        return bindDN;
    }

    /**
     * @param bindDN the bindDN to set
     */
    public void setBindDN(String bindDN) {
        this.bindDN = bindDN;
    }

    /**
     * @return the bindpwd
     */
    public String getBindpwd() {
        return bindpwd;
    }

    /**
     * @param bindpwd the bindpwd to set
     */
    public void setBindpwd(String bindpwd) {
        this.bindpwd = bindpwd;
    }

    /**
     * @return the secureConn
     */
    public String getSecureConn() {
        return secureConn;
    }

    /**
     * @param secureConn the secureConn to set
     */
    public void setSecureConn(String secureConn) {
        this.secureConn = secureConn;
    }

    /**
     * @return the removeData
     */
    public String getRemoveData() {
        return removeData;
    }

    /**
     * @param removeData the removeData to set
     */
    public void setRemoveData(String removeData) {
        this.removeData = removeData;
    }

    /**
     * @return the masterReplicationPort
     */
    public String getMasterReplicationPort() {
        return masterReplicationPort;
    }

    /**
     * @param masterReplicationPort the masterReplicationPort to set
     */
    public void setMasterReplicationPort(String masterReplicationPort) {
        this.masterReplicationPort = masterReplicationPort;
    }

    /**
     * @return the cloneReplicationPort
     */
    public String getCloneReplicationPort() {
        return cloneReplicationPort;
    }

    /**
     * @param cloneReplicationPort the cloneReplicationPort to set
     */
    public void setCloneReplicationPort(String cloneReplicationPort) {
        this.cloneReplicationPort = cloneReplicationPort;
    }

    /**
     * @return the replicationSecurity
     */
    public String getReplicationSecurity() {
        return replicationSecurity;
    }

    /**
     * @param replicationSecurity the replicationSecurity to set
     */
    public void setReplicationSecurity(String replicationSecurity) {
        this.replicationSecurity = replicationSecurity;
    }

    /**
     * @return the database
     */
    public String getDatabase() {
        return database;
    }

    /**
     * @param database the database to set
     */
    public void setDatabase(String database) {
        this.database = database;
    }

    /**
     *
     * @return systemCerts
     */
    public Collection<SystemCertData> getSystemCerts() {
        return systemCerts;
    }

    /**
     *
     * @param systemCerts
     */
    public void setSystemCerts(Collection<SystemCertData> systemCerts) {
        this.systemCerts = systemCerts;
    }

    /**
     * @return the issuingCA
     */
    public String getIssuingCA() {
        return issuingCA;
    }

    /**
     * @param issuingCA the issuingCA to set
     */
    public void setIssuingCA(String issuingCA) {
        this.issuingCA = issuingCA;
    }

    /**
     * @return the backupKeys
     */
    public String getBackupKeys() {
        return backupKeys;
    }

    /**
     * @param backupKeys the backupKeys to set
     */
    public void setBackupKeys(String backupKeys) {
        this.backupKeys = backupKeys;
    }

    /**
     * @return the backupFile
     */
    public String getBackupFile() {
        return backupFile;
    }

    /**
     * @param backupFile the backupFile to set
     */
    public void setBackupFile(String backupFile) {
        this.backupFile = backupFile;
    }

    /**
     * @return the backupPassword
     */
    public String getBackupPassword() {
        return backupPassword;
    }

    /**
     * @param backupPassword the backupPassword to set
     */
    public void setBackupPassword(String backupPassword) {
        this.backupPassword = backupPassword;
    }

    /**
     * @return the adminUID
     */
    public String getAdminUID() {
        return adminUID;
    }

    /**
     * @param adminUID the adminUID to set
     */
    public void setAdminUID(String adminUID) {
        this.adminUID = adminUID;
    }

    /**
     * @return the adminPassword
     */
    public String getAdminPassword() {
        return adminPassword;
    }

    /**
     * @param adminPassword the adminPassword to set
     */
    public void setAdminPassword(String adminPassword) {
        this.adminPassword = adminPassword;
    }

    /**
     * @return the adminEmail
     */
    public String getAdminEmail() {
        return adminEmail;
    }

    /**
     * @param adminEmail the adminEmail to set
     */
    public void setAdminEmail(String adminEmail) {
        this.adminEmail = adminEmail;
    }

    /**
     * @return the adminCertRequest
     */
    public String getAdminCertRequest() {
        return adminCertRequest;
    }

    /**
     * @param adminCertRequest the adminCertRequest to set
     */
    public void setAdminCertRequest(String adminCertRequest) {
        this.adminCertRequest = adminCertRequest;
    }

    /**
     * @return the adminCertRequestType
     */
    public String getAdminCertRequestType() {
        return adminCertRequestType;
    }

    /**
     * @param adminCertRequestType the adminCertRequestType to set
     */
    public void setAdminCertRequestType(String adminCertRequestType) {
        this.adminCertRequestType = adminCertRequestType;
    }

    /**
     * @return the adminSubjectDN
     */
    public String getAdminSubjectDN() {
        return adminSubjectDN;
    }

    /**
     * @param adminSubjectDN the adminSubjectDN to set
     */
    public void setAdminSubjectDN(String adminSubjectDN) {
        this.adminSubjectDN = adminSubjectDN;
    }

    /**
     * @return the adminName
     */
    public String getAdminName() {
        return adminName;
    }

    /**
     * @param adminName the adminName to set
     */
    public void setAdminName(String adminName) {
        this.adminName = adminName;
    }

    /**
     * @return the adminProfileID
     */
    public String getAdminProfileID() {
        return adminProfileID;
    }

    /**
     * @param adminProfileID the adminProfileID to set
     */
    public void setAdminProfileID(String adminProfileID) {
        this.adminProfileID = adminProfileID;
    }

    public String getImportAdminCert() {
        return importAdminCert;
    }

    public void setImportAdminCert(String importAdminCert) {
        this.importAdminCert = importAdminCert;
    }

    public String getAdminCert() {
        return adminCert;
    }

    public void setAdminCert(String adminCert) {
        this.adminCert = adminCert;
    }

    public String getStepTwo() {
        return stepTwo;
    }

    public void setStepTwo(String stepTwo) {
        this.stepTwo = stepTwo;
    }

    public String getReplicateSchema() {
        return replicateSchema;
    }

    public void setReplicateSchema(String replicateSchema) {
        this.replicateSchema = replicateSchema;
    }

    public String getGenerateServerCert() {
        return generateServerCert;
    }

    public void setGenerateServerCert(String generateServerCert) {
        this.generateServerCert = generateServerCert;
    }

    @Override
    public String toString() {
        return "ConfigurationRequest [pin=XXXX" +
               ", token=" + token + ", tokenPassword=XXXX" +
               ", securityDomainType=" + securityDomainType +
               ", securityDomainUri=" + securityDomainUri +
               ", securityDomainName=" + securityDomainName +
               ", securityDomainUser=" + securityDomainUser +
               ", securityDomainPassword=XXXX" +
               ", isClone=" + isClone +
               ", cloneUri=" + cloneUri +
               ", subsystemName=" + subsystemName +
               ", p12File=" + p12File +
               ", p12Password=XXXX" +
               ", hierarchy=" + hierarchy +
               ", dsHost=" + dsHost +
               ", dsPort=" + dsPort +
               ", baseDN=" + baseDN +
               ", bindDN=" + bindDN +
               ", bindpwd=XXXX" +
               ", database=" + database +
               ", secureConn=" + secureConn +
               ", removeData=" + removeData +
               ", replicateSchema=" + replicateSchema +
               ", masterReplicationPort=" + masterReplicationPort +
               ", cloneReplicationPort=" + cloneReplicationPort +
               ", replicationSecurity=" + replicationSecurity +
               ", systemCerts=" + systemCerts +
               ", issuingCA=" + issuingCA +
               ", backupKeys=" + backupKeys +
               ", backupPassword=XXXX" +
               ", backupFile=" + backupFile +
               ", adminUID=" + adminUID +
               ", adminPassword=XXXX" +
               ", adminEmail=" + adminEmail +
               ", adminCertRequest=" + adminCertRequest +
               ", adminCertRequestType=" + adminCertRequestType +
               ", adminSubjectDN=" + adminSubjectDN +
               ", adminName=" + adminName +
               ", adminProfileID=" + adminProfileID +
               ", adminCert=" + adminCert +
               ", importAdminCert=" + importAdminCert +
               ", generateServerCert=" + generateServerCert +
               ", stepTwo=" + stepTwo + "]";
    }
}