diff options
Diffstat (limited to 'base/console/src/com/netscape/admin/certsrv/config/install')
137 files changed, 22868 insertions, 0 deletions
diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/ComponentCellRenderer.java b/base/console/src/com/netscape/admin/certsrv/config/install/ComponentCellRenderer.java new file mode 100644 index 000000000..f6dcff392 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/ComponentCellRenderer.java @@ -0,0 +1,32 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import javax.swing.text.*; +import javax.swing.table.*; + +class ComponentCellRenderer implements TableCellRenderer { + public Component getTableCellRendererComponent(JTable table, + Object value, boolean isSelected, boolean hasFocus, int row, + int column) { + return (JComponent)value; + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/InstallWizard.java b/base/console/src/com/netscape/admin/certsrv/config/install/InstallWizard.java new file mode 100644 index 000000000..557dc2739 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/InstallWizard.java @@ -0,0 +1,202 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.util.*; +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.wizard.*; + +/** + * Wizard for Installation wizard + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ + +public class InstallWizard extends WizardWidget implements Runnable { + + public InstallWizard(JFrame parent, InstallWizardInfo info, + IWizardDone wizDone) { + super(parent, wizDone); + setWizardInfo(info); + //addPage(new WIInstallCACertStatusPage()); + addPage(new WIIntroPage(this, parent)); + addPage(new WIMasterOrClone(this, parent)); + addPage(new WIClonePage(this, parent)); + addPage(new WILogonAllTokensPage(this, parent)); + addPage(new WIInternalTokenLogonPage(this, parent)); + addPage(new WIRecreateDBPage(this, parent)); + addPage(new WIInternalDBPage(this, parent)); + addPage(new WIExistingDBPage(this, parent)); + addPage(new WICreateInternalDBPage(this, parent)); + addPage(new WIInternalDBInfoPage(this, parent)); + addPage(new WIReplAgreementPage(this, parent)); + addPage(new WIAdminPage(this, parent)); + addPage(new WIServicesPage(this, parent)); + addPage(new WIInternalDBInfoPage(this, parent)); +/* + addPage(new WIRemoteCASubsystem(this, parent)); + addPage(new WIRemoteKRASubsystem(this, parent)); +*/ + + // CA starting serial number + addPage(new WICASerialNumberPage(this,parent)); + addPage(new WICAOCSPServicePage(this,parent)); +/* + addPage(new WINetworkPage(this, parent)); +*/ + + // CA signing certificate + addPage(new WIInternalDBInfoPage(this, parent)); + addPage(new WICloneCAKeyCertPage(this, parent)); + + addPage(new WICACertSubmitPage(this, parent)); + addPage(new WICAKeyPage(this, parent)); + addPage(new WICAMessageDigestPage(this, parent)); + addPage(new WICACertDNPage(this, parent)); + addPage(new WICACertValidityPage(this, parent)); + addPage(new WICACertExtensionPage(this, parent)); + addPage(new WIGenCAKeyCertPage(this, parent)); + addPage(new WIGenCAKeyCertReqPage(this, parent)); + addPage(new WIManualCACertRequestPage(this, parent)); + addPage(new WICARequestResultPage(this,parent)); + addPage(new WIInstallCAIntroPage(this, parent)); + addPage(new WICATokenLogonPage(this, parent)); + addPage(new WIPasteCACertPage(this, parent)); + addPage(new WIDisplayCACertPage(this, parent)); + addPage(new WIInstallCACertStatusPage(this, parent)); + + // OCSP signing certificate + addPage(new WIInternalDBInfoPage(this, parent)); + addPage(new WICloneOCSPKeyCertPage(this, parent)); + addPage(new WIOCSPCertSubmitPage(this, parent)); + addPage(new WIOCSPKeyPage(this, parent)); + addPage(new WIOCSPMessageDigestPage(this, parent)); + addPage(new WIOCSPCertDNPage(this, parent)); + addPage(new WIGenOCSPKeyCertReqPage(this, parent)); + addPage(new WIManualOCSPCertRequestPage(this, parent)); + addPage(new WIOCSPRequestResultPage(this,parent)); + addPage(new WIInstallOCSPIntroPage(this, parent)); + addPage(new WIOCSPTokenLogonPage(this, parent)); + addPage(new WIPasteOCSPCertPage(this, parent)); + addPage(new WIDisplayOCSPCertPage(this, parent)); + addPage(new WIInstallOCSPCertStatusPage(this, parent)); + + // RA signing certificate + addPage(new WIInternalDBInfoPage(this, parent)); + addPage(new WICloneRAKeyCertPage(this, parent)); + addPage(new WIRACertSubmitPage(this, parent)); + addPage(new WIRAKeyPage(this, parent)); + addPage(new WIRAMessageDigestPage(this, parent)); + addPage(new WIRACertDNPage(this, parent)); + addPage(new WIRACertValidityPage(this, parent)); + addPage(new WIRACertExtensionPage(this, parent)); + addPage(new WIGenRAKeyCertPage(this, parent)); + addPage(new WIGenRAKeyCertReqPage(this, parent)); + addPage(new WIManualRACertRequestPage(this, parent)); + addPage(new WIRARequestResultPage(this,parent)); + addPage(new WIInstallRAIntroPage(this, parent)); + addPage(new WIRATokenLogonPage(this, parent)); + addPage(new WIPasteRACertPage(this, parent)); + addPage(new WIDisplayRACertPage(this, parent)); + addPage(new WIInstallRACertStatusPage(this, parent)); + + // KRA transport certificate + addPage(new WIInternalDBInfoPage(this, parent)); + addPage(new WIKRANumberPage(this, parent)); + addPage(new WICloneKRAKeyCertPage(this, parent)); + addPage(new WIKRACertSubmitPage(this, parent)); + addPage(new WIKRAKeyPage(this, parent)); + addPage(new WIKRAMessageDigestPage(this, parent)); + addPage(new WIKRACertDNPage(this, parent)); + addPage(new WIKRACertValidityPage(this, parent)); + addPage(new WIKRACertExtensionPage(this, parent)); + addPage(new WIGenKRAKeyCertPage(this, parent)); + addPage(new WIGenKRAKeyCertReqPage(this, parent)); + addPage(new WIManualKRACertRequestPage(this, parent)); + addPage(new WIKRARequestResultPage(this,parent)); + addPage(new WIInstallKRAIntroPage(this, parent)); + addPage(new WIKRATokenLogonPage(this, parent)); + addPage(new WIInternalTokenLogonPage(this, parent)); + addPage(new WIPasteKRACertPage(this, parent)); + addPage(new WIDisplayKRACertPage(this, parent)); + addPage(new WIInstallKRACertStatusPage(this, parent)); + addPage(new WIKRAStorageKeyPage(this, parent)); + + addPage(new WIKRAScheme1Page(this, parent)); + addPage(new WIKRAScheme2Page(this, parent)); + + // SSL server certificate + addPage(new WIInternalDBInfoPage(this, parent)); + addPage(new WICloneTKSKeyCertPage(this, parent)); + addPage(new WIKRACertSubmitPage(this, parent)); + addPage(new WIServerCertSubmitPage(this, parent)); + addPage(new WIServerKeyPage(this, parent)); + addPage(new WISSLMessageDigestPage(this, parent)); + addPage(new WIServerCertDNPage(this, parent)); + addPage(new WIServerCertValidityPage(this, parent)); + addPage(new WIServerCertExtensionPage(this, parent)); + addPage(new WIGenServerKeyCertPage(this, parent)); + addPage(new WIGenSSLKeyCertReqPage(this, parent)); + addPage(new WIManualSSLCertRequestPage(this, parent)); + addPage(new WISSLRequestResultPage(this,parent)); + addPage(new WIInstallSSLIntroPage(this, parent)); + addPage(new WISSLTokenLogonPage(this, parent)); + addPage(new WIPasteSSLCertPage(this, parent)); + addPage(new WIDisplaySSLCertPage(this, parent)); + addPage(new WIInstallSSLCertStatusPage(this, parent)); + + addPage(new WIAllCertsInstalledPage(this, parent)); + addPage(new WISingleSignonPage(this, parent)); + addPage(new WICertSetupStatusPage(this, parent)); + + show(); + } + + protected void callHelp() { + if (mCurrent instanceof IWizardPanel) { + ((IWizardPanel)mCurrent).callHelp(); + } + } + + protected void back_cb(WizardInfo info) { + if (mCurrent instanceof WIManualCertRequestPage) { + ((WIManualCertRequestPage)mCurrent).back_cb(info); + } + } + + public void run() { + show(); + } + + public static void main(String[] args) { + JFrame.setDefaultLookAndFeelDecorated(true); + JFrame frame = new JFrame(); + Cursor cursor = new Cursor(Cursor.HAND_CURSOR); + frame.setCursor(cursor); + frame.invalidate(); + frame.validate(); + frame.repaint(1); + InstallWizardInfo wizardInfo = new InstallWizardInfo(); + InstallWizard wizard = new InstallWizard(frame, wizardInfo, null); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/InstallWizardInfo.java b/base/console/src/com/netscape/admin/certsrv/config/install/InstallWizardInfo.java new file mode 100644 index 000000000..a88101cc4 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/InstallWizardInfo.java @@ -0,0 +1,1724 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.management.client.console.*; + +/** + * WizardInfo for certificate setup wizard + * Once complete, we need to zap this object. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +public class InstallWizardInfo extends WizardInfo { + private static final int DB_PORT = 38900; + private static final String BINDDN = "cn=Directory Manager"; + public static final String ALL_CERT_INFO = "allInfo"; + private static final String CA_KEY_TYPE = "caKeyType"; + private static final String CA_KEY_LEN = "caKeyLen"; + private static final String OCSP_TOKEN_NAME = "ocspTokenName"; + private static final String OCSP_TOKEN_PASSWD = "ocspTokenPwd"; + private static final String CA_TOKEN_NAME = "caTokenName"; + private static final String CA_TOKEN_PASSWD = "caTokenPwd"; + private static final String RA_TOKEN_NAME = "raTokenName"; + private static final String RA_TOKEN_PASSWD = "raTokenPwd"; + private static final String KRA_TOKEN_NAME = "kraTokenName"; + private static final String KRA_TOKEN_PASSWD = "kraTokenPwd"; + private static final String SSL_TOKEN_NAME = "sslTokenName"; + private static final String SSL_TOKEN_PASSWD = "sslTokenPwd"; + private static final String MIGRATE_CA_TOKEN_NAME = "migrateCATokenName"; + private static final String MIGRATE_SSL_TOKEN_NAME = "migrateSSLTokenName"; + private static final String INSTALLCERT_NOW = "installCertNow"; + private static final String CLONING = "cloning"; + private static final String CACLONING = "cacloning"; + private static final String RACLONING = "racloning"; + private static final String KRACLONING = "kracloning"; + private static final String SSLCLONING = "sslcloning"; + + private static final String CA_CLONING_CERT = "caSigningCert"; + private static final String RA_CLONING_CERT = "raSigningCert"; + private static final String KRA_CLONING_CERT = "kraTransportCert"; + private static final String OCSP_CLONING_CERT = "ocspSigningCert"; + + private String mPassword = null; + + private ConsoleInfo mConsoleInfo; + + public InstallWizardInfo() { + super(); + } + + public InstallWizardInfo(ConsoleInfo consoleInfo) { + super(); + mConsoleInfo = consoleInfo; + } + + public JFrame getAdminFrame() { + return (JFrame)get("adminFrame"); + } + + public boolean doKeySplitting() { + String str = (String)get("kra.keySplitting"); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + else + return false; + + } + + public void setAdminFrame(JFrame frame) { + put("adminFrame", frame); + } + + public ConsoleInfo getAdminConsoleInfo() { + return mConsoleInfo; + } + + public String getStages() { + return (String)get(ConfigConstants.STAGES); + } + + public String getCloneCertsList() { + String s = (String)get(ConfigConstants.PR_CLONE_CERTIFICATES); + if (s == null || s.equals("")) + return " "; + return s; + } + + public String getCloneSubsystem() { + + String s = (String)get("selected_sub"); + + if(s == null || s.equals("")) + return null; + + return s; + + } + + public boolean isCACloningDone() { + String str = (String)get(ConfigConstants.STAGE_CACLONING); + + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + else + return false; + } + + public void setCACloningDone(String str) { + put(ConfigConstants.STAGE_CACLONING, str); + } + + public boolean isOCSPCloningDone() { + String str = (String)get(ConfigConstants.STAGE_OCSPCLONING); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + + return false; + } + + public void setOCSPCloningDone(String str) { + put(ConfigConstants.STAGE_OCSPCLONING, str); + } + + public boolean isRACloningDone() { + String str = (String)get(ConfigConstants.STAGE_RACLONING); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + + return false; + } + + public void setRACloningDone(String str) { + put(ConfigConstants.STAGE_RACLONING, str); + } + + public boolean isKRACloningDone() { + String str = (String)get(ConfigConstants.STAGE_KRACLONING); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + + return false; + } + + public boolean isTKSCloningDone() { + String str = (String)get(ConfigConstants.STAGE_TKSCLONING); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + + return false; + } + + public void setUpdateDBInfoDone(String str) { + put(ConfigConstants.STAGE_UPDATE_DB_INFO, str); + } + + public boolean isUpdateDBInfoDone() { + String str = (String)get(ConfigConstants.STAGE_UPDATE_DB_INFO); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public void setKRACloningDone(String str) { + put(ConfigConstants.STAGE_KRACLONING, str); + } + + public boolean isSSLCloningDone() { + String str = (String)get(ConfigConstants.STAGE_SSLCLONING); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public void setSSLCloningDone(String str) { + put(ConfigConstants.STAGE_SSLCLONING, str); + } + + public boolean isCloneCASubsystem() { + String str = (String)get(ConfigConstants.PR_CLONE_SUBSYSTEM); + if (str != null && str.equals(ConfigConstants.PR_CA)) + return true; + return false; + } + + public boolean isCloneRASubsystem() { + String str = (String)get(ConfigConstants.PR_CLONE_SUBSYSTEM); + if (str != null && str.equals(ConfigConstants.PR_RA)) + return true; + return false; + } + public boolean isCloneKRASubsystem() { + String str = (String)get(ConfigConstants.PR_CLONE_SUBSYSTEM); + if (str != null && str.equals(ConfigConstants.PR_KRA)) + return true; + return false; + } + public boolean isCloneOCSPSubsystem() { + String str = (String)get(ConfigConstants.PR_CLONE_SUBSYSTEM); + if (str != null && str.equals(ConfigConstants.PR_OCSP)) + return true; + return false; + } + public boolean isCloneTKSSubsystem() { + String str = (String)get(ConfigConstants.PR_CLONE_SUBSYSTEM); + if (str != null && str.equals(ConfigConstants.PR_TKS)) + return true; + return false; + } + public boolean isCloneMasterDone() { + String str = (String)get(ConfigConstants.STAGE_CLONEMASTER); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public void setCloneMasterDone(String str) { + put(ConfigConstants.STAGE_CLONEMASTER, str); + } + + public boolean isNetworkDone() { + String str = (String)get(ConfigConstants.STAGE_SETUP_PORTS); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isAdministratorDone() { + String str = (String)get(ConfigConstants.STAGE_SETUP_ADMINISTRATOR); + if (str == null || str.equals("") || str.equals(ConfigConstants.FALSE)) + return false; + + return true; + } + + public boolean isServicesDone() { + String str = (String)get(ConfigConstants.STAGE_SETUP_SUBSYSTEMS); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isMigrationDone() { + String str = (String)get(ConfigConstants.STAGE_DATA_MIGRATION); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isKRANMSchemeDone() { + String str = (String)get(ConfigConstants.STAGE_KRA_NM_SCHEME); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isCACertRequestBack() { + String str = (String)get(ConfigConstants.CA_CERT_REQUEST_BACK); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isRACertRequestBack() { + String str = (String)get(ConfigConstants.RA_CERT_REQUEST_BACK); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isOCSPCertRequestBack() { + String str = (String)get(ConfigConstants.OCSP_CERT_REQUEST_BACK); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isKRACertRequestBack() { + String str = (String)get(ConfigConstants.KRA_CERT_REQUEST_BACK); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isSSLCertRequestBack() { + String str = (String)get(ConfigConstants.SSL_CERT_REQUEST_BACK); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isSelfSignedCACertDone() { + String str = (String)get(ConfigConstants.STAGE_CA_SELFSIGNED_CERT); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isCACertRequestDone() { + String str = (String)get(ConfigConstants.STAGE_CA_CERT_REQUEST); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isCACertInstalledDone() { + String str = (String)get(ConfigConstants.STAGE_CA_CERT_INSTALL); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isCACertChainImportDone() { + String str = (String)get(ConfigConstants.STAGE_CA_CERTCHAIN_IMPORT); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + public boolean isNumberPageDone(){ + String str = (String)get(ConfigConstants.PR_SERIAL_REQUEST_NUMBER); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + public void setNumberPageDone(String str) { + put(ConfigConstants.PR_SERIAL_REQUEST_NUMBER, str); + } + public boolean isClonePageDone(){ + String str = (String)get(ConfigConstants.PR_CLONE_SETTING_DONE); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + public void setClonePageDone(String str) { + put(ConfigConstants.PR_CLONE_SETTING_DONE, str); + } + public boolean isOCSPCertChainImportDone() { + String str = (String)get(ConfigConstants.STAGE_OCSP_CERTCHAIN_IMPORT); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isRALocalCertDone() { + String str = (String)get(ConfigConstants.STAGE_RA_LOCAL_CERT); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isRACertRequestDone() { + String str = (String)get(ConfigConstants.STAGE_RA_CERT_REQUEST); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isOCSPLocalCertDone() { + String str = (String)get(ConfigConstants.STAGE_OCSP_LOCAL_CERT); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isOCSPCertRequestDone() { + String str = (String)get(ConfigConstants.STAGE_OCSP_CERT_REQUEST); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isOCSPCertInstalledDone() { + String str = (String)get(ConfigConstants.STAGE_OCSP_CERT_INSTALL); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isRACertInstalledDone() { + String str = (String)get(ConfigConstants.STAGE_RA_CERT_INSTALL); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isRACertChainImportDone() { + String str = (String)get(ConfigConstants.STAGE_RA_CERTCHAIN_IMPORT); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isKRALocalCertDone() { + String str = (String)get(ConfigConstants.STAGE_KRA_LOCAL_CERT); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isKRACertRequestDone() { + String str = (String)get(ConfigConstants.STAGE_KRA_CERT_REQUEST); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isKRACertInstalledDone() { + String str = (String)get(ConfigConstants.STAGE_KRA_CERT_INSTALL); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isKRACertChainImportDone() { + String str = (String)get(ConfigConstants.STAGE_KRA_CERTCHAIN_IMPORT); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + public boolean isSSLLocalCertDone() { + String str = (String)get(ConfigConstants.STAGE_SSL_LOCAL_CERT); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isSSLCertRequestDone() { + String str = (String)get(ConfigConstants.STAGE_SSL_CERT_REQUEST); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isSSLCertInstalledDone() { + String str = (String)get(ConfigConstants.STAGE_SSL_CERT_INSTALL); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isSSLCertChainImportDone() { + String str = (String)get(ConfigConstants.STAGE_SSL_CERTCHAIN_IMPORT); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + public String getNextAvailPort() { + return (String)get(ConfigConstants.PR_NEXT_AVAIL_PORT); + } + + public void setSubsystems(String str) { + put(ConfigConstants.PR_SUBSYSTEMS, str); + } + + public String getSubsystems() { + return (String)get(ConfigConstants.PR_SUBSYSTEMS); + } + + public void setReplicationEnabled(String str) { + put(ConfigConstants.PR_ENABLE_REPLICATION, str); + } + + public boolean isReplicationEnabled() { + String str = (String)get(ConfigConstants.PR_ENABLE_REPLICATION); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public void setAgreementDone(String str) { + put(ConfigConstants.STAGE_REPLICATION_AGREEMENT, str); + } + + public boolean isAgreementDone() { + String str = (String)get(ConfigConstants.STAGE_REPLICATION_AGREEMENT); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + else + return false; + } + + public void setDBCreated(String str) { + put(ConfigConstants.PR_IS_DBCREATED, str); + } + + public void setCloneDBCreated(String str) { + put(ConfigConstants.PR_IS_CLONEDDB_CREATED, str); + } + + public boolean isDBCreated() { + String str = (String)get(ConfigConstants.PR_IS_DBCREATED); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isCloneDBCreated() { + String str = (String)get(ConfigConstants.PR_IS_CLONEDDB_CREATED); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public void setDBCreateNow(String str) { + put("dbCreateNow", str); + } + + public boolean isDBCreateNow() { + String str = (String)get("dbCreateNow"); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public String getSingleSignOnPassword() { + return mPassword; + } + + public void setSingleSignOnPassword(String password) { + mPassword = password; + } + + public void setCertAdminUid(String uid) { + put(ConfigConstants.PR_CERT_ADMINUID, uid); + } + + public String getCertAdminUid() { + return (String)get(ConfigConstants.PR_CERT_ADMINUID); + } + + public void setCertAdminName(String name) { + put(ConfigConstants.PR_CERT_ADMINNAME, name); + } + + public String getCertAdminName() { + return (String)get(ConfigConstants.PR_CERT_ADMINNAME); + } + + public void setDBPort(String val) { + put(ConfigConstants.PR_DB_PORT, val); + } + + public int getDBPort() { + String val = (String)get(ConfigConstants.PR_DB_PORT); + if (val != null) + return Integer.parseInt(val); + return 38900; + } + + public void setDBName(String name) { + put(ConfigConstants.PR_DB_NAME, name); + } + + public String getDBName() { + String dbName = (String)get(ConfigConstants.PR_DB_NAME); + if (dbName == null) + dbName = ""; + return dbName; + } + + public void setCloneDBName(String name) { + put(ConfigConstants.PR_CLONEDDB_NAME, name); + } + + public String getCloneDBName() { + String dbName = (String)get(ConfigConstants.PR_CLONEDDB_NAME); + if (dbName == null) + dbName = ""; + return dbName; + } + + public void setDBBindDN(String val) { + put(ConfigConstants.PR_DB_BINDDN, val); + } + + public String getDBBindDN() { + String dn = (String)get(ConfigConstants.PR_DB_BINDDN); + if (dn == null) + dn = BINDDN; + return dn; + } + + public String getAdminPort() { + String val = (String)get(ConfigConstants.PR_RADM_PORT); + if (val == null) + val = "8200"; + return val; + } + + public void setAdminPort(String val) { + put(ConfigConstants.PR_RADM_PORT, val); + } + + public String getEEPort() { + String val = (String)get(ConfigConstants.PR_EE_PORT); + if (val == null || val.equals("")) + val = "81"; + return val; + } + + public void setEEPort(String port) { + put(ConfigConstants.PR_EE_PORT, port); + } + + public String getEESecurePort() { + String val = (String)get(ConfigConstants.PR_EE_SECURE_PORT); + if (val == null) + val = "8001"; + return val; + } + + public void setEESecurePort(String port) { + put(ConfigConstants.PR_EE_SECURE_PORT, port); + } + + public String getAgentPort() { + String val = (String)get(ConfigConstants.PR_AGENT_PORT); + if (val == null) + val = "8100"; + return val; + } + + public void setAgentPort(String val) { + put(ConfigConstants.PR_AGENT_PORT, val); + } + + public boolean isEEEnabled() { + String val = (String)get(ConfigConstants.PR_EE_PORT_ENABLE); + if (val != null && val.equals(Constants.TRUE)) + return true; + return false; + } + + public void setEEEnable(String enable) { + put(ConfigConstants.PR_EE_PORT_ENABLE, enable); + } + + public String getCertType() { + return (String)get(Constants.PR_CERTIFICATE_TYPE); + } + + public void setCertType(String str) { + put(Constants.PR_CERTIFICATE_TYPE, str); + } + + public String getReqFormat(String certType) { + return (String)get(certType+ConfigConstants.PR_REQUEST_FORMAT); + } + + public void setReqFormat(String certType, String str) { + put(certType+ConfigConstants.PR_REQUEST_FORMAT , str); + } + + public boolean isNewRequest() { + String val = (String)get(getCertType()+"new"); + if (val != null && val.equals(Constants.TRUE)) + return true; + return false; + } + + public void setNewRequest() { + put(getCertType()+"new", Constants.TRUE); + } + + public boolean isCAReqResultDisplayed() { + String val = (String)get(ConfigConstants.CA_REQUEST_DISPLAYED); + if (val != null && val.equals(Constants.TRUE)) + return true; + return false; + } + + public void setCAReqResultDisplayed(String val) { + put(ConfigConstants.CA_REQUEST_DISPLAYED, val); + } + + public boolean isRAReqResultDisplayed() { + String val = (String)get(ConfigConstants.RA_REQUEST_DISPLAYED); + if (val != null && val.equals(Constants.TRUE)) + return true; + return false; + } + + public void setRAReqResultDisplayed(String val) { + put(ConfigConstants.RA_REQUEST_DISPLAYED, val); + } + + public boolean isOCSPReqResultDisplayed() { + String val = (String)get(ConfigConstants.OCSP_REQUEST_DISPLAYED); + if (val != null && val.equals(Constants.TRUE)) + return true; + return false; + } + + public void setOCSPReqResultDisplayed(String val) { + put(ConfigConstants.OCSP_REQUEST_DISPLAYED, val); + } + + public boolean isKRAReqResultDisplayed() { + String val = (String)get(ConfigConstants.KRA_REQUEST_DISPLAYED); + if (val != null && val.equals(Constants.TRUE)) + return true; + return false; + } + + public void setKRAReqResultDisplayed(String val) { + put(ConfigConstants.KRA_REQUEST_DISPLAYED, val); + } + + public boolean isSSLReqResultDisplayed() { + String val = (String)get(ConfigConstants.SSL_REQUEST_DISPLAYED); + if (val != null && val.equals(Constants.TRUE)) + return true; + return false; + } + + public void setSSLReqResultDisplayed(String val) { + put(ConfigConstants.SSL_REQUEST_DISPLAYED, val); + } + + public String getCertRequest() { + return (String)get(Constants.PR_CERT_REQUEST); + } + + public void setCertRequest(String certReq) { + put(Constants.PR_CERT_REQUEST, certReq); + } + + public String getCAKeyLength() { + return (String)get(CA_KEY_LEN); + } + + public String getCATokenName() { + return (String)get(CA_TOKEN_NAME); + } + + public void setCATokenName(String tokenname) { + put(CA_TOKEN_NAME, tokenname); + } + + public String getOCSPTokenName() { + return (String)get(OCSP_TOKEN_NAME); + } + + public void setOCSPTokenName(String tokenname) { + put(OCSP_TOKEN_NAME, tokenname); + } + + public String getRATokenName() { + return (String)get(RA_TOKEN_NAME); + } + + public void setRATokenName(String tokenname) { + put(RA_TOKEN_NAME, tokenname); + } + + public String getKRATokenName() { + return (String)get(KRA_TOKEN_NAME); + } + + public void setKRATokenName(String tokenname) { + put(KRA_TOKEN_NAME, tokenname); + } + + public String getSSLTokenName() { + return (String)get(SSL_TOKEN_NAME); + } + + public void setSSLTokenName(String tokenname) { + put(SSL_TOKEN_NAME, tokenname); + } + + public String getMigrateCACertTokenName() { + return (String)get(MIGRATE_CA_TOKEN_NAME); + } + + public void setMigrateCACertTokenName(String tokenname) { + put(MIGRATE_CA_TOKEN_NAME, tokenname); + } + + public String getMigrateSSLCertTokenName() { + return (String)get(MIGRATE_SSL_TOKEN_NAME); + } + + public void setMigrateSSLCertTokenName(String tokenname) { + put(MIGRATE_SSL_TOKEN_NAME, tokenname); + } + + public String getTokenName() { + return (String)get(ConfigConstants.PR_TOKEN_NAME); + } + + public String getTokensList() { + return (String)get(ConfigConstants.PR_TOKEN_NAMES); + } + + public String getTokensInit() { + return (String)get(ConfigConstants.PR_TOKEN_INITIALIZED); + } + + public String getTokensLogin() { + return (String)get(ConfigConstants.PR_TOKEN_LOGGED_IN); + } + + public void setKeyLength(String val) { + put(ConfigConstants.PR_KEY_LEN, val); + } + + public String getKeyLength() { + String val = (String)get(ConfigConstants.PR_KEY_LEN); + if (val == null) + val = "512"; + return val; + } + + public String getKeyCurveName() { + String val = (String)get(ConfigConstants.PR_KEY_CURVENAME); + if (val ==null) + val = "nistp521"; + return val; + } + + public void setKeyCurveName(String val) { + put(ConfigConstants.PR_KEY_CURVENAME, val); + } + + public String getKeyType() { + String type = (String)get(ConfigConstants.PR_KEY_TYPE); + // work around the historical mistake, + // not touching files around the places. + if ( type == null || type.equals("")) { + String certType = getCertType(); + if (certType.equals(Constants.PR_CA_SIGNING_CERT)) { + type = (String)get("ca_keyType"); + } else if (certType.equals(Constants.PR_RA_SIGNING_CERT)) { + type = (String)get("ra_keyType"); + } else if (certType.equals(Constants.PR_OCSP_SIGNING_CERT)) { + type = (String)get("ocsp_keyType"); + } else if (certType.equals(Constants.PR_KRA_TRANSPORT_CERT)) { + type = (String)get("kra_keyType"); + } else if (certType.equals(Constants.PR_SERVER_CERT)) { + type = (String)get("ssl_keyType"); + } + } + return type; + } + + public String getSubjectName() { + return (String)get(ConfigConstants.PR_SUBJECT_NAME); + } + + public void setSubjectName(String str) { + put(ConfigConstants.PR_SUBJECT_NAME, str); + } + + public String getCASubjectName() { + return (String)get(ConfigConstants.PR_CA_SUBJECT_NAME); + } + + public void setCASubjectName(String str) { + put(ConfigConstants.PR_CA_SUBJECT_NAME, str); + } + + public String getRASubjectName() { + return (String)get(ConfigConstants.PR_RA_SUBJECT_NAME); + } + + public void setRASubjectName(String str) { + put(ConfigConstants.PR_RA_SUBJECT_NAME, str); + } + + public String getOCSPSubjectName() { + return (String)get(ConfigConstants.PR_OCSP_SUBJECT_NAME); + } + + public void setOCSPSubjectName(String str) { + put(ConfigConstants.PR_OCSP_SUBJECT_NAME, str); + } + + public String getKRASubjectName() { + return (String)get(ConfigConstants.PR_KRA_SUBJECT_NAME); + } + + public void setKRASubjectName(String str) { + put(ConfigConstants.PR_KRA_SUBJECT_NAME, str); + } + + public String getSSLSubjectName() { + return (String)get(ConfigConstants.PR_SSL_SUBJECT_NAME); + } + + public void setSSLSubjectName(String str) { + put(ConfigConstants.PR_SSL_SUBJECT_NAME, str); + } + + public NameValuePairs getAllCertInfo() { + return (NameValuePairs)get(ALL_CERT_INFO); + } + + public String getBeginYear() { + return (String)get(Constants.PR_BEGIN_YEAR); + } + + public String getBeginMonth() { + return (String)get(Constants.PR_BEGIN_MONTH); + } + + public String getBeginDate() { + return (String)get(Constants.PR_BEGIN_DATE); + } + + public String getBeginHour() { + return (String)get(Constants.PR_BEGIN_HOUR); + } + + public String getBeginMin() { + return (String)get(Constants.PR_BEGIN_MIN); + } + + public String getBeginSec() { + return (String)get(Constants.PR_BEGIN_SEC); + } + + public String getAfterYear() { + return (String)get(Constants.PR_AFTER_YEAR); + } + + public String getAfterMonth() { + return (String)get(Constants.PR_AFTER_MONTH); + } + + public String getAfterDate() { + return (String)get(Constants.PR_AFTER_DATE); + } + + public String getAfterHour() { + return (String)get(Constants.PR_AFTER_HOUR); + } + + public String getAfterMin() { + return (String)get(Constants.PR_AFTER_MIN); + } + + public String getAfterSec() { + return (String)get(Constants.PR_AFTER_SEC); + } + + public boolean isSingleSignon() { + String val = (String)get(ConfigConstants.PR_SINGLE_SIGNON); + if (val != null && val.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isCACertLocalCA() { + String val = (String)get(ConfigConstants.PR_CACERT_LOCALCA); + if (val == null) { + return true; + } + else if (val.equals(Constants.TRUE)) { + return true; + } + return false; + } + + // set true or false + public void setCACertLocalCA(String val) { + put(ConfigConstants.PR_CACERT_LOCALCA, val); + } + + public boolean isRACertLocalCA() { + String val = (String)get(ConfigConstants.PR_RACERT_LOCALCA); + if (val == null) + return true; + else if (val.equals(Constants.TRUE)) + return true; + return false; + } + + // set true or false + public void setRACertLocalCA(String val) { + put(ConfigConstants.PR_RACERT_LOCALCA, val); + } + + public boolean isOCSPCertLocalCA() { + String val = (String)get(ConfigConstants.PR_OCSPCERT_LOCALCA); + if (val == null) + return true; + else if (val.equals(Constants.TRUE)) + return true; + return false; + } + + // set true or false + public void setOCSPCertLocalCA(String val) { + put(ConfigConstants.PR_OCSPCERT_LOCALCA, val); + } + + public boolean isKRACertLocalCA() { + String val = (String)get(ConfigConstants.PR_KRACERT_LOCALCA); + if (val == null) + return true; + else if (val.equals(Constants.TRUE)) + return true; + return false; + } + + // set true or false + public void setKRACertLocalCA(String val) { + put(ConfigConstants.PR_KRACERT_LOCALCA, val); + } + + public boolean isSSLCertLocalCA() { + String val = (String)get(ConfigConstants.PR_SSLCERT_LOCALCA); + if (val == null || val.equals("")) + return true; + else if (val.equals(Constants.TRUE)) + return true; + return false; + } + + // set true or false + public void setSSLCertLocalCA(String val) { + put(ConfigConstants.PR_SSLCERT_LOCALCA, val); + } + + public void setInstallCertNow(String val) { + put(INSTALLCERT_NOW, val); + } + + public boolean isInstallCertNow() { + String val = (String)get(INSTALLCERT_NOW); + if (val == null) + return false; + else if (val.equals(Constants.TRUE)) + return true; + return false; + } + + public String getCertContent() { + return (String)get(Constants.PR_CERT_CONTENT); + } + + public String getNickname() { + return (String)get(Constants.PR_NICKNAME); + } + + public String getCertOrder() { + return (String)get(ConfigConstants.PR_CERT_CONTENT_ORDER); + } + + public String getPKCS10() { + String val = (String)get(Constants.PR_PKCS10); + if (val != null && !val.equals("")) + return val; + return null; + } + + public void setPKCS10(String b64E) { + put(Constants.PR_PKCS10, b64E); + } + + public String getCertFilePath() { + String val = (String)get(Constants.PR_CERT_FILEPATH); + if (val != null && !val.equals("")) + return val; + return null; + } + + public void setCertFilePath(String path) { + put(Constants.PR_CERT_FILEPATH, path); + } + + public String getMachineName() { + return (String)get(ConfigConstants.PR_MACHINE_NAME); + } + + public void setEnableMigration(String val) { + put(ConfigConstants.PR_ENABLE_MIGRATION, val); + } + + public boolean isMigrationEnable() { + String val = (String)get(ConfigConstants.PR_ENABLE_MIGRATION); + if (val != null && val.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public void setMigrationOutputPath(String path) { + put(ConfigConstants.PR_OUTPUT_PATH, path); + } + + public String getMigrationOutputPath() { + return (String)get(ConfigConstants.PR_OUTPUT_PATH); + } + + public void setInternalDBPasswd(String passwd) { + put(ConfigConstants.PR_DB_PWD, passwd); + } + + public String getInternalDBPasswd() { + return (String)get(ConfigConstants.PR_DB_PWD); + } + + public void setMigrationPasswd(String val) { + put(ConfigConstants.PR_MIGRATION_PASSWORD, val); + } + + public String getMigrationPasswd() { + return (String)get(ConfigConstants.PR_MIGRATION_PASSWORD); + } + + public void setSigningKeyMigrationToken(String tokenname) { + put(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN, tokenname); + } + + public String getSigningKeyMigrationToken() { + return (String)get(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN); + } + + public void setSSLKeyMigrationToken(String tokenname) { + put(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN, tokenname); + } + + public String getSSLKeyMigrationToken() { + return (String)get(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN); + } + + public void setSigningKeyMigrationPasswd(String val) { + put(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN_PASSWD, val); + } + + public String getSigningKeyMigrationPasswd() { + return (String)get(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN_PASSWD); + } + + public void setSigningKeyMigrationSOPPasswd(String val) { + put(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN_SOPPASSWD, val); + } + + public String getSigningKeyMigrationSOPPasswd() { + return (String)get(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN_SOPPASSWD); + } + + public void setSSLKeyMigrationPasswd(String val) { + put(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN_PASSWD, val); + } + + public String getSSLKeyMigrationPasswd() { + return (String)get(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN_PASSWD); + } + + public void setSSLKeyMigrationSOPPasswd(String val) { + put(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN_SOPPASSWD, val); + } + + public String getSSLKeyMigrationSOPPasswd() { + return (String)get(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN_SOPPASSWD); + } + + public void setInstalledOCSP(String val) { + put(ConfigConstants.PR_OCSP, val); + } + + public void setInstalledCA(String val) { + put(ConfigConstants.PR_CA, val); + } + + public boolean isOCSPInstalled() { + String str = (String)get(ConfigConstants.PR_OCSP); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public boolean isCAInstalled() { + String str = (String)get(ConfigConstants.PR_CA); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public void setInstalledRA(String val) { + put(ConfigConstants.PR_RA, val); + } + + public boolean isRAInstalled() { + String str = (String)get(ConfigConstants.PR_RA); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public void setInstalledKRA(String val) { + put(ConfigConstants.PR_KRA, val); + } + + public void setInstalledTKS(String val) { + put(ConfigConstants.PR_TKS, val); + } + + public boolean isKRAInstalled() { + String str = (String)get(ConfigConstants.PR_KRA); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + public boolean isTKSInstalled() { + String str = (String)get(ConfigConstants.PR_TKS); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + public boolean isOCSPServiceAdded() { + String str = (String)get(ConfigConstants.PR_CA_OCSP_SERVICE); + if (str == null || str.equals(ConfigConstants.FALSE)) + return false; + return true; + } + + public void setOCSPService(String val) { + put(ConfigConstants.PR_CA_OCSP_SERVICE, val); + } + + public void setCMHost(String host) { + put(ConfigConstants.CA_HOST, host); + } + + public String getCMHost() { + return (String)get(ConfigConstants.CA_HOST); + } + + public void setCMPort(String port) { + put(ConfigConstants.CA_PORT, port); + } + + public String getCMPort() { + return (String)get(ConfigConstants.CA_PORT); + } + + public void setCMTimeout(String timeout) { + put(ConfigConstants.CA_TIMEOUT, timeout); + } + + public String getCMTimeout() { + return (String)get(ConfigConstants.CA_TIMEOUT); + } + + public void setCMEEPort(String port) { + put(ConfigConstants.CA_EEPORT, port); + } + + public String getCMEEPort() { + return (String)get(ConfigConstants.CA_EEPORT); + } + + public void setCMEEType(String type) { + put(ConfigConstants.CA_EETYPE, type); + } + + public String getCMEEType() { + return (String)get(ConfigConstants.CA_EETYPE); + } + + public void setRequestStatus(String requestStatus) { + put(getCertType()+ConfigConstants.PR_CERT_REQUEST+"Status", requestStatus); + } + + public String getRequestStatus() { + return (String)get(getCertType()+ConfigConstants.PR_CERT_REQUEST+"Status"); + } + + public void setRequestID(String requestID) { + put(getCertType()+ConfigConstants.PR_REQUEST_ID, requestID); + } + + public String getRequestID() { + return (String)get(getCertType()+ConfigConstants.PR_REQUEST_ID); + } + + public void setX509RequestStatus(String requestStatus) { + put("x509"+ConfigConstants.PR_CERT_REQUEST+"Status", requestStatus); + } + + public String getX509RequestStatus() { + return (String)get("x509"+ConfigConstants.PR_CERT_REQUEST+"Status"); + } + + public void setX509RequestID(String requestID) { + put("x509"+getCertRequest()+ConfigConstants.PR_CERT_REQUEST, requestID); + } + + public String getX509RequestID() { + return (String)get("x509"+getCertRequest()+ConfigConstants.PR_CERT_REQUEST); + } + + public void setRequestSent(boolean sent) { + if (sent) + put(getCertRequest()+"Sent", ConfigConstants.TRUE); + else + put(getCertRequest()+"Sent", ConfigConstants.FALSE); + } + + public boolean requestSent() { + String str = (String)get(getCertRequest()+"Sent"); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + return false; + } + + public void setRequestError(String error) { + put(getCertRequest()+"Error", error); + } + + public String getRequestError() { + return (String)get(getCertRequest()+"Error"); + } + + public void setImportError(String error) { + put(getCertType()+"Error", error); + } + + public String getImportError() { + return (String)get(getCertType()+"Error"); + } + + public void setX509RequestError(String error) { + put("x509"+getCertRequest()+"Error", error); + } + + public String getX509RequestError() { + return (String)get("x509"+getCertRequest()+"Error"); + } + + public void setDRMHost(String host) { + put(ConfigConstants.KRA_HOST, host); + } + + public String getDRMHost() { + return (String)get(ConfigConstants.KRA_HOST); + } + + public void setDRMPort(String port) { + put(ConfigConstants.KRA_PORT, port); + } + + public String getDRMPort() { + return (String)get(ConfigConstants.KRA_PORT); + } + + public void setDRMTimeout(String timeout) { + put(ConfigConstants.KRA_TIMEOUT, timeout); + } + + public String getDRMTimeout() { + return (String)get(ConfigConstants.KRA_TIMEOUT); + } + + public void enableRemoteDRM(String enable) { + put(ConfigConstants.REMOTE_KRA_ENABLED, enable); + } + + public boolean isRemoteDRM() { + String value = (String)get(ConfigConstants.REMOTE_KRA_ENABLED); + if (value == null || value.equals("") || value.equals(ConfigConstants.FALSE) || + !value.equals(ConfigConstants.TRUE)) + return false; + return true; + } + + public String getSingleSignon() { + return (String)get(ConfigConstants.PR_SINGLE_SIGNON); + } + + public void setRequiredAgents(String val) { + put(ConfigConstants.PR_AGENT_M, val); + } + + public String getRequiredAgents() { + return (String)get(ConfigConstants.PR_AGENT_M); + } + + public void setTotalAgents(String val) { + put(ConfigConstants.PR_AGENT_N, val); + } + + public String getTotalAgents() { + return (String)get(ConfigConstants.PR_AGENT_N); + } + + public String getHashType() { + return (String)get(ConfigConstants.PR_HASH_TYPE); + } + + public void setHashType(String type) { + put(ConfigConstants.PR_HASH_TYPE, type); + } + + public String getSignedByType() { + return (String)get(ConfigConstants.PR_SIGNEDBY_TYPE); + } + + public void setSignedByType(String type) { + put(ConfigConstants.PR_SIGNEDBY_TYPE, type); + } + + public String getCAKeyType() { + return (String)get(ConfigConstants.PR_CA_KEYTYPE); + } + + public boolean hasEntireCAChain() { + String str = (String)get(Constants.PR_CA_SIGNING_CERT+ + "hasEntireChain"); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + else + return false; + } + + public boolean hasEntireSSLChain() { + String str = (String)get(Constants.PR_SERVER_CERT+ + "hasEntireChain"); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + else + return false; + } + + public boolean hasEntireKRAChain() { + String str = (String)get(Constants.PR_KRA_TRANSPORT_CERT+ + "hasEntireChain"); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + else + return false; + } + + public boolean hasEntireOCSPChain() { + String str = (String)get(Constants.PR_OCSP_SIGNING_CERT+ + "hasEntireChain"); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + else + return false; + } + + public boolean hasEntireRAChain() { + String str = (String)get(Constants.PR_RA_SIGNING_CERT+ + "hasEntireChain"); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + else + return false; + } + + public String getOComponent() { + return (String)get(ConfigConstants.PR_O_COMPONENT); + } + + public void setOComponent(String str) { + put(ConfigConstants.PR_O_COMPONENT, str); + } + + public String getOUComponent() { + return (String)get(ConfigConstants.PR_OU_COMPONENT); + } + + public void setOUComponent(String str) { + put(ConfigConstants.PR_OU_COMPONENT, str); + } + + public String getLComponent() { + return (String)get(ConfigConstants.PR_L_COMPONENT); + } + + public void setLComponent(String str) { + put(ConfigConstants.PR_L_COMPONENT, str); + } + + public String getSTComponent() { + return (String)get(ConfigConstants.PR_ST_COMPONENT); + } + + public void setSTComponent(String str) { + put(ConfigConstants.PR_ST_COMPONENT, str); + } + + public String getCComponent() { + return (String)get(ConfigConstants.PR_C_COMPONENT); + } + + public void setCComponent(String str) { + put(ConfigConstants.PR_C_COMPONENT, str); + } + + public String getCAOComp() { + String str = (String)get(ConfigConstants.PR_CA_O_COMPONENT); + return str; + } + + public void setCAOComp(String str) { + put(ConfigConstants.PR_CA_O_COMPONENT, str); + } + + public String getCACComp() { + String str = (String)get(ConfigConstants.PR_CA_C_COMPONENT); + return str; + } + + public void setCACComp(String str) { + put(ConfigConstants.PR_CA_C_COMPONENT, str); + } + + public String getOCSPOComp() { + String str = (String)get(ConfigConstants.PR_OCSP_O_COMPONENT); + return str; + } + + public void setOCSPOComp(String str) { + put(ConfigConstants.PR_OCSP_O_COMPONENT, str); + } + + public String getRAOComp() { + String str = (String)get(ConfigConstants.PR_RA_O_COMPONENT); + return str; + } + + public void setRAOComp(String str) { + put(ConfigConstants.PR_RA_O_COMPONENT, str); + } + + public String getOCSPCComp() { + String str = (String)get(ConfigConstants.PR_OCSP_C_COMPONENT); + return str; + } + + public void setOCSPCComp(String str) { + put(ConfigConstants.PR_OCSP_C_COMPONENT, str); + } + + public String getRACComp() { + String str = (String)get(ConfigConstants.PR_RA_C_COMPONENT); + return str; + } + + public void setRACComp(String str) { + put(ConfigConstants.PR_RA_C_COMPONENT, str); + } + + public String getCertRequestDir() { + return (String)get(Constants.PR_CERT_REQUEST_DIR); + } + + public void setCASerialNumber(String str) { + put(ConfigConstants.PR_CA_SERIAL_NUMBER, str); + } + public void setRequestNumber(String str) { + put(ConfigConstants.PR_REQUEST_NUMBER, str); + } + + public String getCASerialNumber() { + return (String)get(ConfigConstants.PR_CA_SERIAL_NUMBER); + } + public String getRequestNumber() { + return (String)get(ConfigConstants.PR_REQUEST_NUMBER); + } + + public void clearRequestNumber() { + remove(ConfigConstants.PR_REQUEST_NUMBER); + } + + public void setCAEndSerialNumber(String str) { + put(ConfigConstants.PR_CA_ENDSERIAL_NUMBER, str); + } + + public String getCAEndSerialNumber() { + return (String)get(ConfigConstants.PR_CA_ENDSERIAL_NUMBER); + } + + public void clearCAEndSerialNumber() { + remove(ConfigConstants.PR_CA_ENDSERIAL_NUMBER); + } + public String getEndRequestNumber() { + return (String)get(ConfigConstants.PR_ENDREQUEST_NUMBER); + } + + public boolean isCloning() { + String str = (String)get("cloning"); + if (str != null && str.equals(ConfigConstants.TRUE)) + return true; + else + return false; + } + public void setCloning(String str) { + put("cloning", str); + } + public void setCLAHost(String host) { + put(ConfigConstants.CLA_HOST, host); + } + + public String getCLAHost() { + return (String)get(ConfigConstants.CLA_HOST); + } + + public void setCLAPort(String port) { + put(ConfigConstants.CLA_PORT, port); + } + + public String getCLAPort() { + return (String)get(ConfigConstants.CLA_PORT); + } + + public void setCLAPortEE(String port) { + put(ConfigConstants.CLA_PORT_EE, port); + } + + public String getCLAPortEE() { + return (String)get(ConfigConstants.CLA_PORT_EE); + } + + public void setCLATimeout(String timeout) { + put(ConfigConstants.CLA_TIMEOUT, timeout); + } + + public String getCLATimeout() { + return (String)get(ConfigConstants.CLA_TIMEOUT); + } + + public boolean isConnectDBDone() { + String val = (String)get(ConfigConstants.STAGE_CONNECT_DB); + if (val == null || val.equals("") || val.equals(ConfigConstants.FALSE)) + return false; + return true; + } + + public void setConnectDBDone(String s) { + put(ConfigConstants.STAGE_CONNECT_DB, s); + } + + public boolean isCreateDBDone() { + String val = (String)get(ConfigConstants.STAGE_INTERNAL_DB); + if (val == null || val.equals("") || val.equals(ConfigConstants.FALSE)) + return false; + return true; + } + + public void setCreateDBDone(String s) { + put(ConfigConstants.STAGE_INTERNAL_DB, s); + } + + public boolean isWebServerDone() { + String val = (String)get(ConfigConstants.STAGE_CONFIG_WEBSERVER); + if (val == null || val.equals("") || val.equals(ConfigConstants.FALSE)) + return false; + return true; + } + + public void setWebServerDone(String str) { + put(ConfigConstants.STAGE_CONFIG_WEBSERVER, str); + } + + public boolean isOCSPServiceDone() { + String val = (String)get(ConfigConstants.STAGE_OCSP_SERVICE_ADDED); + if (val == null || val.equals("") || val.equals(ConfigConstants.FALSE)) + return false; + return true; + } + + public boolean isCACertRequestSucc() { + String str = (String)get(ConfigConstants.STAGE_CA_REQ_SUCCESS); + if (str == null || str.equals("") || str.equals(ConfigConstants.FALSE)) + return false; + return true; + } + + public boolean isRACertRequestSucc() { + String str = (String)get(ConfigConstants.STAGE_RA_REQ_SUCCESS); + if (str == null || str.equals("") || str.equals(ConfigConstants.FALSE)) + return false; + return true; + } + + public boolean isKRACertRequestSucc() { + String str = (String)get(ConfigConstants.STAGE_KRA_REQ_SUCCESS); + if (str == null || str.equals("") || str.equals(ConfigConstants.FALSE)) + return false; + return true; + } + + public boolean isSSLCertRequestSucc() { + String str = (String)get(ConfigConstants.STAGE_SSL_REQ_SUCCESS); + if (str == null || str.equals("") || str.equals(ConfigConstants.FALSE)) + return false; + return true; + } + + public boolean isOCSPCertRequestSucc() { + String str = (String)get(ConfigConstants.STAGE_OCSP_REQ_SUCCESS); + if (str == null || str.equals("") || str.equals(ConfigConstants.FALSE)) + return false; + return true; + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIAdminPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIAdminPage.java new file mode 100644 index 000000000..467632102 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIAdminPage.java @@ -0,0 +1,266 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.util.*; +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.certsrv.common.*; +import com.netscape.management.client.console.*; + +/** + * Admin page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIAdminPage extends WizardBasePanel implements IWizardPanel { + private JCheckBox mEnable; + private JTextField mIDText, mFullNameText, mPasswordText, + mPasswordAgainText; + private static final String PANELNAME = "ADMININSTALLWIZARD"; + private static final String HELPINDEX = + "install-administrator-configuration-wizard-help"; + + WIAdminPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIAdminPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isAgreementDone() && + wizardInfo.isReplicationEnabled()) + return false; + if (wizardInfo.isCloning() && !wizardInfo.isAgreementDone()) + return false; + if (wizardInfo.isAdministratorDone()) + return false; + mIDText.setText(wizardInfo.getCertAdminUid()); + mFullNameText.setText(wizardInfo.getCertAdminName()); + + setBorder(makeTitledBorder(PANELNAME)); + + return true; + } + + public boolean validatePanel() { + String password = mPasswordText.getText().trim(); + String passwordAgain = mPasswordAgainText.getText().trim(); + if (password.equals("") || passwordAgain.equals("")) { + setErrorMessage("BLANKPASSWD"); + return false; + } + + if (!password.equals(passwordAgain)) { + setErrorMessage("NOTSAMEPASSWD"); + return false; + } + + if (mIDText.getText().trim().equals("")) { + setErrorMessage("BLANKADMINID"); + return false; + } + + if (mFullNameText.getText().trim().equals("")) { + setErrorMessage("BLANKADMINNAME"); + return false; + } + + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_SETUP_ADMINISTRATOR; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_CERT_ADMINUID+"="+mIDText.getText(); + rawData = rawData+"&"+ConfigConstants.PR_CERT_ADMINNAME+"="+mFullNameText.getText(); + rawData = rawData+"&"+ConfigConstants.PR_CERT_ADMINPASSWD+"="+mPasswordAgainText.getText(); + if (mEnable.isSelected()) { + rawData = rawData+"&"+ConfigConstants.PR_ENABLE+"=true"; + } else { + rawData = rawData+"&"+ConfigConstants.PR_ENABLE+"=false"; + } + if (wizardInfo.getInternalDBPasswd() != null) + rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+wizardInfo.getInternalDBPasswd(); + wizardInfo.setCertAdminUid(mIDText.getText().trim()); + wizardInfo.setCertAdminName(mFullNameText.getText().trim()); + + startProgressStatus(); + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea desc = createTextArea(mResource.getString( + "ADMININSTALLWIZARD_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel idLbl = makeJLabel("ADMINID"); + gbc.anchor = gbc.NORTHEAST; + gbc.insets = new Insets(COMPONENT_SPACE,0, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.fill = gbc.NONE; + add(idLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mIDText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(mIDText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel nameLbl = makeJLabel("FULLNAME"); + gbc.insets = new Insets(0, 0, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.fill = gbc.NONE; + gbc.anchor = gbc.NORTHEAST; + add(nameLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mFullNameText = makeJTextField(30); + gbc.insets = new Insets(0, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + add(mFullNameText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel passwdLbl = makeJLabel("PASSWORD"); + gbc.insets = new Insets(0, 0, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + add(passwdLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPasswordText = makeJPasswordField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(0,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mPasswordText, gbc); + +/* + CMSAdminUtil.resetGBC(gbc); + JTextArea dummy2 = createTextArea(" ", 1, 5); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(dummy2, gbc); +*/ + + CMSAdminUtil.resetGBC(gbc); + JLabel passwdAgainLbl = makeJLabel("PASSWORDAGAIN"); + gbc.insets = new Insets(0, 0, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + add(passwdAgainLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPasswordAgainText = makeJPasswordField(30); + gbc.insets = new Insets(0, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + add(mPasswordAgainText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel passwdAgainLbl1 = makeJLabel("DUMMY"); + gbc.insets = new Insets(0, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.weighty = 1.0; + add(passwdAgainLbl1, gbc); + + CMSAdminUtil.resetGBC(gbc); + mEnable = makeJCheckBox("ENABLE"); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(0, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.weighty = 1.0; + gbc.gridheight = gbc.REMAINDER; + gbc.gridwidth = gbc.REMAINDER; + add(mEnable, gbc); + mEnable.setSelected(true); +/* + CMSAdminUtil.resetGBC(gbc); + JTextArea dummy3 = createTextArea(" ", 1, 5); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy3, gbc); +*/ + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIAllCertsInstalledPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIAllCertsInstalledPage.java new file mode 100644 index 000000000..b84460814 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIAllCertsInstalledPage.java @@ -0,0 +1,269 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIAllCertsInstalledPage extends WizardBasePanel implements IWizardPanel { + private JTextArea mLabel; + private static final String PANELNAME = "ALLCERTSINSTALLEDWIZARD"; + private static final String HELPINDEX = + "install-allcerts-getinstalled-wizard-help"; + + WIAllCertsInstalledPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIAllCertsInstalledPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return true; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (wizardInfo.isCloning()) + return false; + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) { + if (caCertInstalled(wizardInfo) && kraCertInstalled(wizardInfo)) + return false; + if (wizardInfo.isCloning()) { + if (wizardInfo.isCACloningDone() && wizardInfo.isKRACloningDone()) { + if (wizardInfo.isSSLCloningDone()) + return false; + else if (!wizardInfo.isSSLCloningDone()) { + if (wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertInstalledDone()) + return false; + } + } + } + } + + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) { + if (raCertInstalled(wizardInfo) && kraCertInstalled(wizardInfo)) + return false; + if (wizardInfo.isCloning()) { + if (wizardInfo.isRACloningDone() && wizardInfo.isKRACloningDone()) { + if (wizardInfo.isSSLCloningDone()) + return false; + else if (!wizardInfo.isSSLCloningDone()) { + if (wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertInstalledDone()) + return false; + } + } + } + } + + else if (wizardInfo.isCAInstalled()) { + if (caCertInstalled(wizardInfo)) + return false; + if (wizardInfo.isCloning()) { + if (wizardInfo.isCACloningDone()) { + if (wizardInfo.isSSLCloningDone()) + return false; + else if (!wizardInfo.isSSLCloningDone()) { + if (wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertInstalledDone()) + return false; + } + } + } + } + else if (wizardInfo.isOCSPInstalled()) { + if (ocspCertInstalled(wizardInfo)) + return false; + } + + else if (wizardInfo.isRAInstalled()) { + if (raCertInstalled(wizardInfo)) + return false; + if (wizardInfo.isCloning()) { + if (wizardInfo.isRACloningDone()) { + if (wizardInfo.isSSLCloningDone()) + return false; + else if (!wizardInfo.isSSLCloningDone()) { + if (wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertInstalledDone()) + return false; + } + } + } + } + + else if (wizardInfo.isKRAInstalled()) { + if (kraCertInstalled(wizardInfo)) + return false; + if (wizardInfo.isCloning()) { + if (wizardInfo.isKRACloningDone()) { + if (wizardInfo.isSSLCloningDone()) + return false; + else if (!wizardInfo.isSSLCloningDone()) { + if (wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertInstalledDone()) + return false; + } + } + } + } + else if (wizardInfo.isTKSInstalled()) { + if (tksCertInstalled(wizardInfo)) + return false; + } + setBorder(makeTitledBorder(PANELNAME)); + mLabel.setVisible(false); + + return true; + } + + private boolean caCertInstalled(InstallWizardInfo wizardInfo) { + if (wizardInfo.isMigrationEnable() || + ((wizardInfo.isSelfSignedCACertDone() || + wizardInfo.isCACertInstalledDone()) && + (wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertInstalledDone()))) + return true; + return false; + } + + private boolean ocspCertInstalled(InstallWizardInfo wizardInfo) { + if (wizardInfo.isOCSPCertInstalledDone() && + wizardInfo.isSSLCertInstalledDone()) + return true; + return false; + } + + private boolean raCertInstalled(InstallWizardInfo wizardInfo) { + if ((wizardInfo.isRALocalCertDone() || + wizardInfo.isRACertInstalledDone()) && + (wizardInfo.isMigrationEnable() || wizardInfo.isSSLLocalCertDone() || + wizardInfo.isSSLCertInstalledDone())) + return true; + return false; + } + + private boolean kraCertInstalled(InstallWizardInfo wizardInfo) { + if ((wizardInfo.isKRALocalCertDone() || + wizardInfo.isKRACertInstalledDone()) && + (wizardInfo.isMigrationEnable() || wizardInfo.isSSLLocalCertDone() || + wizardInfo.isSSLCertInstalledDone())) + return true; + return false; + } + private boolean tksCertInstalled(InstallWizardInfo wizardInfo) { + if(wizardInfo.isSSLCertInstalledDone()) + return true; + return false; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_GET_DEFAULT_INFO; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ; + // #344791 - help server to make up the hostname +/* + data.put(ConfigConstants.PR_HOST, + consoleInfo.get(ConfigConstants.PR_HOST)); +*/ + startProgressStatus(); + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JTextArea desc = createTextArea(mResource.getString( + PANELNAME+"_TEXT_DESC_LABEL")); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + mLabel = createTextArea(mResource.getString( + "INTROINSTALLWIZARD_TEXT_HEADING_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + //gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mLabel, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACert1CustomPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACert1CustomPage.java new file mode 100644 index 000000000..6f8c26032 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACert1CustomPage.java @@ -0,0 +1,72 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Setup CA signing cert for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICACert1CustomPage extends WBaseKeyPage implements IWizardPanel { + private static final String PANELNAME = "CACERT1CUSTOMWIZARD"; + private static final String HELPINDEX = + "configuration-kra-wizard-change-keyscheme-help"; + + WICACert1CustomPage() { + super(PANELNAME); + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACert1Page.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACert1Page.java new file mode 100644 index 000000000..c3ca75420 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACert1Page.java @@ -0,0 +1,218 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Setup CA signing cert for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICACert1Page extends WizardBasePanel implements IWizardPanel { + private JComboBox mKeyTypeBox; + private JComboBox mKeyLengthBox; + //private JComboBox mTokenBox; + //private JPasswordField mPasswordText; + + private static final String PANELNAME = "CACERT1WIZARD"; + private static final String HELPINDEX = + "configuration-kra-wizard-change-keyscheme-help"; + + WICACert1Page() { + super(PANELNAME); + init(); + } + + public boolean initializePanel(WizardInfo info) { + return true; + } + + public boolean isLastPage() { + return false; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JTextArea desc = createTextArea( + CMSAdminUtil.wrapText(mResource.getString( + "CACERT1WIZARD_TEXT_HEADING_LABEL"), 80), 2, 80); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + +/* + JTextArea desc1 = createTextArea( + CMSAdminUtil.wrapText(mResource.getString( + "CACERT1WIZARD_TEXT_TOKENHEADING_LABEL"), 80), 1, 80); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc1, gbc); + + JLabel tokenLbl = makeJLabel("TOKEN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(tokenLbl, gbc); + + mTokenBox = new JComboBox(); + mTokenBox.addItem("internal"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,0, + COMPONENT_SPACE,COMPONENT_SPACE); + add(mTokenBox, gbc); + + JTextArea dummy = createTextArea(" ", 1, 5); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,0, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(dummy, gbc); + + JTextArea desc2 = createTextArea( + CMSAdminUtil.wrapText(mResource.getString( + "CACERT1WIZARD_TEXT_HARDWARE_LABEL"), 80), 1, 80); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(2*COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc2, gbc); + + JLabel pwdLbl = makeJLabel("PWD"); + mPasswordText = makeJPasswordField(20); + //JTextArea dummy1 = createTextArea(" ", 1, 10); + //CMSAdminUtil.addComponents(this, pwdLbl, mPasswordText, dummy1, gbc); + CMSAdminUtil.addComponents(this, pwdLbl, mPasswordText, gbc); +*/ + + JTextArea desc3 = createTextArea( + CMSAdminUtil.wrapText(mResource.getString( + "CACERT1WIZARD_TEXT_KEY_LABEL"), 80), 1, 80); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(2*COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc3, gbc); + + JPanel panel = new JPanel(); + GridBagLayout gb1 = new GridBagLayout(); + panel.setLayout(gb1); + + JLabel keyTypeLbl = makeJLabel("KEYTYPE"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(keyTypeLbl, gbc); + + mKeyTypeBox = makeJComboBox("KEYTYPE"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + gbc.fill = gbc.NONE; + panel.add(mKeyTypeBox, gbc); + + JLabel keyLengthLbl = makeJLabel("KEYLENGTH"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + //gbc.weighty = 1.0; + gbc.insets = new Insets(0, COMPONENT_SPACE,0,COMPONENT_SPACE); + gbc.gridheight = gbc.REMAINDER; + panel.add(keyLengthLbl, gbc); + + mKeyLengthBox = makeJComboBox("KEYLENGTH"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + //gbc.weighty = 1.0; + gbc.gridheight = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE,0,COMPONENT_SPACE); + panel.add(mKeyLengthBox, gbc); + + JLabel unitLbl = makeJLabel("UNITS"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + //gbc.weighty = 1.0; + gbc.insets = new Insets(0, 0,0,COMPONENT_SPACE); + panel.add(unitLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + add(panel, gbc); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACert2Page.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACert2Page.java new file mode 100644 index 000000000..79fc00b02 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACert2Page.java @@ -0,0 +1,72 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * CA signing cert for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICACert2Page extends WBaseDNPage implements IWizardPanel { + private static final String PANELNAME = "CACERT2WIZARD"; + private static final String HELPINDEX = + "configuration-kra-wizard-change-keyscheme-help"; + + WICACert2Page() { + super(PANELNAME); + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACertDNPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertDNPage.java new file mode 100644 index 000000000..531de6be5 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertDNPage.java @@ -0,0 +1,97 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; + +/** + * Subject DN page for CA signing certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICACertDNPage extends WICertDNPage { + private static final String PANELNAME = "INSTALLCACERTDNWIZARD"; + private static final String CALOCALHELPINDEX = "install-cacertlocal-subjectdn-wizard-help"; + private static final String CAREMOTEHELPINDEX = "install-cacertsub-subjectdn-wizard-help"; + private static final String CAKRALOCALHELPINDEX = "install-cakracertlocal-subjectdn-wizard-help"; + private static final String CAKRAREMOTEHELPINDEX = "install-cakracertsub-subjectdn-wizard-help"; + + WICACertDNPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WICACertDNPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) + return false; + + if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() || + wizardInfo.isSelfSignedCACertDone() || wizardInfo.isCACertRequestDone() || + wizardInfo.isCACertInstalledDone()) + return false; + //dnDesc.setText(CA_DN); + String str = wizardInfo.getCASubjectName(); + if (str == null || str.equals("")) + str = CA_CN+", "+CA_C; + wizardInfo.setCASubjectName(str); + populateDN(str); + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + if (wizardInfo.isCACertLocalCA()) + mHelpIndex = CAKRALOCALHELPINDEX; + else + mHelpIndex = CAKRAREMOTEHELPINDEX; + else if (wizardInfo.isCACertLocalCA()) + mHelpIndex = CALOCALHELPINDEX; + else + mHelpIndex = CAREMOTEHELPINDEX; + return super.initializePanel(info); + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (super.concludePanel(info)) { + wizardInfo.setCASubjectName(mStr); + return true; + } + + return false; + } + + public void getUpdateInfo(WizardInfo info) { +/* + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String str = mOText.getText().trim(); + wizardInfo.setCAOComp(str); + str = mCText.getText().trim(); + wizardInfo.setCACComp(str); +*/ + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACertExtensionPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertExtensionPage.java new file mode 100644 index 000000000..1a1a1a8b9 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertExtensionPage.java @@ -0,0 +1,80 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.border.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Certificate Extension page for CA signing Certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICACertExtensionPage extends WICertExtensionPage { + private static final String PANELNAME = "INSTALLCACERTEXTENSION1WIZARD"; + private static final String CAHELPINDEX = "install-cacert-extension-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakracert-extension-wizard-help"; + + WICACertExtensionPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WICACertExtensionPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) + return false; + + if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() || + wizardInfo.isSelfSignedCACertDone() || + wizardInfo.isCACertRequestDone() || wizardInfo.isCACertInstalledDone()) + return false; + + if (!mModified) { + mBasicCheckBox.setSelected(true); + mAKICheckBox.setSelected(true); + mCACheckBox.setSelected(true); + mSKICheckBox.setSelected(true); + mCertPathBox.setSelected(false); + mExtendedKeyCheckBox.setSelected(false); + mKeyUsageBox.setSelected(true); + } + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else + mHelpIndex = CAHELPINDEX; + + return super.initializePanel(info); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertPage.java new file mode 100644 index 000000000..b962c6ca1 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertPage.java @@ -0,0 +1,172 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * This page allows the user to generate a CA certificate request. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICACertPage extends WizardBasePanel implements IWizardPanel { + private JRadioButton mSelfBtn, mSubordinateBtn, mEmailBtn; + private JRadioButton mUrlBtn, mManualBtn; + private JTextField mEmailText; + private JTextField mUrlText; + private static final String PANELNAME = "CACERTWIZARD"; + private static final String HELPINDEX = + "configuration-kra-wizard-change-keyscheme-help"; + + WICACertPage() { + super(PANELNAME); + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JTextArea desc = createTextArea( + CMSAdminUtil.wrapText(mResource.getString( + "CACERTWIZARD_TEXT_HEADING_LABEL"), 80), 1, 80); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + mSelfBtn = makeJRadioButton("SELF", true); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mSelfBtn, gbc); + + mSubordinateBtn = makeJRadioButton("SUBORDINATE", false); + CMSAdminUtil.resetGBC(gbc); + gbc.weightx = 1.0; + gbc.insets = new Insets(0,COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mSubordinateBtn, gbc); + + JTextArea desc1 = createTextArea( + CMSAdminUtil.wrapText(mResource.getString( + "CACERTWIZARD_TEXT_HEADING1_LABEL"), 80), 2, 80); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc1, gbc); + + mEmailBtn = makeJRadioButton("EMAIL", true); + CMSAdminUtil.resetGBC(gbc); + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mEmailBtn, gbc); + + mEmailText = makeJTextField(30); + CMSAdminUtil.resetGBC(gbc); + gbc.gridwidth = gbc.REMAINDER; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mEmailText, gbc); + + mUrlBtn = makeJRadioButton("URL", false); + CMSAdminUtil.resetGBC(gbc); + gbc.weightx = 1.0; + gbc.insets = new Insets(0, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mUrlBtn, gbc); + + mUrlText = makeJTextField(30); + CMSAdminUtil.resetGBC(gbc); + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.fill = gbc.NONE; + add(mUrlText, gbc); + + mManualBtn = makeJRadioButton("MANUAL", false); + CMSAdminUtil.resetGBC(gbc); + gbc.weightx = 1.0; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mManualBtn, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.gridwidth = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy, gbc); + + ButtonGroup CAButtonGrp = new ButtonGroup(); + CAButtonGrp.add(mSelfBtn); + CAButtonGrp.add(mSubordinateBtn); + + ButtonGroup MethodButtonGrp = new ButtonGroup(); + MethodButtonGrp.add(mEmailBtn); + MethodButtonGrp.add(mUrlBtn); + MethodButtonGrp.add(mManualBtn); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACertSubmitPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertSubmitPage.java new file mode 100644 index 000000000..efa2d8b0c --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertSubmitPage.java @@ -0,0 +1,79 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * CA Certificate Submission. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICACertSubmitPage extends WICertSubmitPage implements IWizardPanel { + private static final String PANELNAME = "INSTALLCACERTWIZARD"; + private static final String CAHELPINDEX = "install-catype-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakratype-wizard-help"; + + WICACertSubmitPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WICACertSubmitPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) + return false; + + wizardInfo.put(Constants.PR_CERTIFICATE_TYPE, + Constants.PR_CA_SIGNING_CERT); + if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() || + wizardInfo.isSelfSignedCACertDone() || wizardInfo.isCACertRequestDone() || + wizardInfo.isCACertInstalledDone()) + return false; + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else + mHelpIndex = CAHELPINDEX; + return super.initializePanel(info); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mSelfButton.isSelected()) + wizardInfo.setCACertLocalCA(Constants.TRUE); + else + wizardInfo.setCACertLocalCA(Constants.FALSE); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICACertValidityPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertValidityPage.java new file mode 100644 index 000000000..cb8fa550d --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICACertValidityPage.java @@ -0,0 +1,75 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Validity page for CA signing certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICACertValidityPage extends WICertValidityPage { + private static final String PANELNAME = "INSTALLCACERTVALIDWIZARD"; + private static final String CAHELPINDEX = "install-cacert-validity-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakracert-validity-wizard-help"; + + WICACertValidityPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WICACertValidityPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) + return false; + if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() || + wizardInfo.isSelfSignedCACertDone() || wizardInfo.isCACertRequestDone() || + wizardInfo.isCACertInstalledDone()) + return false; + if (super.initializePanel(info)) { + if (!wizardInfo.isCACertLocalCA()) + return false; + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else + mHelpIndex = CAHELPINDEX; + + return true; + } + return false; + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICAKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICAKeyPage.java new file mode 100644 index 000000000..accc866b2 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICAKeyPage.java @@ -0,0 +1,115 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Setup key information for CA signing certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICAKeyPage extends WIKeyPage implements IWizardPanel { + private static final String PANELNAME = "INSTALLCAKEYWIZARD"; + private static final String CALOCALHELPINDEX = + "install-cakeylocal-configuration-wizard-help"; + private static final String CAREMOTEHELPINDEX = + "install-cakeysub-configuration-wizard-help"; + private static final String CAKRALOCALHELPINDEX = + "install-cakrakeylocal-configuration-wizard-help"; + private static final String CAKRAREMOTEHELPINDEX = + "install-cakrakeysub-configuration-wizard-help"; + + WICAKeyPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WICAKeyPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + mWizardInfo = (InstallWizardInfo)info; + if (mWizardInfo.isCloning() && mWizardInfo.isCACloningDone()) + return false; + + if (!mWizardInfo.isCAInstalled() || mWizardInfo.isMigrationEnable() || + mWizardInfo.isSelfSignedCACertDone() || mWizardInfo.isCACertRequestDone() || + mWizardInfo.isCACertInstalledDone()) + return false; + + if (super.initializePanel(info)) { + String caTokenName = mWizardInfo.getCATokenName(); + if (caTokenName == null || caTokenName.equals("")) { + mTokenBox.setSelectedIndex(0); + } else { + if (caTokenName.equals(Constants.PR_INTERNAL_TOKEN_NAME)) + mTokenBox.setSelectedIndex(0); + else + mTokenBox.setSelectedItem(caTokenName); + } + } + + int counts = mKeyTypeBox.getItemCount(); + if (counts == 1) + mKeyTypeBox.addItem("DSA"); + + if (mWizardInfo.isCAInstalled() && mWizardInfo.isKRAInstalled()) { + if (mWizardInfo.isCACertLocalCA()) + mHelpIndex = CAKRALOCALHELPINDEX; + else + mHelpIndex = CAKRAREMOTEHELPINDEX; + } else if (mWizardInfo.isCACertLocalCA()) + mHelpIndex = CALOCALHELPINDEX; + else + mHelpIndex = CAREMOTEHELPINDEX; + + enableFields(); + mIsCAKey = true; + return true; + } + + public void getUpdateInfo(WizardInfo info) { + super.getUpdateInfo(info); + mWizardInfo.setCATokenName(mWizardInfo.getTokenName()); + + if (mPassword.isEditable()) { + String tokenname = mWizardInfo.getCATokenName(); + + // this is used for single signon. The key is the token name with + // the prefix "TOKEN:" and the value is the token password. + mWizardInfo.put("TOKEN:"+tokenname, mPassword.getText().trim()); + } + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICAMessageDigestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICAMessageDigestPage.java new file mode 100644 index 000000000..e19fc6586 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICAMessageDigestPage.java @@ -0,0 +1,80 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.text.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Setup the message digest information for the installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICAMessageDigestPage extends WMessageDigestPage { + + private static final String PANELNAME = "INSTALLCAMESSAGEDIGESTWIZARD"; + + WICAMessageDigestPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WICAMessageDigestPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) + return false; + + if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() || + !wizardInfo.isCACertLocalCA() || wizardInfo.isSelfSignedCACertDone() || + wizardInfo.isCACertRequestDone() || wizardInfo.isCACertInstalledDone()) + return false; + + mCAKeyType = wizardInfo.getCAKeyType(); + + return super.initializePanel(info); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mDSAHashTypeBox.isVisible()) + wizardInfo.setHashType((String)mDSAHashTypeBox.getSelectedItem()); + else + wizardInfo.setHashType((String)mRSAHashTypeBox.getSelectedItem()); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICAOCSPServicePage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICAOCSPServicePage.java new file mode 100644 index 000000000..9245b14bf --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICAOCSPServicePage.java @@ -0,0 +1,172 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import java.math.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * This panel asks for the starting serial number that the CA issues + * + * @author Michelle Zhao + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICAOCSPServicePage extends WizardBasePanel implements IWizardPanel { + private JTextArea mDesc; + + private boolean mEnable; + private JCheckBox mOCSPServiceCB; + private JLabel mOCSPServiceLabel; + + private static final String PANELNAME = "CAOCSPSERVICEWIZARD"; + private static final String HELPINDEX = + "install-ca-ocspservice-wizard-help"; + + WICAOCSPServicePage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WICAOCSPServicePage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + String serial; + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + setBorder(makeTitledBorder(PANELNAME)); + // If ca's signing cert is not generated, + // we allow "back" to modify the panel + if (!wizardInfo.isCAInstalled()) + return false; + if (wizardInfo.isOCSPServiceDone()) + return false; + if (wizardInfo.isOCSPInstalled()) + return false; + + mDesc.setText(mResource.getString(PANELNAME+"_TEXT_HEADING_LABEL")); + + return true; + } + + public boolean validatePanel() + { + mEnable = mOCSPServiceCB.isSelected(); + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_ADD_OCSP_SERVICE; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + if (mEnable) + rawData = rawData+"&"+ConfigConstants.PR_CA_OCSP_SERVICE+"="+ + "true"; + else + rawData = rawData+"&"+ConfigConstants.PR_CA_OCSP_SERVICE+"="+ + "false"; + + startProgressStatus(); + + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str.equals("")) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + mDesc = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mDesc, gbc); + + CMSAdminUtil.resetGBC(gbc); + mOCSPServiceLabel = makeJLabel("OCSPSERVICE"); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mOCSPServiceLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mOCSPServiceCB = makeJCheckBox("OCSPSERVICE"); + mOCSPServiceCB.setSelected(true); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mOCSPServiceCB, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mEnable) + wizardInfo.setOCSPService(ConfigConstants.TRUE); + else + wizardInfo.setOCSPService(ConfigConstants.FALSE); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICARequestResultPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICARequestResultPage.java new file mode 100644 index 000000000..f40898821 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICARequestResultPage.java @@ -0,0 +1,59 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Display the CA signing certificate request result + * + * @author Michelle Zhao + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICARequestResultPage extends WIRequestResultPage { + WICARequestResultPage(JDialog parent) { + super(parent); + } + + WICARequestResultPage(JDialog parent, JFrame adminFrame) { + super( parent, adminFrame); + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) + return false; + + if (wizardInfo.isCACertLocalCA() || !wizardInfo.isCAInstalled() || + wizardInfo.isMigrationEnable() || + wizardInfo.isCACertInstalledDone() || + (wizardInfo.isCACertRequestSucc() && wizardInfo.isCAReqResultDisplayed()) || + wizardInfo.isSelfSignedCACertDone()) + return false; + + wizardInfo.setCAReqResultDisplayed(Constants.TRUE); + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICASerialNumberPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICASerialNumberPage.java new file mode 100644 index 000000000..3b1653d7f --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICASerialNumberPage.java @@ -0,0 +1,381 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import java.math.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * This panel asks for the starting serial number that the CA issues + * + * @author Michelle Zhao + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICASerialNumberPage extends WizardBasePanel implements IWizardPanel { + private JTextArea mDesc; + + private String mSerialNumber; + private JTextField mSerialNumberText; + private JLabel mSerialNumberLabel; + + private String mEndSerialNumber = null; + private JTextField mEndSerialNumberText; + private JLabel mEndSerialNumberLabel; + + private String mbeginRequestNumber; + private JTextField mbeginRequestNumberText; + private JLabel mbeginRequestNumberLabel; + + private String mEndRequestNumber = null; + private JTextField mEndRequestNumberText; + private JLabel mEndRequestNumberLabel; + + private static final String DEFAULT_SERIAL_NUMBER = "1"; + private static final String PANELNAME = "CASERIALNUMBERWIZARD"; + private static final String HELPINDEX = + "install-ca-serialnumber-wizard-help"; + + WICASerialNumberPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WICASerialNumberPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + String serial; + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + setBorder(makeTitledBorder(PANELNAME)); + // If ca's signing cert is not generated, + // we allow "back" to modify the panel + + if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() || + wizardInfo.isSelfSignedCACertDone() || wizardInfo.isCACertRequestDone() + ||wizardInfo.isNumberPageDone()) + return false; + + if (wizardInfo.isCloning()) + mDesc.setText(mResource.getString(PANELNAME+"_TEXT_HEADING_LABEL") + + mResource.getString(PANELNAME+"_TEXT_MORE_LABEL")); + else + mDesc.setText(mResource.getString(PANELNAME+"_TEXT_HEADING_LABEL")); + + + if ((serial = wizardInfo.getCASerialNumber()) != null) + mSerialNumberText.setText(serial); + else + mSerialNumberText.setText(DEFAULT_SERIAL_NUMBER); + + if ((serial = wizardInfo.getRequestNumber()) != null) + mbeginRequestNumberText.setText(serial); + else + mbeginRequestNumberText.setText(DEFAULT_SERIAL_NUMBER); + + if ((serial = wizardInfo.getCAEndSerialNumber()) != null) + mEndSerialNumberText.setText(serial); + + if ((serial = wizardInfo.getEndRequestNumber()) != null) + mEndRequestNumberText.setText(serial); + + return true; + } + + private String hexToDecimal(String hex, boolean isHex) + { + //String newHex = hex.substring(2); + BigInteger bi; + if(isHex) + bi = new BigInteger(hex, 16); + else + bi = new BigInteger(hex, 10); + return bi.toString(); + } + + private String DecToHex(String dec) + { + BigInteger bi; + bi = new BigInteger(dec, 10); + return bi.toString(16); + } + + private boolean validateNumber(JTextField beginNumberField, JTextField endNumberField,String beginText, String endText,boolean isSerialNumber) + { + BigInteger num = null; + BigInteger endNum = null; + String serial = null; + beginText = beginNumberField.getText().trim(); + if (beginText != null && !beginText.equals("")) { + try { + if (beginText.startsWith("0x")) { + serial = hexToDecimal(beginText.substring(2),true); + } else { + serial = beginText; + } + num = new BigInteger(serial); + if (num.compareTo(new BigInteger("0")) < 0) { + setErrorMessage("You must specify a positive value."); + return false; + } + } catch (NumberFormatException e) { + setErrorMessage("You must specify a numeric value."); + return false; + } + if(isSerialNumber) + mSerialNumber = DecToHex(serial); // Hex to the server + else + mbeginRequestNumber = serial; + } else { + if(isSerialNumber) + mSerialNumber = ""; + else + mbeginRequestNumber = ""; + } + endText = endNumberField.getText().trim(); + if (endText != null && !endText.equals("")) { + try { + if (endText.startsWith("0x")) { + serial = hexToDecimal(endText.substring(2),true); + } else { + serial = endText; + } + endNum = new BigInteger(serial); + if (endNum.compareTo(new BigInteger("0")) < 0) { + setErrorMessage("You must specify a positive value."); + return false; + } + } catch (NumberFormatException e) { + setErrorMessage("You must specify a numeric value."); + return false; + } + if(isSerialNumber) + mEndSerialNumber = DecToHex(serial); // Hex to the Server + else + mEndRequestNumber = serial; + } else { + if(isSerialNumber) + mEndSerialNumber = ""; + else + mEndRequestNumber = ""; + } + + if (num != null && endNum != null && num.compareTo(endNum) > 0) { + setErrorMessage("Ending number must be greater than starting number."); + return false; + } + return true; + } + public boolean validatePanel() { + + if(validateNumber(mSerialNumberText,mEndSerialNumberText,mSerialNumber,mEndSerialNumber,true)==false) + return false; + if(validateNumber(mbeginRequestNumberText,mEndRequestNumberText,mbeginRequestNumber,mEndRequestNumber,false)==false) + return false; + + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mSerialNumber != null && !mSerialNumber.equals("")) + wizardInfo.setCASerialNumber(mSerialNumber); + else { + wizardInfo.setCASerialNumber(DEFAULT_SERIAL_NUMBER); + mSerialNumber = DEFAULT_SERIAL_NUMBER; + } + if (mbeginRequestNumber != null && !mbeginRequestNumber.equals("")) + wizardInfo.setRequestNumber(mbeginRequestNumber); + else { + wizardInfo.setRequestNumber(DEFAULT_SERIAL_NUMBER); + mbeginRequestNumber = DEFAULT_SERIAL_NUMBER; + } + + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_SET_CA_SERIAL; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + if (mSerialNumber != null && !mSerialNumber.equals("")) + rawData = rawData+"&"+ConfigConstants.PR_CA_SERIAL_NUMBER+"="+ + mSerialNumber; + if (mEndSerialNumber != null && !mEndSerialNumber.equals("")) + rawData = rawData+"&"+ConfigConstants.PR_CA_ENDSERIAL_NUMBER+"="+ + mEndSerialNumber; + if (mbeginRequestNumber != null && !mbeginRequestNumber.equals("")) + rawData = rawData+"&"+ConfigConstants.PR_REQUEST_NUMBER+"="+ + mbeginRequestNumber; + if (mEndRequestNumber != null && !mEndSerialNumber.equals("")) + rawData = rawData+"&"+ConfigConstants.PR_ENDREQUEST_NUMBER+"="+ + mEndRequestNumber; + if (wizardInfo.getInternalDBPasswd() != null) + rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+ + wizardInfo.getInternalDBPasswd(); + + rawData = rawData+"&"+ConfigConstants.PR_SERIAL_REQUEST_NUMBER+"="+ + ConfigConstants.TRUE; + startProgressStatus(); + + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str.equals("")) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + }else { + wizardInfo.setNumberPageDone(ConfigConstants.TRUE); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + mDesc = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mDesc, gbc); + + CMSAdminUtil.resetGBC(gbc); + mSerialNumberLabel = makeJLabel("SERIALNUMBER"); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mSerialNumberLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mSerialNumberText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; +// gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mSerialNumberText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mEndSerialNumberLabel = makeJLabel("ENDSERIALNUMBER"); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mEndSerialNumberLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mEndSerialNumberText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; +// gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mEndSerialNumberText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mbeginRequestNumberLabel = makeJLabel("REQUESTNUMBER"); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mbeginRequestNumberLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mbeginRequestNumberText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; +// gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mbeginRequestNumberText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mEndRequestNumberLabel = makeJLabel("ENDREQUESTNUMBER"); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mEndRequestNumberLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mEndRequestNumberText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; +// gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mEndRequestNumberText, gbc); + + /* + CMSAdminUtil.resetGBC(gbc); + mSerialNumberLabel = makeJLabel("PWD"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mSerialNumberLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mSerialNumberText = makeJSerialNumberField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mSerialNumberText, gbc); +*/ + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICATokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICATokenLogonPage.java new file mode 100644 index 000000000..f7068b3d3 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICATokenLogonPage.java @@ -0,0 +1,76 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * This panel asks for the information of the current internal database. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICATokenLogonPage extends WITokenLogonPage implements IWizardPanel { + + private static final String HELPINDEX = "install-catoken-logon-wizard-help"; + private static final String PANELNAME = "CATOKENLOGONWIZARD"; + + WICATokenLogonPage(JDialog dialog) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = dialog; + } + + WICATokenLogonPage(JDialog dialog, JFrame adminFrame) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = dialog; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String tokenname = wizardInfo.getCATokenName(); + String pwd = (String)wizardInfo.get("TOKEN:"+tokenname); + if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) { + if (pwd != null && !pwd.equals("")) + return false; + } + + if (wizardInfo.isCACertLocalCA() || !wizardInfo.isInstallCertNow() + || !wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() + || wizardInfo.isCACertInstalledDone()) + return false; + if (pwd != null) + return false; + + mTokenName = tokenname; + mTokenText.setText(tokenname); + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICertDNPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICertDNPage.java new file mode 100644 index 000000000..cf7e623ad --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICertDNPage.java @@ -0,0 +1,153 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; +import com.netscape.management.client.console.*; +import com.netscape.admin.certsrv.task.*; + +/** + * Specify Subject DN for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICertDNPage extends WBaseDNPage { + protected String mSubjectName; + protected String mHelpIndex; + protected static final String CA_CN = "CN=Certificate Manager"; + protected static final String CA_C = "C=US"; + protected static final String RA_CN = "CN=Registration Manager"; + protected static final String RA_C = "C=US"; + protected static final String OCSP_CN = "CN=Online Certificate Status Manager"; + protected static final String OCSP_C = "C=US"; + protected static final String KRA_CN = "CN=Data Recovery Manager"; + protected static final String KRA_C = "C=US"; + protected static final String SERVER_C = "C=US"; + protected String mStr; + + WICertDNPage(String panelName) { + super(panelName); + mPanelName = panelName; + init(); + } + + public boolean initializePanel(WizardInfo info) { + setBorder(makeTitledBorder(mPanelName)); +/* + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String str = wizardInfo.getSubjectName(); + + populateDN(str); +*/ + + return true; + } + + public boolean validatePanel() { + return super.validatePanel(); + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String str1 = mSubjectDNText.getText().trim(); + String str2 = mSubjectStringText.getText().trim(); + String str = ""; + + if (mDNComponents.isSelected()) { + str = str1; + } else { + str = str2; + } + + if (str.equals("")) { + setErrorMessage("BLANKFIELD"); + return false; + //str = dnDesc.getText().trim(); + } + + mStr = CMSAdminUtil.getPureString(str); + + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CHECK_DN; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_CERTIFICATE_TYPE+"="+ wizardInfo.getCertType(); + rawData = rawData+"&"+ConfigConstants.PR_SUBJECT_NAME+"="+mStr; + + startProgressStatus(); + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + wizardInfo.setSubjectName(mStr); + + if (!ready) { + String errstr = getErrorMessage(); + if (errstr.equals("")) { + String errorMsg = mResource.getString( + mPanelName+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(errstr); + } + +/* + CertSetupWizardInfo wizardInfo = (CertSetupWizardInfo)info; + AdminConnection connection = wizardInfo.getAdminConnection(); + NameValuePairs nvps = new NameValuePairs(); + + nvps.add(Constants.PR_SUBJECT_NAME, str); + wizardInfo.addEntry(Constants.PR_SUBJECT_NAME, str); + + try { + connection.validate(DestDef.DEST_SERVER_ADMIN, + ScopeDef.SC_SUBJECT_NAME, nvps); + } catch (EAdminException e) { + //showErrorDialog(e.toString()); + setErrorMessage(e.toString()); + return false; + } + + nvps.add(Constants.PR_TOKEN_NAME, wizardInfo.getTokenName()); + if (wizardInfo.isNewKey()) { + nvps.add(Constants.PR_KEY_LENGTH, wizardInfo.getKeyLength()); + nvps.add(Constants.PR_KEY_TYPE, wizardInfo.getKeyType()); + } + + wizardInfo.addEntry(wizardInfo.ALL_INFO, nvps); +*/ + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + super.init(); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICertExtensionPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICertExtensionPage.java new file mode 100644 index 000000000..8c989685a --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICertExtensionPage.java @@ -0,0 +1,168 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Certificate Extension for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICertExtensionPage extends WBaseCertExtensionPage implements + IWizardPanel { + protected String mHelpIndex; + + WICertExtensionPage(String panelName) { + super(panelName); + mPanelName = panelName; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + setBorder(makeTitledBorder(mPanelName)); + return super.initializePanel(info); + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + boolean ready = false; + + String rawData = ""; + if (mMIMECheckBox.isSelected()) { + //Check the extension if it is valid + rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CHECK_EXTENSION; + rawData = rawData+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+ConfigConstants.PR_CERTIFICATE_EXTENSION+"="+ + mMIMEText.getText().trim(); + + startProgressStatus(); + ready = send(rawData, wizardInfo); + endProgressStatus(); + if (!ready) { + String str = getErrorMessage(); + if (str.equals("")) { + String errorMsg = mResource.getString( + mPanelName+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + } else + ready = true; + + if (ready) { + NameValuePairs nvps = new NameValuePairs(); + + nvps.put(Constants.PR_CERTIFICATE_TYPE, wizardInfo.getCertType()); + nvps.put(Constants.PR_SUBJECT_NAME, wizardInfo.getSubjectName()); + nvps.put(Constants.PR_TOKEN_NAME, wizardInfo.getTokenName()); + nvps.put(Constants.PR_KEY_LENGTH, wizardInfo.getKeyLength()); + nvps.put(Constants.PR_KEY_TYPE, wizardInfo.getKeyType()); + nvps.put(Constants.PR_KEY_CURVENAME, wizardInfo.getKeyCurveName()); + addValidityPeriod(wizardInfo, nvps); + + if (mBasicCheckBox.isSelected()) + addBasicConstraints(nvps); + + if (mExtendedKeyCheckBox.isSelected()) + addExtendedKey(nvps); + + if (mAKICheckBox.isSelected()) + nvps.put(Constants.PR_AKI, Constants.TRUE); + + if (mSKICheckBox.isSelected()) + nvps.put(Constants.PR_SKI, Constants.TRUE); + + if (mKeyUsageBox.isSelected()) + nvps.put(Constants.PR_KEY_USAGE, Constants.TRUE); + + if (mMIMECheckBox.isSelected()) + nvps.put(Constants.PR_DER_EXTENSION, mMIMEText.getText().trim()); + + wizardInfo.put(wizardInfo.ALL_CERT_INFO, nvps); + } + + mModified = true; + return ready; + } + + private void addValidityPeriod(InstallWizardInfo wizardInfo, + NameValuePairs nvps) { + nvps.put(Constants.PR_BEGIN_YEAR, wizardInfo.getBeginYear()); + nvps.put(Constants.PR_BEGIN_MONTH, wizardInfo.getBeginMonth()); + nvps.put(Constants.PR_BEGIN_DATE, wizardInfo.getBeginDate()); + nvps.put(Constants.PR_BEGIN_HOUR, wizardInfo.getBeginHour()); + nvps.put(Constants.PR_BEGIN_MIN, wizardInfo.getBeginMin()); + nvps.put(Constants.PR_BEGIN_SEC, wizardInfo.getBeginSec()); + nvps.put(Constants.PR_AFTER_YEAR, wizardInfo.getAfterYear()); + nvps.put(Constants.PR_AFTER_MONTH, wizardInfo.getAfterMonth()); + nvps.put(Constants.PR_AFTER_DATE, wizardInfo.getAfterDate()); + nvps.put(Constants.PR_AFTER_HOUR, wizardInfo.getAfterHour()); + nvps.put(Constants.PR_AFTER_MIN, wizardInfo.getAfterMin()); + nvps.put(Constants.PR_AFTER_SEC, wizardInfo.getAfterSec()); + } + + private void addBasicConstraints(NameValuePairs nvps) { + if (mCACheckBox.isSelected()) + nvps.put(Constants.PR_IS_CA, Constants.TRUE); + + if (mCertPathBox.isSelected()) { + String certLen = mCertPathText.getText().trim(); + if (!certLen.equals("")) + nvps.put(Constants.PR_CERT_LEN, certLen); + } else { + // negative number means infinity + nvps.put(Constants.PR_CERT_LEN, "-1"); + } + } + + private void addExtendedKey(NameValuePairs nvps) { + if (mSSLClient.isSelected()) + nvps.put(Constants.PR_SSL_CLIENT_BIT, Constants.TRUE); + if (mSSLServer.isSelected()) + nvps.put(Constants.PR_SSL_SERVER_BIT, Constants.TRUE); + if (mSSLMail.isSelected()) + nvps.put(Constants.PR_SSL_MAIL_BIT, Constants.TRUE); + if (mObjectSigning.isSelected()) + nvps.put(Constants.PR_OBJECT_SIGNING_BIT, Constants.TRUE); + if (mTimeStamping.isSelected()) + nvps.put(Constants.PR_TIMESTAMPING_BIT, Constants.TRUE); + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICertRequestPage.java new file mode 100644 index 000000000..d4926e1e9 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICertRequestPage.java @@ -0,0 +1,73 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICertRequestPage extends WBaseCertRequestPage implements IWizardPanel { + private JButton mCopy; + private JTextArea mText; + private static final String PANELNAME = "CERTREQUESTWIZARD"; + private static final String HELPINDEX = + "configuration-kra-wizard-change-keyscheme-help"; + + WICertRequestPage() { + super(PANELNAME); + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICertSetupStatusPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICertSetupStatusPage.java new file mode 100644 index 000000000..ff9ca97a6 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICertSetupStatusPage.java @@ -0,0 +1,144 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.util.Hashtable; +import java.net.URL; +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.awt.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.management.client.console.ConsoleInfo; +import com.netscape.management.client.util.*; +import com.netscape.management.client.comm.*; +import com.netscape.management.client.*; + +/** + * Status page for the configuration of the certificate server. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICertSetupStatusPage extends WizardBasePanel implements IWizardPanel { + private JTextArea desc; + private static final String PANELNAME = "INSTALLCONFIGSTATUSWIZARD"; + private static final String HELPINDEX = "install-certsetup-status-wizard-help"; + + WICertSetupStatusPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WICertSetupStatusPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return true; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String str = ""; + if (wizardInfo.isCAInstalled()) { + + String str1 = ""; + // display status + str = mResource.getString( + "INSTALLCONFIGSTATUSWIZARD_CATEXT_DESC_LABEL"); + if (wizardInfo.isKRAInstalled()) + str1 = mResource.getString( + "INSTALLCONFIGSTATUSWIZARD_CAKRATEXT_DESC_LABEL"); + String link = "https://"+wizardInfo.getMachineName()+":"+ + wizardInfo.getAdminPort() + "/ca/adminEnroll.html"; + desc.setText(str+"\n"+link+"\n\n"+str1); + } else if (wizardInfo.isOCSPInstalled()) { + desc.setText(mResource.getString( + "INSTALLCONFIGSTATUSWIZARD_OCSPTEXT_DESC_LABEL")); + } else if (wizardInfo.isRAInstalled()) { + if (wizardInfo.isKRAInstalled()) + desc.setText(mResource.getString( + "INSTALLCONFIGSTATUSWIZARD_RAKRATEXT_DESC_LABEL")); + else + desc.setText(mResource.getString( + "INSTALLCONFIGSTATUSWIZARD_RATEXT_DESC_LABEL")); + } else if (wizardInfo.isKRAInstalled()) { + desc.setText(mResource.getString( + "INSTALLCONFIGSTATUSWIZARD_KRATEXT_DESC_LABEL")); + } + else if (wizardInfo.isTKSInstalled()) { + desc.setText(mResource.getString( + "INSTALLCONFIGSTATUSWIZARD_TKSTEXT_DESC_LABEL")); + } + setBorder(makeTitledBorder(PANELNAME)); + + CMSAdmin admin = (CMSAdmin)wizardInfo.get("CMSAdmin"); + IPage viewInstance = (IPage)wizardInfo.get("viewInstance"); + if (viewInstance != null) + admin.updateMenu(viewInstance); + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + +/* + desc = new JTextArea("", 4, 80); + desc.setBackground(getBackground()); + desc.setEditable(false); + desc.setCaretColor(getBackground()); +*/ + desc = createTextArea(""); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + add(desc, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICertSubmitPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICertSubmitPage.java new file mode 100644 index 000000000..18beac219 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICertSubmitPage.java @@ -0,0 +1,144 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICertSubmitPage extends WizardBasePanel implements IWizardPanel { + protected JRadioButton mSelfButton; + protected JRadioButton mSubordinateButton; + protected JTextArea mLabel; + protected String mHelpIndex; + private String mPanelName; + protected InstallWizardInfo mWizardInfo; + + WICertSubmitPage(String panelName) { + super(panelName); + mPanelName = panelName; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + setBorder(makeTitledBorder(mPanelName)); + mWizardInfo = (InstallWizardInfo)info; + if (!mWizardInfo.getCertType().equals(Constants.PR_CA_SIGNING_CERT)) { + if (mWizardInfo.isCACertRequestDone() && + !mWizardInfo.isCACertInstalledDone()) { + mSubordinateButton.setSelected(true); + mSelfButton.setSelected(false); + } + } + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + mLabel = createTextArea(mResource.getString( + mPanelName+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mLabel, gbc); + + mSelfButton = makeJRadioButton("SELF", true); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mSelfButton, gbc); + + mSubordinateButton = makeJRadioButton("SUB", false); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(0,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mSubordinateButton, gbc); + + ButtonGroup buttonGroup = new ButtonGroup(); + buttonGroup.add(mSelfButton); + buttonGroup.add(mSubordinateButton); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } + + public void actionPerformed(ActionEvent e) { + if (!mWizardInfo.getCertType().equals(Constants.PR_CA_SIGNING_CERT)) { + if (e.getSource().equals(mSelfButton)) { + if (mWizardInfo.isCACertRequestDone() && + !mWizardInfo.isCACertInstalledDone()) { + String errorMsg = mResource.getString(mPanelName+"_LABEL_INCOMPLETE_LABEL"); + JOptionPane.showMessageDialog(mParent, errorMsg, "Warning", + JOptionPane.WARNING_MESSAGE, + CMSAdminUtil.getImage(CMSAdminResources.IMAGE_WARN_ICON)); + mSelfButton.setSelected(false); + mSubordinateButton.setSelected(true); + } + } + } + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICertValidityPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICertValidityPage.java new file mode 100644 index 000000000..8f2acd493 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICertValidityPage.java @@ -0,0 +1,141 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import java.text.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * Validity page for installation wizard + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICertValidityPage extends WBaseValidityPage implements IWizardPanel { + private String mPanelName; + protected String mHelpIndex; + + WICertValidityPage(String panelName) { + super(panelName); + mPanelName = panelName; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + setBorder(makeTitledBorder(mPanelName)); + return true; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + super.init(); + } + + public boolean validatePanel() { + boolean status = super.validatePanel(); + Date currTime = new Date(); + + if (status) { + if (currTime.before(mBeforeDate)) { + if (!mWarningDisplayed) { + setErrorMessage("INVALIDCERT"); + mWarningDisplayed = true; + return false; + } + } + } + + return status; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (!wizardInfo.getCertType().equals(Constants.PR_CA_SIGNING_CERT)) { + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_VALIDITY_PERIOD; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_NOTAFTER+"="+mAfterDate.getTime(); + startProgressStatus(); + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str.equals("")) { + String errorMsg = mResource.getString( + mPanelName+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else if (str.equals("beyondCAValidity")) { + String errormsg = mResource.getString(mPanelName+"_BEYONDCAVALIDITY"); + int status = JOptionPane.showConfirmDialog(mAdminFrame, errormsg, "Information", + JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, + CMSAdminUtil.getImage(CMSAdminResources.IMAGE_INFO_ICON)); + if (status == JOptionPane.OK_OPTION) { + rawData = rawData+"&"+ConfigConstants.OVERRIDE_VALIDITY+"="+ConfigConstants.TRUE; + ready = send(rawData, wizardInfo); + return true; + } else { + setErrorMessage(mResource.getString(mPanelName+"_ERROR1")); + return false; + } + } else + setErrorMessage(str); + return ready; + } + } + + return super.concludePanel(info); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.addEntry(Constants.PR_BEGIN_YEAR, mBYear.getText().trim()); + int beforeMonth = Integer.parseInt(mBMonth.getText().trim()); + wizardInfo.addEntry(Constants.PR_BEGIN_MONTH, ""+(beforeMonth-1)); + wizardInfo.addEntry(Constants.PR_BEGIN_DATE, mBDay.getText().trim()); + wizardInfo.addEntry(Constants.PR_BEGIN_HOUR, mBHour.getText().trim()); + wizardInfo.addEntry(Constants.PR_BEGIN_MIN, mBMin.getText().trim()); + wizardInfo.addEntry(Constants.PR_BEGIN_SEC, mBSec.getText().trim()); + wizardInfo.addEntry(Constants.PR_AFTER_YEAR, mEYear.getText().trim()); + int afterMonth = Integer.parseInt(mEMonth.getText().trim()); + wizardInfo.addEntry(Constants.PR_AFTER_MONTH, ""+(afterMonth-1)); + wizardInfo.addEntry(Constants.PR_AFTER_DATE, mEDay.getText().trim()); + wizardInfo.addEntry(Constants.PR_AFTER_HOUR, mEHour.getText().trim()); + wizardInfo.addEntry(Constants.PR_AFTER_MIN, mEMin.getText().trim()); + wizardInfo.addEntry(Constants.PR_AFTER_SEC, mESec.getText().trim()); + //wizardInfo.addEntry(Constants.PR_VALIDITY_PERIOD, ""+period); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICloneCAKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneCAKeyCertPage.java new file mode 100644 index 000000000..d5722df32 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneCAKeyCertPage.java @@ -0,0 +1,292 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICloneCAKeyCertPage extends WizardBasePanel implements IWizardPanel { + private String mCANicknameStr, mSSLNicknameStr, mOCSPNicknameStr; + private String mCATokenname, mOCSPTokenname, mSSLTokenname; + protected InstallWizardInfo mWizardInfo; + protected JComboBox mCANicknameBox, mOCSPNicknameBox, mSSLNicknameBox; + private static final String PANELNAME = "CLONECAKEYCERTWIZARD"; + private static final String CAHELPINDEX = + "install-cacertclone-wizard-help"; + + + WICloneCAKeyCertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + mCANicknameStr = "caSigningCert"; + mSSLNicknameStr = "Server-Cert"; + mOCSPNicknameStr = "ocspSigningCert"; + init(); + } + + WICloneCAKeyCertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + mCANicknameStr = "caSigningCert"; + mSSLNicknameStr = "Server-Cert"; + mOCSPNicknameStr = "ocspSigningCert"; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + mWizardInfo = wizardInfo; + if (!wizardInfo.isCloning()) + return false; + if (!wizardInfo.isCloneCASubsystem()) + return false; + if (wizardInfo.isCACloningDone()) + return false; + if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() + || wizardInfo.isSelfSignedCACertDone() + || wizardInfo.isCACertRequestDone()) + return false; + + setBorder(makeTitledBorder(PANELNAME)); + if (mCANicknameBox.getItemCount() > 0) { + mCANicknameBox.removeAllItems(); + } + + if (mOCSPNicknameBox.getItemCount() > 0) { + mOCSPNicknameBox.removeAllItems(); + } + + if (mSSLNicknameBox.getItemCount() > 0) { + mSSLNicknameBox.removeAllItems(); + } + String certsList = mWizardInfo.getCloneCertsList(); + StringTokenizer t1 = new StringTokenizer(certsList, ";"); + while (t1.hasMoreTokens()) { + String s1 = (String)t1.nextToken(); + if (s1.indexOf(mCANicknameStr) >= 0) + mCANicknameBox.addItem(s1); + } + + StringTokenizer t2 = new StringTokenizer(certsList, ";"); + while (t2.hasMoreTokens()) { + String s1 = (String)t2.nextToken(); + if (s1.indexOf(mSSLNicknameStr) >= 0) + mSSLNicknameBox.addItem(s1); + } + + StringTokenizer t3 = new StringTokenizer(certsList, ";"); + while (t3.hasMoreTokens()) { + String s1 = (String)t3.nextToken(); + if (s1.indexOf(mOCSPNicknameStr) >= 0) + mOCSPNicknameBox.addItem(s1); + } + + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + String canickname = (String)mCANicknameBox.getSelectedItem(); + mCATokenname = Constants.PR_INTERNAL_TOKEN_NAME; + int index = canickname.indexOf(":"); + if (index > -1) { + mCATokenname = canickname.substring(0, index); + } + mWizardInfo.put(ConfigConstants.PR_CLONE_CA_TOKEN_NAME, mCATokenname); + + String ocspnickname = (String)mOCSPNicknameBox.getSelectedItem(); + mOCSPTokenname = Constants.PR_INTERNAL_TOKEN_NAME; + index = ocspnickname.indexOf(":"); + if (index > -1) { + mOCSPTokenname = ocspnickname.substring(0, index); + } + mWizardInfo.put(ConfigConstants.PR_CLONE_OCSP_TOKEN_NAME, mOCSPTokenname); + + String sslnickname = (String)mSSLNicknameBox.getSelectedItem(); + mSSLTokenname = Constants.PR_INTERNAL_TOKEN_NAME; + index = sslnickname.indexOf(":"); + if (index > -1) { + mSSLTokenname = sslnickname.substring(0, index); + } + mWizardInfo.put(ConfigConstants.PR_CLONE_SSL_TOKEN_NAME, mSSLTokenname); + + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CLONING; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_SUBSYSTEM+"="+ConfigConstants.PR_CA; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_CA_TOKEN_NAME+"="+ + mCATokenname; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_CA_NICKNAME+"="+ + mCANicknameBox.getSelectedItem(); + rawData = rawData+"&"+ConfigConstants.PR_CLONE_OCSP_TOKEN_NAME+"="+ + mOCSPTokenname; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_OCSP_NICKNAME+"="+ + mOCSPNicknameBox.getSelectedItem(); + rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_TOKEN_NAME+"="+ + mSSLTokenname; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_NICKNAME+"="+ + mSSLNicknameBox.getSelectedItem(); + + startProgressStatus(); + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String errstr = getErrorMessage(wizardInfo); + if (errstr.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(errstr); + } + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(CAHELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea heading = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(heading, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel caNicknameLbl = makeJLabel("CANICKNAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(caNicknameLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mCANicknameBox = new JComboBox(); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.weightx = 0.0; + gbc.gridwidth = gbc.REMAINDER; + add(mCANicknameBox, gbc); + + CMSAdminUtil.resetGBC(gbc); + JTextArea heading1 = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING1_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(heading1, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel ocspNicknameLbl = makeJLabel("OCSPNICKNAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(ocspNicknameLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mOCSPNicknameBox = new JComboBox(); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.weightx = 0.0; + gbc.gridwidth = gbc.REMAINDER; + add(mOCSPNicknameBox, gbc); + + CMSAdminUtil.resetGBC(gbc); + JTextArea heading2 = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING2_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(heading2, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel sslNicknameLbl = makeJLabel("SSLNICKNAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(sslNicknameLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mSSLNicknameBox = new JComboBox(); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.weightx = 0.0; + gbc.gridwidth = gbc.REMAINDER; + add(mSSLNicknameBox, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + mWizardInfo.setCATokenName(mCATokenname); + mWizardInfo.setOCSPTokenName(mOCSPTokenname); + mWizardInfo.setSSLTokenName(mSSLTokenname); + } + + public void actionPerformed(ActionEvent e) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICloneKRAKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneKRAKeyCertPage.java new file mode 100644 index 000000000..bea79b2e0 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneKRAKeyCertPage.java @@ -0,0 +1,292 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICloneKRAKeyCertPage extends WizardBasePanel implements IWizardPanel { + private String mKRANicknameStr, mStorageNicknameStr, mSSLNicknameStr; + private String mKRATokenname, mStorageTokenname, mSSLTokenname; + protected InstallWizardInfo mWizardInfo; + protected JComboBox mKRANicknameBox, mStorageNicknameBox, mSSLNicknameBox; + private static final String PANELNAME = "CLONEKRAKEYCERTWIZARD"; + private static final String KRAHELPINDEX = + "install-kracertclone-wizard-help"; + + + WICloneKRAKeyCertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + mKRANicknameStr = "kraTransportCert"; + mSSLNicknameStr = "Server-Cert"; + mStorageNicknameStr = "kraStorageCert"; + init(); + } + + WICloneKRAKeyCertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + mKRANicknameStr = "kraTransportCert"; + mSSLNicknameStr = "Server-Cert"; + mStorageNicknameStr = "kraStorageCert"; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + mWizardInfo = wizardInfo; + if (!wizardInfo.isCloning()) + return false; + if (!wizardInfo.isCloneKRASubsystem()) + return false; + if (wizardInfo.isKRACloningDone()) + return false; + + if (!wizardInfo.isKRAInstalled() || + wizardInfo.isKRACertRequestDone()) { + return false; + } + + setBorder(makeTitledBorder(PANELNAME)); + if (mKRANicknameBox.getItemCount() > 0) { + mKRANicknameBox.removeAllItems(); + } + + if (mStorageNicknameBox.getItemCount() > 0) { + mStorageNicknameBox.removeAllItems(); + } + + if (mSSLNicknameBox.getItemCount() > 0) { + mSSLNicknameBox.removeAllItems(); + } + String certsList = mWizardInfo.getCloneCertsList(); + StringTokenizer t1 = new StringTokenizer(certsList, ";"); + while (t1.hasMoreTokens()) { + String s1 = (String)t1.nextToken(); + if (s1.indexOf(mStorageNicknameStr) >= 0) + mStorageNicknameBox.addItem(s1); + } + + StringTokenizer t2 = new StringTokenizer(certsList, ";"); + while (t2.hasMoreTokens()) { + String s1 = (String)t2.nextToken(); + if (s1.indexOf(mSSLNicknameStr) >= 0) + mSSLNicknameBox.addItem(s1); + } + + StringTokenizer t3 = new StringTokenizer(certsList, ";"); + while (t3.hasMoreTokens()) { + String s1 = (String)t3.nextToken(); + if (s1.indexOf(mKRANicknameStr) >= 0) + mKRANicknameBox.addItem(s1); + } + + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + String kranickname = (String)mKRANicknameBox.getSelectedItem(); + mKRATokenname = Constants.PR_INTERNAL_TOKEN_NAME; + int index = kranickname.indexOf(":"); + if (index > -1) { + mKRATokenname = kranickname.substring(0, index); + } + mWizardInfo.put(ConfigConstants.PR_CLONE_KRA_TOKEN_NAME, mKRATokenname); + + String storagenickname = (String)mStorageNicknameBox.getSelectedItem(); + mStorageTokenname = Constants.PR_INTERNAL_TOKEN_NAME; + index = storagenickname.indexOf(":"); + if (index > -1) { + mStorageTokenname = storagenickname.substring(0, index); + } + mWizardInfo.put(ConfigConstants.PR_CLONE_STORAGE_TOKEN_NAME, mStorageTokenname); + + String sslnickname = (String)mSSLNicknameBox.getSelectedItem(); + mSSLTokenname = Constants.PR_INTERNAL_TOKEN_NAME; + index = sslnickname.indexOf(":"); + if (index > -1) { + mSSLTokenname = sslnickname.substring(0, index); + } + mWizardInfo.put(ConfigConstants.PR_CLONE_SSL_TOKEN_NAME, mSSLTokenname); + + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CLONING; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_SUBSYSTEM+"="+ConfigConstants.PR_KRA; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_KRA_TOKEN_NAME+"="+ + mKRATokenname; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_KRA_NICKNAME+"="+ + mKRANicknameBox.getSelectedItem(); + rawData = rawData+"&"+ConfigConstants.PR_CLONE_STORAGE_TOKEN_NAME+"="+ + mStorageTokenname; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_STORAGE_NICKNAME+"="+ + mStorageNicknameBox.getSelectedItem(); + rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_TOKEN_NAME+"="+ + mSSLTokenname; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_NICKNAME+"="+ + mSSLNicknameBox.getSelectedItem(); + + startProgressStatus(); + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String errstr = getErrorMessage(); + if (errstr.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(errstr); + } + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(KRAHELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea heading = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(heading, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel kraNicknameLbl = makeJLabel("KRANICKNAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(kraNicknameLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mKRANicknameBox = new JComboBox(); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.weightx = 0.0; + gbc.gridwidth = gbc.REMAINDER; + add(mKRANicknameBox, gbc); + + CMSAdminUtil.resetGBC(gbc); + JTextArea heading1 = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING1_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(heading1, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel storageNicknameLbl = makeJLabel("STORAGENICKNAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(storageNicknameLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mStorageNicknameBox = new JComboBox(); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.weightx = 0.0; + gbc.gridwidth = gbc.REMAINDER; + add(mStorageNicknameBox, gbc); + + CMSAdminUtil.resetGBC(gbc); + JTextArea heading2 = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING2_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(heading2, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel sslNicknameLbl = makeJLabel("SSLNICKNAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(sslNicknameLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mSSLNicknameBox = new JComboBox(); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.weightx = 0.0; + gbc.gridwidth = gbc.REMAINDER; + add(mSSLNicknameBox, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + mWizardInfo.setKRATokenName(mKRATokenname); + mWizardInfo.setSSLTokenName(mSSLTokenname); + } + + public void actionPerformed(ActionEvent e) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICloneMasterPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneMasterPage.java new file mode 100644 index 000000000..c8498f306 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneMasterPage.java @@ -0,0 +1,409 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; +import javax.swing.*; +import java.awt.*; +import java.util.*; +import java.awt.event.*; + +/** + * Clone CA getting Clone Master connector info. + * + * @author Christina Fu + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ + +class WICloneMasterPage extends WizardBasePanel implements IWizardPanel { + protected JTextField mHostText, mPortText, mPortEEText, mTimeoutText; + protected JLabel mHostLbl, mPortLbl, mPortEELbl, mTimeoutLbl, mTimeunitLbl; + protected JRadioButton mYes, mNo; + protected String mHost, mPort, mPortEE, mTimeout; + protected JTextArea mHeading; + protected Color mActiveColor; + public static final int MAX_PORT = 65535; + public static final int MIN_PORT = 1; + private static final String PANELNAME = "CLONEMASTERWIZARD"; + private static final String HELPINDEX1 = "install-ca-clone-master-wizard-help"; + + private InstallWizardInfo mWizardInfo; + + WICloneMasterPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WICloneMasterPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + mWizardInfo = wizardInfo; + Debug.println("WICloneMasterPage: initializing"); + + if (wizardInfo.isCloneMasterDone()) + return false; + + if (wizardInfo.isCloning()) { + Debug.println("WICloneMasterPage: is cloning"); + setBorder(makeTitledBorder(PANELNAME)); + if (mYes.isSelected()) + enableFields(true, mActiveColor); + else + enableFields(false, getBackground()); + return true; + } + return false; + } + + public boolean validatePanel() { + if (mNo.isSelected()) { + mHost = ""; + mPort = ""; + mPortEE = ""; + mTimeout = ""; + return true; + } + + mHost = mHostText.getText().trim(); + mPort = mPortText.getText().trim(); + mPortEE = mPortEEText.getText().trim(); + mTimeout = mTimeoutText.getText().trim(); + if (mHost.equals("")) { + setErrorMessage("BLANKHOST"); + return false; + } + if (mPort.equals("")) { + setErrorMessage("BLANKPORT"); + return false; + } + if (mPortEE.equals("")) { + setErrorMessage("BLANKPORT"); + return false; + } + if (mTimeout.equals("")) { + setErrorMessage("BLANKTIMEOUT"); + return false; + } + + try { + int portnumber = Integer.parseInt(mPort); + if (portnumber < MIN_PORT || portnumber > MAX_PORT) { + setErrorMessage("OUTOFRANGE"); + return false; + } + int portnumberEE = Integer.parseInt(mPortEE); + if (portnumberEE < MIN_PORT || portnumberEE > MAX_PORT) { + setErrorMessage("OUTOFRANGE"); + return false; + } + } catch (NumberFormatException e) { + setErrorMessage("INVALIDPORT"); + return false; + } + + return true; + } + + public boolean concludePanel(WizardInfo info) { + Debug.println("WICloneMasterPage: in concludePanel"); + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.setCLAHost(mHost); + wizardInfo.setCLAPort(mPort); + wizardInfo.setCLAPortEE(mPortEE); + wizardInfo.setCLATimeout(mTimeout); + ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo(); + CMSConfigCert configCertCgi = new CMSConfigCert(); + configCertCgi.initialize(wizardInfo); + Hashtable data = new Hashtable(); + data.put(ConfigConstants.TASKID,TaskId.TASK_CLONE_MASTER); + data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY); + data.put(ConfigConstants.PR_CERT_INSTANCE_NAME, + consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME)); + data.put(ConfigConstants.PR_DB_BINDDN, wizardInfo.getDBBindDN()); + data.put(ConfigConstants.PR_DB_PWD, wizardInfo.getInternalDBPasswd()); + data.put(ConfigConstants.PR_CLONING_INSTANCE, + wizardInfo.get(ConfigConstants.PR_CLONING_INSTANCE)); + + if (wizardInfo.isCAInstalled()) + data.put(ConfigConstants.PR_CA, ConfigConstants.TRUE); + else + data.put(ConfigConstants.PR_CA, ConfigConstants.FALSE); + + if (wizardInfo.isRAInstalled()) + data.put(ConfigConstants.PR_RA, ConfigConstants.TRUE); + else + data.put(ConfigConstants.PR_RA, ConfigConstants.FALSE); + + if (wizardInfo.isKRAInstalled()) + data.put(ConfigConstants.PR_KRA, ConfigConstants.TRUE); + else + data.put(ConfigConstants.PR_KRA, ConfigConstants.FALSE); + + String services = ""; + if (wizardInfo.isCAInstalled()) { + if (!services.equals("")) + services = services+":"; + services=services+ConfigConstants.PR_CA; + } else { + data.put(ConfigConstants.CA_HOST, wizardInfo.getCMHost()); + data.put(ConfigConstants.CA_PORT, wizardInfo.getCMPort()); + data.put(ConfigConstants.CA_TIMEOUT, wizardInfo.getCMTimeout()); + } + + if (wizardInfo.isRAInstalled()) { + if (!services.equals("")) + services = services+":"; + services=services+ConfigConstants.PR_RA; + } + if (wizardInfo.isKRAInstalled()) { + if (!services.equals("")) + services = services+":"; + services=services+ConfigConstants.PR_KRA; + } else { + // connect to the clone master (CLA) + Debug.println("WICloneMasterPage: Cloning page"); + if (mYes.isSelected()) { + Debug.println("WICloneMasterPage: Cloning page yes selected"); + data.put(ConfigConstants.CLA_HOST, wizardInfo.getCLAHost()); + data.put(ConfigConstants.CLA_PORT, wizardInfo.getCLAPort()); + data.put(ConfigConstants.CLA_PORT_EE, wizardInfo.getCLAPortEE()); + data.put(ConfigConstants.CLA_TIMEOUT, + wizardInfo.getCLATimeout()); + data.put(ConfigConstants.CLONE_CA, ConfigConstants.TRUE); + } else { + Debug.println("WICloneMasterPage: Cloning page yes NOT selected"); + // admin will have to manually add if not through wizard + } + } + + data.put(ConfigConstants.PR_SUBSYSTEMS, services); + wizardInfo.setSubsystems(services); + startProgressStatus(); + CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CONFIGDB"); + boolean ready = configCertCgi.configCert(data); + dlg.setVisible(false); + + endProgressStatus(); + + if (!ready) { + String str = configCertCgi.getErrorMessage(); + if (str.equals("")) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + if (mWizardInfo.isCAInstalled()) { + CMSAdminUtil.help(HELPINDEX1); + } + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JTextArea heading = createTextArea(mResource.getString( + "CLONEMASTERWIZARD_TEXT_ISCLONECA_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(heading, gbc); + + mNo = makeJRadioButton("NO", false); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mNo, gbc); + + mYes = makeJRadioButton("YES", true); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(0,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mYes, gbc); + + ButtonGroup btnGroup = new ButtonGroup(); + btnGroup.add(mNo); + btnGroup.add(mYes); + + mHeading = createTextArea(mResource.getString( + "CLONEMASTERWIZARD_TEXT_HEADING_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(0,4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mHeading, gbc); + + mHostLbl = makeJLabel("HOST"); + CMSAdminUtil.resetGBC(gbc); + gbc.fill = gbc.NONE; + gbc.anchor = gbc.EAST; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + add(mHostLbl, gbc); + + mHostText = makeJTextField(30); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mHostText, gbc); + mActiveColor = mHostText.getBackground(); + + mPortLbl = makeJLabel("PORT"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mPortLbl, gbc); + + mPortText = makeJTextField(10); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mPortText, gbc); + + mPortEELbl = makeJLabel("PORTEE"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mPortEELbl, gbc); + + mPortEEText = makeJTextField(10); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mPortEEText, gbc); + + mTimeoutLbl = makeJLabel("TIMEOUT"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + add(mTimeoutLbl, gbc); + + mTimeoutText = makeJTextField("30", 10); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mTimeoutText, gbc); + + /*mTimeunitLbl = makeJLabel("TIMEUNIT"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + add(mTimeunitLbl, gbc); + */ + + JLabel label = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(label, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } + + public void actionPerformed(ActionEvent e) { + if (mYes.isSelected()) { + enableFields(true, mActiveColor); + } else { + enableFields(false, getBackground()); + } + } + + private void enableFields(boolean enabled, Color color) { + mHeading.setEnabled(enabled); + mHostLbl.setEnabled(enabled); + mPortLbl.setEnabled(enabled); + mPortEELbl.setEnabled(enabled); + mTimeoutLbl.setEnabled(enabled); + mHostText.setEnabled(enabled); + mHostText.setEditable(enabled); + mHostText.setBackground(color); + mPortText.setEnabled(enabled); + mPortText.setEditable(enabled); + mPortText.setBackground(color); + mPortEEText.setEnabled(enabled); + mPortEEText.setEditable(enabled); + mPortEEText.setBackground(color); + mTimeoutText.setEnabled(enabled); + mTimeoutText.setEditable(enabled); + mTimeoutText.setBackground(color); + CMSAdminUtil.repaintComp(mHeading); + CMSAdminUtil.repaintComp(mHostLbl); + CMSAdminUtil.repaintComp(mHostText); + CMSAdminUtil.repaintComp(mPortLbl); + CMSAdminUtil.repaintComp(mPortText); + CMSAdminUtil.repaintComp(mPortEELbl); + CMSAdminUtil.repaintComp(mPortEEText); + CMSAdminUtil.repaintComp(mTimeoutLbl); + CMSAdminUtil.repaintComp(mTimeoutText); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICloneOCSPKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneOCSPKeyCertPage.java new file mode 100644 index 000000000..9061b5f7a --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneOCSPKeyCertPage.java @@ -0,0 +1,237 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICloneOCSPKeyCertPage extends WizardBasePanel implements IWizardPanel { + private String mOCSPNicknameStr, mSSLNicknameStr; + private String mOCSPTokenname, mSSLTokenname; + protected InstallWizardInfo mWizardInfo; + protected JComboBox mOCSPNicknameBox, mSSLNicknameBox; + private static final String PANELNAME = "CLONEOCSPKEYCERTWIZARD"; + private static final String OCSPHELPINDEX = + "install-ocspcertclone-wizard-help"; + + + WICloneOCSPKeyCertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + mSSLNicknameStr = "Server-Cert"; + mOCSPNicknameStr = "ocspSigningCert"; + init(); + } + + WICloneOCSPKeyCertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + mSSLNicknameStr = "Server-Cert"; + mOCSPNicknameStr = "ocspSigningCert"; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + mWizardInfo = wizardInfo; + if (!wizardInfo.isCloning()) + return false; + if (!wizardInfo.isCloneOCSPSubsystem()) + return false; + if (wizardInfo.isOCSPCloningDone()) + return false; + + setBorder(makeTitledBorder(PANELNAME)); + + if (mOCSPNicknameBox.getItemCount() > 0) { + mOCSPNicknameBox.removeAllItems(); + } + + if (mSSLNicknameBox.getItemCount() > 0) { + mSSLNicknameBox.removeAllItems(); + } + String certsList = mWizardInfo.getCloneCertsList(); + StringTokenizer t2 = new StringTokenizer(certsList, ";"); + while (t2.hasMoreTokens()) { + String s1 = (String)t2.nextToken(); + if (s1.indexOf(mSSLNicknameStr) >= 0) + mSSLNicknameBox.addItem(s1); + } + + StringTokenizer t3 = new StringTokenizer(certsList, ";"); + while (t3.hasMoreTokens()) { + String s1 = (String)t3.nextToken(); + if (s1.indexOf(mOCSPNicknameStr) >= 0) + mOCSPNicknameBox.addItem(s1); + } + + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + String ocspnickname = (String)mOCSPNicknameBox.getSelectedItem(); + mOCSPTokenname = Constants.PR_INTERNAL_TOKEN_NAME; + int index = ocspnickname.indexOf(":"); + if (index > -1) { + mOCSPTokenname = ocspnickname.substring(0, index); + } + mWizardInfo.put(ConfigConstants.PR_CLONE_OCSP_TOKEN_NAME, mOCSPTokenname); + + String sslnickname = (String)mSSLNicknameBox.getSelectedItem(); + mSSLTokenname = Constants.PR_INTERNAL_TOKEN_NAME; + index = sslnickname.indexOf(":"); + if (index > -1) { + mSSLTokenname = sslnickname.substring(0, index); + } + mWizardInfo.put(ConfigConstants.PR_CLONE_SSL_TOKEN_NAME, mSSLTokenname); + + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CLONING; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_SUBSYSTEM+"="+ + ConfigConstants.PR_OCSP; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_OCSP_TOKEN_NAME+"="+ + mOCSPTokenname; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_OCSP_NICKNAME+"="+ + mOCSPNicknameBox.getSelectedItem(); + rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_TOKEN_NAME+"="+ + mSSLTokenname; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_NICKNAME+"="+ + mSSLNicknameBox.getSelectedItem(); + + startProgressStatus(); + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String errstr = getErrorMessage(); + if (errstr.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(errstr); + } + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(OCSPHELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea heading1 = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING1_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(heading1, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel ocspNicknameLbl = makeJLabel("OCSPNICKNAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(ocspNicknameLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mOCSPNicknameBox = new JComboBox(); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.weightx = 0.0; + gbc.gridwidth = gbc.REMAINDER; + add(mOCSPNicknameBox, gbc); + + CMSAdminUtil.resetGBC(gbc); + JTextArea heading2 = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING2_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(heading2, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel sslNicknameLbl = makeJLabel("SSLNICKNAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(sslNicknameLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mSSLNicknameBox = new JComboBox(); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.weightx = 0.0; + gbc.gridwidth = gbc.REMAINDER; + add(mSSLNicknameBox, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + mWizardInfo.setOCSPTokenName(mOCSPTokenname); + mWizardInfo.setSSLTokenName(mSSLTokenname); + } + + public void actionPerformed(ActionEvent e) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIClonePage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIClonePage.java new file mode 100644 index 000000000..cdfa23199 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIClonePage.java @@ -0,0 +1,142 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIClonePage extends WizardBasePanel implements IWizardPanel { + + private static final String PANELNAME = "CLONEINSTALLWIZARD"; + private static final String HELPINDEX = + "install-general-intro-wizard-help"; + + WIClonePage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIClonePage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + setBorder(makeTitledBorder(PANELNAME)); + + if //(wizardInfo.isKRACertLocalCA() || !wizardInfo.isInstallCertNow() || + (!wizardInfo.isCloning()||wizardInfo.isClonePageDone()) + return false; + + mAdminFrame = wizardInfo.getAdminFrame(); + + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + cleanUpWizardInfo(wizardInfo); + startProgressStatus(); + Debug.println("WIClonePage:concludePanel() 1"); + + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_MASTER_OR_CLONE; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_SETTING_DONE+"="+ + ConfigConstants.TRUE; + boolean ready = send(rawData, wizardInfo); + + Debug.println("WIClonePage:concludePanel() 2"); + + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str == null) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + }else{ + wizardInfo.setClonePageDone(ConfigConstants.TRUE); + } + + return ready; + } + + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JTextArea desc = createTextArea(mResource.getString( + "CLONEINSTALLWIZARD_TEXT_DESC_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICloneRAKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneRAKeyCertPage.java new file mode 100644 index 000000000..7194ee3cc --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneRAKeyCertPage.java @@ -0,0 +1,242 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICloneRAKeyCertPage extends WizardBasePanel implements IWizardPanel { + private String mRANicknameStr, mSSLNicknameStr; + private String mRATokenname, mSSLTokenname; + protected InstallWizardInfo mWizardInfo; + protected JComboBox mRANicknameBox, mSSLNicknameBox; + private static final String PANELNAME = "CLONERAKEYCERTWIZARD"; + private static final String CAHELPINDEX = + "install-racertclone-wizard-help"; + + + WICloneRAKeyCertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + mRANicknameStr = "raSigningCert"; + mSSLNicknameStr = "Server-Cert"; + init(); + } + + WICloneRAKeyCertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + mRANicknameStr = "raSigningCert"; + mSSLNicknameStr = "Server-Cert"; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + mWizardInfo = wizardInfo; + if (!wizardInfo.isCloning()) + return false; + if (!wizardInfo.isCloneRASubsystem()) + return false; + if (wizardInfo.isRACloningDone()) + return false; + if (!wizardInfo.isRAInstalled() || + wizardInfo.isRACertRequestDone()) + return false; + + setBorder(makeTitledBorder(PANELNAME)); + if (mRANicknameBox.getItemCount() > 0) { + mRANicknameBox.removeAllItems(); + } + + if (mSSLNicknameBox.getItemCount() > 0) { + mSSLNicknameBox.removeAllItems(); + } + String certsList = mWizardInfo.getCloneCertsList(); + StringTokenizer t1 = new StringTokenizer(certsList, ";"); + while (t1.hasMoreTokens()) { + String s1 = (String)t1.nextToken(); + if (s1.indexOf(mRANicknameStr) >= 0) + mRANicknameBox.addItem(s1); + } + + StringTokenizer t2 = new StringTokenizer(certsList, ";"); + while (t2.hasMoreTokens()) { + String s1 = (String)t2.nextToken(); + if (s1.indexOf(mSSLNicknameStr) >= 0) + mSSLNicknameBox.addItem(s1); + } + + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + String ranickname = (String)mRANicknameBox.getSelectedItem(); + mRATokenname = Constants.PR_INTERNAL_TOKEN_NAME; + int index = ranickname.indexOf(":"); + if (index > -1) { + mRATokenname = ranickname.substring(0, index); + } + mWizardInfo.put(ConfigConstants.PR_CLONE_RA_TOKEN_NAME, mRATokenname); + + String sslnickname = (String)mSSLNicknameBox.getSelectedItem(); + mSSLTokenname = Constants.PR_INTERNAL_TOKEN_NAME; + index = sslnickname.indexOf(":"); + if (index > -1) { + mSSLTokenname = sslnickname.substring(0, index); + } + mWizardInfo.put(ConfigConstants.PR_CLONE_SSL_TOKEN_NAME, mSSLTokenname); + + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo(); + CMSConfigCert configCertCgi = new CMSConfigCert(); + configCertCgi.initialize(wizardInfo); + Hashtable data = new Hashtable(); + data.put(ConfigConstants.TASKID,TaskId.TASK_CLONING); + data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY); + data.put(ConfigConstants.PR_SUBSYSTEM, ConfigConstants.PR_RA); + data.put(ConfigConstants.PR_CERT_INSTANCE_NAME, + consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME)); + data.put(ConfigConstants.PR_CLONE_RA_TOKEN_NAME, mRATokenname); + data.put(ConfigConstants.PR_CLONE_RA_NICKNAME, + mRANicknameBox.getSelectedItem()); + data.put(ConfigConstants.PR_CLONE_SSL_TOKEN_NAME, mSSLTokenname); + data.put(ConfigConstants.PR_CLONE_SSL_NICKNAME, + mSSLNicknameBox.getSelectedItem()); + + startProgressStatus(); + boolean ready = configCertCgi.configCert(data); + endProgressStatus(); + + if (!ready) { + String errstr = configCertCgi.getErrorMessage(); + if (errstr.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(errstr); + } + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(CAHELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea heading = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(heading, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel raNicknameLbl = makeJLabel("RANICKNAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(raNicknameLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRANicknameBox = new JComboBox(); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.weightx = 0.0; + gbc.gridwidth = gbc.REMAINDER; + add(mRANicknameBox, gbc); + + CMSAdminUtil.resetGBC(gbc); + JTextArea heading1 = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING1_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(heading1, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel sslNicknameLbl = makeJLabel("SSLNICKNAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(sslNicknameLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mSSLNicknameBox = new JComboBox(); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.weightx = 0.0; + gbc.gridwidth = gbc.REMAINDER; + add(mSSLNicknameBox, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + mWizardInfo.setRATokenName(mRATokenname); + mWizardInfo.setSSLTokenName(mSSLTokenname); + } + + public void actionPerformed(ActionEvent e) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICloneTKSKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneTKSKeyCertPage.java new file mode 100644 index 000000000..baeaaec8d --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICloneTKSKeyCertPage.java @@ -0,0 +1,182 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICloneTKSKeyCertPage extends WizardBasePanel implements IWizardPanel { + private String mSSLNicknameStr, mSSLTokenname; + protected InstallWizardInfo mWizardInfo; + protected JComboBox mSSLNicknameBox; + private static final String PANELNAME = "CLONETKSKEYCERTWIZARD"; + private static final String TKSHELPINDEX = + "install-tkscertclone-wizard-help"; + + + WICloneTKSKeyCertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + mSSLNicknameStr = "Server-Cert"; + init(); + } + + WICloneTKSKeyCertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + mSSLNicknameStr = "Server-Cert"; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + mWizardInfo = wizardInfo; + if (!wizardInfo.isCloning()) + return false; + if (!wizardInfo.isCloneTKSSubsystem()) + return false; + if (wizardInfo.isTKSCloningDone()) + return false; + + setBorder(makeTitledBorder(PANELNAME)); + + if (mSSLNicknameBox.getItemCount() > 0) { + mSSLNicknameBox.removeAllItems(); + } + String certsList = mWizardInfo.getCloneCertsList(); + StringTokenizer t = new StringTokenizer(certsList, ";"); + while (t.hasMoreTokens()) { + String s1 = (String)t.nextToken(); + if (s1.indexOf(mSSLNicknameStr) >= 0) + mSSLNicknameBox.addItem(s1); + } + + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + String sslnickname = (String)mSSLNicknameBox.getSelectedItem(); + mSSLTokenname = Constants.PR_INTERNAL_TOKEN_NAME; + int index = sslnickname.indexOf(":"); + if (index > -1) { + mSSLTokenname = sslnickname.substring(0, index); + } + mWizardInfo.put(ConfigConstants.PR_CLONE_SSL_TOKEN_NAME, mSSLTokenname); + + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CLONING; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_SUBSYSTEM+"="+ConfigConstants.PR_TKS; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_TOKEN_NAME+"="+ + mSSLTokenname; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_SSL_NICKNAME+"="+ + mSSLNicknameBox.getSelectedItem(); + + startProgressStatus(); + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String errstr = getErrorMessage(); + if (errstr.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(errstr); + } + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(TKSHELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea heading = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(heading, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel sslNicknameLbl = makeJLabel("SSLNICKNAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(sslNicknameLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mSSLNicknameBox = new JComboBox(); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.weightx = 0.0; + gbc.gridwidth = gbc.REMAINDER; + add(mSSLNicknameBox, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + mWizardInfo.setSSLTokenName(mSSLTokenname); + } + + public void actionPerformed(ActionEvent e) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIConfigWebServerPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIConfigWebServerPage.java new file mode 100644 index 000000000..ad9e8b4d6 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIConfigWebServerPage.java @@ -0,0 +1,182 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.event.*; +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Web Server Configuration. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIConfigWebServerPage extends WizardBasePanel implements IWizardPanel { + private Color mActiveColor; + private JTextField mServerRootText; + private JTextField mUserIDText; + + private static final String PANELNAME = "WEBSERVERCONFIGWIZARD"; + private static final String HELPINDEX = + "install-webserver-configuration-wizard-help"; + + WIConfigWebServerPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIConfigWebServerPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isWebServerDone()) + return false; + setBorder(makeTitledBorder(PANELNAME)); + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo(); + CMSConfigCert configCertCgi = new CMSConfigCert(); + configCertCgi.initialize(wizardInfo); + Hashtable data = new Hashtable(); + + data.put(ConfigConstants.TASKID,TaskId.TASK_CONFIG_WEB_SERVER); + data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY); + data.put(ConfigConstants.PR_CERT_INSTANCE_NAME, + consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME)); + + data.put(ConfigConstants.PR_WEB_SERVERROOT, + mServerRootText.getText().trim()); + data.put(ConfigConstants.PR_USER_ID, + mUserIDText.getText().trim()); + + startProgressStatus(); + CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CREATEWEBSERVER"); + + boolean ready = configCertCgi.configCert(data); + dlg.setVisible(false); + + endProgressStatus(); + + if (!ready) { + String str = configCertCgi.getErrorMessage(); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea desc = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel serverRootLbl = makeJLabel("SERVERROOT"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(serverRootLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mServerRootText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + //gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mServerRootText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel userIDLbl = makeJLabel("USERID"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(userIDLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mUserIDText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + //gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mUserIDText, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.setWebServerDone(ConfigConstants.TRUE); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WICreateInternalDBPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WICreateInternalDBPage.java new file mode 100644 index 000000000..4aee62e27 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WICreateInternalDBPage.java @@ -0,0 +1,581 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.event.*; +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WICreateInternalDBPage extends WizardBasePanel implements IWizardPanel { + private Color mActiveColor; + private JTextField mPortText, mBindAsText, mInstanceIDText; + private JTextField mRemoteHostText, mRemotePortText, mRemoteBaseDNText; + private JTextField mRemoteBindAsText,mRemotePasswordText, mRemoteDatabaseText; + private JPasswordField mPasswordText, mPasswordAgainText; + private JLabel mBindAsLabel, mPasswordLabel, mPasswordAgainLabel; + private JComboBox mVersionBox; + private JCheckBox mEnable, mSchema; + private JRadioButton mLocal, mRemote; + private static final String PANELNAME = "CREATEINTERNALDBWIZARD"; + private static final String HELPINDEX = + "install-internaldb-configuration-wizard-help"; + private static final String EMPTYSTR = " "; + + WICreateInternalDBPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WICreateInternalDBPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource().equals(mEnable)) { + enableLocalDB(mEnable.isSelected()); + enableRemoteDB(mEnable.isSelected()); + mLocal.setEnabled(mEnable.isSelected()); + mRemote.setEnabled(mEnable.isSelected()); + } else if (e.getSource().equals(mLocal)) { + enableLocalDB(mEnable.isSelected()); + enableRemoteDB(mEnable.isSelected()); + } else if (e.getSource().equals(mRemote)) { + enableLocalDB(mEnable.isSelected()); + enableRemoteDB(mEnable.isSelected()); + } + } + + private void enableLocalDB(boolean e) + { + Color c; + if (e) { + if (mLocal.isSelected()) + c = mActiveColor; + else + c = getBackground(); + } else { + c = getBackground(); + } + mPortText.setEditable(e); + mPortText.setEnabled(e); + mPortText.setBackground(c); + mBindAsText.setEditable(e); + mBindAsText.setEnabled(e); + mBindAsText.setBackground(c); + mInstanceIDText.setEditable(e); + mInstanceIDText.setEnabled(e); + mInstanceIDText.setBackground(c); + mPasswordText.setEditable(e); + mPasswordText.setEnabled(e); + mPasswordText.setBackground(c); + mPasswordAgainText.setEditable(e); + mPasswordAgainText.setEnabled(e); + mPasswordAgainText.setBackground(c); + } + + private void enableRemoteDB(boolean e) { + Color c; + if (e) { + if (mRemote.isSelected()) + c = mActiveColor; + else + c = getBackground(); + } else { + c = getBackground(); + } + mRemoteHostText.setEditable(e); + mRemoteHostText.setEnabled(e); + mRemoteHostText.setBackground(c); + mRemotePortText.setEditable(e); + mRemotePortText.setEnabled(e); + mRemotePortText.setBackground(c); + mRemoteBaseDNText.setEditable(e); + mRemoteBaseDNText.setEnabled(e); + mRemoteBaseDNText.setBackground(c); + mRemoteBindAsText.setEditable(e); + mRemoteBindAsText.setEnabled(e); + mRemoteBindAsText.setBackground(c); + mRemotePasswordText.setEditable(e); + mRemotePasswordText.setEnabled(e); + mRemotePasswordText.setBackground(c); + mRemoteDatabaseText.setEditable(e); + mRemoteDatabaseText.setEnabled(e); + mRemoteDatabaseText.setBackground(c); + mSchema.setEnabled(e); + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (wizardInfo.isCloning() && wizardInfo.isUpdateDBInfoDone()) + return false; + if (wizardInfo.isCloning() && !wizardInfo.isCreateDBDone()) { + setBorder(makeTitledBorder(PANELNAME)); + mEnable.setSelected(true); + mInstanceIDText.setText(wizardInfo.getCloneDBName()); + mPortText.setText(""+wizardInfo.getNextAvailPort()); + mBindAsText.setText(wizardInfo.getDBBindDN()); + mPasswordText.setText(""); + mPasswordAgainText.setText(""); + mRemoteBaseDNText.setText("o=netscapeCertificateServer"); + mRemoteDatabaseText.setText("userRoot"); + mRemoteBindAsText.setText("cn=directory manager"); + enableLocalDB(mEnable.isSelected()); + enableRemoteDB(mEnable.isSelected()); + mLocal.setEnabled(mEnable.isSelected()); + mRemote.setEnabled(mEnable.isSelected()); + return true; + } + + return false; + } + + public boolean validatePanel() { + if (!mEnable.isSelected()) + return true; + if (mLocal.isSelected()) { + String passwd = mPasswordText.getText().trim(); + String passwdAgain = mPasswordAgainText.getText().trim(); + String instanceId = mInstanceIDText.getText().trim(); + String bindAs = mBindAsText.getText().trim(); + String port = mPortText.getText().trim(); + + if (instanceId.equals("") || bindAs.equals("") || + port.equals("")) { + setErrorMessage("BLANKFIELD"); + return false; + } + + if (passwd.equals("") || passwdAgain.equals("")) { + setErrorMessage("BLANKPASSWD"); + return false; + } + if (!passwd.equals(passwdAgain)) { + setErrorMessage("NOTSAMEPASSWD"); + return false; + } + + try { + Integer num = new Integer(mPortText.getText().trim()); + } catch (NumberFormatException e) { + setErrorMessage("NUMBERFORMAT"); + return false; + } + } else { + String host = mRemoteHostText.getText().trim(); + String port = mRemotePortText.getText().trim(); + String baseDN = mRemoteBaseDNText.getText().trim(); + String bindAs = mRemoteBindAsText.getText().trim(); + String passwd = mRemotePasswordText.getText().trim(); + String dbname = mRemoteDatabaseText.getText().trim(); + if (host.equals("") || port.equals("") || bindAs.equals("") || + baseDN.equals("") || dbname.equals("")) { + setErrorMessage("BLANKFIELD"); + return false; + } + if (passwd.equals("")) { + setErrorMessage("BLANKPASSWD"); + return false; + } + try { + Integer num = new Integer(port); + } catch (NumberFormatException e) { + setErrorMessage("NUMBERFORMAT"); + return false; + } + } + + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String rawData = ""; + if (!mEnable.isSelected()) { + rawData = rawData+ConfigConstants.TASKID+"="+TaskId.TASK_UPDATE_DB_INFO; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + boolean ready = send(rawData, wizardInfo); + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + if (mRemote.isSelected()) { + rawData = ConfigConstants.TASKID+"="+TaskId.TASK_ADD_DBSCHEMA_INDEXES; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_HOST+"="+mRemoteHostText.getText().trim(); + rawData = rawData+"&"+ConfigConstants.PR_DB_PORT+"="+mRemotePortText.getText().trim(); + rawData = rawData+"&"+ConfigConstants.PR_DB_BINDDN+"="+mRemoteBindAsText.getText().trim(); + rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+mRemotePasswordText.getText().trim(); + rawData = rawData+"&"+ConfigConstants.PR_DB_NAME+"="+mRemoteBaseDNText.getText().trim(); + rawData = rawData+"&"+ConfigConstants.PR_LDAP_DB_NAME+"="+mRemoteDatabaseText.getText().trim(); + rawData = rawData+"&"+ConfigConstants.PR_DB_SCHEMA+"="+mSchema.isSelected(); + rawData = rawData+"&"+ConfigConstants.PR_DB_MODE+"=remote"; + } else { + rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CREATE_INTERNALDB; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_IS_CLONEDDB_CREATED+"=true"; + rawData = rawData+"&"+ConfigConstants.PR_DB_MODE+"=local"; + rawData = rawData+"&"+ConfigConstants.PR_DB_PORT+"="+mPortText.getText(); + rawData = rawData+"&"+ConfigConstants.PR_DB_BINDDN+"="+mBindAsText.getText(); + rawData = rawData+"&"+ConfigConstants.PR_DB_NAME+"="+mInstanceIDText.getText(); + rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+mPasswordText.getText(); + wizardInfo.setInternalDBPasswd(mPasswordText.getText().trim()); + wizardInfo.setDBBindDN(mBindAsText.getText().trim()); + wizardInfo.setDBName(mInstanceIDText.getText().trim()); + } + + startProgressStatus(); + //CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CREATEDB"); + + boolean ready = send(rawData, wizardInfo); + + if (ready) { + rawData = ConfigConstants.TASKID+"="+TaskId.TASK_TOKEN_INFO; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ; + ready = send(rawData, wizardInfo); + } + //dlg.setVisible(false); + + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea desc = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + CMSAdminUtil.resetGBC(gbc); + mEnable = makeJCheckBox("ENABLE"); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mEnable, gbc); + + CMSAdminUtil.resetGBC(gbc); + mLocal = makeJRadioButton("LOCAL", true); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, 2*COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + add(mLocal, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel instanceIDLbl = makeJLabel("INSTANCEID"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(instanceIDLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mInstanceIDText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + //gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mInstanceIDText, gbc); + mActiveColor = mInstanceIDText.getBackground(); + + CMSAdminUtil.resetGBC(gbc); + JLabel portNumber = makeJLabel("PORT"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, + COMPONENT_SPACE,COMPONENT_SPACE); + add(portNumber, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPortText = makeJTextField(10); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.HORIZONTAL; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(mPortText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mBindAsLabel = makeJLabel("ADMIN"); + //gbc.anchor = gbc.NORTHWEST; + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 2*COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mBindAsLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mBindAsText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + //gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mBindAsText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPasswordLabel = makeJLabel("PWD"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mPasswordLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPasswordText = makeJPasswordField(30); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.HORIZONTAL; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mPasswordText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPasswordAgainLabel = makeJLabel("PWDAGAIN"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mPasswordAgainLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPasswordAgainText = makeJPasswordField(30); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.HORIZONTAL; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mPasswordAgainText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRemote = makeJRadioButton("REMOTE", false); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, 2*COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + add(mRemote, gbc); + + ButtonGroup buttonGroup = new ButtonGroup(); + buttonGroup.add(mLocal); + buttonGroup.add(mRemote); + + CMSAdminUtil.resetGBC(gbc); + JLabel hostLbl = makeJLabel("HOST"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(hostLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRemoteHostText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + //gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRemoteHostText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel portNumber1 = makeJLabel("PORT"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, + COMPONENT_SPACE,COMPONENT_SPACE); + add(portNumber1, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRemotePortText = makeJTextField(10); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.HORIZONTAL; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(mRemotePortText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel baseDNLbl = makeJLabel("BASEDN"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, + COMPONENT_SPACE,COMPONENT_SPACE); + add(baseDNLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRemoteBaseDNText = makeJTextField(30); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.HORIZONTAL; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(mRemoteBaseDNText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel bindAsLabel = makeJLabel("ADMIN"); + //gbc.anchor = gbc.NORTHWEST; + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 2*COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(bindAsLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRemoteBindAsText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + //gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRemoteBindAsText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel passwordLabel = makeJLabel("PWD"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(passwordLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRemotePasswordText = makeJPasswordField(30); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.HORIZONTAL; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRemotePasswordText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel databaseLabel = makeJLabel("DNAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 3*COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(databaseLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRemoteDatabaseText = makeJTextField(30); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.HORIZONTAL; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRemoteDatabaseText, gbc); + + JLabel dummy1 = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(dummy1, gbc); + + CMSAdminUtil.resetGBC(gbc); + mSchema = makeJCheckBox("SCHEMA", true); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mSchema, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.setDBCreated(ConfigConstants.TRUE); + wizardInfo.setDBCreateNow(ConfigConstants.FALSE); + wizardInfo.setCreateDBDone(ConfigConstants.TRUE); + + if (mEnable.isSelected()) + wizardInfo.setCloneDBCreated("true"); + else { + wizardInfo.setUpdateDBInfoDone(ConfigConstants.TRUE); + wizardInfo.setCloneDBCreated("false"); + } + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIDBEnrollPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIDBEnrollPage.java new file mode 100644 index 000000000..d63a07129 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIDBEnrollPage.java @@ -0,0 +1,211 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIDBEnrollPage extends WizardBasePanel implements IWizardPanel { + private JCheckBox mEnable; + private JTextField mHostNameText, mPortText, mBaseDNText; + private JComboBox mVersionBox; + + private static final String PANELNAME = "DBENROLLWIZARD"; + private static final String HELPINDEX = + "configuration-kra-wizard-change-keyscheme-help"; + + WIDBEnrollPage() { + super(PANELNAME); + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea desc = createTextArea( + CMSAdminUtil.wrapText(mResource.getString( + "DBENROLLWIZARD_TEXT_HEADING_LABEL"), 80), 1, 80); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + CMSAdminUtil.resetGBC(gbc); + mEnable = makeJCheckBox("ENABLE"); + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mEnable, gbc); + + JPanel panel = new JPanel(); + panel.setBorder(CMSAdminUtil.makeTitledBorder(mResource, + PANELNAME, "DESTINATION")); + GridBagLayout gb1 = new GridBagLayout(); + panel.setLayout(gb1); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.weighty = 1.0; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + add(panel, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel hostName = makeJLabel("HOST"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + panel.add(hostName, gbc); + + CMSAdminUtil.resetGBC(gbc); + mHostNameText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + panel.add(mHostNameText, gbc); + +/* + CMSAdminUtil.resetGBC(gbc); + JTextArea dummy = createTextArea(" ", 2, 5); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + add(dummy, gbc); +*/ + + CMSAdminUtil.resetGBC(gbc); + JLabel portNumber = makeJLabel("PORT"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + panel.add(portNumber, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPortText = makeJTextField(10); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + panel.add(mPortText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel versionLbl = makeJLabel("VERSION"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(versionLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mVersionBox = makeJComboBox("VERSION"); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(mVersionBox, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel dummy = new JLabel(" "); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(dummy, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel baseDNLbl = makeJLabel("BASEDN"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.gridheight = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(baseDNLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mBaseDNText = makeJTextField(20); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(mBaseDNText, gbc); + +/* + CMSAdminUtil.resetGBC(gbc); + JTextArea dummy1 = createTextArea(" ", 2, 30); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + add(dummy1, gbc); +*/ + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayCACertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayCACertPage.java new file mode 100644 index 000000000..442fa2b29 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayCACertPage.java @@ -0,0 +1,75 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; +import com.netscape.certsrv.common.*; + +/** + * The panel displays the certificate which will be installed in the token. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIDisplayCACertPage extends WIDisplayCertPage { + private static final String PANELNAME = "INSTALLDISPLAYCACERTWIZARD"; + private static final String CAHELPINDEX = "install-cacert-display-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakracert-display-wizard-help"; + + WIDisplayCACertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIDisplayCACertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) + return false; + + if (wizardInfo.isCACertLocalCA() || !wizardInfo.isInstallCertNow() || + !wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() || + wizardInfo.isCACertInstalledDone()) + return false; + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else + mHelpIndex = CAHELPINDEX; + return super.initializePanel(info); + } + + public boolean concludePanel(WizardInfo info) { + if (super.concludePanel(info)) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.put(ConfigConstants.STAGE_CA_CERT_REQUEST, + ConfigConstants.TRUE); + return true; + } + + return false; + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayCertPage.java new file mode 100644 index 000000000..30e0bac13 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayCertPage.java @@ -0,0 +1,205 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.management.client.util.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * This page is to install the certificate in the internal token. It + * displays the certificate information. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIDisplayCertPage extends WizardBasePanel implements IWizardPanel { + private JTextArea mTextArea; + private JTextField mCertNameField; + protected String mPanelName; + protected String mHelpIndex; + + WIDisplayCertPage(String panelName) { + super(panelName); + mPanelName = panelName; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + setBorder(makeTitledBorder(mPanelName)); + String content = wizardInfo.getCertContent(); + String certOrder = wizardInfo.getCertOrder(); + String str = reformat(content, certOrder); + mTextArea.setText(str); + mCertNameField.setEditable(false); + mCertNameField.setBackground(getBackground()); + String tokenName = null; + String certType = wizardInfo.getCertType(); + if (certType != null) { + if (certType.equalsIgnoreCase(Constants.PR_CA_SIGNING_CERT)) { + tokenName = wizardInfo.getCATokenName(); + } else if (certType.equalsIgnoreCase(Constants.PR_RA_SIGNING_CERT)) { + tokenName = wizardInfo.getRATokenName(); + } else if (certType.equalsIgnoreCase(Constants.PR_OCSP_SIGNING_CERT)) { + tokenName = wizardInfo.getOCSPTokenName(); + } else if (certType.equalsIgnoreCase(Constants.PR_KRA_TRANSPORT_CERT)) { + tokenName = wizardInfo.getKRATokenName(); + } else if (certType.equalsIgnoreCase(Constants.PR_SERVER_CERT)) { + tokenName = wizardInfo.getSSLTokenName(); + } else { + Debug.println("WIDisplayCertPage: unrecognized certType: "+ + certType); + } + } + if ((tokenName != null) && + !(tokenName.equalsIgnoreCase(Constants.PR_INTERNAL_TOKEN_NAME))) { + Debug.println("tokenName="+tokenName); + mCertNameField.setText(tokenName+":"+wizardInfo.getNickname()); + } else { + Debug.println("tokenName=null"); + mCertNameField.setText(wizardInfo.getNickname()); + } + return true; + } + + private String reformat(String content, String certOrder) { + StringBuffer buffer = new StringBuffer(content); + StringTokenizer tokenizer = new StringTokenizer(certOrder, ":"); + int len = 0; + while (tokenizer.hasMoreTokens()) { + String str = (String)tokenizer.nextToken(); + int index = len+Integer.parseInt(str); + if (index >= buffer.length()) + break; + buffer.insert(index, "\n"); + len = index+1; + } + return buffer.toString(); + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_INSTALL_CERT; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + String val = wizardInfo.getPKCS10(); + if (val == null) { + rawData = rawData+"&"+Constants.PR_CERT_FILEPATH+"="+ + wizardInfo.getCertFilePath(); + } else { + rawData = rawData+"&"+Constants.PR_PKCS10+"="+ + wizardInfo.getPKCS10(); + } + rawData = rawData+"&"+Constants.PR_CERTIFICATE_TYPE+"="+wizardInfo.getCertType(); + rawData = rawData+"&"+Constants.PR_NICKNAME+"="+wizardInfo.getNickname(); + if (wizardInfo.getInternalDBPasswd() != null) + rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+wizardInfo.getInternalDBPasswd(); + + startProgressStatus(); + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(); + if (str.equals("")) { + String errorMsg = mResource.getString( + mPanelName+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JLabel label1 = makeJLabel("NAME"); + gbc.fill = gbc.NONE; + gbc.anchor = gbc.WEST; + gbc.insets = new Insets(COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE); + add(label1, gbc); + + CMSAdminUtil.resetGBC(gbc); + mCertNameField = new JTextField(30); + gbc.gridwidth = gbc.REMAINDER; + gbc.anchor = gbc.WEST; + gbc.weightx=1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + add(mCertNameField, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel certLbl = makeJLabel("CONTENT"); + gbc.gridwidth = gbc.REMAINDER; + gbc.anchor = gbc.WEST; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + add(certLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mTextArea = new JTextArea("",100,90); + mTextArea.setEditable(false); + mTextArea.setBackground(getBackground()); + JScrollPane scrollPanel = new JScrollPane(mTextArea, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollPanel.setAlignmentX(LEFT_ALIGNMENT); + scrollPanel.setAlignmentY(TOP_ALIGNMENT); + scrollPanel.setBorder(BorderFactory.createLoweredBevelBorder()); + gbc.fill = gbc.BOTH; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weightx=1.0; + gbc.weighty=1.0; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(scrollPanel, gbc); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayKRACertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayKRACertPage.java new file mode 100644 index 000000000..cae06e6cf --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayKRACertPage.java @@ -0,0 +1,77 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; +import com.netscape.certsrv.common.*; + +/** + * The panel displays the certificate which will be installed in the token. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIDisplayKRACertPage extends WIDisplayCertPage { + private static final String PANELNAME = "INSTALLDISPLAYKRACERTWIZARD"; + private static final String KRAHELPINDEX = "install-kracert-display-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakra-kracert-display-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakra-kracert-display-wizard-help"; + + WIDisplayKRACertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIDisplayKRACertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) + return false; + if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isInstallCertNow() || + !wizardInfo.isKRAInstalled() || wizardInfo.isKRACertInstalledDone()) + return false; + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = KRAHELPINDEX; + + return super.initializePanel(info); + } + + public boolean concludePanel(WizardInfo info) { + if (super.concludePanel(info)) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.put(ConfigConstants.STAGE_KRA_CERT_REQUEST, + ConfigConstants.TRUE); + return true; + } + + return false; + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayOCSPCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayOCSPCertPage.java new file mode 100644 index 000000000..e9db0e436 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayOCSPCertPage.java @@ -0,0 +1,71 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; +import com.netscape.certsrv.common.*; +import com.netscape.management.client.util.*; + +/** + * The panel displays the certificate which will be installed in the token. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIDisplayOCSPCertPage extends WIDisplayCertPage { + private static final String PANELNAME = "INSTALLDISPLAYOCSPCERTWIZARD"; + private static final String OCSPHELPINDEX = "install-ocspcert-display-wizard-help"; + + WIDisplayOCSPCertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIDisplayOCSPCertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone()) + return false; + + if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isInstallCertNow() || + !wizardInfo.isOCSPInstalled() || wizardInfo.isOCSPCertInstalledDone()) + return false; + + mHelpIndex = OCSPHELPINDEX; + return super.initializePanel(info); + } + + public boolean concludePanel(WizardInfo info) { + if (super.concludePanel(info)) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.put(ConfigConstants.STAGE_OCSP_CERT_REQUEST, + ConfigConstants.TRUE); + return true; + } + + return false; + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayRACertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayRACertPage.java new file mode 100644 index 000000000..891e68038 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplayRACertPage.java @@ -0,0 +1,73 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; +import com.netscape.certsrv.common.*; + +/** + * The panel displays the certificate which will be installed in the token. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIDisplayRACertPage extends WIDisplayCertPage { + private static final String PANELNAME = "INSTALLDISPLAYRACERTWIZARD"; + private static final String RAHELPINDEX = "install-racert-display-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakracert-display-wizard-help"; + + WIDisplayRACertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIDisplayRACertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isRACloningDone()) + return false; + if (wizardInfo.isRACertLocalCA() || !wizardInfo.isInstallCertNow() || + !wizardInfo.isRAInstalled() || wizardInfo.isRACertInstalledDone()) + return false; + + if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = RAHELPINDEX; + return super.initializePanel(info); + } + + public boolean concludePanel(WizardInfo info) { + if (super.concludePanel(info)) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.put(ConfigConstants.STAGE_RA_CERT_REQUEST, + ConfigConstants.TRUE); + return true; + } + + return false; + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplaySSLCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplaySSLCertPage.java new file mode 100644 index 000000000..3a791b4ed --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIDisplaySSLCertPage.java @@ -0,0 +1,70 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; +import com.netscape.certsrv.common.*; + +/** + * The panel displays the certificate which will be installed in the token. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIDisplaySSLCertPage extends WIDisplayCertPage { + private static final String PANELNAME = "INSTALLDISPLAYSSLCERTWIZARD"; + private static final String HELPINDEX = "install-sslcert-display-wizard-help"; + + WIDisplaySSLCertPage(JDialog parent) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = parent; + } + + WIDisplaySSLCertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning()) + return false; + if (wizardInfo.isSSLCertLocalCA() || !wizardInfo.isInstallCertNow() || + wizardInfo.isMigrationEnable() || wizardInfo.isSSLCertInstalledDone()) + return false; + + return super.initializePanel(info); + } + + public boolean concludePanel(WizardInfo info) { + if (super.concludePanel(info)) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.put(ConfigConstants.STAGE_SSL_CERT_REQUEST, + ConfigConstants.TRUE); + return true; + } + + return false; + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIExistingDBPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIExistingDBPage.java new file mode 100644 index 000000000..93bbde830 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIExistingDBPage.java @@ -0,0 +1,282 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.event.*; +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * This panel is for cloning. It lets the user to enter the configuration + * information for the master database. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIExistingDBPage extends WizardBasePanel implements IWizardPanel { + private JTextField mRMPortText, mRMBindAsText, mRMHostText; + private JTextField mRMBaseDNText; + private JPasswordField mRMPasswordText; + + private static final String PANELNAME = "EXISTINGDBWIZARD"; + private static final String HELPINDEX = + "install-internaldb-configuration-wizard-help"; + private static final String EMPTYSTR = " "; + + WIExistingDBPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIExistingDBPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public void actionPerformed(ActionEvent e) { + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (wizardInfo.isCloning() && !wizardInfo.isConnectDBDone()) { + setBorder(makeTitledBorder(PANELNAME)); + mRMBindAsText.setText(wizardInfo.getDBBindDN()); + return true; + } + + return false; + } + + public boolean validatePanel() { + String rmhostname = mRMHostText.getText().trim(); + String rmport = mRMPortText.getText().trim(); + String rmbindDN = mRMBindAsText.getText().trim(); + String rmpasswd = mRMPasswordText.getText().trim(); + + if (rmhostname.equals("")) { + setErrorMessage("EMPTYHOST"); + return false; + } + + if (rmport.equals("")) { + setErrorMessage("EMPTYPORT"); + return false; + } + + if (rmbindDN.equals("")) { + setErrorMessage("EMPTYBINDDN"); + return false; + } + + if (rmpasswd.equals("")) { + setErrorMessage("EMPTYPASSWD"); + return false; + } + + try { + Integer num = new Integer(rmport); + } catch (NumberFormatException e) { + setErrorMessage("NUMBERFORMAT"); + return false; + } + + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + cleanUpWizardInfo(wizardInfo); + + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CREATE_INTERNALDB; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_DB_MODE+"=remote"; + rawData = rawData+"&"+ConfigConstants.PR_HOST+"="+mRMHostText.getText(); + rawData = rawData+"&"+ConfigConstants.PR_DB_PORT+"="+mRMPortText.getText(); + rawData = rawData+"&"+ConfigConstants.PR_DB_BINDDN+"="+mRMBindAsText.getText(); + rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+mRMPasswordText.getText(); + rawData = rawData+"&"+ConfigConstants.PR_DB_NAME+"="+mRMBaseDNText.getText(); + wizardInfo.setInternalDBPasswd(mRMPasswordText.getText().trim()); + wizardInfo.setDBBindDN(mRMBindAsText.getText().trim()); + + startProgressStatus(); + //CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CONNECTDB"); + + boolean ready = send(rawData, wizardInfo); + + if (ready) { + rawData = ConfigConstants.TASKID+"="+TaskId.TASK_TOKEN_INFO; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ; + ready = send(rawData, wizardInfo); + } + //dlg.setVisible(false); + + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea desc = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel instanceIDLbl = makeJLabel("REMOTEHOST"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(instanceIDLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMHostText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + //gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMHostText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel portNumber = makeJLabel("REMOTEPORT"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, + COMPONENT_SPACE,COMPONENT_SPACE); + add(portNumber, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMPortText = makeJTextField(10); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.HORIZONTAL; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(mRMPortText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel mRMBindAsLabel = makeJLabel("REMOTEADMIN"); + //gbc.anchor = gbc.NORTHWEST; + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMBindAsLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMBindAsText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + //gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMBindAsText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel mRMPasswordLabel = makeJLabel("REMOTEPWD"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMPasswordLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMPasswordText = makeJPasswordField(30); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.HORIZONTAL; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMPasswordText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel mRMBaseDNLabel = makeJLabel("REMOTEBASEDN"); + //gbc.anchor = gbc.NORTHWEST; + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMBaseDNLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMBaseDNText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + //gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMBaseDNText, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.setDBCreated(ConfigConstants.TRUE); + wizardInfo.setDBCreateNow(ConfigConstants.FALSE); + wizardInfo.setConnectDBDone(ConfigConstants.TRUE); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenCAKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenCAKeyCertPage.java new file mode 100644 index 000000000..2bbb2f570 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenCAKeyCertPage.java @@ -0,0 +1,68 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Generate the CA signing certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.keycert + */ +class WIGenCAKeyCertPage extends WIGenKeyCertPage { + private static final String PANELNAME = "INSTALLGENCAWIZARD"; + private static final String CAHELPINDEX = "install-cacert-creation-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakracert-creation-wizard-help"; + + WIGenCAKeyCertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIGenCAKeyCertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) + return false; + + if (!wizardInfo.isCACertLocalCA() || !wizardInfo.isCAInstalled() || + wizardInfo.isMigrationEnable() || wizardInfo.isSelfSignedCACertDone() || + wizardInfo.isCACertRequestDone() || wizardInfo.isCACertInstalledDone()) + return false; + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else + mHelpIndex = CAHELPINDEX; + + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenCAKeyCertReqPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenCAKeyCertReqPage.java new file mode 100644 index 000000000..c1f3c11ea --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenCAKeyCertReqPage.java @@ -0,0 +1,80 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Generate the CA signing certificate request + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIGenCAKeyCertReqPage extends WIGenKeyCertReqPage { + private static final String PANELNAME = "INSTALLGENCACERTREQWIZARD"; + private static final String CAHELPINDEX = "install-cacert-request-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakracert-request-wizard-help"; + + WIGenCAKeyCertReqPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIGenCAKeyCertReqPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) + return false; + + if (wizardInfo.isCACertLocalCA() || !wizardInfo.isCAInstalled() || + wizardInfo.isMigrationEnable() || wizardInfo.isSelfSignedCACertDone() + || (wizardInfo.isCACertRequestDone() && + !wizardInfo.isCACertRequestBack()) || + wizardInfo.isCACertInstalledDone()) + return false; + + if (wizardInfo.isCACertRequestBack()) { + wizardInfo.put(ConfigConstants.STAGE_CA_CERT_REQUEST, + ConfigConstants.FALSE); + wizardInfo.put(ConfigConstants.CA_CERT_REQUEST_BACK, + ConfigConstants.FALSE); + } + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else + mHelpIndex = CAHELPINDEX; + + mTokenName = wizardInfo.getCATokenName(); + wizardInfo.setCertType(Constants.PR_CA_SIGNING_CERT); + wizardInfo.setNewRequest(); + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertPage.java new file mode 100644 index 000000000..98ef24812 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertPage.java @@ -0,0 +1,70 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Generate the KRA transport certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.keycert + */ +class WIGenKRAKeyCertPage extends WIGenKeyCertPage { + private static final String PANELNAME = "INSTALLGENKRAWIZARD"; + private static final String KRAHELPINDEX = "install-kracert-creation-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakracert-creation-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakra-kracert-creation-wizard-help"; + + WIGenKRAKeyCertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIGenKRAKeyCertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) + return false; + if (!wizardInfo.isKRACertLocalCA() || !wizardInfo.isKRAInstalled() || + wizardInfo.isKRALocalCertDone() || wizardInfo.isKRACertRequestDone() || + wizardInfo.isKRACertInstalledDone()) + return false; + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = KRAHELPINDEX; + + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertReqPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertReqPage.java new file mode 100644 index 000000000..f6e5df9fe --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKRAKeyCertReqPage.java @@ -0,0 +1,82 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Generate the KRA signing certificate request + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIGenKRAKeyCertReqPage extends WIGenKeyCertReqPage { + private static final String PANELNAME = "INSTALLGENKRACERTREQWIZARD"; + private static final String KRAHELPINDEX = "install-kracert-request-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakra-kracert-request-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakra-kracert-request-wizard-help"; + + WIGenKRAKeyCertReqPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIGenKRAKeyCertReqPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) + return false; + if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isKRAInstalled() || + (wizardInfo.isKRACertRequestDone() && + !wizardInfo.isKRACertRequestBack()) || + wizardInfo.isKRALocalCertDone() || + wizardInfo.isKRACertInstalledDone()) + return false; + + if (wizardInfo.isCACertRequestBack()) { + wizardInfo.put(ConfigConstants.STAGE_KRA_CERT_REQUEST, + ConfigConstants.FALSE); + wizardInfo.put(ConfigConstants.KRA_CERT_REQUEST_BACK, + ConfigConstants.FALSE); + } + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = KRAHELPINDEX; + + mTokenName = wizardInfo.getKRATokenName(); + wizardInfo.setCertType(Constants.PR_KRA_TRANSPORT_CERT); + wizardInfo.setNewRequest(); + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertPage.java new file mode 100644 index 000000000..8272d44df --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertPage.java @@ -0,0 +1,143 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Generate the certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.keycert + */ +class WIGenKeyCertPage extends WizardBasePanel implements IWizardPanel { + private JTextArea desc; + private String mPanelName; + protected String mHelpIndex; + + WIGenKeyCertPage(String panelName) { + super(panelName); + mPanelName = panelName; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + setBorder(makeTitledBorder(mPanelName)); + + String str = mResource.getString(mPanelName+"_TEXT_NEWKEY_LABEL"); + desc.setText(str); + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + NameValuePairs nvps = wizardInfo.getAllCertInfo(); + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CREATE_CERT; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_HASH_TYPE+"="+wizardInfo.getHashType(); + if (wizardInfo.getCertType().equals(Constants.PR_CA_SIGNING_CERT)) { + String OComp = wizardInfo.getCAOComp(); + if (OComp != null && !OComp.equals("")) { + rawData = rawData+"&"+ConfigConstants.PR_CA_O_COMPONENT+"="+ + wizardInfo.getCAOComp(); + } + String CComp = wizardInfo.getCACComp(); + if (CComp != null && !CComp.equals("")) + rawData = rawData+"&"+ConfigConstants.PR_CA_C_COMPONENT+"="+ + wizardInfo.getCACComp(); + } + + // testing, please remove after finish testing + if (wizardInfo.getInternalDBPasswd() != null) + rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+wizardInfo.getInternalDBPasswd(); + + if (nvps != null) { + for (String name : nvps.keySet()) { + String value = nvps.get(name); + rawData = rawData+"&"+name+"="+value; + } + } + + startProgressStatus(); + + //CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CREATECERT"); + + boolean ready = send(rawData, wizardInfo); + + //dlg.setVisible(false); + + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(); + if (str.equals("")) { + String errorMsg = mResource.getString( + mPanelName+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + +/* + desc = new JTextArea(2, 80); + desc.setBackground(getBackground()); + desc.setEditable(false); + desc.setCaretColor(getBackground()); +*/ + desc = createTextArea(""); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertReqPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertReqPage.java new file mode 100644 index 000000000..b5c0378c3 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenKeyCertReqPage.java @@ -0,0 +1,291 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Generate the certificate request + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIGenKeyCertReqPage extends WizardBasePanel implements IWizardPanel { + private JTextArea desc; + private String mPanelName; + private static final String CERTREQ_BEGIN_HEADING = + "-----BEGIN NEW CERTIFICATE REQUEST-----"; + private static final String CERTREQ_END_HEADING = + "-----END NEW CERTIFICATE REQUEST-----"; + private static final int LINE_COUNT = 76; + protected String mHelpIndex; + protected String mTokenName; + + protected JRadioButton mPKCS10; + protected JRadioButton mCMC; + protected String mSigningCert = null; + + WIGenKeyCertReqPage(String panelName) { + super(panelName); + mPanelName = panelName; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + setBorder(makeTitledBorder(mPanelName)); + + String str = mResource.getString(mPanelName+"_TEXT_NEWKEY_LABEL"); + desc.setText(str); + // check subject key identifier to enable cmc or not + NameValuePairs nvps = + (NameValuePairs)wizardInfo.get(wizardInfo.ALL_CERT_INFO); + if (nvps != null) { + str = (String)nvps.get(Constants.PR_SKI); + if (str != null && str.equals(ConfigConstants.TRUE)) { + mCMC.setEnabled(true); + mCMC.setVisible(true); + mPKCS10.setVisible(true); + } else if (str == null || str.equals(ConfigConstants.FALSE)){ + mCMC.setEnabled(false); + mCMC.setVisible(false); + mPKCS10.setVisible(false); + } + CMSAdminUtil.repaintComp(mCMC); + CMSAdminUtil.repaintComp(mPKCS10); + } + // check if a signing cert installed + String type = wizardInfo.getCertType(); + if (!mCMC.isEnabled() && + (type.equals(Constants.PR_SERVER_CERT) || + type.equals(Constants.PR_KRA_TRANSPORT_CERT)) ) { + if (wizardInfo.isCAInstalled() && + wizardInfo.isCACertInstalledDone()) { + mSigningCert = Constants.PR_CA_SIGNING_CERT; + mCMC.setEnabled(true); + mCMC.setVisible(true); + CMSAdminUtil.repaintComp(mCMC); + mPKCS10.setVisible(true); + CMSAdminUtil.repaintComp(mPKCS10); + } else if (wizardInfo.isRAInstalled() && + wizardInfo.isRACertInstalledDone()) { + mSigningCert = Constants.PR_RA_SIGNING_CERT; + mCMC.setEnabled(true); + mCMC.setVisible(true); + CMSAdminUtil.repaintComp(mCMC); + mPKCS10.setVisible(true); + CMSAdminUtil.repaintComp(mPKCS10); + } else if (wizardInfo.isKRAInstalled() && + wizardInfo.isKRACertInstalledDone()) { + mSigningCert = Constants.PR_KRA_TRANSPORT_CERT; + mCMC.setEnabled(true); + mCMC.setVisible(true); + CMSAdminUtil.repaintComp(mCMC); + mPKCS10.setVisible(true); + CMSAdminUtil.repaintComp(mPKCS10); + } else if (wizardInfo.isOCSPInstalled() && + wizardInfo.isOCSPCertInstalledDone()) { + mSigningCert = Constants.PR_OCSP_SIGNING_CERT; + mCMC.setEnabled(true); + mCMC.setVisible(true); + CMSAdminUtil.repaintComp(mCMC); + mPKCS10.setVisible(true); + CMSAdminUtil.repaintComp(mPKCS10); + } + } + + if (type.equals(Constants.PR_OCSP_SIGNING_CERT)) { + mCMC.setEnabled(false); + mCMC.setVisible(false); + CMSAdminUtil.repaintComp(mCMC); + mPKCS10.setVisible(false); + CMSAdminUtil.repaintComp(mPKCS10); + } + + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CERT_REQUEST; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + + if (wizardInfo.getSubjectName() == null) { + setErrorMessage("Subject Name is not available. Please redo all the request generation procedure. "); + return false; + } + rawData = rawData+"&"+Constants.PR_SUBJECT_NAME+"="+wizardInfo.getSubjectName(); + if (mTokenName == null) { + setErrorMessage("Token Name is not available. Please redo all the request generation procedure. "); + return false; + } + rawData = rawData+"&"+Constants.PR_TOKEN_NAME+"="+mTokenName; + if (wizardInfo.getKeyLength() == null) { + setErrorMessage("Key Length is not available. Please redo all the request generation procedure. "); + return false; + } + rawData = rawData+"&"+Constants.PR_KEY_LENGTH+"="+wizardInfo.getKeyLength(); + if (wizardInfo.getKeyType() == null) { + setErrorMessage("Key Type is not available. Please redo all the request generation procedure. "); + return false; + } + rawData = rawData+"&"+Constants.PR_KEY_TYPE+"="+wizardInfo.getKeyType(); + if (wizardInfo.getCertType() == null) { + setErrorMessage("CertType is not available. Please redo all the request generation procedure. "); + return false; + } + rawData = rawData+"&"+Constants.PR_CERTIFICATE_TYPE+"="+wizardInfo.getCertType(); + + NameValuePairs nvps = wizardInfo.getAllCertInfo();//extensions + if (nvps != null) { + for (String name : nvps.keySet()) { + String value = nvps.get(name); + if (name != null && value != null) + rawData = rawData+"&"+name+"="+value; + } + } + + if (mSigningCert != null) { + rawData = rawData+"&"+"signing_cert="+mSigningCert; + } + + if (mPKCS10.isSelected()) { + rawData = rawData+"&"+wizardInfo.getCertType()+ConfigConstants.PR_REQUEST_FORMAT+ + "="+ConfigConstants.PR_REQUEST_PKCS10; + } else if (mCMC.isSelected()) { + rawData = rawData+"&"+wizardInfo.getCertType()+ConfigConstants.PR_REQUEST_FORMAT+"="+ConfigConstants.PR_REQUEST_CMC; + } + + startProgressStatus(); + //CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CREATEREQ"); + boolean ready = send(rawData, wizardInfo); + if (ready) { + String pkcs = wizardInfo.getCertRequest(); + wizardInfo.setCertRequest(reformat(pkcs)); + } + //dlg.setVisible(false); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(); + if (str.equals("")) { + String errorMsg = mResource.getString( + mPanelName+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + private String reformat(String pkcs) { + int beginIndex = CERTREQ_BEGIN_HEADING.length(); + int endIndex = CERTREQ_END_HEADING.length(); + int totalLen = pkcs.length(); + String content = pkcs.substring(beginIndex, totalLen-endIndex); + String result = CERTREQ_BEGIN_HEADING+"\n"; + int index = 0; + while (content.length() >= LINE_COUNT) { + result = result+content.substring(0, LINE_COUNT)+"\n"; + content = content.substring(LINE_COUNT); + } + if (content.length() > 0) { + result = result+content+"\n"+CERTREQ_END_HEADING; + } else { + result = result+CERTREQ_END_HEADING; + } + + return result; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + +/* + desc = new JTextArea(2, 80); + desc.setBackground(getBackground()); + desc.setEditable(false); + desc.setCaretColor(getBackground()); +*/ + desc = createTextArea(""); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + //gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + mPKCS10 = makeJRadioButton("PKCS10", true); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mPKCS10, gbc); + + mCMC = makeJRadioButton("CMC", false); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mCMC, gbc); + + ButtonGroup group = new ButtonGroup(); + group.add(mCMC); + group.add(mPKCS10); + + CMSAdminUtil.resetGBC(gbc); + JLabel d1 = new JLabel(" "); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridheight = gbc.REMAINDER; + gbc.gridwidth = gbc.REMAINDER; + add(d1, gbc); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertPage.java new file mode 100644 index 000000000..2e2fbdbed --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertPage.java @@ -0,0 +1,62 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.management.client.util.*; + +/** + * Generate the OCSP signing certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.keycert + */ +class WIGenOCSPKeyCertPage extends WIGenKeyCertPage { + private static final String PANELNAME = "INSTALLGENOCSPWIZARD"; + private static final String OCSPHELPINDEX = "install-ocspcert-creation-wizard-help"; + + WIGenOCSPKeyCertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIGenOCSPKeyCertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + +Debug.println("+++++++++++++++++++++++++++++=WIGenOCSPKeyCertPage "); + if (!wizardInfo.isOCSPInstalled()) + return false; + + mHelpIndex = OCSPHELPINDEX; + + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertReqPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertReqPage.java new file mode 100644 index 000000000..7c27f673d --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenOCSPKeyCertReqPage.java @@ -0,0 +1,77 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.management.client.util.*; + +/** + * Generate the OCSP signing certificate request + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIGenOCSPKeyCertReqPage extends WIGenKeyCertReqPage { + private static final String PANELNAME = "INSTALLGENOCSPCERTREQWIZARD"; + private static final String OCSPHELPINDEX = "install-ocspcert-request-wizard-help"; + + WIGenOCSPKeyCertReqPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIGenOCSPKeyCertReqPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone()) + return false; + + if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isOCSPInstalled() || + (wizardInfo.isOCSPCertRequestDone() && + !wizardInfo.isOCSPCertRequestBack()) || + wizardInfo.isOCSPLocalCertDone() || + wizardInfo.isOCSPCertInstalledDone()) + return false; + + if (wizardInfo.isOCSPCertRequestBack()) { + wizardInfo.put(ConfigConstants.STAGE_OCSP_CERT_REQUEST, + ConfigConstants.FALSE); + wizardInfo.put(ConfigConstants.OCSP_CERT_REQUEST_BACK, + ConfigConstants.FALSE); + } + + mHelpIndex = OCSPHELPINDEX; + + mTokenName = wizardInfo.getOCSPTokenName(); + wizardInfo.setCertType(Constants.PR_OCSP_SIGNING_CERT); + wizardInfo.setNewRequest(); + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenRAKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenRAKeyCertPage.java new file mode 100644 index 000000000..05859e54c --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenRAKeyCertPage.java @@ -0,0 +1,67 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Generate the RA signing certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.keycert + */ +class WIGenRAKeyCertPage extends WIGenKeyCertPage { + private static final String PANELNAME = "INSTALLGENRAWIZARD"; + private static final String RAHELPINDEX = "install-racert-creation-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakracert-creation-wizard-help"; + + WIGenRAKeyCertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIGenRAKeyCertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isRACloningDone()) + return false; + if (!wizardInfo.isRACertLocalCA() || !wizardInfo.isRAInstalled() || + wizardInfo.isRALocalCertDone() || wizardInfo.isRACertRequestDone() || + wizardInfo.isRACertInstalledDone()) + return false; + + if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = RAHELPINDEX; + + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenRAKeyCertReqPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenRAKeyCertReqPage.java new file mode 100644 index 000000000..89aa21f14 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenRAKeyCertReqPage.java @@ -0,0 +1,79 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Generate the RA signing certificate request + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIGenRAKeyCertReqPage extends WIGenKeyCertReqPage { + private static final String PANELNAME = "INSTALLGENRACERTREQWIZARD"; + private static final String RAHELPINDEX = "install-racert-request-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakracert-request-wizard-help"; + + WIGenRAKeyCertReqPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIGenRAKeyCertReqPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isRACloningDone()) + return false; + if (wizardInfo.isRACertLocalCA() || !wizardInfo.isRAInstalled() || + (wizardInfo.isRACertRequestDone() && + !wizardInfo.isRACertRequestBack()) || + wizardInfo.isRALocalCertDone() || + wizardInfo.isRACertInstalledDone()) + return false; + + if (wizardInfo.isRACertRequestBack()) { + wizardInfo.put(ConfigConstants.STAGE_RA_CERT_REQUEST, + ConfigConstants.FALSE); + wizardInfo.put(ConfigConstants.RA_CERT_REQUEST_BACK, + ConfigConstants.FALSE); + } + + if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = RAHELPINDEX; + + mTokenName = wizardInfo.getRATokenName(); + wizardInfo.setCertType(Constants.PR_RA_SIGNING_CERT); + wizardInfo.setNewRequest(); + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenSSLKeyCertReqPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenSSLKeyCertReqPage.java new file mode 100644 index 000000000..58a85f790 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenSSLKeyCertReqPage.java @@ -0,0 +1,76 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Generate the SSL server certificate request + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIGenSSLKeyCertReqPage extends WIGenKeyCertReqPage { + private static final String PANELNAME = "INSTALLGENSSLCERTREQWIZARD"; + private static final String HELPINDEX = "install-sslcert-request-wizard-help"; + + WIGenSSLKeyCertReqPage(JDialog parent) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = parent; + } + + WIGenSSLKeyCertReqPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning()) + return false; + if (wizardInfo.isSSLCertLocalCA() || wizardInfo.isMigrationEnable() || + (wizardInfo.isSSLCertRequestDone() && + !wizardInfo.isSSLCertRequestBack()) || + wizardInfo.isSSLLocalCertDone() || + wizardInfo.isSSLCertInstalledDone()) + return false; + + + if (wizardInfo.isSSLCertRequestBack()) { + wizardInfo.put(ConfigConstants.STAGE_SSL_CERT_REQUEST, + ConfigConstants.FALSE); + wizardInfo.put(ConfigConstants.SSL_CERT_REQUEST_BACK, + ConfigConstants.FALSE); + } + + mTokenName = wizardInfo.getSSLTokenName(); + wizardInfo.setCertType(Constants.PR_SERVER_CERT); + wizardInfo.setNewRequest(); + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIGenServerKeyCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenServerKeyCertPage.java new file mode 100644 index 000000000..e93c378f6 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIGenServerKeyCertPage.java @@ -0,0 +1,62 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Generate the SSL server certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.keycert + */ +class WIGenServerKeyCertPage extends WIGenKeyCertPage { + private static final String PANELNAME = "INSTALLGENSSLWIZARD"; + private static final String HELPINDEX = "install-sslcert-creation-wizard-help"; + + WIGenServerKeyCertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIGenServerKeyCertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning()) + return false; + if (!wizardInfo.isSSLCertLocalCA() || wizardInfo.isMigrationEnable() || + wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertRequestDone() || + wizardInfo.isSSLCertInstalledDone()) + return false; + + mHelpIndex = HELPINDEX; + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCACertStatusPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCACertStatusPage.java new file mode 100644 index 000000000..d26b79ab0 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCACertStatusPage.java @@ -0,0 +1,70 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import javax.swing.*; + +/** + * The panel asks the user to paste the certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInstallCACertStatusPage extends WIInstallCertStatusPage { + private static final String PANELNAME = "INSTALLCACERTSTATUSWIZARD"; + private static final String CAHELPINDEX = "install-cacert-status-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakracert-status-wizard-help"; + + WIInstallCACertStatusPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIInstallCACertStatusPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) + return false; + if (wizardInfo.isCACertLocalCA() || !wizardInfo.isCACertInstalledDone() || + !wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() || + wizardInfo.isCACertChainImportDone()) + return false; + + if (wizardInfo.hasEntireCAChain()) + return false; + + wizardInfo.setCertType(Constants.PR_CA_SIGNING_CERT); + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else + mHelpIndex = CAHELPINDEX; + + return super.initializePanel(info); + } +} + + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCAIntroPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCAIntroPage.java new file mode 100644 index 000000000..033897c79 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCAIntroPage.java @@ -0,0 +1,62 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; + +/** + * The panel asks if the user wants to install the CA certificate now. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInstallCAIntroPage extends WIInstallIntroPage { + private static final String PANELNAME = "INSTALLCAINTROWIZARD"; + private static final String CAHELPINDEX = "install-cacert-installintro-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakracert-installintro-wizard-help"; + + WIInstallCAIntroPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIInstallCAIntroPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) + return false; + + if (wizardInfo.isCACertLocalCA() || !wizardInfo.isCAInstalled() || + wizardInfo.isMigrationEnable() || wizardInfo.isCACertInstalledDone()) + return false; + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else + mHelpIndex = CAHELPINDEX; + + return super.initializePanel(info); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCert1Page.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCert1Page.java new file mode 100644 index 000000000..240134536 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCert1Page.java @@ -0,0 +1,157 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * This page is to install the certificate in the internal token. The user can + * import the cert from the file or paste the Base 64 encoded blob in the + * text area. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInstallCert1Page extends WizardBasePanel implements IWizardPanel { + private JRadioButton mFileBtn; + private JRadioButton mBase64Btn; + private JTextField mFileText; + private JTextArea mBase64Text; + private JButton mPaste; + private static final String PANELNAME = "INSTALLCERT1WIZARD"; + private static final String HELPINDEX = + "configuration-kra-wizard-change-keyscheme-help"; + + WIInstallCert1Page() { + super(PANELNAME); + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + mFileBtn = makeJRadioButton("FILE", true); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mFileBtn, gbc); + + mFileText = makeJTextField(50); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, 0); + add(mFileText, gbc); + + mBase64Btn = makeJRadioButton("BASE64", false); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mBase64Btn, gbc); + + JTextArea desc = createTextArea( + CMSAdminUtil.wrapText(mResource.getString( + "INSTALLCERT1WIZARD_TEXT_DESC_LABEL"), 80), 2, 80); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + mPaste = makeJButton("PASTE"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mPaste, gbc); + + mBase64Text = new JTextArea(null, null, 0, 0); + mBase64Text.setLineWrap(true); + mBase64Text.setWrapStyleWord(true); + JScrollPane scrollPane = new JScrollPane(mBase64Text, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollPane.setPreferredSize(new Dimension(50, 20)); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.fill = gbc.BOTH; + gbc.gridwidth = gbc.REMAINDER; + add(scrollPane, gbc); + + JLabel dummy = new JLabel(" "); + gbc.gridwidth = gbc.REMAINDER; + gbc.anchor = gbc.NORTHWEST; + gbc.weighty = 1.0; + gbc.fill = gbc.BOTH; + add(dummy, gbc); + + ButtonGroup buttonGrp = new ButtonGroup(); + buttonGrp.add(mFileBtn); + buttonGrp.add(mBase64Btn); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCert2Page.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCert2Page.java new file mode 100644 index 000000000..fc9eaacb0 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCert2Page.java @@ -0,0 +1,140 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * This page is to install the certificate in the internal token. It + * displays the certificate information. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInstallCert2Page extends WizardBasePanel implements IWizardPanel { + private JButton mAdd; + private static final String PANELNAME = "INSTALLCERT2WIZARD"; + private static final String HELPINDEX = + "configuration-kra-wizard-change-keyscheme-help"; + + WIInstallCert2Page() { + super(PANELNAME); + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JLabel subjectDNLbl = makeJLabel("SUBJECTDN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(subjectDNLbl, gbc); + + JLabel issuerLbl = makeJLabel("ISSUE"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(issuerLbl, gbc); + + JTextArea subjectText = new JTextArea(null, null, 0, 0); + JScrollPane subjectScrollPane = new JScrollPane(subjectText, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + //subjectScrollPane.setPreferredSize(new Dimension(50, 30)); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, 0 ); + gbc.weighty = 1.0; + gbc.weightx = 1.0; + gbc.fill = gbc.BOTH; + add(subjectScrollPane, gbc); + + JTextArea issueText = new JTextArea(null, null, 0, 0); + JScrollPane issueScrollPane = new JScrollPane(issueText, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + //issueScrollPane.setPreferredSize(new Dimension(50, 30)); + CMSAdminUtil.resetGBC(gbc); + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + gbc.anchor = gbc.NORTHWEST; + gbc.weighty = 1.0; + gbc.weightx = 1.0; + gbc.fill = gbc.BOTH; + gbc.gridwidth = gbc.REMAINDER; + add(issueScrollPane, gbc); + + JTextArea infoText = new JTextArea(null, null, 0, 0); + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + infoText.setPreferredSize(new Dimension(50, 20)); + gbc.fill = gbc.BOTH; + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weighty = 1.0; + add(infoText, gbc); + + mAdd = makeJButton("ADD"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mAdd, gbc); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCertStatusPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCertStatusPage.java new file mode 100644 index 000000000..860e5b60e --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallCertStatusPage.java @@ -0,0 +1,248 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import java.io.*; +import javax.swing.*; +import javax.swing.text.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * Status page of certificate installation. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInstallCertStatusPage extends WizardBasePanel implements IWizardPanel { + private Color mActiveColor; + private JTextArea desc; + private JRadioButton mFileBtn; + private JRadioButton mBase64Btn; + private String mPanelName; + protected JTextArea mBase64Text; + private JTextField mFileText; + protected JButton mPaste; + protected String mHelpIndex; + protected String mCertChain; + protected String mCertFilePath; + + WIInstallCertStatusPage(String panelName) { + super(panelName); + mPanelName = panelName; + init(); + } + + public boolean initializePanel(WizardInfo info) { + setBorder(makeTitledBorder(mPanelName)); + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String str = mResource.getString(mPanelName+"_TEXT_DESC_LABEL"); + desc.setText(str); + return true; + } + + public boolean isLastPage() { + return false; + } + + public boolean validatePanel() { + if (mFileBtn.isSelected()) { + mCertFilePath = mFileText.getText().trim(); + if (mCertFilePath.equals("")) { + setErrorMessage("EMPTYFILEFIELD"); + return false; + } + } else if (mBase64Btn.isSelected()) { + mCertChain = mBase64Text.getText().trim(); + if (mCertChain.equals("")) { + setErrorMessage("B64EEMPTY"); + return false; + } + } + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_IMPORT_CERT_CHAIN; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ; + if (mFileBtn.isSelected()) { + rawData = rawData+"&"+Constants.PR_CERT_FILEPATH+"="+mCertFilePath; + } else if (mBase64Btn.isSelected()) { + rawData = rawData+"&"+ConfigConstants.PR_CERT_CHAIN+"="+mCertChain; + } + + rawData = rawData+"&"+Constants.PR_CERTIFICATE_TYPE+"="+wizardInfo.getCertType(); + + startProgressStatus(); + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + if (!ready) { + String str = getErrorMessage(); + if (str.equals("")) { + String errorMsg = mResource.getString( + mPanelName+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else if (str.equals("incompleteCertChain")) { + String errormsg = mResource.getString(mPanelName+"_INCOMPLETECERTCHAIN"); + int status = JOptionPane.showConfirmDialog(mAdminFrame, errormsg, "Information", + JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, + CMSAdminUtil.getImage(CMSAdminResources.IMAGE_INFO_ICON)); + if (status == JOptionPane.OK_OPTION) { + rawData = rawData+"&"+ConfigConstants.NOT_IMPORT_CHAIN+"="+ + ConfigConstants.TRUE; + ready = send(rawData, wizardInfo); + return true; + } else { + setErrorMessage(mResource.getString(mPanelName+"_ERROR1")); + return false; + } + } else + setErrorMessage(str); + } + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + desc = createTextArea(""); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + //gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + mFileBtn = makeJRadioButton("FILE", true); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mFileBtn, gbc); + + mFileText = makeJTextField(50); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, 4*COMPONENT_SPACE, COMPONENT_SPACE, 0); + add(mFileText, gbc); + mActiveColor = mFileText.getBackground(); + + mBase64Btn = makeJRadioButton("BASE64", false); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mBase64Btn, gbc); + + ButtonGroup btngroup = new ButtonGroup(); + btngroup.add(mFileBtn); + btngroup.add(mBase64Btn); + + JTextArea desc1 = createTextArea(mResource.getString( + mPanelName+"_TEXT_DESC1_LABEL")); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,4*COMPONENT_SPACE,0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc1, gbc); + + mBase64Text = new JTextArea(null, null, 0, 0); + JScrollPane scrollPane = new JScrollPane(mBase64Text, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollPane.setPreferredSize(new Dimension(50, 20)); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.fill = gbc.BOTH; + gbc.gridwidth = gbc.REMAINDER; + add(scrollPane, gbc); + + mPaste = makeJButton("PASTE"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mPaste, gbc); + + JLabel dummy = new JLabel(" "); + gbc.gridwidth = gbc.REMAINDER; + gbc.anchor = gbc.NORTHWEST; + gbc.weighty = 1.0; + gbc.fill = gbc.BOTH; + add(dummy, gbc); + + enableFields(mFileText, true, mActiveColor); + enableFields(mBase64Text, false, getBackground()); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource().equals(mPaste)) { + mBase64Text.paste(); + } else if (e.getSource().equals(mFileBtn)) { + enableFields(mFileText, true, mActiveColor); + enableFields(mBase64Text, false, getBackground()); + } else if (e.getSource().equals(mBase64Btn)) { + enableFields(mFileText, false, getBackground()); + enableFields(mBase64Text, true, mActiveColor); + } + } + + private void enableFields(JTextComponent comp1, boolean enable, Color color) { + comp1.setEnabled(enable); + comp1.setEditable(enable); + comp1.setBackground(color); + CMSAdminUtil.repaintComp(comp1); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallIntroPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallIntroPage.java new file mode 100644 index 000000000..29ddd0a46 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallIntroPage.java @@ -0,0 +1,133 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * Setup Single Signon for the installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInstallIntroPage extends WizardBasePanel implements IWizardPanel { + protected JRadioButton mYes; + protected JRadioButton mNo; + protected String mPanelName; + protected String mHelpIndex; + + WIInstallIntroPage(String panelName) { + super(panelName); + mPanelName = panelName; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + setBorder(makeTitledBorder(mPanelName)); + + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JTextArea heading = createTextArea(mResource.getString( + mPanelName+"_TEXT_HEADING_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(heading, gbc); + + mNo = makeJRadioButton("NO", false); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mNo, gbc); + + mYes = makeJRadioButton("YES", true); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(0,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mYes, gbc); + + JLabel dummy = new JLabel(""); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(dummy, gbc); + + ButtonGroup buttonGrp = new ButtonGroup(); + buttonGrp.add(mYes); + buttonGrp.add(mNo); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mNo.isSelected()) + wizardInfo.setInstallCertNow(Constants.FALSE); + else + wizardInfo.setInstallCertNow(Constants.TRUE); + } + + public void actionPerformed(ActionEvent e) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallKRACertStatusPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallKRACertStatusPage.java new file mode 100644 index 000000000..d33601151 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallKRACertStatusPage.java @@ -0,0 +1,72 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import javax.swing.*; + +/** + * The panel asks the user to paste the certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInstallKRACertStatusPage extends WIInstallCertStatusPage { + private static final String PANELNAME = "INSTALLKRACERTSTATUSWIZARD"; + private static final String KRAHELPINDEX = "install-kracert-status-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakra-kracert-status-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakra-kracert-status-wizard-help"; + + WIInstallKRACertStatusPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIInstallKRACertStatusPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) + return false; + if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isKRACertInstalledDone() || + !wizardInfo.isKRAInstalled() || wizardInfo.isKRACertChainImportDone()) + return false; + + if (wizardInfo.hasEntireKRAChain()) + return false; + + wizardInfo.setCertType(Constants.PR_KRA_TRANSPORT_CERT); + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = KRAHELPINDEX; + + return super.initializePanel(info); + } +} + + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallKRAIntroPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallKRAIntroPage.java new file mode 100644 index 000000000..cba792c1c --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallKRAIntroPage.java @@ -0,0 +1,65 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; + +/** + * The panel asks if the user wants to install the KR certificate now. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInstallKRAIntroPage extends WIInstallIntroPage { + private static final String PANELNAME = "INSTALLKRAINTROWIZARD"; + private static final String KRAHELPINDEX = "install-kracert-installintro-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakra-kracert-installintro-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakra-kracert-installintro-wizard-help"; + + + WIInstallKRAIntroPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIInstallKRAIntroPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) + return false; + if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isKRAInstalled() || + wizardInfo.isKRACertInstalledDone()) + return false; + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = KRAHELPINDEX; + + return super.initializePanel(info); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallOCSPCertStatusPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallOCSPCertStatusPage.java new file mode 100644 index 000000000..c98b7b045 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallOCSPCertStatusPage.java @@ -0,0 +1,67 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import javax.swing.*; +import com.netscape.management.client.util.*; + +/** + * The panel asks the user to paste the certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInstallOCSPCertStatusPage extends WIInstallCertStatusPage { + private static final String PANELNAME = "INSTALLOCSPCERTSTATUSWIZARD"; + private static final String OCSPHELPINDEX = "install-ocspcert-status-wizard-help"; + + WIInstallOCSPCertStatusPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIInstallOCSPCertStatusPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone()) + return false; + + if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isOCSPCertInstalledDone() || + !wizardInfo.isOCSPInstalled() || wizardInfo.isOCSPCertChainImportDone()) + return false; + + if (wizardInfo.hasEntireOCSPChain()) + return false; + + wizardInfo.setCertType(Constants.PR_OCSP_SIGNING_CERT); + + mHelpIndex = OCSPHELPINDEX; + + return super.initializePanel(info); + } +} + + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallOCSPIntroPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallOCSPIntroPage.java new file mode 100644 index 000000000..96c843e57 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallOCSPIntroPage.java @@ -0,0 +1,60 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; +import com.netscape.management.client.util.*; + +/** + * The panel asks if the user wants to install the RA certificate now. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInstallOCSPIntroPage extends WIInstallIntroPage { + + private static final String PANELNAME = "INSTALLOCSPINTROWIZARD"; + private static final String OCSPHELPINDEX = "install-ocspcert-installintro-wizard-help"; + + WIInstallOCSPIntroPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIInstallOCSPIntroPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone()) + return false; + if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isOCSPInstalled() || + wizardInfo.isOCSPCertInstalledDone()) + return false; + + mHelpIndex = OCSPHELPINDEX; + + return super.initializePanel(info); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallRACertStatusPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallRACertStatusPage.java new file mode 100644 index 000000000..326f5067a --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallRACertStatusPage.java @@ -0,0 +1,69 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import javax.swing.*; + +/** + * The panel asks the user to paste the certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInstallRACertStatusPage extends WIInstallCertStatusPage { + private static final String PANELNAME = "INSTALLRACERTSTATUSWIZARD"; + private static final String RAHELPINDEX = "install-racert-status-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakracert-status-wizard-help"; + + WIInstallRACertStatusPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIInstallRACertStatusPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isRACloningDone()) + return false; + if (wizardInfo.isRACertLocalCA() || !wizardInfo.isRACertInstalledDone() || + !wizardInfo.isRAInstalled() || wizardInfo.isRACertChainImportDone()) + return false; + + if (wizardInfo.hasEntireRAChain()) + return false; + + wizardInfo.setCertType(Constants.PR_RA_SIGNING_CERT); + + if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = RAHELPINDEX; + + return super.initializePanel(info); + } +} + + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallRAIntroPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallRAIntroPage.java new file mode 100644 index 000000000..d3d48492c --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallRAIntroPage.java @@ -0,0 +1,61 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; + +/** + * The panel asks if the user wants to install the RA certificate now. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInstallRAIntroPage extends WIInstallIntroPage { + private static final String PANELNAME = "INSTALLRAINTROWIZARD"; + private static final String RAHELPINDEX = "install-racert-installintro-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakracert-installintro-wizard-help"; + + WIInstallRAIntroPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIInstallRAIntroPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isRACloningDone()) + return false; + if (wizardInfo.isRACertLocalCA() || !wizardInfo.isRAInstalled() || + wizardInfo.isRACertInstalledDone()) + return false; + + if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = RAHELPINDEX; + + return super.initializePanel(info); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallSSLCertStatusPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallSSLCertStatusPage.java new file mode 100644 index 000000000..27ca1755f --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallSSLCertStatusPage.java @@ -0,0 +1,65 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import javax.swing.*; + +/** + * The panel asks the user to paste the certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInstallSSLCertStatusPage extends WIInstallCertStatusPage { + private static final String PANELNAME = "INSTALLSSLCERTSTATUSWIZARD"; + private static final String HELPINDEX = "install-sslcert-status-wizard-help"; + + WIInstallSSLCertStatusPage(JDialog parent) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = parent; + } + + WIInstallSSLCertStatusPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning()) + return false; + if (wizardInfo.isSSLCertLocalCA() || !wizardInfo.isSSLCertInstalledDone() || + wizardInfo.isMigrationEnable() || wizardInfo.isSSLCertChainImportDone()) + return false; + + if (wizardInfo.hasEntireSSLChain()) + return false; + + wizardInfo.setCertType(Constants.PR_SERVER_CERT); + + return super.initializePanel(info); + } +} + + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallSSLIntroPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallSSLIntroPage.java new file mode 100644 index 000000000..7115f96bf --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInstallSSLIntroPage.java @@ -0,0 +1,58 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; + +/** + * The panel asks if the user wants to install the SSL certificate now. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInstallSSLIntroPage extends WIInstallIntroPage { + private static final String PANELNAME = "INSTALLSSLINTROWIZARD"; + private static final String HELPINDEX = "install-sslcert-installintro-wizard-help"; + + WIInstallSSLIntroPage(JDialog parent) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = parent; + } + + WIInstallSSLIntroPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning()) + return false; + + if (wizardInfo.isSSLCertLocalCA() || wizardInfo.isMigrationEnable() || + wizardInfo.isSSLCertInstalledDone()) + return false; + + return super.initializePanel(info); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalDBInfoPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalDBInfoPage.java new file mode 100644 index 000000000..5338e820d --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalDBInfoPage.java @@ -0,0 +1,173 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * This panel asks for the information of the current internal database. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInternalDBInfoPage extends WizardBasePanel implements IWizardPanel { + private JTextField mBindAsText; + private JPasswordField mPasswordText; + private JLabel mBindAsLabel, mPasswordLabel; + + private static final String PANELNAME = "INTERNALDBINFOWIZARD"; + private static final String HELPINDEX = + "install-internaldb-logon-wizard-help"; + + WIInternalDBInfoPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIInternalDBInfoPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.getInternalDBPasswd() != null) + return false; + setBorder(makeTitledBorder(PANELNAME)); + mBindAsText.setText(wizardInfo.getDBBindDN()); + return true; + } + + public boolean validatePanel() { + String passwd = mPasswordText.getText(); + if (passwd.equals("")) { + setErrorMessage("BLANKPASSWD"); + return false; + } + + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.setDBBindDN(mBindAsText.getText().trim()); + wizardInfo.setInternalDBPasswd(mPasswordText.getText().trim()); + + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_VALIDATE_DSPASSWD; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+wizardInfo.getInternalDBPasswd(); + rawData = rawData+"&"+ConfigConstants.PR_DB_BINDDN+"="+wizardInfo.getDBBindDN(); + + startProgressStatus(); + + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str.equals("")) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea desc = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + CMSAdminUtil.resetGBC(gbc); + mBindAsLabel = makeJLabel("ADMIN"); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mBindAsLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mBindAsText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + //gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mBindAsText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPasswordLabel = makeJLabel("PWD"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mPasswordLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPasswordText = makeJPasswordField(30); + gbc.anchor = gbc.NORTHWEST; + // gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mPasswordText, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalDBPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalDBPage.java new file mode 100644 index 000000000..936d252d8 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalDBPage.java @@ -0,0 +1,313 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.event.*; +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInternalDBPage extends WizardBasePanel implements IWizardPanel { + private Color mActiveColor; + + private JCheckBox mSchema; + private JTextField mRMPortText, mRMBindAsText, mRMBaseText; + private JTextField mRMHostText,mRMDBNameAsText; + private JPasswordField mRMPasswordText; + private JLabel mRMHostLabel, mRMDBNameAsLabel; + private JLabel mRMBaseLabel, mRMBindAsLabel, mRMPasswordLabel; + + private static final String PANELNAME = "INTERNALDBWIZARD"; + private static final String HELPINDEX = + "install-internaldb-configuration-wizard-help"; + private static final String EMPTYSTR = " "; + + WIInternalDBPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIInternalDBPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource().equals(mSchema)) { + if (mSchema.isSelected()) { + mRMDBNameAsText.setEnabled(true); + mRMDBNameAsText.setBackground(mActiveColor); + } else { + mRMDBNameAsText.setEnabled(false); + mRMDBNameAsText.setBackground(getBackground()); + } + } else { + super.actionPerformed(e); + } + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (wizardInfo.isCloning()) + return false; + if (wizardInfo.isDBCreateNow()) { + setBorder(makeTitledBorder(PANELNAME)); + mRMBaseText.setText("o="+wizardInfo.getDBName()+", o=netscapeCertificateServer"); + mRMBindAsText.setText(wizardInfo.getDBBindDN()); + return true; + } + + return false; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + cleanUpWizardInfo(wizardInfo); + + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CREATE_INTERNALDB; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_CMS_SEED+"="+ + (new Long(WizardBasePanel.mSeed).toString()); + // remote database + rawData = rawData+"&"+ConfigConstants.PR_HOST+"=" + +mRMHostText.getText(); + rawData = rawData+"&"+ConfigConstants.PR_LDAP_DB_NAME+"=" + +mRMDBNameAsText.getText(); + rawData = rawData+"&"+ConfigConstants.PR_DB_PORT+"="+mRMPortText.getText(); + rawData = rawData+"&"+ConfigConstants.PR_DB_BINDDN+"="+mRMBindAsText.getText(); + rawData = rawData+"&"+ConfigConstants.PR_DB_NAME+"="+mRMBaseText.getText(); + rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+mRMPasswordText.getText(); + if (mSchema.isSelected()) { + rawData = rawData+"&"+ConfigConstants.PR_DB_SCHEMA+"="+"true"; + } else { + rawData = rawData+"&"+ConfigConstants.PR_DB_SCHEMA+"="+"false"; + } + wizardInfo.setInternalDBPasswd(mRMPasswordText.getText().trim()); + wizardInfo.setDBBindDN(mRMBindAsText.getText().trim()); + wizardInfo.setDBName(mRMBaseText.getText().trim()); + + startProgressStatus(); + //CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CREATEDB"); + + boolean ready = send(rawData, wizardInfo); + + if (ready) { + rawData = ConfigConstants.TASKID+"="+TaskId.TASK_TOKEN_INFO; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ; + ready = send(rawData, wizardInfo); + } + //dlg.setVisible(false); + + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea desc = createTextArea(mResource.getString( + "INTERNALDBWIZARD_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel instanceIDLbl = makeJLabel("REMOTEHOST"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(instanceIDLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMHostText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + //gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMHostText, gbc); + + mActiveColor = mRMHostText.getBackground(); + + CMSAdminUtil.resetGBC(gbc); + JLabel portNumber = makeJLabel("REMOTEPORT"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, + COMPONENT_SPACE,COMPONENT_SPACE); + add(portNumber, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMPortText = makeJTextField(10); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.HORIZONTAL; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(mRMPortText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMBaseLabel = makeJLabel("REMOTEDN"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMBaseLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMBaseText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + //gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMBaseText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMBindAsLabel = makeJLabel("REMOTEADMIN"); + //gbc.anchor = gbc.NORTHWEST; + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMBindAsLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMBindAsText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + //gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMBindAsText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMPasswordLabel = makeJLabel("REMOTEPWD"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMPasswordLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMPasswordText = makeJPasswordField(30); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.HORIZONTAL; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMPasswordText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMDBNameAsLabel = makeJLabel("DATABASE"); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMDBNameAsLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRMDBNameAsText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + //gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mRMDBNameAsText, gbc); + + JLabel dummy1 = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(dummy1, gbc); + + CMSAdminUtil.resetGBC(gbc); + mSchema = makeJCheckBox("SCHEMA", true); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mSchema, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.setDBCreated(ConfigConstants.TRUE); + wizardInfo.setDBCreateNow(ConfigConstants.FALSE); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalTokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalTokenLogonPage.java new file mode 100644 index 000000000..3bc9bd2f3 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIInternalTokenLogonPage.java @@ -0,0 +1,67 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * This panel asks for the information of the current internal database. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIInternalTokenLogonPage extends WITokenLogonPage implements IWizardPanel { + + private static final String HELPINDEX = "install-internaltoken-logon-wizard-help"; + private static final String PANELNAME = "INTERNALTOKENLOGONWIZARD"; + + WIInternalTokenLogonPage(JDialog dialog) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = dialog; + } + + WIInternalTokenLogonPage(JDialog dialog, JFrame adminFrame) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = dialog; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String pwd = + (String)wizardInfo.get("TOKEN:"+Constants.PR_INTERNAL_TOKEN_NAME); + if (pwd != null) + return false; + + mTokenName = "Internal"; + mTokenText.setText(Constants.PR_INTERNAL_TOKEN_NAME); + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroMigrationPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroMigrationPage.java new file mode 100644 index 000000000..616911252 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroMigrationPage.java @@ -0,0 +1,162 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * Data Migration. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIIntroMigrationPage extends WizardBasePanel implements IWizardPanel { + private JRadioButton mYes; + private JRadioButton mNo; + private static final String PANELNAME = "INTROMIGRATIONWIZARD"; + private String mHelpIndex; + private static final String CAHELPINDEX = + "install-ca-migration-enable-wizard-help"; + private static final String CAKRAHELPINDEX = + "install-cakra-migration-enable-wizard-help"; + + WIIntroMigrationPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIIntroMigrationPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (!wizardInfo.isCAInstalled() || wizardInfo.isMigrationDone()) + return false; + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else + mHelpIndex = CAHELPINDEX; + setBorder(makeTitledBorder(PANELNAME)); + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + Hashtable data = new Hashtable(); + + boolean ready = false; + if (mYes.isSelected()) { + wizardInfo.setEnableMigration(ConfigConstants.TRUE); + data.put(ConfigConstants.TASKID, TaskId.TASK_TOKEN_INFO); + data.put(ConfigConstants.OPTYPE, OpDef.OP_READ); + } else { + wizardInfo.setEnableMigration(ConfigConstants.FALSE); + // do the data migration + data.put(ConfigConstants.TASKID, TaskId.TASK_MIGRATION); + data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY); + data.put(ConfigConstants.PR_ENABLE_MIGRATION, + ConfigConstants.FALSE); + } + + startProgressStatus(); + + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JTextArea label = createTextArea(mResource.getString( + PANELNAME+"_LABEL_DESC_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(label, gbc); + + mYes = makeJRadioButton("YES", false); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mYes, gbc); + + mNo = makeJRadioButton("NO", true); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(0,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + add(mNo, gbc); + + ButtonGroup group = new ButtonGroup(); + group.add(mYes); + group.add(mNo); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroPage.java new file mode 100644 index 000000000..208a92cb8 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroPage.java @@ -0,0 +1,217 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIIntroPage extends WizardBasePanel implements IWizardPanel { + private JRadioButton mDbButton; + private JRadioButton mNetworkButton; + private JRadioButton mAdminButton; + private JRadioButton mSubsystemButton; + private JRadioButton mMigrationButton; + private JTextArea mLabel; + private static final String PANELNAME = "INTROINSTALLWIZARD"; + private static final String HELPINDEX = + "install-general-intro-wizard-help"; + + WIIntroPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIIntroPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + setBorder(makeTitledBorder(PANELNAME)); + mAdminFrame = wizardInfo.getAdminFrame(); + mLabel.setVisible(false); + mDbButton.setVisible(false); + mNetworkButton.setVisible(false); + mAdminButton.setVisible(false); + mSubsystemButton.setVisible(false); + mMigrationButton.setVisible(false); + String stages = wizardInfo.getStages(); + + if (stages != null && !stages.equals("")) { + StringTokenizer tokenizer = new StringTokenizer(stages, ":"); + mLabel.setVisible(true); + while (tokenizer.hasMoreTokens()) { + String str = (String)tokenizer.nextToken(); + if (str.equals(ConfigConstants.STAGE_INTERNAL_DB)) { + mDbButton.setVisible(true); + } else if (str.equals(ConfigConstants.STAGE_SETUP_PORTS)) { + mNetworkButton.setVisible(true); + } else if (str.equals(ConfigConstants.STAGE_SETUP_ADMINISTRATOR)) { + mAdminButton.setVisible(true); + } + } + } + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + cleanUpWizardInfo(wizardInfo); + + startProgressStatus(); + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_GET_DEFAULT_INFO; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+ OpDef.OP_READ; + boolean ready = send(rawData, wizardInfo); + if (ready) { + rawData = ConfigConstants.TASKID+"="+TaskId.TASK_TOKEN_INFO; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ; + rawData = rawData+"&"+ConfigConstants.PR_CMS_SEED+"="+ + (new Long(WizardBasePanel.mSeed).toString()); + + ready = send(rawData, wizardInfo); + } + + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str == null) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JTextArea desc = createTextArea(mResource.getString( + "INTROINSTALLWIZARD_TEXT_DESC_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + mLabel = createTextArea( + CMSAdminUtil.wrapText(mResource.getString( + "INTROINSTALLWIZARD_TEXT_HEADING_LABEL"), 80), 2, 80); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mLabel, gbc); + + mDbButton = makeJRadioButton("CREATEDB"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mDbButton, gbc); + + mNetworkButton = makeJRadioButton("NETWORK"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mNetworkButton, gbc); + + mAdminButton = makeJRadioButton("ADMIN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mAdminButton, gbc); + + mSubsystemButton = makeJRadioButton("SUBSYSTEMS"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mSubsystemButton, gbc); + + mMigrationButton = makeJRadioButton("MIGRATION"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mMigrationButton, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroSingleSignonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroSingleSignonPage.java new file mode 100644 index 000000000..659dd6969 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIIntroSingleSignonPage.java @@ -0,0 +1,162 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.io.*; +import java.net.*; +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.comm.*; +import com.netscape.management.client.util.*; + +/** + * Setup Single Signon for the installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIIntroSingleSignonPage extends WizardBasePanel implements IWizardPanel { + private JRadioButton mYes; + private JRadioButton mNo; + private static final String HELPINDEX = + "install-single-signon-enable-wizard-help"; + private static final String PANELNAME = "INSTALLINTROSINGLESIGNON"; + + WIIntroSingleSignonPage() { + super(PANELNAME); + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + setBorder(makeTitledBorder(PANELNAME)); + + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + if (mNo.isSelected()) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + Hashtable data = new Hashtable(); + ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo(); + CMSConfigCert configCertCgi = new CMSConfigCert(); + configCertCgi.initialize(wizardInfo); + data.put(ConfigConstants.TASKID, TaskId.TASK_MISCELLANEOUS); + data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY); + data.put(ConfigConstants.PR_CERT_INSTANCE_NAME, + consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME)); + data.put(ConfigConstants.PR_ADMIN_PASSWD, + (String)consoleInfo.get(ConfigConstants.PR_ADMIN_PASSWD)); + + boolean ready = configCertCgi.configCert(data); + return ready; + } + + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + +/* + JTextArea heading = createTextArea( + CMSAdminUtil.wrapText(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL"), 80), 1, 80); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(heading, gbc); +*/ + JLabel heading = makeJLabel("HEADING"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(heading, gbc); + + mNo = makeJRadioButton("NO", true); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mNo, gbc); + + mYes = makeJRadioButton("YES", false); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(0,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mYes, gbc); + + JLabel dummy = new JLabel(""); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(dummy, gbc); + + ButtonGroup buttonGrp = new ButtonGroup(); + buttonGrp.add(mYes); + buttonGrp.add(mNo); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mNo.isSelected()) + wizardInfo.put(ConfigConstants.PR_SINGLE_SIGNON, ConfigConstants.FALSE); + else + wizardInfo.put(ConfigConstants.PR_SINGLE_SIGNON, ConfigConstants.TRUE); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertDNPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertDNPage.java new file mode 100644 index 000000000..2dca713b5 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertDNPage.java @@ -0,0 +1,105 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; + +/** + * Subject DN page for KRA transport certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIKRACertDNPage extends WICertDNPage { + private static final String PANELNAME = "INSTALLKRACERTDNWIZARD"; + private static final String CAKRALOCALHELPINDEX = "install-cakra-kracertlocal-subjectdn-wizard-help"; + private static final String CAKRAREMOTEHELPINDEX = "install-cakra-kracertsub-subjectdn-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakra-kracertsub-subjectdn-wizard-help"; + private static final String KRAHELPINDEX = "install-kracertsub-subjectdn-wizard-help"; + + WIKRACertDNPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIKRACertDNPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) + return false; + if (!wizardInfo.isKRAInstalled() || wizardInfo.isKRALocalCertDone() || + wizardInfo.isKRACertRequestDone() || wizardInfo.isKRACertInstalledDone()) + return false; +// dnDesc.setText(KRA_DN); + String str = wizardInfo.getKRASubjectName(); + String OComp = null; + String CComp = null; + if (wizardInfo.isCAInstalled()) { + // get O component + OComp = wizardInfo.getCAOComp(); + CComp = wizardInfo.getCACComp(); + } + + if (str == null || str.equals("")) { + if (OComp != null && !OComp.equals("")) { + if (CComp == null || CComp.equals("")) + str = KRA_CN+", O="+OComp; + else + str = KRA_CN+", O="+OComp+", C="+CComp; + } else { + if (CComp == null || CComp.equals("")) + str = KRA_CN; + else + str = KRA_CN+", C="+CComp; + } + } + wizardInfo.setKRASubjectName(str); + populateDN(str); + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + if (wizardInfo.isKRACertLocalCA()) + mHelpIndex = CAKRALOCALHELPINDEX; + else + mHelpIndex = CAKRAREMOTEHELPINDEX; + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = KRAHELPINDEX; + + return super.initializePanel(info); + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (super.concludePanel(info)) { + wizardInfo.setKRASubjectName(mStr); + return true; + } + + return false; + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertExtensionPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertExtensionPage.java new file mode 100644 index 000000000..2b1f0dc99 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertExtensionPage.java @@ -0,0 +1,75 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.border.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Certificate Extension page for KRA transport certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIKRACertExtensionPage extends WICertExtensionPage { + private static final String PANELNAME = "INSTALLKRACERTEXTENSION1WIZARD"; + private static final String KRAHELPINDEX = "install-kracert-extension-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakra-kracert-extension-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakracert-extension-wizard-help"; + + WIKRACertExtensionPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIKRACertExtensionPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) + return false; + if (!wizardInfo.isKRAInstalled() || + wizardInfo.isKRALocalCertDone() || wizardInfo.isKRACertRequestDone() || + wizardInfo.isKRACertInstalledDone()) + return false; + + if (!mModified) + mAKICheckBox.setSelected(true); + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = KRAHELPINDEX; + + return super.initializePanel(info); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertSubmitPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertSubmitPage.java new file mode 100644 index 000000000..992bd7f14 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertSubmitPage.java @@ -0,0 +1,80 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * KRA Certificate Submission. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIKRACertSubmitPage extends WICertSubmitPage implements IWizardPanel { + private static final String PANELNAME = "INSTALLKRACERTWIZARD"; + private static final String KRAHELPINDEX = "install-kratype-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakratype-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakratype-wizard-help"; + + WIKRACertSubmitPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) + return false; + wizardInfo.put(Constants.PR_CERTIFICATE_TYPE, + Constants.PR_KRA_TRANSPORT_CERT); + if (!wizardInfo.isKRAInstalled() || + wizardInfo.isKRACertRequestDone() || wizardInfo.isKRACertInstalledDone() || + !wizardInfo.isCAInstalled()) { + wizardInfo.setKRACertLocalCA(Constants.FALSE); + return false; + } + + if (wizardInfo.isKRALocalCertDone()) + return false; + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = KRAHELPINDEX; + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + + return super.initializePanel(info); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mSelfButton.isSelected()) + wizardInfo.setKRACertLocalCA(Constants.TRUE); + else + wizardInfo.setKRACertLocalCA(Constants.FALSE); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertValidityPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertValidityPage.java new file mode 100644 index 000000000..feaa29983 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRACertValidityPage.java @@ -0,0 +1,77 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Validity page for KRA transport certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIKRACertValidityPage extends WICertValidityPage { + private static final String PANELNAME = "INSTALLKRACERTVALIDWIZARD"; + private static final String KRAHELPINDEX = "install-kracert-validity-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakracert-validity-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakra-kracert-validity-wizard-help"; + + WIKRACertValidityPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIKRACertValidityPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) + return false; + if (!wizardInfo.isKRAInstalled() || wizardInfo.isKRALocalCertDone() || + wizardInfo.isKRACertRequestDone() || wizardInfo.isKRACertInstalledDone()) + return false; + if (super.initializePanel(info)) { + if (!wizardInfo.isKRACertLocalCA()) + return false; + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = KRAHELPINDEX; + + return true; + } + return false; + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAKeyPage.java new file mode 100644 index 000000000..00b12d43c --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAKeyPage.java @@ -0,0 +1,100 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Setup key information for KRA transport certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIKRAKeyPage extends WIKeyPage implements IWizardPanel { + private static final String PANELNAME = "INSTALLKRAKEYWIZARD"; + private static final String KRAHELPINDEX = + "install-krakeysub-configuration-wizard-help"; + private static final String CAKRALOCALHELPINDEX = + "install-cakra-krakeylocal-configuration-wizard-help"; + private static final String CAKRAREMOTEHELPINDEX = + "install-cakra-krakeysub-configuration-wizard-help"; + private static final String RAKRAHELPINDEX = + "install-rakra-krakeysub-configuration-wizard-help"; + + WIKRAKeyPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIKRAKeyPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + mWizardInfo = (InstallWizardInfo)info; + if (mWizardInfo.isCloning() && mWizardInfo.isKRACloningDone()) + return false; + if (!mWizardInfo.isKRAInstalled() || mWizardInfo.isKRALocalCertDone() || + mWizardInfo.isKRACertRequestDone() || mWizardInfo.isKRACertInstalledDone()) + return false; + if (super.initializePanel(info)) { + String kraTokenName = mWizardInfo.getKRATokenName(); + if (kraTokenName == null || kraTokenName.equals("")) { + mTokenBox.setSelectedIndex(0); + } else { + if (kraTokenName.equals(Constants.PR_INTERNAL_TOKEN_NAME)) + mTokenBox.setSelectedIndex(0); + else + mTokenBox.setSelectedItem(kraTokenName); + } + } + + if (mWizardInfo.isCAInstalled() && mWizardInfo.isKRAInstalled()) { + if (mWizardInfo.isKRACertLocalCA()) + mHelpIndex = CAKRALOCALHELPINDEX; + else + mHelpIndex = CAKRAREMOTEHELPINDEX; + } else if (mWizardInfo.isRAInstalled() && mWizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = KRAHELPINDEX; + + enableFields(); + mIsCAKey = false; + return true; + } + + public void getUpdateInfo(WizardInfo info) { + super.getUpdateInfo(info); + mWizardInfo.setKRATokenName(mWizardInfo.getTokenName()); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAMessageDigestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAMessageDigestPage.java new file mode 100644 index 000000000..38941ec7b --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAMessageDigestPage.java @@ -0,0 +1,79 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.text.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Setup the message digest information for the installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIKRAMessageDigestPage extends WMessageDigestPage { + + private static final String PANELNAME = "INSTALLKRAMESSAGEDIGESTWIZARD"; + + WIKRAMessageDigestPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIKRAMessageDigestPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) + return false; + if (!wizardInfo.isKRAInstalled() || !wizardInfo.isKRACertLocalCA() || + wizardInfo.isKRALocalCertDone() || wizardInfo.isKRACertRequestDone() || + wizardInfo.isKRACertInstalledDone()) + return false; + + mCAKeyType = wizardInfo.getCAKeyType(); + + return super.initializePanel(info); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mDSAHashTypeBox.isVisible()) + wizardInfo.setHashType((String)mDSAHashTypeBox.getSelectedItem()); + else + wizardInfo.setHashType((String)mRSAHashTypeBox.getSelectedItem()); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRANumberPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRANumberPage.java new file mode 100644 index 000000000..000b3eb9f --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRANumberPage.java @@ -0,0 +1,378 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import java.math.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * This panel asks for the starting serial number that the CA issues + * + * @author Michelle Zhao + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIKRANumberPage extends WizardBasePanel implements IWizardPanel { + private JTextArea mDesc; + + private String mSerialNumber; + private JTextField mSerialNumberText; + private JLabel mSerialNumberLabel; + + private String mEndSerialNumber = null; + private JTextField mEndSerialNumberText; + private JLabel mEndSerialNumberLabel; + + private String mbeginRequestNumber; + private JTextField mbeginRequestNumberText; + private JLabel mbeginRequestNumberLabel; + + private String mEndRequestNumber = null; + private JTextField mEndRequestNumberText; + private JLabel mEndRequestNumberLabel; + + private static final String DEFAULT_SERIAL_NUMBER = "1"; + private static final String PANELNAME = "KRAREQUESTNUMBERWIZARD"; + private static final String HELPINDEX = + "install-ca-serialnumber-wizard-help"; + + WIKRANumberPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIKRANumberPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + String serial; + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + setBorder(makeTitledBorder(PANELNAME)); + if (//wizardInfo.isKRACertLocalCA() || !wizardInfo.isInstallCertNow() || + !wizardInfo.isKRAInstalled() || wizardInfo.isKRACertInstalledDone()|| + wizardInfo.isNumberPageDone()) + return false; + + if (wizardInfo.isCloning()) + mDesc.setText(mResource.getString(PANELNAME+"_TEXT_HEADING_LABEL") + + mResource.getString(PANELNAME+"_TEXT_MORE_LABEL")); + else + mDesc.setText(mResource.getString(PANELNAME+"_TEXT_HEADING_LABEL")); + + + if ((serial = wizardInfo.getCASerialNumber()) != null) + mSerialNumberText.setText(serial); + else + mSerialNumberText.setText(DEFAULT_SERIAL_NUMBER); + + if ((serial = wizardInfo.getRequestNumber()) != null) + mbeginRequestNumberText.setText(serial); + else + mbeginRequestNumberText.setText(DEFAULT_SERIAL_NUMBER); + + if ((serial = wizardInfo.getCAEndSerialNumber()) != null) + mEndSerialNumberText.setText(serial); + + if ((serial = wizardInfo.getEndRequestNumber()) != null) + mEndRequestNumberText.setText(serial); + return true; + } + + private String hexToDecimal(String hex, boolean isHex) + { + //String newHex = hex.substring(2); + BigInteger bi; + if(isHex) + bi = new BigInteger(hex, 16); + else + bi = new BigInteger(hex, 10); + return bi.toString(); + } + + private String DecToHex(String dec) + { + BigInteger bi; + bi = new BigInteger(dec, 10); + return bi.toString(16); + } + + private boolean validateNumber(JTextField beginNumberField, JTextField endNumberField,String beginText, String endText,boolean isSerialNumber) + { + BigInteger num = null; + BigInteger endNum = null; + String serial = null; + beginText = beginNumberField.getText().trim(); + if (beginText != null && !beginText.equals("")) { + try { + if (beginText.startsWith("0x")) { + serial = hexToDecimal(beginText.substring(2),true); + } else { + serial = beginText; + } + num = new BigInteger(serial); + if (num.compareTo(new BigInteger("0")) < 0) { + setErrorMessage("You must specify a positive value."); + return false; + } + } catch (NumberFormatException e) { + setErrorMessage("You must specify a numeric value."); + return false; + } + if(isSerialNumber) + mSerialNumber = DecToHex(serial); + else + mbeginRequestNumber = serial; + } else { + if(isSerialNumber) + mSerialNumber = ""; + else + mbeginRequestNumber = ""; + } + + endText = endNumberField.getText().trim(); + if (endText != null && !endText.equals("")) { + try { + if (endText.startsWith("0x")) { + serial = hexToDecimal(endText.substring(2),true); + } else { + serial = endText; + } + endNum = new BigInteger(serial); + if (endNum.compareTo(new BigInteger("0")) < 0) { + setErrorMessage("You must specify a positive value."); + return false; + } + } catch (NumberFormatException e) { + setErrorMessage("You must specify a numeric value."); + return false; + } + if(isSerialNumber) + mEndSerialNumber = DecToHex(serial); + else + mEndRequestNumber = serial; + } else { + if(isSerialNumber) + mEndSerialNumber = ""; + else + mEndRequestNumber = ""; + } + + if (num != null && endNum != null && num.compareTo(endNum) > 0) { + setErrorMessage("Ending number must be greater than starting number."); + return false; + } + return true; + } + + public boolean validatePanel() { + if(validateNumber(mSerialNumberText,mEndSerialNumberText,mSerialNumber,mEndSerialNumber,true)==false) + return false; + if(validateNumber(mbeginRequestNumberText,mEndRequestNumberText,mbeginRequestNumber,mEndRequestNumber,false)==false) + return false; + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mSerialNumber != null && !mSerialNumber.equals("")) + wizardInfo.setCASerialNumber(mSerialNumber); + else { + wizardInfo.setCASerialNumber(DEFAULT_SERIAL_NUMBER); + mSerialNumber = DEFAULT_SERIAL_NUMBER; + } + if (mbeginRequestNumber != null && !mbeginRequestNumber.equals("")) + wizardInfo.setRequestNumber(mbeginRequestNumber); + else { + wizardInfo.setRequestNumber(DEFAULT_SERIAL_NUMBER); + mbeginRequestNumber = DEFAULT_SERIAL_NUMBER; + } + + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_SET_KRA_NUMBER; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + if (mSerialNumber != null && !mSerialNumber.equals("")) + rawData = rawData+"&"+ConfigConstants.PR_CA_SERIAL_NUMBER+"="+ + mSerialNumber; + if (mEndSerialNumber != null && !mEndSerialNumber.equals("")) + rawData = rawData+"&"+ConfigConstants.PR_CA_ENDSERIAL_NUMBER+"="+ + mEndSerialNumber; + if (mbeginRequestNumber != null && !mbeginRequestNumber.equals("")) + rawData = rawData+"&"+ConfigConstants.PR_REQUEST_NUMBER+"="+ + mbeginRequestNumber; + if (mEndRequestNumber != null && !mEndSerialNumber.equals("")) + rawData = rawData+"&"+ConfigConstants.PR_ENDREQUEST_NUMBER+"="+ + mEndRequestNumber; + if (wizardInfo.getInternalDBPasswd() != null) + rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+ + wizardInfo.getInternalDBPasswd(); + rawData = rawData+"&"+ConfigConstants.PR_SERIAL_REQUEST_NUMBER+"="+ + ConfigConstants.TRUE; + + startProgressStatus(); + + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(); + if (str.equals("")) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + }else { + wizardInfo.setNumberPageDone(ConfigConstants.TRUE); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + mDesc = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mDesc, gbc); + + CMSAdminUtil.resetGBC(gbc); + mSerialNumberLabel = makeJLabel("SERIALNUMBER"); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mSerialNumberLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mSerialNumberText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; +// gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mSerialNumberText, gbc); + + + CMSAdminUtil.resetGBC(gbc); + mEndSerialNumberLabel = makeJLabel("ENDSERIALNUMBER"); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mEndSerialNumberLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mEndSerialNumberText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; +// gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mEndSerialNumberText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mbeginRequestNumberLabel = makeJLabel("REQUESTNUMBER"); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mbeginRequestNumberLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mbeginRequestNumberText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; +// gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mbeginRequestNumberText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mEndRequestNumberLabel = makeJLabel("ENDREQUESTNUMBER"); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mEndRequestNumberLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mEndRequestNumberText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; +// gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mEndRequestNumberText, gbc); + + /* + CMSAdminUtil.resetGBC(gbc); + mSerialNumberLabel = makeJLabel("PWD"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mSerialNumberLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mSerialNumberText = makeJSerialNumberField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mSerialNumberText, gbc); +*/ + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRARequestResultPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRARequestResultPage.java new file mode 100644 index 000000000..1580b7101 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRARequestResultPage.java @@ -0,0 +1,58 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Display the KRA transport certificate request result + * + * @author Michelle Zhao + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIKRARequestResultPage extends WIRequestResultPage { + + WIKRARequestResultPage(JDialog parent) { + super(parent); + } + + WIKRARequestResultPage(JDialog parent, JFrame adminFrame) { + super( parent, adminFrame); + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) + return false; + if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isKRAInstalled() || + wizardInfo.isKRALocalCertDone() || + (wizardInfo.isKRACertRequestSucc() && wizardInfo.isKRAReqResultDisplayed()) || + wizardInfo.isKRACertInstalledDone()) + return false; + + wizardInfo.setKRAReqResultDisplayed(Constants.TRUE); + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAScheme1Page.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAScheme1Page.java new file mode 100644 index 000000000..d6171e651 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAScheme1Page.java @@ -0,0 +1,188 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * KRA Key recovery for installation wizard: specify number of required and + * available agents + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIKRAScheme1Page extends WizardBasePanel implements IWizardPanel { + private JTextField mRequiredText; + private JTextField mAvailText; + private String mHelpIndex; + private static final String PANELNAME = "KRASCHEME1WIZARD"; + private static final String KRAHELPINDEX = + "install-kra-mnscheme-wizard-help"; + private static final String CAKRAHELPINDEX = + "install-cakra-mnscheme-wizard-help"; + private static final String RAKRAHELPINDEX = + "install-rakra-mnscheme-wizard-help"; + private int mRequired, mAvail; + + WIKRAScheme1Page(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIKRAScheme1Page(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (!wizardInfo.doKeySplitting()) + return false; + if (wizardInfo.isCloning()) + return false; + if (!wizardInfo.isKRAInstalled() || wizardInfo.isKRANMSchemeDone()) + return false; + setBorder(makeTitledBorder(PANELNAME)); + mRequiredText.setText(wizardInfo.getRequiredAgents()); + mAvailText.setText(wizardInfo.getTotalAgents()); + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = KRAHELPINDEX; + return true; + } + + public boolean validatePanel() { + String str = mRequiredText.getText().trim(); + if (str.equals("")) { + setErrorMessage("CANNOTBEBLANK"); + return false; + } + + try { + mRequired = Integer.parseInt(str); + str = mAvailText.getText().trim(); + if (str.equals("")) { + setErrorMessage("CANNOTBEBLANK"); + return false; + } + mAvail = Integer.parseInt(str); + } catch (NumberFormatException e) { + setErrorMessage("NOTINTEGER"); + return false; + } + + if (mRequired <= 0 || mAvail <= 0) { + setErrorMessage("NONZERO"); + return false; + } + + if (mRequired > mAvail) { + setErrorMessage("LARGER"); + return false; + } + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JLabel requiredLbl = makeJLabel("REQUIRED"); + gbc.anchor = gbc.NORTHEAST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.fill = gbc.NONE; + add(requiredLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mRequiredText = makeJTextField(5); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.fill = gbc.NONE; + add(mRequiredText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JTextArea dummy = createTextArea(" ", 1, 15); + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(dummy, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel availLbl = makeJLabel("AVAILABLE"); + gbc.anchor = gbc.NORTHEAST; + gbc.insets = new Insets(0,COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE); + gbc.weighty = 1.0; + gbc.fill = gbc.NONE; + add(availLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mAvailText = makeJTextField(5); + gbc.insets = new Insets(0,COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE); + gbc.anchor = gbc.NORTHWEST; + gbc.weighty = 1.0; + gbc.fill = gbc.NONE; + add(mAvailText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JTextArea dummy1 = createTextArea(" ", 1, 15); + gbc.weighty = 1.0; + gbc.insets = new Insets(0,COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(dummy1, gbc); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.setRequiredAgents(mRequiredText.getText().trim()); + wizardInfo.setTotalAgents(mAvailText.getText()); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAScheme2Page.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAScheme2Page.java new file mode 100644 index 000000000..f8c9c9f8e --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAScheme2Page.java @@ -0,0 +1,309 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.util.*; +import java.awt.*; +import javax.swing.*; +import javax.swing.text.*; +import javax.swing.table.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.certsrv.common.*; +import com.netscape.management.client.console.*; + +/** + * KRA Key recovery for installation wizard: specify the uid and password + * for all the available agents + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIKRAScheme2Page extends WizardBasePanel implements IWizardPanel { + private JTable mTable; + private NewAgentModel mDataModel; + private String mHelpIndex; + private static final String PANELNAME = "KRASCHEME2WIZARD"; + private static final String KRAHELPINDEX = + "install-kra-scheme-usrpwds-wizard-help"; + private static final String CAKRAHELPINDEX = + "install-cakra-scheme-usrpwds-wizard-help"; + private static final String RAKRAHELPINDEX = + "install-rakra-scheme-usrpwds-wizard-help"; + + WIKRAScheme2Page(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIKRAScheme2Page(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (!wizardInfo.doKeySplitting()) + return false; + if (wizardInfo.isCloning()) + return false; + if (!wizardInfo.isKRAInstalled() || wizardInfo.isKRANMSchemeDone()) + return false; + + String val = wizardInfo.getTotalAgents(); + int M = Integer.parseInt(val); + mDataModel.removeAllRows(); + + Vector[] data = new Vector[M]; + for (int i=0; i<data.length; i++) { + data[i] = new Vector(); + data[i].addElement(Integer.toString(i+1)); + // initialize userid + data[i].addElement("agent"+(i+1)); + data[i].addElement(""); + data[i].addElement(""); + mDataModel.addRow(data[i]); + } + + setBorder(makeTitledBorder(PANELNAME)); + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = KRAHELPINDEX; + + return true; + } + + public boolean validatePanel() { + + Component component = mTable.getEditorComponent(); + if(component!= null) { + int col = mTable.getEditingColumn(); + int row = mTable.getEditingRow(); + if ((col>-1)&&(row>-1)) { + String str = ((JTextComponent)component).getText(); + mTable.setValueAt(str, row, col); + } + } + + if(!checkBlank()) { + setErrorMessage("CANNOTBEBLANK"); + return false; + } + + if(!checkConfirm()) { + setErrorMessage("PASSWORDERROR"); + return false; + } + + if (!checkDuplicate()) { + setErrorMessage("DUPLICATEERROR"); + return false; + } + + return true; + } + + private boolean checkBlank() { + for (int i=0; i<mDataModel.getRowCount(); i++) { + String val1 = (String)mDataModel.getValueAt(i,1); + String val2 = (String)mDataModel.getValueAt(i,2); + String val3 = (String)mDataModel.getValueAt(i,3); + if ( (val1.trim().equals(""))||(val2.trim().equals(""))|| + (val3.trim().equals(""))) { + return false; + } + } + return true; + } + + private boolean checkDuplicate() { + Hashtable table = new Hashtable(); + for (int i=0; i<mDataModel.getRowCount(); i++) { + String val1 = (String)mDataModel.getValueAt(i,1); + table.put(val1.trim(), "1"); + } + if (table.size() != mDataModel.getRowCount()) { + table = null; + return false; + } + + table = null; + return true; + } + + private boolean checkConfirm() { + for (int i=0; i<mDataModel.getRowCount(); i++) { + String val2 = (String)mDataModel.getValueAt(i,2); + String val3 = (String)mDataModel.getValueAt(i,3); + if (!val2.trim().equals(val3.trim())) { + return false; + } + } + return true; + } + + private String getUIDPassword() { + String result = ""; + for (int i=0; i<mDataModel.getRowCount(); i++) { + String val1 = (String)mDataModel.getValueAt(i,1); + String val2 = (String)mDataModel.getValueAt(i,2); + result = result+val1.trim()+"="+val2.trim(); + if (i < (mDataModel.getRowCount()-1)) + result = result+","; + } + return result; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + String rawData = ""; + int total = Integer.parseInt(wizardInfo.getTotalAgents()); + for (int i=0; i<total; i++) { + String val1 = (String)mDataModel.getValueAt(i,1); + String val2 = (String)mDataModel.getValueAt(i,2); + rawData = rawData+ConfigConstants.PR_AGENT_UID+i+"="+val1; + rawData = rawData+"&"+ConfigConstants.PR_AGENT_PWD+i+"="+val2; + } + + rawData = rawData+"&"+ConfigConstants.TASKID+"="+TaskId.TASK_AGENTS; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_AGENT_N+"="+ + wizardInfo.getTotalAgents(); + rawData = rawData+"&"+ConfigConstants.PR_AGENT_M+"="+ + wizardInfo.getRequiredAgents(); + startProgressStatus(); + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea headingLbl = createTextArea(mResource.getString( + PANELNAME+"_LABEL_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(headingLbl, gbc); + + mDataModel = new NewAgentModel(); + mTable = new JTable(mDataModel); + JScrollPane scrollPane = JTable.createScrollPaneForTable(mTable); + scrollPane.setHorizontalScrollBarPolicy(scrollPane.HORIZONTAL_SCROLLBAR_NEVER); + scrollPane.setVerticalScrollBarPolicy(scrollPane.VERTICAL_SCROLLBAR_ALWAYS); + mTable.setAutoscrolls(true); + mTable.sizeColumnsToFit(true); + mTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); + scrollPane.setBackground(Color.white); + setLabelCellRenderer(mTable, 1); + setLabelCellEditor(mTable, 2); + setLabelCellEditor(mTable, 3); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.BOTH; + gbc.weighty = 1.0; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gb.setConstraints(scrollPane, gbc); + add(scrollPane); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } + + //Set the first column's cellrender as label cell + protected void setLabelCellRenderer(JTable table, int index) { + table.getColumnModel().getColumn(index).setCellRenderer( + new DefaultTableCellRenderer()); + } + + //Set the first column's cellrender as label cell + protected void setLabelCellEditor(JTable table, int index) { + table.getColumnModel().getColumn(index).setCellRenderer( + new PasswordCellRenderer()); + table.getColumnModel().getColumn(index).setCellEditor( + new DefaultCellEditor(new JPasswordField())); + } +} + +class NewAgentModel extends CMSTableModel +{ + /*========================================================== + * variables + *==========================================================*/ + public static final String COL1 = "NUMBER"; + public static final String COL2 = "UID"; + public static final String COL3 = "PASSWORD"; + public static final String COL4 = "CONFIRM"; + + + private static String[] mColumns = {COL1, COL2, COL3, COL4}; + + /*========================================================== + * constructors + *==========================================================*/ + public NewAgentModel() { + super(); + init(mColumns); + } + + public boolean isCellEditable(int row, int col) { + if(col >= 1) + return true; + return false; + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAStorageKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAStorageKeyPage.java new file mode 100644 index 000000000..6cce19d95 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRAStorageKeyPage.java @@ -0,0 +1,356 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.util.*; +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.certsrv.common.*; +import com.netscape.management.client.console.*; +import javax.swing.event.*; +import java.awt.event.*; + +/** + * Install KRA storage key. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIKRAStorageKeyPage extends WizardBasePanel implements IWizardPanel { + private String mHelpIndex; + private static final String PANELNAME = "INSTALLKRASTORAGEKEYWIZARD"; + private static final String KRAHELPINDEX = + "install-kra-storagekey-wizard-help"; + private static final String CAKRAHELPINDEX = + "install-cakra-storagekey-wizard-help"; + private static final String RAKRAHELPINDEX = + "install-rakra-storagekey-wizard-help"; + + protected JComboBox mKeyTypeBox, mKeyLengthBox, mDSAKeyLengthBox, mTokenBox; + protected JPasswordField mPassword, mPasswordAgain, mSOPPassword; + protected JLabel keyTypeLbl, keyLengthCustomText, keyLengthLbl, unitLbl, + keyLengthCustomLbl, unit1Lbl, mTokenLbl; + protected JLabel mPasswdLbl, mPasswdAgainLbl, mSOPLbl; + protected JCheckBox mHardwareSplit; + protected String[] mTokenInitialized; + protected String[] mTokenLogin; + private Color mActiveColor; + + WIKRAStorageKeyPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIKRAStorageKeyPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning()) + return false; + if (!wizardInfo.isKRAInstalled() || wizardInfo.isKRANMSchemeDone()) + return false; + setBorder(makeTitledBorder(PANELNAME)); + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = KRAHELPINDEX; + + wizardInfo = (InstallWizardInfo)info; + setBorder(makeTitledBorder(mPanelName)); + if (mTokenBox.getItemCount() > 0) { + mTokenBox.removeAllItems(); + } + + String tokenList = wizardInfo.getTokensList(); + StringTokenizer tokenizer = new StringTokenizer(tokenList, ":"); + int count = tokenizer.countTokens(); + while (tokenizer.hasMoreTokens()) { + mTokenBox.addItem((String)tokenizer.nextToken()); + } + + String initializedList = wizardInfo.getTokensInit(); + tokenizer = new StringTokenizer(initializedList, ":"); + int i=0; + mTokenInitialized = new String[count]; + while (tokenizer.hasMoreElements()) { + mTokenInitialized[i] = (String)tokenizer.nextToken(); + i++; + } + + String loginList = wizardInfo.getTokensLogin(); + tokenizer = new StringTokenizer(loginList, ":"); + i=0; + mTokenLogin = new String[count]; + while (tokenizer.hasMoreElements()) { + mTokenLogin[i] = (String)tokenizer.nextToken(); + i++; + } + + //mTokenBox.setSelectedIndex(0); + mTokenBox.addItemListener(this); + + return true; + } + + public boolean validatePanel() { + return true; + } + + public void actionPerformed(ActionEvent e) { + int index = mTokenBox.getSelectedIndex(); + if (index > 0) { + mPassword.setEnabled(true); + mPassword.setBackground(mActiveColor); + } else { + // Internal Token + mPassword.setEnabled(false); + mPassword.setBackground(getBackground()); + } + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo(); + CMSConfigCert configCertCgi = new CMSConfigCert(); + configCertCgi.initialize(wizardInfo); + Hashtable data = new Hashtable(); + + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_STORAGE_KEY; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + wizardInfo.setKeyLength((String)mKeyLengthBox.getSelectedItem()); + rawData = rawData+"&"+ConfigConstants.PR_KEY_LEN+"="+wizardInfo.getKeyLength(); + rawData = rawData+"&"+ConfigConstants.PR_TOKEN_NAME+"="+(String)mTokenBox.getSelectedItem(); + rawData = rawData+"&"+ConfigConstants.PR_TOKEN_PASSWD+"="+ + (String)mPassword.getText().trim(); + startProgressStatus(); + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(); + if (str.equals("")) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JPanel panel = new JPanel(); + GridBagLayout gb1 = new GridBagLayout(); + panel.setLayout(gb1); + + JPanel panel2 = new JPanel(); + GridBagLayout gb3 = new GridBagLayout(); + panel2.setLayout(gb3); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + add(panel, gbc); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + add(panel2, gbc); + + JTextArea selectTokenLbl = createTextArea(mResource.getString( + mPanelName+"_LABEL_SELECTTOKEN_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE,0); + panel.add(selectTokenLbl, gbc); + + JLabel tokenLbl = makeJLabel("TOKEN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.CENTER; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + gbc.fill = gbc.NONE; + panel.add(tokenLbl, gbc); + + mTokenBox = new JComboBox(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + //gbc.weightx = 1.0; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + panel.add(mTokenBox, gbc); + mTokenBox.addActionListener(this); + + JTextArea dummy2 = createTextArea(" ", 1, 5); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + panel.add(dummy2, gbc); + + mTokenLbl = new JLabel(""); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, 0, + COMPONENT_SPACE,COMPONENT_SPACE); + panel2.add(mTokenLbl, gbc); + + mPasswdLbl = makeJLabel("PASSWD"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + panel2.add(mPasswdLbl, gbc); + + mPassword = new JPasswordField(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + panel2.add(mPassword, gbc); + mActiveColor = mPassword.getBackground(); + +/** + mPasswdAgainLbl = makeJLabel("PASSWDAGAIN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + panel2.add(mPasswdAgainLbl, gbc); + + mPasswordAgain = new JPasswordField(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + panel2.add(mPasswordAgain, gbc); + + mSOPLbl = makeJLabel("SOP"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + panel2.add(mSOPLbl, gbc); + + mSOPPassword = new JPasswordField(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, + COMPONENT_SPACE); + panel2.add(mSOPPassword, gbc); + **/ + + CMSAdminUtil.resetGBC(gbc); + JTextArea label = createTextArea(mResource.getString( + PANELNAME+"_LABEL_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gbc.weightx = 1.0; + add(label, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel keyLengthLbl = makeJLabel("KEYLENGTH"); + gbc.anchor = gbc.WEST; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gbc.fill = gbc.NONE; + add(keyLengthLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mKeyLengthBox = makeJComboBox("KEYLENGTH"); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + add(mKeyLengthBox, gbc); + +/** + CMSAdminUtil.resetGBC(gbc); + mHardwareSplit = makeJCheckBox("HARDWARE_SPLIT"); + gbc.anchor = gbc.NORTHWEST; + //gbc.weightx = 0.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, + DIFFERENT_COMPONENT_SPACE - COMPONENT_SPACE,0,COMPONENT_SPACE); + add(mHardwareSplit, gbc); + mHardwareSplit.setEnabled(false); + mHardwareSplit.setSelected(false); + **/ + + CMSAdminUtil.resetGBC(gbc); + JLabel dummy = new JLabel(" "); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy, gbc); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKRATokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRATokenLogonPage.java new file mode 100644 index 000000000..82857a154 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKRATokenLogonPage.java @@ -0,0 +1,74 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * This panel asks for the information of the current internal database. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIKRATokenLogonPage extends WITokenLogonPage implements IWizardPanel { + + private static final String HELPINDEX = "install-kratoken-logon-wizard-help"; + private static final String PANELNAME = "KRATOKENLOGONWIZARD"; + + WIKRATokenLogonPage(JDialog dialog) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = dialog; + } + + WIKRATokenLogonPage(JDialog dialog, JFrame adminFrame) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = dialog; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String tokenname = wizardInfo.getKRATokenName(); + String pwd = (String)wizardInfo.get("TOKEN:"+tokenname); + if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) { + if (pwd != null && !pwd.equals("")) + return false; + } + if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isInstallCertNow() || + !wizardInfo.isKRAInstalled() || wizardInfo.isKRACertInstalledDone()) + return false; + if (pwd != null) + return false; + + mTokenText.setText(tokenname); + mTokenName = tokenname; + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIKeyPage.java new file mode 100644 index 000000000..d67d0e339 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIKeyPage.java @@ -0,0 +1,641 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.text.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Setup key information for certificate setup wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIKeyPage extends WizardBasePanel implements IWizardPanel, ItemListener { + protected Color mActiveColor; + protected JComboBox mKeyTypeBox, mKeyLengthBox, mDSAKeyLengthBox, mTokenBox; + protected JTextField mKeyLengthText; + protected JPasswordField mPassword, mPasswordAgain, mSOPPassword; + protected JLabel keyTypeLbl, keyLengthCustomText, keyLengthLbl, unitLbl, + keyLengthCustomLbl, unit1Lbl, mTokenLbl; + protected JTextArea keyHeading; + protected JLabel mPasswdLbl, mPasswdAgainLbl, mSOPLbl; + private String mPanelName; + protected String[] mTokenInitialized; + protected String[] mTokenLogin; + protected InstallWizardInfo mWizardInfo; + protected String mHelpIndex; + protected boolean mIsCAKey; + + WIKeyPage(String panelName) { + super(panelName); + mPanelName = panelName; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + mWizardInfo = (InstallWizardInfo)info; + setBorder(makeTitledBorder(mPanelName)); + if (mTokenBox.getItemCount() > 0) { + mTokenBox.removeAllItems(); + } + + String tokenList = mWizardInfo.getTokensList(); + StringTokenizer tokenizer = new StringTokenizer(tokenList, ":"); + int count = tokenizer.countTokens(); + while (tokenizer.hasMoreTokens()) { + mTokenBox.addItem((String)tokenizer.nextToken()); + } + + String initializedList = mWizardInfo.getTokensInit(); + tokenizer = new StringTokenizer(initializedList, ":"); + int i=0; + mTokenInitialized = new String[count]; + while (tokenizer.hasMoreElements()) { + mTokenInitialized[i] = (String)tokenizer.nextToken(); + i++; + } + + String loginList = mWizardInfo.getTokensLogin(); + tokenizer = new StringTokenizer(loginList, ":"); + i=0; + mTokenLogin = new String[count]; + while (tokenizer.hasMoreElements()) { + mTokenLogin[i] = (String)tokenizer.nextToken(); + i++; + } + + //mTokenBox.setSelectedIndex(0); + mTokenBox.addItemListener(this); + + String type = (String)mKeyTypeBox.getSelectedItem(); + if (type.equals("RSA")) { + mDSAKeyLengthBox.setVisible(false); + mKeyLengthBox.setVisible(true); + } else { + mKeyLengthBox.setVisible(false); + mDSAKeyLengthBox.setVisible(true); + } + + enableKeyLengthFields(); + return true; + } + + public boolean validatePanel() { + int index = mTokenBox.getSelectedIndex(); + + if (mKeyLengthText.isEnabled()) { + String str = mKeyLengthText.getText().trim(); + if (str.equals("")) { + setErrorMessage("BLANKLEN"); + return false; + } else { + try { + int num = Integer.parseInt(str); + if (num <= 0) { + setErrorMessage("INVALIDKEYLEN"); + return false; + }else if (mKeyTypeBox.isVisible()) { + String type = (String)mKeyTypeBox.getSelectedItem(); + if (type.equals("RSA")) { + float fraction = (float)num / (float)8.0; + int wholeNumber = (int)fraction; + if((fraction - wholeNumber)!=0) { + setErrorMessage("RSAINVALID"); + return false; + } + }else { + float fraction = (float)num / (float)64.0; + int wholeNumber = (int)fraction; + if(num < 512 || num > 1024 || (fraction - wholeNumber)!=0){ + setErrorMessage("DSAINVALID"); + return false; + } + } + } + } catch (NumberFormatException e) { + setErrorMessage("NONINTEGER"); + return false; + } + } + } + + if (index > 0) + return validateHardwareToken(index); + else + return validateInternalToken(index); + } + + private boolean validateHardwareToken(int index) { + String passwd = mPassword.getText(); + String passwdAgain = mPasswordAgain.getText(); + String sopPasswd = mSOPPassword.getText(); + if (mTokenLogin[index].equals(ConfigConstants.TRUE)) { + return true; + } + + if (mTokenInitialized[index].equals(ConfigConstants.TRUE)) { + if (passwd.equals("")) { + setErrorMessage("BLANKPASSWD"); + return false; + } + return true; + } + + if (passwd.equals("") || passwdAgain.equals("") || sopPasswd.equals("")) { + setErrorMessage("BLANKPASSWD"); + return false; + } + if (!passwd.equals(passwdAgain)) { + setErrorMessage("NOTSAMEPASSWD"); + return false; + } + return true; + } + + private boolean validateInternalToken(int index) { + String passwd = mPassword.getText(); + String passwdAgain = mPasswordAgain.getText(); + if (mTokenLogin[index].equals(ConfigConstants.TRUE)) { + return true; + } + + if (mTokenInitialized[index].equals(ConfigConstants.TRUE)) { + if (passwd.equals("")) { + setErrorMessage("BLANKPASSWD"); + return false; + } + return true; + } + + if (passwd.equals("") || passwdAgain.equals("")) { + setErrorMessage("BLANKPASSWD"); + return false; + } + if (!passwd.equals(passwdAgain)) { + setErrorMessage("NOTSAMEPASSWD"); + return false; + } + return true; + } + + public boolean concludePanel(WizardInfo info) { + mWizardInfo = (InstallWizardInfo)info; + + String customLen = ""; + if (mKeyLengthText.isEnabled()) + customLen = mKeyLengthText.getText(); + + if (customLen != null && (!customLen.trim().equals(""))) { + mWizardInfo.put(ConfigConstants.PR_KEY_LEN, customLen); + } else { + if (mKeyLengthBox.isVisible()) { + mWizardInfo.put(ConfigConstants.PR_KEY_LEN, + mKeyLengthBox.getSelectedItem()); + } else if (mDSAKeyLengthBox.isVisible()) { + mWizardInfo.put(ConfigConstants.PR_KEY_LEN, + mDSAKeyLengthBox.getSelectedItem()); + } + } + + if (mIsCAKey) { + mWizardInfo.put(ConfigConstants.PR_CA_KEYTYPE, mKeyTypeBox.getSelectedItem()); + mWizardInfo.put(ConfigConstants.PR_CA_KEYTYPE, mKeyTypeBox.getSelectedItem()); + } + + mWizardInfo.put(ConfigConstants.PR_KEY_TYPE, mKeyTypeBox.getSelectedItem()); + + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_INIT_TOKEN; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_TOKEN_NAME+"="+(String)mTokenBox.getSelectedItem(); + rawData = rawData+"&"+ConfigConstants.PR_TOKEN_PASSWD+"="+mPassword.getText().trim(); + String sop = mSOPPassword.getText().trim(); + if (sop != null) { + rawData = rawData+"&"+ConfigConstants.PR_TOKEN_SOP+"="+sop; + } + rawData = rawData+"&"+ConfigConstants.PR_KEY_LEN+"="+mWizardInfo.getKeyLength(); + rawData = rawData+"&"+ConfigConstants.PR_KEY_TYPE+"="+mWizardInfo.getKeyType(); + rawData = rawData+"&"+ConfigConstants.PR_CERTIFICATE_TYPE+"="+mWizardInfo.getCertType(); + + startProgressStatus(); +// CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "INITTOKEN"); + + boolean ready = send(rawData, mWizardInfo); + + if (ready) { + rawData = rawData+"&"+ConfigConstants.TASKID+"="+TaskId.TASK_TOKEN_INFO; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ; + ready = send(rawData, mWizardInfo); + } + + if (ready) { + rawData = rawData+"&"+ConfigConstants.TASKID+"="+TaskId.TASK_CHECK_KEYLENGTH; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + ready = send(rawData, mWizardInfo); + } + + //dlg.setVisible(false); + + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(); + if (str.equals("")) { + String errorMsg = mResource.getString( + mPanelName+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JPanel panel = new JPanel(); + GridBagLayout gb1 = new GridBagLayout(); + panel.setLayout(gb1); + + JPanel panel2 = new JPanel(); + GridBagLayout gb3 = new GridBagLayout(); + panel2.setLayout(gb3); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + add(panel, gbc); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + add(panel2, gbc); + + JTextArea selectTokenLbl = createTextArea(mResource.getString( + mPanelName+"_LABEL_SELECTTOKEN_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE,0); + panel.add(selectTokenLbl, gbc); + + JLabel tokenLbl = makeJLabel("TOKEN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.CENTER; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + gbc.fill = gbc.NONE; + panel.add(tokenLbl, gbc); + + mTokenBox = new JComboBox(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + //gbc.weightx = 1.0; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + panel.add(mTokenBox, gbc); + + JTextArea dummy2 = createTextArea(" ", 1, 5); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + panel.add(dummy2, gbc); + + mTokenLbl = new JLabel(""); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, 0, + COMPONENT_SPACE,COMPONENT_SPACE); + panel2.add(mTokenLbl, gbc); + + mPasswdLbl = makeJLabel("PASSWD"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + panel2.add(mPasswdLbl, gbc); + + mPassword = new JPasswordField(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + panel2.add(mPassword, gbc); + + mPasswdAgainLbl = makeJLabel("PASSWDAGAIN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + panel2.add(mPasswdAgainLbl, gbc); + + mPasswordAgain = new JPasswordField(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + panel2.add(mPasswordAgain, gbc); + + mSOPLbl = makeJLabel("SOP"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + panel2.add(mSOPLbl, gbc); + + mSOPPassword = new JPasswordField(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel2.add(mSOPPassword, gbc); + + keyHeading = createTextArea(mResource.getString( + mPanelName+"_LABEL_KEY_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + add(keyHeading, gbc); + + keyTypeLbl = makeJLabel("KEYTYPE"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(keyTypeLbl, gbc); + + mKeyTypeBox = makeJComboBox("KEYTYPE"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + gbc.fill = gbc.NONE; + add(mKeyTypeBox, gbc); + + keyLengthLbl = makeJLabel("KEYLENGTH"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE); + add(keyLengthLbl, gbc); + + mDSAKeyLengthBox = makeJComboBox("DSAKEYLENGTH"); + mDSAKeyLengthBox.setVisible(false); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE); + add(mDSAKeyLengthBox, gbc); + + mKeyLengthBox = makeJComboBox("KEYLENGTH"); + mKeyLengthBox.setVisible(true); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE); + add(mKeyLengthBox, gbc); + + unitLbl = makeJLabel("UNITS"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.CENTER; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, 0,COMPONENT_SPACE, COMPONENT_SPACE); + add(unitLbl, gbc); + + JPanel panel1 = new JPanel(); + GridBagLayout gb2 = new GridBagLayout(); + panel1.setLayout(gb2); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, 0, 0, 0); + add(panel1, gbc); + + keyLengthCustomText = makeJLabel("CUSTOMKEY"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + panel1.add(keyLengthCustomText, gbc); + +/* + keyLengthCustomLbl = makeJLabel("KEYLENGTH"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.CENTER; + gbc.fill = gbc.NONE; + //gbc.gridheight = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE,0,COMPONENT_SPACE); + add(keyLengthCustomLbl, gbc); +*/ + + mKeyLengthText = makeJTextField(7); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + //gbc.gridheight = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, + COMPONENT_SPACE, 0); + panel1.add(mKeyLengthText, gbc); + mActiveColor = mKeyLengthText.getBackground(); + + unit1Lbl = makeJLabel("UNITS"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + //gbc.gridheight = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE); + panel1.add(unit1Lbl, gbc); + + JLabel dummy1 = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy1, gbc); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + mWizardInfo = (InstallWizardInfo)info; + String name = (String)mTokenBox.getSelectedItem(); + if (name.equalsIgnoreCase(Constants.PR_INTERNAL_TOKEN)) + name = Constants.PR_INTERNAL_TOKEN_NAME; + mWizardInfo.put(ConfigConstants.PR_TOKEN_NAME, name); + if (mPassword.isEditable()) { + // this is used for single signon. The key is the token name with + // the prefix "TOKEN:" and the value is the token password. + mWizardInfo.put("TOKEN:"+name, mPassword.getText().trim()); + } + + mTokenBox.removeItemListener(this); + } + + public void actionPerformed(ActionEvent e) { + } + + public void itemStateChanged(ItemEvent e){ + //super.itemStateChanged(e); + if (e.getSource().equals(mTokenBox)) { + JComboBox c = (JComboBox)(e.getSource()); + if (c.getItemCount() > 0) + enableFields(); + } else if (e.getSource().equals(mKeyLengthBox) || + e.getSource().equals(mDSAKeyLengthBox)) { + enableKeyLengthFields(); + } else if (e.getSource().equals(mKeyTypeBox)) { + String type = (String)mKeyTypeBox.getSelectedItem(); + if (type.equals("RSA")) { + mDSAKeyLengthBox.setVisible(false); + mKeyLengthBox.setVisible(true); + } else { + mDSAKeyLengthBox.setVisible(true); + mKeyLengthBox.setVisible(false); + } + enableKeyLengthFields(); + CMSAdminUtil.repaintComp(this); + } + } + + protected void enableKeyLengthFields() { + String value = ""; + if (mKeyLengthBox.isVisible()) + value = (String)mKeyLengthBox.getSelectedItem(); + else + value = (String)mDSAKeyLengthBox.getSelectedItem(); + + if (value.equals("Custom")) { + enableFields(keyLengthCustomText, mKeyLengthText, true, mActiveColor); + enableFields(unit1Lbl, null, true, mActiveColor); + } else { + enableFields(keyLengthCustomText, mKeyLengthText, false, + getBackground()); + enableFields(unit1Lbl, null, false, getBackground()); + } + } + + protected void enableFields(JComponent comp1, JTextComponent comp2, boolean enable, + Color color) { + if (comp1 != null) { + comp1.setEnabled(enable); + CMSAdminUtil.repaintComp(comp1); + } + if (comp2 != null) { + comp2.setEnabled(enable); + comp2.setBackground(color); + comp2.setEditable(enable); + CMSAdminUtil.repaintComp(comp2); + } + } + + + protected void enableFields() { + int index = mTokenBox.getSelectedIndex(); + + if (mTokenLogin[index].equals(ConfigConstants.TRUE)) { + mTokenLbl.setText(""); + enableFields(mTokenLbl, null, false, null); + enableFields(mSOPLbl, mSOPPassword, false, getBackground()); + enableFields(mPasswdLbl, mPassword, false, getBackground()); + enableFields(mPasswdAgainLbl, mPasswordAgain, false, getBackground()); + } else { + if (mTokenInitialized[index].equals(ConfigConstants.TRUE)) { + String str = mResource.getString(mPanelName+"_LABEL_LOGIN_LABEL"); + mTokenLbl.setText(str); + enableFields(mTokenLbl, null, true, null); + enableFields(mPasswdAgainLbl, mPasswordAgain, false, getBackground()); + enableFields(mPasswdLbl, mPassword, true, mActiveColor); + enableFields(mSOPLbl, mSOPPassword, false, getBackground()); +/* + if (index == 0) { + enableFields(mSOPLbl, mSOPPassword, false, getBackground()); + } else { + enableFields(mSOPLbl, mSOPPassword, true, mActiveColor); + } +*/ + } else { + String str = mResource.getString(mPanelName+"_LABEL_INITIALIZE_LABEL"); + mTokenLbl.setText(str); + enableFields(mTokenLbl, null, true, null); + enableFields(mTokenLbl, null, true, null); + enableFields(mPasswdAgainLbl, mPasswordAgain, true, mActiveColor); + enableFields(mPasswdLbl, mPassword, true, mActiveColor); + if (index == 0) { + enableFields(mSOPLbl, mSOPPassword, false, getBackground()); + } else { + enableFields(mSOPLbl, mSOPPassword, true, mActiveColor); + } + } + } + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WILDAPPublishingPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WILDAPPublishingPage.java new file mode 100644 index 000000000..5cb6b3db3 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WILDAPPublishingPage.java @@ -0,0 +1,279 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WILDAPPublishingPage extends WizardBasePanel implements IWizardPanel { + private JTextField mHostNameText, mPortText, mBindAsText; + private JCheckBox mSecurePort, mEnable; + private JLabel mBindAsLabel, mCertLabel; + private JComboBox mAuthBox, mCertBox, mVersionBox; + + private static final String PANELNAME = "LDAPPUBLISHINGWIZARD"; + private static final String HELPINDEX = + "configuration-kra-wizard-change-keyscheme-help"; + private static final String EMPTYSTR = " "; + private static final String DELIMITER = ","; + private final static String[] AUTHTYPE = {Constants.PR_BASIC_AUTH, + Constants.PR_SSL_AUTH}; + + WILDAPPublishingPage() { + super(PANELNAME); + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea desc = createTextArea( + CMSAdminUtil.wrapText(mResource.getString( + "INTERNALDBWIZARD_TEXT_HEADING_LABEL"), 80), 2, 80); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + mEnable = makeJCheckBox("ENABLE"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mEnable, gbc); + + JPanel panel = new JPanel(); + panel.setBorder(CMSAdminUtil.makeTitledBorder(mResource, + PANELNAME, "DESTINATION")); + GridBagLayout gb1 = new GridBagLayout(); + panel.setLayout(gb1); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.weighty = 1.0; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + add(panel, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel hostName = makeJLabel("HOST"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + panel.add(hostName, gbc); + + CMSAdminUtil.resetGBC(gbc); + mHostNameText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + panel.add(mHostNameText, gbc); + +/* + CMSAdminUtil.resetGBC(gbc); + JTextArea dummy = createTextArea(" ", 2, 5); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + add(dummy, gbc); +*/ + + CMSAdminUtil.resetGBC(gbc); + JLabel portNumber = makeJLabel("PORT"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + panel.add(portNumber, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPortText = makeJTextField(10); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + panel.add(mPortText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mSecurePort = makeJCheckBox("SECUREPORT"); + gbc.anchor = gbc.NORTHWEST; + //gbc.weightx = 0.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, + DIFFERENT_COMPONENT_SPACE - COMPONENT_SPACE,0,COMPONENT_SPACE); + panel.add(mSecurePort, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel versionLbl = makeJLabel("VERSION"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(versionLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mVersionBox = makeJComboBox("VERSION"); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(mVersionBox, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel dummy = new JLabel(" "); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(dummy, gbc); + + CMSAdminUtil.resetGBC(gbc); + mBindAsLabel = makeJLabel("BINDAS"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(mBindAsLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mBindAsText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(mBindAsText, gbc); + + CMSAdminUtil.resetGBC(gbc); + mCertLabel = makeJLabel("CERTLIST"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(mCertLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mCertBox = new JComboBox(); + mCertBox.addItem("internal"); + gbc.fill = gbc.NONE; + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(mCertBox, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel dummy1 = new JLabel(" "); + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(dummy1, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel authLbl = makeJLabel("AUTHTYPE"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.gridheight = gbc.REMAINDER; + //gbc.weighty = 1.0; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(authLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mAuthBox = makeJComboBox("AUTHTYPE"); + //gbc.weighty = 1.0; + gbc.anchor = gbc.NORTHWEST; + gbc.gridheight = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(mAuthBox, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel dummy2 = new JLabel(" "); + gbc.gridwidth = gbc.REMAINDER; + gbc.anchor = gbc.NORTHWEST; + gbc.gridheight = gbc.REMAINDER; + gbc.weightx = 1.0; + //gbc.weighty = 1.0; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel.add(dummy2, gbc); + +/* + CMSAdminUtil.resetGBC(gbc); + JTextArea dummy1 = createTextArea(" ", 2, 30); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + add(dummy1, gbc); +*/ + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WILoggingPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WILoggingPage.java new file mode 100644 index 000000000..a28a4795d --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WILoggingPage.java @@ -0,0 +1,202 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WILoggingPage extends WizardBasePanel implements IWizardPanel { + private JCheckBox mEnableSysLog; + private JCheckBox mEnableErrorLog; + private JCheckBox mEnableAuditLog; + private JComboBox mlogFQC, mLogLevel; + private JTextField mlogMaxSizText, mlogBufSizText; + private static final String PANELNAME = "LOGGINGWIZARD"; + private static final String HELPINDEX = + "configuration-kra-wizard-change-keyscheme-help"; + private static final String EMPTYSTR = " "; + + protected final static int YEAR = 31536000; + protected final static int MONTH = 2592000; + protected final static int WEEK = 604800; + protected final static int DAY = 86400; + protected final static int HOUR = 3600; + + WILoggingPage() { + super(PANELNAME); + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + mEnableSysLog = makeJCheckBox("SYSLOG"); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mEnableSysLog, gbc); + + CMSAdminUtil.resetGBC(gbc); + mEnableErrorLog = makeJCheckBox("ERRORLOG"); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(0, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mEnableErrorLog, gbc); + + CMSAdminUtil.resetGBC(gbc); + mEnableAuditLog = makeJCheckBox("AUDITLOG"); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mEnableAuditLog, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel logFQC = makeJLabel("LOGFQC"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + add(logFQC, gbc); + + CMSAdminUtil.resetGBC(gbc); + mlogFQC = makeJComboBox("LOGFQC"); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 0.0; + add(mlogFQC, gbc); + + CMSAdminUtil.resetGBC(gbc); + JTextArea dummy1 = new JTextArea(EMPTYSTR, 1, 20); + dummy1.setBackground(getBackground()); + dummy1.setEditable(false); + dummy1.setCaretColor(getBackground()); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + add(dummy1, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel logMaxSiz = makeJLabel("LOGMAXSIZ"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + add(logMaxSiz, gbc); + + CMSAdminUtil.resetGBC(gbc); + mlogMaxSizText = makeJTextField(10); + gbc.anchor = gbc.NORTHWEST; + add(mlogMaxSizText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel maxLabel = makeJLabel("SIZEUNIT"); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + add(maxLabel, gbc); + //mActiveColor = mlogMaxSizText.getBackground(); + + CMSAdminUtil.resetGBC(gbc); + JLabel logBufSiz = makeJLabel("LOGBUFSIZ"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + add(logBufSiz, gbc); + + CMSAdminUtil.resetGBC(gbc); + mlogBufSizText = makeJTextField(10); + gbc.anchor = gbc.NORTHWEST; + add(mlogBufSizText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel bufferLabel = makeJLabel("SIZEUNIT"); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + add(bufferLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel logLevel = makeJLabel("LOGLEVEL"); + gbc.fill = gbc.NONE; + gbc.anchor = gbc.NORTHEAST; + add(logLevel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mLogLevel = makeJComboBox("LOGLEVEL"); + gbc.anchor = gbc.NORTHWEST; + add(mLogLevel, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel dummy4 = new JLabel(EMPTYSTR); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy4, gbc); + +/* + CMSAdminUtil.resetGBC(gbc); + JLabel dummy = new JLabel(" "); + JLabel dummy5 = new JLabel(" "); + gbc.weighty = 0.1; + CMSAdminUtil.addEntryField(this, dummy, dummy5, gbc); +*/ + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WILogonAllTokensPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WILogonAllTokensPage.java new file mode 100644 index 000000000..9a8060b30 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WILogonAllTokensPage.java @@ -0,0 +1,264 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import javax.swing.text.*; +import javax.swing.table.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.config.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * This panel asks for the information of the current internal database. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WILogonAllTokensPage extends WizardBasePanel implements IWizardPanel { + private ProfileDataTable mTable; + private static final String EMPTYSTR = " "; + private static final String PANELNAME = "LOGONALLTOKENSWIZARD"; + private static final String HELPINDEX = "install-internaldb-configuration-wizard-help"; + + WILogonAllTokensPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WILogonAllTokensPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + setBorder(makeTitledBorder(PANELNAME)); + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + String tokenList = wizardInfo.getTokensList(); + String tokenLoggedIn = wizardInfo.getTokensLogin(); + String tokenInits = wizardInfo.getTokensInit(); + StringTokenizer tokenizer = new StringTokenizer(tokenList, ":"); + StringTokenizer tokenizerLoggedIn = new StringTokenizer(tokenLoggedIn, ":"); + StringTokenizer tokenizerInits = new StringTokenizer(tokenInits, ":"); + String loggedIn = ""; + String inits = ""; + + boolean logon = false; + Vector defcolNames = new Vector(); + defcolNames.addElement("Token Name"); + defcolNames.addElement("Password"); + Vector defdata = new Vector(); + + while (tokenizer.hasMoreElements()) { + String token = (String)tokenizer.nextElement(); + loggedIn = (String)tokenizerLoggedIn.nextElement(); + inits = (String)tokenizerInits.nextElement(); + + // if (loggedIn.equals("false")) { + // always logon to the token. + if (inits.equals("true")) { + Vector v = new Vector(); + v.addElement(new JLabel(token)); + v.addElement(new JPasswordField()); + defdata.addElement(v); + logon = true; + } + //} + } + + ProfilePolicyEditDataModel defmodel = new ProfilePolicyEditDataModel(); + defmodel.setInfo(defdata, defcolNames); + mTable.setModel(defmodel); + + return logon; + } + + public boolean validatePanel() { + for (int i=0; i<mTable.getRowCount(); i++) { + JComponent comp = (JComponent)mTable.getValueAt(i,1); + if (comp instanceof JPasswordField) { + String val2 = ((JPasswordField)comp).getText().trim(); + if (val2.trim().equals("")) { + setErrorMessage("CANNOTBEBLANK"); + return false; + } + } + } + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + cleanUpWizardInfo(wizardInfo); + String tokenNames = ""; + String pwds = ""; + + String val1 = ""; + String val2 = ""; + for (int i=0; i<mTable.getRowCount(); i++) { + JComponent comp = (JComponent)mTable.getValueAt(i,0); + if (comp instanceof JLabel) { + val1 = ((JLabel)comp).getText().trim(); + } + JComponent comp1 = (JComponent)mTable.getValueAt(i,1); + if (comp1 instanceof JPasswordField) { + val2 = ((JPasswordField)comp1).getText().trim(); + } + wizardInfo.put("TOKEN:"+val1, val2); + if (i == 0) { + tokenNames = val1; + pwds = val2; + } else { + tokenNames = tokenNames+":"+val1; + pwds = pwds+":"+val2; + } + } + + startProgressStatus(); + String rawData = ConfigConstants.PR_TOKEN_LOGONLIST+"="+tokenNames; + rawData = rawData+"&"+ConfigConstants.PR_TOKEN_LOGON_PWDS+"="+pwds; + rawData = rawData+"&"+ConfigConstants.TASKID+"="+TaskId.TASK_LOGON_ALL_TOKENS; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_CMS_SEED+"="+ + (new Long(WizardBasePanel.mSeed).toString()); + + boolean ready = send(rawData, wizardInfo); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str == null) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } else { + rawData = ConfigConstants.TASKID+"="+TaskId.TASK_TOKEN_INFO; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ; + ready = send(rawData, wizardInfo); + } + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str == null) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + } + + endProgressStatus(); + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea desc = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + Vector colNames = new Vector(); + colNames.addElement("Token Name"); + colNames.addElement("Password"); + Vector data = new Vector(); + Vector row = new Vector(); + row.addElement("x"); + row.addElement("x"); + data.addElement(row); + ProfilePolicyEditDataModel dataModel = new ProfilePolicyEditDataModel(); + dataModel.setInfo(data, colNames); + mTable = new ProfileDataTable(dataModel); + JScrollPane scrollPane = JTable.createScrollPaneForTable(mTable); + scrollPane.setHorizontalScrollBarPolicy( + scrollPane.HORIZONTAL_SCROLLBAR_NEVER); + scrollPane.setVerticalScrollBarPolicy( + scrollPane.VERTICAL_SCROLLBAR_ALWAYS); + mTable.setAutoscrolls(true); + mTable.sizeColumnsToFit(true); + mTable.getSelectionModel().setSelectionMode( + ListSelectionModel.SINGLE_INTERVAL_SELECTION); + scrollPane.setBackground(Color.white); + mTable.setDefaultRenderer(JComponent.class, new ComponentCellRenderer()); + mTable.setDefaultEditor(JComponent.class, + new ProfileComponentCellEditor()); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.BOTH; + gbc.weighty = 1.0; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gb.setConstraints(scrollPane, gbc); + add(scrollPane, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } + + private void setLabelCellRenderer(JTable table, int index) { + table.getColumnModel().getColumn(index).setCellRenderer( + new DefaultTableCellRenderer()); + } + + private void setLabelCellEditor(JTable table, int index) { + table.getColumnModel().getColumn(index).setCellRenderer( + new PasswordCellRenderer()); + table.getColumnModel().getColumn(index).setCellEditor( + new DefaultCellEditor(new JPasswordField())); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIManualCACertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualCACertRequestPage.java new file mode 100644 index 000000000..cb1e092de --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualCACertRequestPage.java @@ -0,0 +1,86 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.management.client.console.*; + +/** + * Generate the CA signing certificate request + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIManualCACertRequestPage extends WIManualCertRequestPage { + private static final String PANELNAME = "INSTALLMANUALCACERTREQUESTWIZARD"; + private static final String CAHELPINDEX = "install-cacertrequest-manual-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakracertrequest-manual-wizard-help"; + + WIManualCACertRequestPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIManualCACertRequestPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) + return false; + + if (wizardInfo.isCACertLocalCA() || !wizardInfo.isCAInstalled() || + wizardInfo.isMigrationEnable() || + wizardInfo.isCACertInstalledDone() || + wizardInfo.isCACertRequestSucc() || + wizardInfo.isSelfSignedCACertDone()) + return false; + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else + mHelpIndex = CAHELPINDEX; + +/* + mDesc.setText(mResource.getString( + mPanelName+"_TEXT_DESC_LABEL")); +*/ + + return super.initializePanel(info); + } + + public void back_cb(WizardInfo info) { + super.back_cb(info); + info.put(ConfigConstants.CA_CERT_REQUEST_BACK,ConfigConstants.TRUE); + info.put(ConfigConstants.CA_CERT_REQUEST_BACK,ConfigConstants.TRUE); + } + +} + + + + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIManualCertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualCertRequestPage.java new file mode 100644 index 000000000..37adddb98 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualCertRequestPage.java @@ -0,0 +1,178 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.io.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Manual certificate request page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIManualCertRequestPage extends WBaseManualCertRequestPage implements IWizardPanel { +// private static final String PANELNAME = "INSTALLMANUALCERTREQUESTWIZARD"; + String mHelpIndex; + + WIManualCertRequestPage(String panelName) { + super(panelName); + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + return super.initializePanel(info); + } + + public boolean validatePanel() { + return super.validatePanel(); + } + + public boolean concludePanel(WizardInfo info) { + if (!mSendNowBox.isSelected()) + return true; + + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mHost != null && !mHost.equals("")) + wizardInfo.setCMHost(mHost); + if (mPort != null && !mPort.equals("")) + wizardInfo.setCMEEPort(mPort); + if (mSSL.isSelected()) + wizardInfo.setCMEEType("https"); + else + wizardInfo.setCMEEType("http"); + String certType = null; + String rawData = ""; + if (mReqType.equals(Constants.PR_CA_SIGNING_CERT)){ + rawData = "profileId=caCACert"; + }else if (mReqType.equals(Constants.PR_SERVER_CERT) || + mReqType.equals(Constants.PR_KRA_TRANSPORT_CERT)){ + rawData = "profileId=caServerCert"; + }else if (mReqType.equals(Constants.PR_OCSP_SIGNING_CERT)){ + rawData = "profileId=caOCSPCert"; + }else if (mReqType.equals(Constants.PR_RA_SIGNING_CERT)){ + rawData = "profileId=caRACert"; + }else { + setErrorMessage("Wrong cert request type!"); + return false; + } + + if (mReqFormat.equals(ConfigConstants.PR_REQUEST_PKCS10)){ + rawData = rawData+"&cert_request_type=pkcs10"; + rawData = rawData+"&cert_request="+mReq; + } else { + rawData = rawData+"&cert_request_type=cmc"; + rawData = rawData+"&cert_request="+mReq; + // test full response, but we don't really need it + // data.put("fullResponse", "true"); + } + + startProgressStatus(); + boolean ready = send(mHost, Integer.parseInt(mPort), + "/ca/ee/ca/profileSubmit", rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(); + if (str.equals("")) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + return ready; + } + + wizardInfo.setRequestSent(ready); + + //save the stage + String reqID = wizardInfo.getRequestID(); + String reqStatus = wizardInfo.getRequestStatus(); + String reqError = wizardInfo.getRequestError(); + + wizardInfo.setX509RequestID(reqID); + wizardInfo.setX509RequestStatus(reqStatus); + if (reqError != null) + wizardInfo.setX509RequestError(reqError); + + // rejected request should not be saved as requestSuccStage!! + if ( (reqID != null) && !reqID.equals("") && + (wizardInfo.getRequestError() == null) && + (reqStatus.equals(Constants.PR_REQUEST_SUCCESS) + || reqStatus.equals(Constants.PR_REQUEST_PENDING) + || reqStatus.equals(Constants.PR_REQUEST_SVC_PENDING)) ) { + rawData = ConfigConstants.TASKID+"="+TaskId.TASK_REQUEST_SUCCESS; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+Constants.PR_CERTIFICATE_TYPE+"="+mReqType; + rawData = rawData+"&"+mReqType+ConfigConstants.PR_REQUEST_ID+"="+ + reqID; + rawData = rawData+"&"+ConfigConstants.CA_EEPORT+"="+ + mPortText.getText(); + rawData = rawData+"&"+ConfigConstants.CA_EETYPE+"="+ + wizardInfo.getCMEEType(); + rawData = rawData+"&"+ConfigConstants.CA_HOST+"="+ + mHostText.getText(); + + startProgressStatus(); + ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(); + if (str.equals("")) { + String errorMsg = mResource.getString( + mPanelName+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + return ready; + } + } + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void back_cb(WizardInfo info) { + // clear up the status + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.remove(wizardInfo.getCertType()+ConfigConstants.PR_CERT_REQUEST+"Status"); + wizardInfo.remove(wizardInfo.getCertRequest()+"Error"); + wizardInfo.remove(wizardInfo.getCertType()+ConfigConstants.PR_REQUEST_ID); + } + + protected void init() { + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIManualKRACertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualKRACertRequestPage.java new file mode 100644 index 000000000..c1355b3d5 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualKRACertRequestPage.java @@ -0,0 +1,77 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Generate the CA signing certificate request + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIManualKRACertRequestPage extends WIManualCertRequestPage { + private static final String PANELNAME = "INSTALLMANUALKRACERTREQUESTWIZARD"; + private static final String KRAHELPINDEX = "install-kracertrequest-manual-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakra-kracertrequest-manual-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakra-kracertrequest-manual-wizard-help"; + + WIManualKRACertRequestPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIManualKRACertRequestPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) + return false; + if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isKRAInstalled() || + wizardInfo.isKRALocalCertDone() || + wizardInfo.isKRACertInstalledDone() || + wizardInfo.isKRACertRequestSucc()) + return false; + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = KRAHELPINDEX; + + return super.initializePanel(info); + } + + public void back_cb(WizardInfo info) { + super.back_cb(info); + info.put(ConfigConstants.KRA_CERT_REQUEST_BACK,ConfigConstants.TRUE); + info.put(ConfigConstants.KRA_REQUEST_DISPLAYED,ConfigConstants.FALSE); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIManualOCSPCertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualOCSPCertRequestPage.java new file mode 100644 index 000000000..268c6c395 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualOCSPCertRequestPage.java @@ -0,0 +1,72 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.management.client.util.*; + +/** + * Generate the OCSP signing certificate request + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIManualOCSPCertRequestPage extends WIManualCertRequestPage { + private static final String PANELNAME = "INSTALLMANUALOCSPCERTREQUESTWIZARD"; + private static final String OCSPHELPINDEX = "install-ocspcertrequest-manual-wizard-help"; + + WIManualOCSPCertRequestPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIManualOCSPCertRequestPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone()) + return false; + if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isOCSPInstalled() || + wizardInfo.isOCSPLocalCertDone() || + wizardInfo.isOCSPCertInstalledDone() || + wizardInfo.isOCSPCertRequestSucc() ) + return false; + + mHelpIndex = OCSPHELPINDEX; + + return super.initializePanel(info); + } + + public void back_cb(WizardInfo info) { + super.back_cb(info); + info.put(ConfigConstants.OCSP_CERT_REQUEST_BACK,ConfigConstants.TRUE); + info.put(ConfigConstants.OCSP_REQUEST_DISPLAYED,ConfigConstants.FALSE); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIManualRACertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualRACertRequestPage.java new file mode 100644 index 000000000..7439ed7b5 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualRACertRequestPage.java @@ -0,0 +1,74 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Generate the CA signing certificate request + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIManualRACertRequestPage extends WIManualCertRequestPage { + private static final String PANELNAME = "INSTALLMANUALRACERTREQUESTWIZARD"; + private static final String RAHELPINDEX = "install-racertrequest-manual-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakracertrequest-manual-wizard-help"; + + WIManualRACertRequestPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIManualRACertRequestPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isRACloningDone()) + return false; + if (wizardInfo.isRACertLocalCA() || !wizardInfo.isRAInstalled() || + wizardInfo.isRALocalCertDone() || + wizardInfo.isRACertInstalledDone() || + wizardInfo.isRACertRequestSucc() ) + return false; + + if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = RAHELPINDEX; + + return super.initializePanel(info); + } + + public void back_cb(WizardInfo info) { + super.back_cb(info); + info.put(ConfigConstants.RA_CERT_REQUEST_BACK,ConfigConstants.TRUE); + info.put(ConfigConstants.RA_REQUEST_DISPLAYED,ConfigConstants.FALSE); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIManualSSLCertRequestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualSSLCertRequestPage.java new file mode 100644 index 000000000..f96ea5208 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIManualSSLCertRequestPage.java @@ -0,0 +1,69 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Generate the CA signing certificate request + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIManualSSLCertRequestPage extends WIManualCertRequestPage { + private static final String PANELNAME = "INSTALLMANUALSSLCERTREQUESTWIZARD"; + private static final String HELPINDEX = "install-sslcertrequest-manual-wizard-help"; + + WIManualSSLCertRequestPage(JDialog parent) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = parent; + } + + WIManualSSLCertRequestPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning()) + return false; + if (wizardInfo.isSSLCertLocalCA() || wizardInfo.isMigrationEnable() || + wizardInfo.isSSLLocalCertDone() || + wizardInfo.isSSLCertInstalledDone() || + wizardInfo.isSSLCertRequestSucc()) + return false; + return super.initializePanel(info); + } + + public void back_cb(WizardInfo info) { + super.back_cb(info); + info.put(ConfigConstants.SSL_CERT_REQUEST_BACK,ConfigConstants.TRUE); + info.put(ConfigConstants.SSL_REQUEST_DISPLAYED,ConfigConstants.FALSE); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIMasterOrClone.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIMasterOrClone.java new file mode 100644 index 000000000..96c764381 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIMasterOrClone.java @@ -0,0 +1,172 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIMasterOrClone extends WizardBasePanel implements IWizardPanel { + protected JRadioButton mYes; + protected JRadioButton mNo; + protected JTextArea mLabel; + private static final String PANELNAME = "MASTERORCLONE"; + private static final String HELPINDEX = + "install-internaldb-createdbagain-help"; + + WIMasterOrClone(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIMasterOrClone(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + setBorder(makeTitledBorder(PANELNAME)); + if(wizardInfo.isCloning()) { + mYes.setSelected(true); + mNo.setSelected(false); + }else{ + mYes.setSelected(false); + mNo.setSelected(true); + } + if(wizardInfo.isClonePageDone()) + return false; + else + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + cleanUpWizardInfo(wizardInfo); + startProgressStatus(); + Debug.println("WIMasterOrClone:concludePanel() 1"); + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_MASTER_OR_CLONE; + rawData = rawData+"&"+ ConfigConstants.OPTYPE+"="+OpDef.OP_READ; + if (mYes.isSelected()) { + rawData = rawData+"&"+"cloning="+ConfigConstants.TRUE; + } else { + rawData = rawData+"&"+"cloning="+ConfigConstants.FALSE; + rawData = rawData+"&"+ConfigConstants.PR_CLONE_SETTING_DONE+"="+ConfigConstants.TRUE; + } + rawData = rawData+"&"+ConfigConstants.PR_CMS_SEED+"="+(new Long(WizardBasePanel.mSeed).toString()); + Debug.println("WIMasterOrClone:concludePanel() 2"); + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str == null) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + }else if (!mYes.isSelected()){ + wizardInfo.setClonePageDone(ConfigConstants.TRUE); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + mLabel = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mLabel, gbc); + + + mYes = makeJRadioButton("YES", false); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mYes, gbc); + + mNo = makeJRadioButton("NO", false); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(0,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mNo, gbc); + + ButtonGroup buttonGroup = new ButtonGroup(); + buttonGroup.add(mYes); + buttonGroup.add(mNo); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mYes.isSelected()) { + wizardInfo.setCloning(ConfigConstants.TRUE); + } else { + wizardInfo.setCloning(ConfigConstants.FALSE); + } + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIMigrationPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIMigrationPage.java new file mode 100644 index 000000000..ab9bcebb9 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIMigrationPage.java @@ -0,0 +1,715 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.text.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * Migration page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIMigrationPage extends WizardBasePanel implements IWizardPanel, ItemListener { + private JLabel mTransportLbl, mDBLbl; + private JPasswordField mTransportPassword, mDBPassword; + private JLabel mCAPasswdLbl, mCAPasswdAgainLbl, mCASOPLbl; + private JPasswordField mCAPassword, mCAPasswordAgain, mCASOPPassword; + private JLabel mSSLPasswdLbl, mSSLPasswdAgainLbl, mSSLSOPLbl; + private JPasswordField mSSLPassword, mSSLPasswordAgain, mSSLSOPPassword; + private JLabel mPathLbl, mCATokenHeading, mSSLTokenHeading; + private JLabel mCATokenLbl, mSSLTokenLbl; + private JTextField mPathText; + private JComboBox mCATokenBox, mSSLTokenBox; + private String[] mTokenInitialized; + private String[] mTokenLogin; + private Color mActiveColor; + private JLabel mLogonInitCATokenLbl, mLogonInitSSLTokenLbl; + private String mHelpIndex; + private InstallWizardInfo mWizardInfo; + private static final String PANELNAME = "MIGRATIONWIZARD"; + private static final String CAHELPINDEX = + "install-ca-migration-configuration-wizard-help"; + private static final String CAKRAHELPINDEX = + "install-cakra-migration-configuration-wizard-help"; + + WIMigrationPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIMigrationPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + mWizardInfo = (InstallWizardInfo)info; + if (!mWizardInfo.isMigrationEnable() || !mWizardInfo.isCAInstalled() || + mWizardInfo.isMigrationDone()) + return false; + setBorder(makeTitledBorder(PANELNAME)); + initializeTokenBox(mCATokenBox); + + if (mSSLTokenBox.getItemCount() > 0) + mSSLTokenBox.removeAllItems(); + for (int i=0; i<mCATokenBox.getItemCount(); i++) { + String str = (String)mCATokenBox.getItemAt(i); + mSSLTokenBox.addItem(str); + } + int index = mCATokenBox.getSelectedIndex(); + mWizardInfo.setMigrateCACertTokenName((String)mCATokenBox.getSelectedItem()); + enableFields(index, mLogonInitCATokenLbl, mCAPasswdLbl, mCAPassword, + mCAPasswdAgainLbl, mCAPasswordAgain, mCASOPLbl, mCASOPPassword); + + index = mSSLTokenBox.getSelectedIndex(); + mWizardInfo.setMigrateSSLCertTokenName((String)mSSLTokenBox.getSelectedItem()); + enableFields(index, mLogonInitSSLTokenLbl, mSSLPasswdLbl, mSSLPassword, + mSSLPasswdAgainLbl, mSSLPasswordAgain, mSSLSOPLbl, mSSLSOPPassword); + + mCATokenBox.addItemListener(this); + mSSLTokenBox.addItemListener(this); + enablePasswordFields(); + + if (mWizardInfo.isCAInstalled() && mWizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else + mHelpIndex = CAHELPINDEX; + + return true; + } + + private void initializeTokenBox(JComboBox tokenBox) { + if (tokenBox.getItemCount() > 0) + tokenBox.removeAllItems(); + + String tokenList = mWizardInfo.getTokensList(); + StringTokenizer tokenizer = new StringTokenizer(tokenList, ":"); + int count = tokenizer.countTokens(); + while (tokenizer.hasMoreTokens()) { + tokenBox.addItem((String)tokenizer.nextToken()); + } + + String initializedList = mWizardInfo.getTokensInit(); + tokenizer = new StringTokenizer(initializedList, ":"); + int i=0; + mTokenInitialized = new String[count]; + while (tokenizer.hasMoreElements()) { + mTokenInitialized[i] = (String)tokenizer.nextToken(); + i++; + } + + String loginList = mWizardInfo.getTokensLogin(); + tokenizer = new StringTokenizer(loginList, ":"); + i=0; + mTokenLogin = new String[count]; + while (tokenizer.hasMoreElements()) { + mTokenLogin[i] = (String)tokenizer.nextToken(); + i++; + } + } + + public boolean validatePanel() { + int caindex = mCATokenBox.getSelectedIndex(); + boolean status = false; + + if (caindex > 0) { + status = validateHardwareToken(caindex, mCAPassword, mCAPasswordAgain, + mCASOPPassword); + } else { + status = validateInternalToken(caindex, mCAPassword, mCAPasswordAgain); + } + + if (!status) + return false; + + int sslindex = mSSLTokenBox.getSelectedIndex(); + if (sslindex != caindex) { + if (sslindex > 0) { + status = validateHardwareToken(sslindex, mSSLPassword, mSSLPasswordAgain, + mSSLSOPPassword); + } else { + status = validateInternalToken(sslindex, mSSLPassword, mSSLPasswordAgain); + } + } + + return status; + } + + private boolean validateHardwareToken(int index, JPasswordField passwdField, + JPasswordField passwdAgainField, JPasswordField sopPasswdField) { + String caPasswd = mCAPassword.getText().trim(); + String caPasswdAgain = mCAPasswordAgain.getText().trim(); + String sslPasswd = mSSLPassword.getText().trim(); + String sslPasswdAgain = mSSLPasswordAgain.getText().trim(); + String sopPasswd = sopPasswdField.getText(); + if (mTokenLogin[index].equals(ConfigConstants.TRUE)) { + return true; + } + + if (mTokenInitialized[index].equals(ConfigConstants.TRUE)) { + if (caPasswd.equals("")) { + //if (caPasswd.equals("") || sopPasswd.equals("")) { + setErrorMessage("BLANKPASSWD"); + return false; + } + return true; + } + + if (caPasswd.equals("") || caPasswdAgain.equals("") || sopPasswd.equals("")) { + setErrorMessage("BLANKPASSWD"); + return false; + } + if (!caPasswd.equals(caPasswdAgain)) { + setErrorMessage("NOTSAMEPASSWD"); + return false; + } + return true; + } + + private boolean validateInternalToken(int index, JPasswordField passwdField, + JPasswordField passwdAgainField) { + String passwd = passwdField.getText(); + String passwdAgain = passwdAgainField.getText(); + if (mTokenLogin[index].equals(ConfigConstants.TRUE)) { + return true; + } + + if (mTokenInitialized[index].equals(ConfigConstants.TRUE)) { + if (passwd.equals("")) { + setErrorMessage("BLANKPASSWD"); + return false; + } + return true; + } + + if (passwd.equals("") || passwdAgain.equals("")) { + setErrorMessage("BLANKPASSWD"); + return false; + } + if (!passwd.equals(passwdAgain)) { + setErrorMessage("NOTSAMEPASSWD"); + return false; + } + return true; + } + + public boolean concludePanel(WizardInfo info) { + Hashtable data = new Hashtable(); + String caTokenName = ""; + String sslTokenName = ""; + if (mCATokenBox.getSelectedIndex() == 0) { + caTokenName = Constants.PR_INTERNAL_TOKEN_NAME; + } else { + caTokenName = (String)mCATokenBox.getSelectedItem(); + } + if (mSSLTokenBox.getSelectedIndex() == 0) { + sslTokenName = Constants.PR_INTERNAL_TOKEN_NAME; + } else { + sslTokenName = (String)mSSLTokenBox.getSelectedItem(); + } + + mWizardInfo.setCATokenName(caTokenName); + mWizardInfo.setSSLTokenName(sslTokenName); + mWizardInfo.setMigrationOutputPath(mPathText.getText().trim()); + //mWizardInfo.setInternalDBPasswd(mDBPassword.getText().trim()); + mWizardInfo.setMigrationPasswd(mTransportPassword.getText().trim()); + mWizardInfo.setSigningKeyMigrationToken(caTokenName); + mWizardInfo.setSigningKeyMigrationPasswd(mCAPassword.getText().trim()); + if (mCATokenBox.getSelectedIndex() > 0) { + mWizardInfo.setSigningKeyMigrationSOPPasswd(mCASOPPassword.getText().trim()); + data.put(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN_SOPPASSWD, + mWizardInfo.getSigningKeyMigrationSOPPasswd()); + } + mWizardInfo.setSSLKeyMigrationToken(sslTokenName); + + if (caTokenName.equals(sslTokenName)) + mWizardInfo.setSSLKeyMigrationPasswd(mCAPassword.getText().trim()); + else + mWizardInfo.setSSLKeyMigrationPasswd(mSSLPassword.getText().trim()); + + if (mSSLTokenBox.getSelectedIndex() > 0) { + mWizardInfo.setSSLKeyMigrationSOPPasswd(mSSLSOPPassword.getText().trim()); + data.put(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN_SOPPASSWD, + mWizardInfo.getSSLKeyMigrationSOPPasswd()); + } + ConsoleInfo consoleInfo = mWizardInfo.getAdminConsoleInfo(); + CMSConfigCert configCertCgi = new CMSConfigCert(); + configCertCgi.initialize(mWizardInfo); + data.put(ConfigConstants.PR_CERT_INSTANCE_NAME, + consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME)); + + data.put(ConfigConstants.TASKID, TaskId.TASK_MIGRATION); + data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY); + if (mWizardInfo.isMigrationEnable()) + data.put(ConfigConstants.PR_ENABLE_MIGRATION, ConfigConstants.TRUE); + else + data.put(ConfigConstants.PR_ENABLE_MIGRATION, ConfigConstants.FALSE); + data.put(ConfigConstants.PR_OUTPUT_PATH, + mWizardInfo.getMigrationOutputPath()); + if (mWizardInfo.getInternalDBPasswd() != null) + data.put(ConfigConstants.PR_DB_PWD, + mWizardInfo.getInternalDBPasswd()); + data.put(ConfigConstants.PR_MIGRATION_PASSWORD, + mWizardInfo.getMigrationPasswd()); + data.put(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN, + mWizardInfo.getSigningKeyMigrationToken()); + data.put(ConfigConstants.PR_SIGNING_KEY_MIGRATION_TOKEN_PASSWD, + mWizardInfo.getSigningKeyMigrationPasswd()); + data.put(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN, + mWizardInfo.getSSLKeyMigrationToken()); + data.put(ConfigConstants.PR_SSL_KEY_MIGRATION_TOKEN_PASSWD, + mWizardInfo.getSSLKeyMigrationPasswd()); + + startProgressStatus(); + boolean ready = configCertCgi.configCert(data); + endProgressStatus(); + + mWizardInfo.put("TOKEN:"+caTokenName, mCAPassword.getText().trim()); + mWizardInfo.put("TOKEN:"+sslTokenName, + mSSLPassword.getText().trim()); + + if (!ready) { + String str = configCertCgi.getErrorMessage(); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void itemStateChanged(ItemEvent e) { + super.itemStateChanged(e); + int index = 0; + if (e.getSource().equals(mCATokenBox)) { + index = mCATokenBox.getSelectedIndex(); + mWizardInfo.setMigrateCACertTokenName((String)mCATokenBox.getSelectedItem()); + enableFields(index, mLogonInitCATokenLbl, mCAPasswdLbl, mCAPassword, + mCAPasswdAgainLbl, mCAPasswordAgain, mCASOPLbl, mCASOPPassword); + enablePasswordFields(); + } else if (e.getSource().equals(mSSLTokenBox)) { + index = mSSLTokenBox.getSelectedIndex(); + mWizardInfo.setMigrateSSLCertTokenName((String)mSSLTokenBox.getSelectedItem()); + enableFields(index, mLogonInitSSLTokenLbl, mSSLPasswdLbl, mSSLPassword, + mSSLPasswdAgainLbl, mSSLPasswordAgain, mSSLSOPLbl, mSSLSOPPassword); + enablePasswordFields(); + } + } + + private void enableFields(int index, JLabel logonInitLbl, JLabel passwdLbl, + JPasswordField passwd, JLabel passwdAgainLbl, JPasswordField passwdAgain, + JLabel sopLbl, JPasswordField sopPasswd) { + if (mTokenLogin[index].equals(ConfigConstants.TRUE)) { + logonInitLbl.setText(""); + enableFields(logonInitLbl, null, false, null); + enableFields(sopLbl, sopPasswd, false, getBackground()); + enableFields(passwdLbl, passwd, false, getBackground()); + enableFields(passwdAgainLbl, passwdAgain, false, getBackground()); + } else { + if (mTokenInitialized[index].equals(ConfigConstants.TRUE)) { + String str = mResource.getString(PANELNAME+"_LABEL_LOGIN_LABEL"); + logonInitLbl.setText(str); + enableFields(logonInitLbl, null, true, null); + enableFields(passwdAgainLbl, passwdAgain, false, getBackground()); + enableFields(passwdLbl, passwd, true, mActiveColor); + enableFields(sopLbl, sopPasswd, false, getBackground()); + } else { + String str = mResource.getString(PANELNAME+"_LABEL_INITIALIZE_LABEL") +; + logonInitLbl.setText(str); + enableFields(logonInitLbl, null, true, null); + enableFields(logonInitLbl, null, true, null); + enableFields(passwdAgainLbl, passwdAgain, true, mActiveColor); + enableFields(passwdLbl, passwd, true, mActiveColor); + if (index == 0) { + enableFields(sopLbl, sopPasswd, false, getBackground()); + } else { + enableFields(sopLbl, sopPasswd, true, mActiveColor); + } + } + } + } + + protected void enableFields(JComponent comp1, JTextComponent comp2, + boolean enable, Color color) { + if (comp1 != null) { + comp1.setEnabled(enable); + CMSAdminUtil.repaintComp(comp1); + } + if (comp2 != null) { + comp2.setEnabled(enable); + comp2.setBackground(color); + comp2.setEditable(enable); + CMSAdminUtil.repaintComp(comp2); + } + } + + protected void enablePasswordFields() { + String caTokenStr = (String)mCATokenBox.getSelectedItem(); + String sslTokenStr = (String)mSSLTokenBox.getSelectedItem(); + if (caTokenStr.equals(sslTokenStr)) { + enableFields(mSSLPasswdLbl, mSSLPassword, false, getBackground()); + enableFields(mSSLPasswdAgainLbl, mSSLPasswordAgain, false, getBackground()); + } else { + enableFields(mSSLPasswdLbl, mSSLPassword, true, mActiveColor); + enableFields(mSSLPasswdAgainLbl, mSSLPasswordAgain, true, mActiveColor); + } + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + +/* + JTextArea desc = createTextArea( + CMSAdminUtil.wrapText(mResource.getString( + "MIGRATIONWIZARD_TEXT_DESC_LABEL"), 80), 1, 80); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); +*/ + + CMSAdminUtil.resetGBC(gbc); + mPathLbl = makeJLabel("PATH"); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(mPathLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPathText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mPathText, gbc); + + mTransportLbl = makeJLabel("TRANSPORTPASSWORD"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(mTransportLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mTransportPassword = makeJPasswordField(20); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mTransportPassword, gbc); + mActiveColor = mTransportPassword.getBackground(); + +/* + mDBLbl = makeJLabel("DBPASSWORD"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mDBLbl, gbc); + + mDBPassword = makeJPasswordField(20); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mDBPassword, gbc); +*/ + + JPanel panel1 = new JPanel(); + GridBagLayout gb1 = new GridBagLayout(); + panel1.setLayout(gb1); + + mCATokenHeading = makeJLabel("SELECTCATOKEN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + panel1.add(mCATokenHeading, gbc); + + mCATokenLbl = makeJLabel("TOKEN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + gbc.fill = gbc.NONE; + panel1.add(mCATokenLbl, gbc); + + mCATokenBox = new JComboBox(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + //gbc.weightx = 1.0; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + panel1.add(mCATokenBox, gbc); + + JTextArea dummy1 = createTextArea(" ", 1, 5); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + panel1.add(dummy1, gbc); + + JPanel panel1a = new JPanel(); + GridBagLayout gb1a = new GridBagLayout(); + panel1a.setLayout(gb1a); + + mLogonInitCATokenLbl = new JLabel("Initialize the selected token:"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, 0, 0, COMPONENT_SPACE); + panel1a.add(mLogonInitCATokenLbl, gbc); + + mCAPasswdLbl = makeJLabel("PASSWD"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + panel1a.add(mCAPasswdLbl, gbc); + + mCAPassword = new JPasswordField(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + panel1a.add(mCAPassword, gbc); + + mCAPasswdAgainLbl = makeJLabel("PASSWDAGAIN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + panel1a.add(mCAPasswdAgainLbl, gbc); + + mCAPasswordAgain = new JPasswordField(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + panel1a.add(mCAPasswordAgain, gbc); + + mCASOPLbl = makeJLabel("SOP"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + panel1a.add(mCASOPLbl, gbc); + + mCASOPPassword = new JPasswordField(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel1a.add(mCASOPPassword, gbc); + + JPanel panel2 = new JPanel(); + GridBagLayout gb2 = new GridBagLayout(); + panel2.setLayout(gb2); + + mSSLTokenHeading = makeJLabel("SELECTSSLTOKEN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + panel2.add(mSSLTokenHeading, gbc); + + mSSLTokenLbl = makeJLabel("TOKEN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + gbc.fill = gbc.NONE; + panel2.add(mSSLTokenLbl, gbc); + + mSSLTokenBox = new JComboBox(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + //gbc.weightx = 1.0; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + panel2.add(mSSLTokenBox, gbc); + + JTextArea dummy1a = createTextArea(" ", 1, 5); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + panel2.add(dummy1a, gbc); + + JPanel panel2a = new JPanel(); + GridBagLayout gb2a = new GridBagLayout(); + panel2a.setLayout(gb2a); + + mLogonInitSSLTokenLbl = new JLabel("Initialize the SSL token"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, 0, 0, COMPONENT_SPACE); + panel2a.add(mLogonInitSSLTokenLbl, gbc); + + mSSLPasswdLbl = makeJLabel("PASSWD"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + panel2a.add(mSSLPasswdLbl, gbc); + + mSSLPassword = new JPasswordField(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + panel2a.add(mSSLPassword, gbc); + + mSSLPasswdAgainLbl = makeJLabel("PASSWDAGAIN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + panel2a.add(mSSLPasswdAgainLbl, gbc); + + mSSLPasswordAgain = new JPasswordField(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + panel2a.add(mSSLPasswordAgain, gbc); + + mSSLSOPLbl = makeJLabel("SOP"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + panel2a.add(mSSLSOPLbl, gbc); + + mSSLSOPPassword = new JPasswordField(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + panel2a.add(mSSLSOPPassword, gbc); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gbc.weightx = 1.0; + add(panel1, gbc); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gbc.weightx = 1.0; + add(panel1a, gbc); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gbc.weightx = 1.0; + add(panel2, gbc); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gbc.weightx = 1.0; + add(panel2a, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel dumLbl = new JLabel(""); + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + add(dumLbl, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WINetworkPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WINetworkPage.java new file mode 100644 index 000000000..823980d56 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WINetworkPage.java @@ -0,0 +1,499 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.text.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * Network panel for configurating the admin and EE port. + * + * @author Christine Ho + * @version $Revision$, $Date$ + */ +class WINetworkPage extends WizardBasePanel implements IWizardPanel { + private Color mActiveColor; + + // TextField for port + private JTextField mAdminSSLPortText; + private JTextField mAgentSSLPortText; + private JTextField mGatewayPortText; + private JTextField mGatewaySSLPortText; + private JCheckBox mEnable; + + private JTextArea mAgentDesc; + private JLabel mAgentPortLbl; + private JTextField mPortText; + + protected AdminConnection mAdmin; + private boolean mBlankFieldError = false; + private boolean mNumberError = false; + private JLabel mPortLabel, mSSLPortLabel; + + private static final String HELPINDEX = + "install-network-configuration-wizard-help"; + private static final String PANELNAME = "NETWORKWIZARD"; + private static final int MAX_PORT = 65535; + private static final int MIN_PORT = 1; + private boolean mEnableEEPorts; + private InstallWizardInfo mWizardInfo; + private boolean mWarning; + + WINetworkPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WINetworkPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + mWizardInfo = wizardInfo; + if (wizardInfo.isNetworkDone()) + return false; + setBorder(makeTitledBorder(PANELNAME)); + boolean cloning = mWizardInfo.isCloning(); + String selected_sub = mWizardInfo.getCloneSubsystem(); + if (!cloning || + (cloning && (selected_sub != null && !selected_sub.equals("ca")))) { + mAgentDesc.setVisible(false); + mAgentPortLbl.setVisible(false); + mPortText.setVisible(false); + } + + if (wizardInfo.isOCSPInstalled() || wizardInfo.isOCSPServiceAdded()) { + mEnable.setSelected(true); + } else { + mEnable.setSelected(wizardInfo.isEEEnabled()); + } + + if (wizardInfo.isRAInstalled()) + mEnable.setSelected(true); + mAdminSSLPortText.setText(wizardInfo.getAdminPort()); + mAgentSSLPortText.setText(wizardInfo.getAgentPort()); + if (!wizardInfo.isCAInstalled() && !wizardInfo.isRAInstalled() && + wizardInfo.isKRAInstalled()) { + enableFields(mPortLabel, mGatewayPortText, false, getBackground()); + enableFields(mSSLPortLabel, mGatewaySSLPortText, false, getBackground()); + mEnable.setEnabled(false); + mEnableEEPorts = false; + } else { + mGatewaySSLPortText.setText(wizardInfo.getEESecurePort()); + mGatewayPortText.setText(wizardInfo.getEEPort()); + mEnable.setEnabled(true); + if (mEnable.isSelected()) { + enableFields(true, mActiveColor); + enableFields(mPortLabel, mGatewayPortText, true, mActiveColor); + } else { + enableFields(false, getBackground()); + enableFields(mPortLabel, mGatewayPortText, false, getBackground()); + } + enableFields(mSSLPortLabel, mGatewaySSLPortText, true, mActiveColor); + mEnableEEPorts = true; + } + + return true; + } + + private void enableFields(JComponent comp1, JTextComponent comp2, + boolean enable, Color color) { + if (comp1 != null) { + comp1.setEnabled(enable); + CMSAdminUtil.repaintComp(comp1); + } + if (comp2 != null) { + comp2.setEnabled(enable); + comp2.setBackground(color); + comp2.setEditable(enable); + CMSAdminUtil.repaintComp(comp2); + } + } + + public boolean validatePanel() { + String adminPort = mAdminSSLPortText.getText().trim(); + String agentPort = mAgentSSLPortText.getText().trim(); + String eePort = mGatewayPortText.getText().trim(); + String sslEEPort = mGatewaySSLPortText.getText().trim(); + String masteragentport = mPortText.getText().trim(); + + if (adminPort.equals("") || agentPort.equals("")) { + setErrorMessage("BLANKFIELD"); + return false; + } + + if (mEnableEEPorts) { + if (sslEEPort.equals("") || (mEnable.isSelected() && eePort.equals(""))) { + setErrorMessage("BLANKFIELD"); + return false; + } + } + + boolean cloning = mWizardInfo.isCloning(); + String selected_sub = mWizardInfo.getCloneSubsystem(); + if (cloning && (selected_sub != null && selected_sub.equals("ca"))) { + if (masteragentport.equals("")) { + setErrorMessage("BLANKFIELD"); + return false; + } + } + + int num = 0; + try { + num = Integer.parseInt(adminPort); + if (num < MIN_PORT || num > MAX_PORT) { + setErrorMessage("PORTRANGE"); + return false; + } + num = Integer.parseInt(agentPort); + if (num < MIN_PORT || num > MAX_PORT) { + setErrorMessage("PORTRANGE"); + return false; + } + if (mEnableEEPorts) { + num = Integer.parseInt(sslEEPort); + if (num < MIN_PORT || num > MAX_PORT) { + setErrorMessage("PORTRANGE"); + return false; + } + if (mEnable.isSelected()) { + num = Integer.parseInt(eePort); + if (num < MIN_PORT || num > MAX_PORT) { + setErrorMessage("PORTRANGE"); + return false; + } + } + } + if (cloning && (selected_sub != null && selected_sub.equals("ca"))) + num = Integer.parseInt(masteragentport); + } catch (NumberFormatException e) { + setErrorMessage("NUMBERFORMAT"); + return false; + } + + if (adminPort.equals(agentPort) || agentPort.equals(sslEEPort) || + (mEnable.isSelected() && eePort.equals(sslEEPort))) { + setErrorMessage("SAMEPORT"); + return false; + } + + if (mEnableEEPorts) { + if (agentPort.equals(sslEEPort) || + (mEnable.isSelected() && eePort.equals(sslEEPort))) { + setErrorMessage("SAMEPORT"); + return false; + } + } + setErrorMessage(""); + return true; + } + + private void setEEPorts(InstallWizardInfo wizardInfo, Hashtable data) { + String eePort = mGatewayPortText.getText().trim(); + String eeSSLPort = mGatewaySSLPortText.getText().trim(); + wizardInfo.setEEPort(eePort); + wizardInfo.setEESecurePort(eeSSLPort); + data.put(ConfigConstants.PR_EE_PORT, eePort); + data.put(ConfigConstants.PR_EE_SECURE_PORT, eeSSLPort); + if (mEnable.isSelected()) { + data.put(ConfigConstants.PR_EE_PORT_ENABLE, + ConfigConstants.TRUE); + wizardInfo.setEEEnable(ConfigConstants.TRUE); + } else { + data.put(ConfigConstants.PR_EE_PORT_ENABLE, + ConfigConstants.FALSE); + wizardInfo.setEEEnable(ConfigConstants.FALSE); + } + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo(); + CMSConfigCert configCertCgi = new CMSConfigCert(); + configCertCgi.initialize(wizardInfo); + Hashtable data = new Hashtable(); + data.put(ConfigConstants.TASKID, TaskId.TASK_CONFIGURE_NETWORK); + data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY); + String agentPort = mAgentSSLPortText.getText().trim(); + String radmPort = mAdminSSLPortText.getText().trim(); + wizardInfo.setAgentPort(agentPort); + wizardInfo.setAdminPort(radmPort); + data.put(ConfigConstants.PR_AGENT_PORT, agentPort); + data.put(ConfigConstants.PR_RADM_PORT, radmPort); + data.put(ConfigConstants.PR_CERT_INSTANCE_NAME, + consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME)); + boolean cloning = mWizardInfo.isCloning(); + String selected_sub = mWizardInfo.getCloneSubsystem(); + if (cloning && (selected_sub != null && selected_sub.equals("ca"))) + data.put(Constants.PR_MASTER_AGENT_PORT, mPortText.getText().trim()); + + if (mEnableEEPorts) { + setEEPorts(wizardInfo, data); + data.put(ConfigConstants.PR_EE_PORTS_ENABLE, ConfigConstants.TRUE); + } else + data.put(ConfigConstants.PR_EE_PORTS_ENABLE, ConfigConstants.FALSE); + + startProgressStatus(); + boolean ready = configCertCgi.configCert(data); + endProgressStatus(); + + if (!ready) { + String str = configCertCgi.getErrorMessage(); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JTextArea heading = createTextArea(mResource.getString( + "NETWORKWIZARD_TEXT_DESC_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(heading, gbc); + + JLabel adminSSLport = makeJLabel("ADMINSSLPORT"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.insets = new Insets(COMPONENT_SPACE, 0, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.fill = gbc.NONE; + add(adminSSLport, gbc); + + mAdminSSLPortText = makeJTextField(10); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + //gbc.gridwidth = gbc.REMAINDER; + //gbc.fill = gbc.NONE; + gbc.fill = gbc.HORIZONTAL; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(mAdminSSLPortText, gbc); + mActiveColor = mAdminSSLPortText.getBackground(); + + JLabel dummy2a = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + add(dummy2a, gbc); + + JLabel agentPort = makeJLabel("AGENTSSLPORT"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE,COMPONENT_SPACE); + gbc.fill = gbc.NONE; + add(agentPort, gbc); + + mAgentSSLPortText = makeJTextField(10); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.HORIZONTAL; + gbc.weightx = 1.0; + //gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + //gbc.gridwidth = gbc.REMAINDER; + add(mAgentSSLPortText, gbc); + + JLabel dummy2b = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + add(dummy2b, gbc); + + mSSLPortLabel = makeJLabel("GATEWAYSSLPORT"); + CMSAdminUtil.resetGBC(gbc); + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE,COMPONENT_SPACE); + gbc.anchor = gbc.EAST; + add(mSSLPortLabel, gbc); + + mGatewaySSLPortText = makeJTextField(10); + CMSAdminUtil.resetGBC(gbc); + //gbc.fill = gbc.NONE; + gbc.fill = gbc.HORIZONTAL; + gbc.weightx = 1.0; + gbc.anchor = gbc.WEST; + //gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mGatewaySSLPortText, gbc); + + JLabel dummy2c = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + add(dummy2c, gbc); + + mPortLabel = makeJLabel("GATEWAYPORT"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE,COMPONENT_SPACE); + add(mPortLabel, gbc); + + mGatewayPortText = makeJTextField(10); + CMSAdminUtil.resetGBC(gbc); + //gbc.fill = gbc.NONE; + gbc.fill = gbc.HORIZONTAL; + gbc.weightx = 1.0; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + gbc.anchor = gbc.WEST; + add(mGatewayPortText, gbc); + + // 610632 - remove the enable button + + JLabel enableLbl = makeJLabel("ENABLED"); + CMSAdminUtil.resetGBC(gbc); + gbc.fill = gbc.NONE; + gbc.anchor = gbc.CENTER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + // add(enableLbl, gbc); + + mEnable = new JCheckBox(); + mEnable.addActionListener(this); + CMSAdminUtil.resetGBC(gbc); + gbc.fill = gbc.NONE; + gbc.anchor = gbc.NORTHWEST; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + // add(mEnable, gbc); + + JLabel dummy1 = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + add(dummy1, gbc); + + CMSAdminUtil.resetGBC(gbc); + mAgentDesc = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING1_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(2*COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mAgentDesc, gbc); + + CMSAdminUtil.resetGBC(gbc); + mAgentPortLbl = makeJLabel("AGENTPORT"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mAgentPortLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPortText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.HORIZONTAL; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mPortText, gbc); + + JLabel dummy2 = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + add(dummy2, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.fill = gbc.NONE; + gbc.anchor = gbc.NORTHWEST; + gbc.weighty = 1.0; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } + + public void actionPerformed(ActionEvent e) { + if (mEnable.isSelected()) { + enableFields(true, mActiveColor); + } else { + if (!mWarning && (mWizardInfo.isOCSPInstalled() || mWizardInfo.isOCSPServiceAdded())) { + mWarning = true; + String errormsg = mResource.getString(mPanelName+"_WARNING"); + JOptionPane.showMessageDialog(mAdminFrame, errormsg, "Warning", + JOptionPane.WARNING_MESSAGE, + CMSAdminUtil.getImage(CMSAdminResources.IMAGE_WARN_ICON)); + } else { + enableFields(false, getBackground()); + } + } + } + + private void enableFields(boolean enable, Color color) { + mPortLabel.setEnabled(enable); + mGatewayPortText.setEnabled(enable); + mGatewayPortText.setEditable(enable); + mGatewayPortText.setBackground(color); + CMSAdminUtil.repaintComp(mPortLabel); + CMSAdminUtil.repaintComp(mGatewayPortText); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPCertDNPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPCertDNPage.java new file mode 100644 index 000000000..d13124de6 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPCertDNPage.java @@ -0,0 +1,83 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; +import com.netscape.management.client.util.*; + +/** + * Subject DN page for RA signing certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIOCSPCertDNPage extends WICertDNPage { + private static final String PANELNAME = "INSTALLOCSPCERTDNWIZARD"; + private static final String OCSPHELPINDEX = "install-ocspcert-subjectdn-wizard-help"; + + WIOCSPCertDNPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIOCSPCertDNPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone()) + return false; + + if (!wizardInfo.isOCSPInstalled() || wizardInfo.isOCSPLocalCertDone() || + wizardInfo.isOCSPCertRequestDone() || wizardInfo.isOCSPCertInstalledDone()) + return false; + String str = wizardInfo.getOCSPSubjectName(); + if (str == null || str.equals("")) + str = OCSP_CN+", "+OCSP_C; + wizardInfo.setOCSPSubjectName(str); + populateDN(str); + mHelpIndex = OCSPHELPINDEX; + return super.initializePanel(info); + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (super.concludePanel(info)) { + wizardInfo.setOCSPSubjectName(mStr); + return true; + } + + return false; + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String str = mOText.getText().trim(); + wizardInfo.setOCSPOComp(str); + str = mCText.getText().trim(); + wizardInfo.setOCSPCComp(str); + } + +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPCertSubmitPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPCertSubmitPage.java new file mode 100644 index 000000000..dd58b5f1a --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPCertSubmitPage.java @@ -0,0 +1,76 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * OCSP Certificate Submission. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIOCSPCertSubmitPage extends WICertSubmitPage implements IWizardPanel { + private static final String PANELNAME = "INSTALLOCSPCERTWIZARD"; + private static final String OCSPHELPINDEX = "install-ocsptype-wizard-help"; + + WIOCSPCertSubmitPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone()) + return false; + wizardInfo.put(Constants.PR_CERTIFICATE_TYPE, + Constants.PR_OCSP_SIGNING_CERT); + + if (!wizardInfo.isOCSPInstalled() || + wizardInfo.isOCSPCertRequestDone() || wizardInfo.isOCSPCertInstalledDone() + || + !wizardInfo.isCAInstalled()) { + wizardInfo.setOCSPCertLocalCA(Constants.FALSE); + return false; + } + if (wizardInfo.isOCSPLocalCertDone()) + return false; + + mHelpIndex = OCSPHELPINDEX; + return super.initializePanel(info); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mSelfButton.isSelected()) + wizardInfo.setOCSPCertLocalCA(Constants.TRUE); + else + wizardInfo.setOCSPCertLocalCA(Constants.FALSE); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPKeyPage.java new file mode 100644 index 000000000..a49b428a7 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPKeyPage.java @@ -0,0 +1,90 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; +import com.netscape.management.client.util.*; + +/** + * Setup key information for RA signing certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIOCSPKeyPage extends WIKeyPage implements IWizardPanel { + private static final String PANELNAME = "INSTALLOCSPKEYWIZARD"; + private static final String OCSPHELPINDEX = + "install-ocspkey-configuration-wizard-help"; + + WIOCSPKeyPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIOCSPKeyPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + mWizardInfo = (InstallWizardInfo)info; + + if (mWizardInfo.isCloning() && mWizardInfo.isOCSPCloningDone()) + return false; + if (!mWizardInfo.isOCSPInstalled() || mWizardInfo.isOCSPLocalCertDone() || + mWizardInfo.isOCSPCertRequestDone() || mWizardInfo.isOCSPCertInstalledDone()) + return false; + + if (super.initializePanel(info)) { + String ocspTokenName = mWizardInfo.getOCSPTokenName(); + if (ocspTokenName == null || ocspTokenName.equals("")) { + mTokenBox.setSelectedIndex(0); + } else { + if (ocspTokenName.equals(Constants.PR_INTERNAL_TOKEN_NAME)) + mTokenBox.setSelectedIndex(0); + else + mTokenBox.setSelectedItem(ocspTokenName); + } + } + + mHelpIndex = OCSPHELPINDEX; + + enableFields(); + mIsCAKey = false; + mWizardInfo.setCertType(Constants.PR_OCSP_SIGNING_CERT); + return true; + } + + public void getUpdateInfo(WizardInfo info) { + super.getUpdateInfo(info); + mWizardInfo.setOCSPTokenName(mWizardInfo.getTokenName()); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPMessageDigestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPMessageDigestPage.java new file mode 100644 index 000000000..ec250dcd1 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPMessageDigestPage.java @@ -0,0 +1,80 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.text.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Setup the message digest information for the installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIOCSPMessageDigestPage extends WMessageDigestPage { + + private static final String PANELNAME = "INSTALLOCSPMESSAGEDIGESTWIZARD"; + + WIOCSPMessageDigestPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIOCSPMessageDigestPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone()) + return false; + + if (!wizardInfo.isOCSPInstalled() || !wizardInfo.isOCSPCertLocalCA() || + wizardInfo.isOCSPLocalCertDone() || wizardInfo.isOCSPCertRequestDone() || + wizardInfo.isOCSPCertInstalledDone()) + return false; + + mCAKeyType = wizardInfo.getCAKeyType(); + + return super.initializePanel(info); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mDSAHashTypeBox.isVisible()) + wizardInfo.setHashType((String)mDSAHashTypeBox.getSelectedItem()); + else + wizardInfo.setHashType((String)mRSAHashTypeBox.getSelectedItem()); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPRequestResultPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPRequestResultPage.java new file mode 100644 index 000000000..a94fbf6e3 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPRequestResultPage.java @@ -0,0 +1,63 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.management.client.util.*; + +/** + * Display the OCSP signing certificate request result + * + * @author Michelle Zhao + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIOCSPRequestResultPage extends WIRequestResultPage { + + WIOCSPRequestResultPage(JDialog parent) { + super(parent); + } + + WIOCSPRequestResultPage(JDialog parent, JFrame adminFrame) { + super( parent, adminFrame); + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone()) + return false; + + if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isOCSPInstalled() || + wizardInfo.isOCSPLocalCertDone() || + (wizardInfo.isOCSPCertRequestSucc() && wizardInfo.isOCSPReqResultDisplayed()) || + wizardInfo.isOCSPCertInstalledDone()) + return false; + + wizardInfo.setOCSPReqResultDisplayed(Constants.TRUE); + return super.initializePanel(info); + } + +} + + + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPTokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPTokenLogonPage.java new file mode 100644 index 000000000..aa4be933a --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIOCSPTokenLogonPage.java @@ -0,0 +1,73 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * This panel asks for the information of the current internal database. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIOCSPTokenLogonPage extends WITokenLogonPage implements IWizardPanel { + + private static final String OCSPHELPINDEX = "install-ocsptoken-logon-wizard-help"; + private static final String PANELNAME = "OCSPTOKENLOGONWIZARD"; + + WIOCSPTokenLogonPage(JDialog dialog) { + super(PANELNAME); + mHelpIndex = OCSPHELPINDEX; + mParent = dialog; + } + + WIOCSPTokenLogonPage(JDialog dialog, JFrame adminFrame) { + super(PANELNAME); + mHelpIndex = OCSPHELPINDEX; + mParent = dialog; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String tokenname = wizardInfo.getOCSPTokenName(); + String pwd = (String)wizardInfo.get("TOKEN:"+tokenname); + + if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isInstallCertNow() + || !wizardInfo.isOCSPInstalled() || wizardInfo.isOCSPCertInstalledDone()) + return false; + + if (pwd != null) + return false; + + mTokenText.setText(tokenname); + mTokenName = tokenname; + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteCACertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteCACertPage.java new file mode 100644 index 000000000..816554588 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteCACertPage.java @@ -0,0 +1,67 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import javax.swing.*; + +/** + * The panel asks the user to paste the certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIPasteCACertPage extends WIPasteCertPage { + private static final String PANELNAME = "INSTALLPASTECACERTWIZARD"; + private static final String CAHELPINDEX = "install-cacert-paste-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakracert-paste-wizard-help"; + + WIPasteCACertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIPasteCACertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isCACloningDone()) + return false; + + if (wizardInfo.isCACertLocalCA() || !wizardInfo.isInstallCertNow() + || !wizardInfo.isCAInstalled() || wizardInfo.isMigrationEnable() + || wizardInfo.isCACertInstalledDone()) + return false; + + wizardInfo.setCertType(Constants.PR_CA_SIGNING_CERT); + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else + mHelpIndex = CAHELPINDEX; + + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteCertPage.java new file mode 100644 index 000000000..063382f32 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteCertPage.java @@ -0,0 +1,500 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import java.util.*; +import javax.swing.*; +import javax.swing.text.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * This page is to install the certificate in the internal token. The user can + * import the cert from the file, paste the Base 64 encoded blob in the + * text area or get the cert from the CMS where the request was sent. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIPasteCertPage extends WizardBasePanel implements IWizardPanel { + static private int transId = 1; + private JRadioButton mFileBtn; + private JRadioButton mBase64Btn; + private JTextField mFileText; + private JTextArea mBase64Text; + private JButton mPaste; + private String mCertContent = ""; + private String mCertFilePath = ""; + protected String mPanelName; + protected String mHelpIndex; + protected Color mActiveColor; + protected JTextArea introLbl; + + protected JTextField mHostText, mPortText, mRIDText; + protected JLabel mHostLbl, mPortLbl, mRIDLbl; + protected String mHost, mPort, mRID; + protected JLabel mSSLText; + protected JCheckBox mSSL; // ssl or not + protected JLabel mQueryText; + protected JRadioButton mQueryBtn; + + public static final int MAX_PORT = 65535; + public static final int MIN_PORT = 1; + + WIPasteCertPage(String panelName) { + super(panelName); + mPanelName = panelName; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mQueryBtn.isSelected()) + enableFields(true, mActiveColor); + else + enableFields(false, getBackground()); + + String host = wizardInfo.getCMHost(); + if (host != null && !host.equals("")) + mHostText.setText(host); + String port = wizardInfo.getCMEEPort(); + if (port != null && !port.equals("")) + mPortText.setText(port); + + String portType = wizardInfo.getCMEEType(); + if (portType != null && portType.equals("http")) + mSSL.setSelected(false); + + String rid = wizardInfo.getRequestID(); + if (rid != null && !rid.equals("")) + mRIDText.setText(rid); + + setBorder(makeTitledBorder(mPanelName)); + return true; + } + + public boolean validatePanel() { + if (mBase64Btn.isSelected()) { + mCertContent = mBase64Text.getText().trim(); + if (mCertContent.equals("")) { + setErrorMessage("B64EEMPTY"); + return false; + } + } else if (mFileBtn.isSelected()) { + mCertFilePath = mFileText.getText().trim(); + if (mCertFilePath.equals("")) { + setErrorMessage("EMPTYFILE"); + return false; + } + } else if (mQueryBtn.isSelected()) { + mHost = mHostText.getText().trim(); + mPort = mPortText.getText().trim(); + mRID = mRIDText.getText().trim(); + + if (mRID.equals("")) { + setErrorMessage("BLANKRID"); + return false; + } + try { + int ridnumber = Integer.parseInt(mRID); + } catch (NumberFormatException e) { + setErrorMessage("INVALIDRID"); + return false; + } + + if (mHost.equals("")) { + setErrorMessage("BLANKHOST"); + return false; + } + if (mPort.equals("")) { + setErrorMessage("BLANKPORT"); + return false; + } + + try { + int portnumber = Integer.parseInt(mPort); + if (portnumber < MIN_PORT || portnumber > MAX_PORT) { + setErrorMessage("OUTOFRANGE"); + return false; + } + } catch (NumberFormatException e) { + setErrorMessage("INVALIDPORT"); + return false; + } + return true; + } + return true; + + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_GET_CERT_CONTENT; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ; + String reqType = wizardInfo.getCertType(); + rawData = rawData+"&"+Constants.PR_CERTIFICATE_TYPE+"="+reqType; + if (mFileBtn.isSelected()) { + rawData = rawData+"&"+Constants.PR_CERT_FILEPATH+"="+mCertFilePath; + wizardInfo.setCertFilePath(mCertFilePath); + wizardInfo.setPKCS10(""); + } else if (mBase64Btn.isSelected()) { + rawData = rawData+"&"+Constants.PR_PKCS10+"="+mCertContent; + //xxx It's not pkcs10, it's certificate. + wizardInfo.setPKCS10(mCertContent); + wizardInfo.setCertFilePath(""); + } else if (mQueryBtn.isSelected()) { + if (mRID != null && !mRID.equals("")) + wizardInfo.setRequestID(mRID); + if (mHost != null && !mHost.equals("")) + wizardInfo.setCMHost(mHost); + if (mPort != null && !mPort.equals("")) + wizardInfo.setCMEEPort(mPort); + if (mSSL.isSelected()) + wizardInfo.setCMEEType("https"); + else + wizardInfo.setCMEEType("http"); + + String rawData1 = "importCert=true"; + rawData1=rawData1+"&"+"requestId="+mRID; +/* + CMSImportCert importCertCgi = new CMSImportCert(); + importCertCgi.initialize(wizardInfo); + Hashtable data1 = new Hashtable(); + data1.put("importCert", "true"); + data1.put("requestId", mRID); +*/ + + startProgressStatus(); + boolean ready = send(mHost, Integer.parseInt(mPort), "/checkRequest", + rawData1, wizardInfo); + + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(); + if (str.equals("")) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + return ready; + } + String certS= wizardInfo.getPKCS10(); + // Break the long single line:header,64 byte lines,trailer + // Assuming this is the only format we generate. + String CERT_NEW_HEADER = "-----BEGIN CERTIFICATE-----"; + String CERT_NEW_TRAILER = "-----END CERTIFICATE-----"; + String str = CERT_NEW_HEADER + "\n"; + int len = certS.length(); + for (int i = 0; i < len; i=i+64){ + if (i+64 < len) + str = str + certS.substring(i,i+64) +"\n"; + else + str = str + certS.substring(i,len) +"\n"; + } + str = str + CERT_NEW_TRAILER; + certS = str; + rawData = rawData+"&"+Constants.PR_PKCS10+"="+certS; + wizardInfo.setPKCS10(certS); + wizardInfo.setCertFilePath(""); + } + + startProgressStatus(); + boolean ready = send(rawData, wizardInfo); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(); + if (str.equals("")) { + String errorMsg = mResource.getString( + mPanelName+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + introLbl = createTextArea(mResource.getString( + mPanelName+"_LABEL_INTRO_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(introLbl, gbc); + + mFileBtn = makeJRadioButton("FILE", true); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mFileBtn, gbc); + + mFileText = makeJTextField(50); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, 4*COMPONENT_SPACE, COMPONENT_SPACE, 0); + add(mFileText, gbc); + mActiveColor = mFileText.getBackground(); + + mBase64Btn = makeJRadioButton("BASE64", false); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mBase64Btn, gbc); + + JTextArea desc = createTextArea(mResource.getString( + "PASTECERTWIZARD_TEXT_DESC_LABEL")); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,4*COMPONENT_SPACE,0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + mBase64Text = new JTextArea(null, null, 6, 10); + JScrollPane scrollPane = new JScrollPane(mBase64Text, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollPane.setPreferredSize(new Dimension(30, 50)); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.5; + gbc.insets = new Insets(0, COMPONENT_SPACE, 0, COMPONENT_SPACE); + gbc.fill = gbc.BOTH; + gbc.gridwidth = gbc.REMAINDER; + add(scrollPane, gbc); + + mPaste = makeJButton("PASTE"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE,0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mPaste, gbc); + + JLabel dummy = new JLabel(" "); + gbc.gridwidth = gbc.REMAINDER; + gbc.anchor = gbc.NORTHWEST; + gbc.weighty = 1.0; + gbc.fill = gbc.BOTH; + add(dummy, gbc); + + mQueryBtn = makeJRadioButton("QUERY", false); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(0,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mQueryBtn, gbc); + + mQueryText = new JLabel(mResource.getString( + mPanelName + "_TEXT_QUERY_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(0, 4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mQueryText, gbc); + + mHostLbl = makeJLabel("HOST"); + CMSAdminUtil.resetGBC(gbc); + gbc.fill = gbc.NONE; + gbc.anchor = gbc.EAST; + gbc.insets = new Insets(0, 4*COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mHostLbl, gbc); + + mHostText = makeJTextField(23); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mHostText, gbc); + mActiveColor = mHostText.getBackground(); + + mPortLbl = makeJLabel("PORT"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mPortLbl, gbc); + + mPortText = makeJTextField(23); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mPortText, gbc); + + mSSLText = new JLabel(mResource.getString( + mPanelName+"_TEXT_SSL_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + //gbc.gridwidth = gbc.REMAINDER; + add(mSSLText, gbc); + + mSSL = makeJCheckBox("SSL", true); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mSSL, gbc); + + mRIDLbl = makeJLabel("RID"); + CMSAdminUtil.resetGBC(gbc); + gbc.fill = gbc.NONE; + gbc.anchor = gbc.EAST; + gbc.insets = new Insets(0, 4*COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mRIDLbl, gbc); + + mRIDText = makeJTextField(23); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mRIDText, gbc); + + JLabel label = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(label, gbc); + + ButtonGroup buttonGrp = new ButtonGroup(); + buttonGrp.add(mFileBtn); + buttonGrp.add(mBase64Btn); + buttonGrp.add(mQueryBtn); + + enableFields(mFileText, true, mActiveColor); + enableFields(mBase64Text, false, getBackground()); + enableFields(false,getBackground()); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource().equals(mPaste)) { + mBase64Text.paste(); + } else if (e.getSource().equals(mFileBtn)) { + enableFields(mFileText, true, mActiveColor); + enableFields(mBase64Text, false, getBackground()); + enableFields(false, getBackground()); + } else if (e.getSource().equals(mBase64Btn)) { + enableFields(mFileText, false, getBackground()); + enableFields(mBase64Text, true, mActiveColor); + enableFields(false, getBackground()); + } else if (e.getSource().equals(mQueryBtn)) { + enableFields(mFileText, false, getBackground()); + enableFields(mBase64Text, false, getBackground()); + enableFields(true, mActiveColor); + } + } + + private void enableFields(JTextComponent comp1, boolean enable, Color color) { + comp1.setEnabled(enable); + comp1.setEditable(enable); + comp1.setBackground(color); + CMSAdminUtil.repaintComp(comp1); + } + + protected void enableFields(boolean enabled, Color color) { + mQueryText.setEnabled(enabled); + //mQueryText.setEditable(enabled); + CMSAdminUtil.repaintComp(mQueryText); + mHostLbl.setEnabled(enabled); + mPortLbl.setEnabled(enabled); + mRIDLbl.setEnabled(enabled); + mHostText.setEnabled(enabled); + mHostText.setEditable(enabled); + mHostText.setBackground(color); + mPortText.setEnabled(enabled); + mPortText.setEditable(enabled); + mPortText.setBackground(color); + mRIDText.setEnabled(enabled); + mRIDText.setEditable(enabled); + mRIDText.setBackground(color); + CMSAdminUtil.repaintComp(mHostLbl); + CMSAdminUtil.repaintComp(mHostText); + CMSAdminUtil.repaintComp(mPortLbl); + CMSAdminUtil.repaintComp(mPortText); + CMSAdminUtil.repaintComp(mRIDLbl); + CMSAdminUtil.repaintComp(mRIDText); + mSSLText.setEnabled(enabled); + //mSSLText.setEditable(enabled); + CMSAdminUtil.repaintComp(mSSLText); + mSSL.setEnabled(enabled); + //mSSL.setEditable(enabled); + //mSSL.setBackground(color); + CMSAdminUtil.repaintComp(mSSL); + + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteKRACertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteKRACertPage.java new file mode 100644 index 000000000..7166d64bf --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteKRACertPage.java @@ -0,0 +1,68 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import javax.swing.*; + +/** + * The panel asks the user to paste the certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIPasteKRACertPage extends WIPasteCertPage { + private static final String PANELNAME = "INSTALLPASTEKRACERTWIZARD"; + private static final String KRAHELPINDEX = "install-kracert-paste-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakra-kracert-paste-wizard-help"; + private static final String CAKRAHELPINDEX = "install-cakra-kracert-paste-wizard-help"; + + WIPasteKRACertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIPasteKRACertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isKRACloningDone()) + return false; + if (wizardInfo.isKRACertLocalCA() || !wizardInfo.isInstallCertNow() || + !wizardInfo.isKRAInstalled() || wizardInfo.isKRACertInstalledDone()) + return false; + + wizardInfo.setCertType(Constants.PR_KRA_TRANSPORT_CERT); + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = CAKRAHELPINDEX; + else if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = KRAHELPINDEX; + + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteOCSPCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteOCSPCertPage.java new file mode 100644 index 000000000..783d87da7 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteOCSPCertPage.java @@ -0,0 +1,63 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import javax.swing.*; +import com.netscape.management.client.util.*; + +/** + * The panel asks the user to paste the certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIPasteOCSPCertPage extends WIPasteCertPage { + + private static final String PANELNAME = "INSTALLPASTEOCSPCERTWIZARD"; + private static final String OCSPHELPINDEX = "install-ocspcert-paste-wizard-help"; + + WIPasteOCSPCertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIPasteOCSPCertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (wizardInfo.isCloning() && wizardInfo.isOCSPCloningDone()) + return false; + if (wizardInfo.isOCSPCertLocalCA() || !wizardInfo.isInstallCertNow() + || !wizardInfo.isOCSPInstalled() || wizardInfo.isOCSPCertInstalledDone()) + return false; + + wizardInfo.setCertType(Constants.PR_OCSP_SIGNING_CERT); + + mHelpIndex = OCSPHELPINDEX; + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteRACertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteRACertPage.java new file mode 100644 index 000000000..584c375d4 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteRACertPage.java @@ -0,0 +1,64 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import javax.swing.*; + +/** + * The panel asks the user to paste the certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIPasteRACertPage extends WIPasteCertPage { + private static final String PANELNAME = "INSTALLPASTERACERTWIZARD"; + private static final String RAHELPINDEX = "install-racert-paste-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakracert-paste-wizard-help"; + + WIPasteRACertPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIPasteRACertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isRACloningDone()) + return false; + if (wizardInfo.isRACertLocalCA() || !wizardInfo.isInstallCertNow() + || !wizardInfo.isRAInstalled() || wizardInfo.isRACertInstalledDone()) + return false; + + wizardInfo.setCertType(Constants.PR_RA_SIGNING_CERT); + + if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = RAHELPINDEX; + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteSSLCertPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteSSLCertPage.java new file mode 100644 index 000000000..bf133bc15 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIPasteSSLCertPage.java @@ -0,0 +1,60 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import javax.swing.*; + +/** + * The panel asks the user to paste the certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIPasteSSLCertPage extends WIPasteCertPage { + private static final String PANELNAME = "INSTALLPASTESSLCERTWIZARD"; + private static final String HELPINDEX = "install-sslcert-paste-wizard-help"; + + WIPasteSSLCertPage(JDialog parent) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = parent; + } + + WIPasteSSLCertPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning()) + return false; + if (wizardInfo.isSSLCertLocalCA() || !wizardInfo.isInstallCertNow() || + wizardInfo.isMigrationEnable() || wizardInfo.isSSLCertInstalledDone()) + return false; + + wizardInfo.setCertType(Constants.PR_SERVER_CERT); + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertDNPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertDNPage.java new file mode 100644 index 000000000..788fab869 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertDNPage.java @@ -0,0 +1,86 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; + +/** + * Subject DN page for RA signing certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIRACertDNPage extends WICertDNPage { + private static final String PANELNAME = "INSTALLRACERTDNWIZARD"; + private static final String RAHELPINDEX = "install-racert-subjectdn-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakracert-subjectdn-wizard-help"; + + WIRACertDNPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIRACertDNPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (wizardInfo.isCloning() && wizardInfo.isRACloningDone()) + return false; + if (!wizardInfo.isRAInstalled() || wizardInfo.isRALocalCertDone() || + wizardInfo.isRACertRequestDone() || wizardInfo.isRACertInstalledDone()) + return false; + String str = wizardInfo.getRASubjectName(); + if (str == null || str.equals("")) + str = RA_CN+", "+RA_C; + wizardInfo.setRASubjectName(str); + populateDN(str); + if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = RAHELPINDEX; + return super.initializePanel(info); + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (super.concludePanel(info)) { + wizardInfo.setRASubjectName(mStr); + return true; + } + + return false; + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String str = mOText.getText().trim(); + wizardInfo.setRAOComp(str); + str = mCText.getText().trim(); + wizardInfo.setRACComp(str); + } + +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertExtensionPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertExtensionPage.java new file mode 100644 index 000000000..85553c5c7 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertExtensionPage.java @@ -0,0 +1,75 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.border.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Certificate Extension page for RA signing Certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIRACertExtensionPage extends WICertExtensionPage { + private static final String PANELNAME = "INSTALLRACERTEXTENSION1WIZARD"; + private static final String RAHELPINDEX = "install-racert-extension-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakracert-extension-wizard-help"; + + WIRACertExtensionPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIRACertExtensionPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isRACloningDone()) + return false; + if (!wizardInfo.isRAInstalled() || + wizardInfo.isRALocalCertDone() || wizardInfo.isRACertRequestDone() || + wizardInfo.isRACertInstalledDone()) + return false; + + if (!mModified) { + mAKICheckBox.setSelected(true); + mExtendedKeyCheckBox.setSelected(true); + mSSLClient.setSelected(true); + } + + if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = RAHELPINDEX; + + return super.initializePanel(info); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertSubmitPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertSubmitPage.java new file mode 100644 index 000000000..771aa51b3 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertSubmitPage.java @@ -0,0 +1,76 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * RA Certificate Submission. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIRACertSubmitPage extends WICertSubmitPage implements IWizardPanel { + private static final String PANELNAME = "INSTALLRACERTWIZARD"; + private static final String RAHELPINDEX = "install-ratype-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakratype-wizard-help"; + + WIRACertSubmitPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isRACloningDone()) + return false; + wizardInfo.put(Constants.PR_CERTIFICATE_TYPE, + Constants.PR_RA_SIGNING_CERT); + if (!wizardInfo.isRAInstalled() || + wizardInfo.isRACertRequestDone() || wizardInfo.isRACertInstalledDone() || + !wizardInfo.isCAInstalled()) { + wizardInfo.setRACertLocalCA(Constants.FALSE); + return false; + } + if (wizardInfo.isRALocalCertDone()) + return false; + if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = RAHELPINDEX; + return super.initializePanel(info); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mSelfButton.isSelected()) + wizardInfo.setRACertLocalCA(Constants.TRUE); + else + wizardInfo.setRACertLocalCA(Constants.FALSE); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertValidityPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertValidityPage.java new file mode 100644 index 000000000..fec7619df --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRACertValidityPage.java @@ -0,0 +1,74 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Validity page for RA signing certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIRACertValidityPage extends WICertValidityPage { + private static final String PANELNAME = "INSTALLRACERTVALIDWIZARD"; + private static final String RAHELPINDEX = "install-racert-validity-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakracert-validity-wizard-help"; + + WIRACertValidityPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIRACertValidityPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isRACloningDone()) + return false; + if (!wizardInfo.isRAInstalled() || wizardInfo.isRALocalCertDone() || + wizardInfo.isRACertRequestDone() || wizardInfo.isRACertInstalledDone()) + return false; + if (super.initializePanel(info)) { + if (!wizardInfo.isRACertLocalCA()) + return false; + + if (wizardInfo.isRAInstalled() && wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = RAHELPINDEX; + + return true; + } + return false; + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRAKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRAKeyPage.java new file mode 100644 index 000000000..9abb9e0ac --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRAKeyPage.java @@ -0,0 +1,94 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Setup key information for RA signing certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIRAKeyPage extends WIKeyPage implements IWizardPanel { + private static final String PANELNAME = "INSTALLRAKEYWIZARD"; + private static final String RAHELPINDEX = + "install-rakey-configuration-wizard-help"; + private static final String RAKRAHELPINDEX = + "install-rakrakey-configuration-wizard-help"; + + WIRAKeyPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIRAKeyPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + mWizardInfo = (InstallWizardInfo)info; + + if (mWizardInfo.isCloning() && mWizardInfo.isRACloningDone()) + return false; + + if (!mWizardInfo.isRAInstalled() || mWizardInfo.isRALocalCertDone() || + mWizardInfo.isRACertRequestDone() || mWizardInfo.isRACertInstalledDone()) + return false; + + if (super.initializePanel(info)) { + String raTokenName = mWizardInfo.getRATokenName(); + if (raTokenName == null || raTokenName.equals("")) { + mTokenBox.setSelectedIndex(0); + } else { + if (raTokenName.equals(Constants.PR_INTERNAL_TOKEN_NAME)) + mTokenBox.setSelectedIndex(0); + else + mTokenBox.setSelectedItem(raTokenName); + } + } + + if (mWizardInfo.isRAInstalled() && mWizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = RAHELPINDEX; + + enableFields(); + mIsCAKey = false; + return true; + } + + public void getUpdateInfo(WizardInfo info) { + super.getUpdateInfo(info); + mWizardInfo.setRATokenName(mWizardInfo.getTokenName()); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRAMessageDigestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRAMessageDigestPage.java new file mode 100644 index 000000000..ef843ba37 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRAMessageDigestPage.java @@ -0,0 +1,79 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.text.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Setup the message digest information for the installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIRAMessageDigestPage extends WMessageDigestPage { + + private static final String PANELNAME = "INSTALLRAMESSAGEDIGESTWIZARD"; + + WIRAMessageDigestPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIRAMessageDigestPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning() && wizardInfo.isRACloningDone()) + return false; + if (!wizardInfo.isRAInstalled() || !wizardInfo.isRACertLocalCA() || + wizardInfo.isRALocalCertDone() || wizardInfo.isRACertRequestDone() || + wizardInfo.isRACertInstalledDone()) + return false; + + mCAKeyType = wizardInfo.getCAKeyType(); + + return super.initializePanel(info); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mDSAHashTypeBox.isVisible()) + wizardInfo.setHashType((String)mDSAHashTypeBox.getSelectedItem()); + else + wizardInfo.setHashType((String)mRSAHashTypeBox.getSelectedItem()); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRARequestResultPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRARequestResultPage.java new file mode 100644 index 000000000..36c81b7d9 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRARequestResultPage.java @@ -0,0 +1,58 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Display the RA signing certificate request result + * + * @author Michelle Zhao + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIRARequestResultPage extends WIRequestResultPage { + + WIRARequestResultPage(JDialog parent) { + super(parent); + } + + WIRARequestResultPage(JDialog parent, JFrame adminFrame) { + super( parent, adminFrame); + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isRACertLocalCA() || !wizardInfo.isRAInstalled() || + wizardInfo.isRALocalCertDone() || + (wizardInfo.isRACertRequestSucc() && wizardInfo.isRAReqResultDisplayed()) || + wizardInfo.isRACertInstalledDone()) + return false; + + wizardInfo.setRAReqResultDisplayed(Constants.TRUE); + return super.initializePanel(info); + } +} + + + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRATokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRATokenLogonPage.java new file mode 100644 index 000000000..d6f9dbafe --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRATokenLogonPage.java @@ -0,0 +1,75 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * This panel asks for the information of the current internal database. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIRATokenLogonPage extends WITokenLogonPage implements IWizardPanel { + + private static final String HELPINDEX = "install-ratoken-logon-wizard-help"; + private static final String PANELNAME = "RATOKENLOGONWIZARD"; + + WIRATokenLogonPage(JDialog dialog) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = dialog; + } + + WIRATokenLogonPage(JDialog dialog, JFrame adminFrame) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = dialog; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String tokenname = wizardInfo.getRATokenName(); + String pwd = (String)wizardInfo.get("TOKEN:"+tokenname); + if (wizardInfo.isCloning() && wizardInfo.isRACloningDone()) { + if (pwd != null && !pwd.equals("")) + return false; + } + + if (wizardInfo.isRACertLocalCA() || !wizardInfo.isInstallCertNow() + || !wizardInfo.isRAInstalled() || wizardInfo.isRACertInstalledDone()) + return false; + if (pwd != null) + return false; + + mTokenText.setText(tokenname); + mTokenName = tokenname; + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRecreateDBPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRecreateDBPage.java new file mode 100644 index 000000000..f07de3134 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRecreateDBPage.java @@ -0,0 +1,139 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIRecreateDBPage extends WizardBasePanel implements IWizardPanel { + protected JRadioButton mYes; + protected JRadioButton mNo; + protected JTextArea mLabel; + private static final String PANELNAME = "INSTALLDBAGAIN"; + private static final String HELPINDEX = + "install-internaldb-createdbagain-help"; + + WIRecreateDBPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIRecreateDBPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning()) + return false; + if (wizardInfo.isDBCreated()) { + setBorder(makeTitledBorder(PANELNAME)); + return true; + } + + return false; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + mLabel = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mLabel, gbc); + + mYes = makeJRadioButton("YES", false); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mYes, gbc); + + mNo = makeJRadioButton("NO", true); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(0,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mNo, gbc); + + ButtonGroup buttonGroup = new ButtonGroup(); + buttonGroup.add(mYes); + buttonGroup.add(mNo); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mYes.isSelected()) { + wizardInfo.setDBCreateNow(ConfigConstants.TRUE); + } else { + wizardInfo.setDBCreateNow(ConfigConstants.FALSE); + } + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRemoteCASubsystem.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRemoteCASubsystem.java new file mode 100644 index 000000000..890c8ce4b --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRemoteCASubsystem.java @@ -0,0 +1,291 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.certsrv.common.*; +import javax.swing.*; +import java.awt.*; +import java.util.*; + +/** + * Remote subsystems. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ + +class WIRemoteCASubsystem extends WizardBasePanel implements IWizardPanel { + protected JTextField mHostText; + protected JTextField mPortText; + protected JTextField mTimeoutText; + protected String mHost; + protected String mPort; + protected String mTimeout; + private String mHelpIndex; + public static final int MAX_PORT = 65535; + public static final int MIN_PORT = 1; + private static final String PANELNAME = "REMOTECAWIZARD"; + private static final String RAHELPINDEX = "install-remote-ca-wizard-help"; + private static final String RAKRAHELPINDEX = "install-rakra-remote-ca-wizard-help"; + + WIRemoteCASubsystem(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIRemoteCASubsystem(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isServicesDone()) + return false; + if (wizardInfo.isRAInstalled() && !wizardInfo.isCAInstalled()) { + setBorder(makeTitledBorder(PANELNAME)); + if (wizardInfo.isKRAInstalled()) + mHelpIndex = RAKRAHELPINDEX; + else + mHelpIndex = RAHELPINDEX; + + return true; + } + + return false; + } + + public boolean validatePanel() { + mHost = mHostText.getText().trim(); + mPort = mPortText.getText().trim(); + mTimeout = mTimeoutText.getText().trim(); + if (mHost.equals("")) { + setErrorMessage("BLANKHOST"); + return false; + } + if (mPort.equals("")) { + setErrorMessage("BLANKPORT"); + return false; + } + if (mTimeout.equals("")) { + setErrorMessage("BLANKTIMEOUT"); + return false; + } + + try { + int portnumber = Integer.parseInt(mPort); + if (portnumber < MIN_PORT || portnumber > MAX_PORT) { + setErrorMessage("OUTOFRANGE"); + return false; + } + } catch (NumberFormatException e) { + setErrorMessage("INVALIDPORT"); + return false; + } + + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.setCMHost(mHost); + wizardInfo.setCMPort(mPort); + wizardInfo.setCMTimeout(mTimeout); + + if ((wizardInfo.isCAInstalled() || wizardInfo.isRAInstalled()) + && !wizardInfo.isKRAInstalled()) { + return true; + } + + ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo(); + CMSConfigCert configCertCgi = new CMSConfigCert(); + configCertCgi.initialize(wizardInfo); + Hashtable data = new Hashtable(); + + data.put(ConfigConstants.TASKID,TaskId.TASK_SELECT_SUBSYSTEMS); + data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY); + data.put(ConfigConstants.PR_CERT_INSTANCE_NAME, + consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME)); + if (wizardInfo.getDBBindDN() != null) + data.put(ConfigConstants.PR_DB_BINDDN, wizardInfo.getDBBindDN()); + if (wizardInfo.getInternalDBPasswd() != null) + data.put(ConfigConstants.PR_DB_PWD, wizardInfo.getInternalDBPasswd()); + if (wizardInfo.isCAInstalled()) + data.put(ConfigConstants.PR_CA, ConfigConstants.TRUE); + else + data.put(ConfigConstants.PR_CA, ConfigConstants.FALSE); + + if (wizardInfo.isRAInstalled()) + data.put(ConfigConstants.PR_RA, ConfigConstants.TRUE); + else + data.put(ConfigConstants.PR_RA, ConfigConstants.FALSE); + + if (wizardInfo.isKRAInstalled()) + data.put(ConfigConstants.PR_KRA, ConfigConstants.TRUE); + else + data.put(ConfigConstants.PR_KRA, ConfigConstants.FALSE); + + String services = ""; + if (wizardInfo.isCAInstalled()) { + if (!services.equals("")) + services = services+":"; + services=services+ConfigConstants.PR_CA; + } + if (wizardInfo.isRAInstalled()) { + if (!services.equals("")) + services = services+":"; + services=services+ConfigConstants.PR_RA; + //data.put(ConfigConstants.CA_HOST, wizardInfo.getCMHost()); + //data.put(ConfigConstants.CA_PORT, wizardInfo.getCMPort()); + } + if (wizardInfo.isKRAInstalled()) { + if (!services.equals("")) + services = services+":"; + services=services+ConfigConstants.PR_KRA; + } + data.put(ConfigConstants.PR_SUBSYSTEMS, services); + data.put(ConfigConstants.REMOTE_KRA_ENABLED, ConfigConstants.FALSE); + data.put(ConfigConstants.CA_HOST, wizardInfo.getCMHost()); + data.put(ConfigConstants.CA_PORT, wizardInfo.getCMPort()); + data.put(ConfigConstants.CA_TIMEOUT, wizardInfo.getCMTimeout()); + wizardInfo.enableRemoteDRM(ConfigConstants.FALSE); + wizardInfo.setSubsystems(services); + startProgressStatus(); + + CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CONFIGDB"); + + boolean ready = configCertCgi.configCert(data); + + dlg.setVisible(false); + + endProgressStatus(); + + if (!ready) { + String str = configCertCgi.getErrorMessage(); + if (str.equals("")) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JTextArea heading = createTextArea(mResource.getString( + "REMOTECAWIZARD_TEXT_HEADING_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(heading, gbc); + + JLabel hostLbl = makeJLabel("HOST"); + CMSAdminUtil.resetGBC(gbc); + gbc.fill = gbc.NONE; + gbc.anchor = gbc.EAST; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + add(hostLbl, gbc); + + mHostText = makeJTextField(30); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mHostText, gbc); + + JLabel portLbl = makeJLabel("PORT"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(portLbl, gbc); + + mPortText = makeJTextField(10); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mPortText, gbc); + + JLabel timeoutLbl = makeJLabel("TIMEOUT"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + add(timeoutLbl, gbc); + + mTimeoutText = makeJTextField("30", 10); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mTimeoutText, gbc); + + /*JLabel timeunitLbl = makeJLabel("TIMEUNIT"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + add(timeunitLbl, gbc); + */ + + JLabel label = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(label, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRemoteKRASubsystem.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRemoteKRASubsystem.java new file mode 100644 index 000000000..29beb04af --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRemoteKRASubsystem.java @@ -0,0 +1,371 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import javax.swing.*; +import java.awt.*; +import java.util.*; +import java.awt.event.*; + +/** + * Remote subsystems. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ + +class WIRemoteKRASubsystem extends WizardBasePanel implements IWizardPanel { + protected JTextField mHostText, mPortText, mTimeoutText; + protected JLabel mHostLbl, mPortLbl, mTimeoutLbl, mTimeunitLbl; + protected JRadioButton mYes, mNo; + protected String mHost, mPort, mTimeout; + protected JTextArea mHeading; + protected Color mActiveColor; + public static final int MAX_PORT = 65535; + public static final int MIN_PORT = 1; + private static final String PANELNAME = "REMOTEKRAWIZARD"; + private static final String HELPINDEX1 = "install-ca-remote-kra-wizard-help"; + private static final String HELPINDEX2 = "install-ra-remote-kra-wizard-help"; + private InstallWizardInfo mWizardInfo; + + WIRemoteKRASubsystem(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIRemoteKRASubsystem(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + mWizardInfo = wizardInfo; + if (wizardInfo.isServicesDone()) + return false; + if ((wizardInfo.isCAInstalled() || wizardInfo.isRAInstalled()) + && !wizardInfo.isKRAInstalled()) { + setBorder(makeTitledBorder(PANELNAME)); + if (mYes.isSelected()) + enableFields(true, mActiveColor); + else + enableFields(false, getBackground()); + return true; + } + return false; + } + + public boolean validatePanel() { + if (mNo.isSelected()) { + mHost = ""; + mPort = ""; + mTimeout = ""; + return true; + } + + mHost = mHostText.getText().trim(); + mPort = mPortText.getText().trim(); + mTimeout = mTimeoutText.getText().trim(); + if (mHost.equals("")) { + setErrorMessage("BLANKHOST"); + return false; + } + if (mPort.equals("")) { + setErrorMessage("BLANKPORT"); + return false; + } + if (mTimeout.equals("")) { + setErrorMessage("BLANKTIMEOUT"); + return false; + } + + try { + int portnumber = Integer.parseInt(mPort); + if (portnumber < MIN_PORT || portnumber > MAX_PORT) { + setErrorMessage("OUTOFRANGE"); + return false; + } + } catch (NumberFormatException e) { + setErrorMessage("INVALIDPORT"); + return false; + } + + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.setDRMHost(mHost); + wizardInfo.setDRMPort(mPort); + wizardInfo.setDRMTimeout(mTimeout); + ConsoleInfo consoleInfo = wizardInfo.getAdminConsoleInfo(); + CMSConfigCert configCertCgi = new CMSConfigCert(); + configCertCgi.initialize(wizardInfo); + Hashtable data = new Hashtable(); + data.put(ConfigConstants.TASKID,TaskId.TASK_SELECT_SUBSYSTEMS); + data.put(ConfigConstants.OPTYPE, OpDef.OP_MODIFY); + data.put(ConfigConstants.PR_CERT_INSTANCE_NAME, + consoleInfo.get(ConfigConstants.PR_CERT_INSTANCE_NAME)); + if (wizardInfo.getDBBindDN() != null) + data.put(ConfigConstants.PR_DB_BINDDN, wizardInfo.getDBBindDN()); + if (wizardInfo.getInternalDBPasswd() != null) + data.put(ConfigConstants.PR_DB_PWD, wizardInfo.getInternalDBPasswd()); + + if (wizardInfo.isCAInstalled()) + data.put(ConfigConstants.PR_CA, ConfigConstants.TRUE); + else + data.put(ConfigConstants.PR_CA, ConfigConstants.FALSE); + + if (wizardInfo.isRAInstalled()) + data.put(ConfigConstants.PR_RA, ConfigConstants.TRUE); + else + data.put(ConfigConstants.PR_RA, ConfigConstants.FALSE); + + if (wizardInfo.isKRAInstalled()) + data.put(ConfigConstants.PR_KRA, ConfigConstants.TRUE); + else + data.put(ConfigConstants.PR_KRA, ConfigConstants.FALSE); + + String services = ""; + if (wizardInfo.isCAInstalled()) { + if (!services.equals("")) + services = services+":"; + services=services+ConfigConstants.PR_CA; + } else { + data.put(ConfigConstants.CA_HOST, wizardInfo.getCMHost()); + data.put(ConfigConstants.CA_PORT, wizardInfo.getCMPort()); + data.put(ConfigConstants.CA_TIMEOUT, wizardInfo.getCMTimeout()); + } + + if (wizardInfo.isRAInstalled()) { + if (!services.equals("")) + services = services+":"; + services=services+ConfigConstants.PR_RA; + } + if (wizardInfo.isKRAInstalled()) { + if (!services.equals("")) + services = services+":"; + services=services+ConfigConstants.PR_KRA; + } else { + // connect to the remote KRA subystem + if (mYes.isSelected()) { + data.put(ConfigConstants.KRA_HOST, wizardInfo.getDRMHost()); + data.put(ConfigConstants.KRA_PORT, wizardInfo.getDRMPort()); + data.put(ConfigConstants.KRA_TIMEOUT, wizardInfo.getDRMTimeout()); + data.put(ConfigConstants.REMOTE_KRA_ENABLED, + ConfigConstants.TRUE); + wizardInfo.enableRemoteDRM(ConfigConstants.TRUE); + } else { + data.put(ConfigConstants.REMOTE_KRA_ENABLED, + ConfigConstants.FALSE); + wizardInfo.enableRemoteDRM(ConfigConstants.FALSE); + } + } + + data.put(ConfigConstants.PR_SUBSYSTEMS, services); + wizardInfo.setSubsystems(services); + startProgressStatus(); + CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CONFIGDB"); + boolean ready = configCertCgi.configCert(data); + dlg.setVisible(false); + + endProgressStatus(); + + if (!ready) { + String str = configCertCgi.getErrorMessage(); + if (str.equals("")) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + if (mWizardInfo.isCAInstalled()) { + CMSAdminUtil.help(HELPINDEX1); + } else { + CMSAdminUtil.help(HELPINDEX2); + } + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JTextArea heading = createTextArea(mResource.getString( + "REMOTEKRAWIZARD_TEXT_ISREMOTEKRA_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(heading, gbc); + + mNo = makeJRadioButton("NO", true); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mNo, gbc); + + mYes = makeJRadioButton("YES", false); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(0,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mYes, gbc); + + ButtonGroup btnGroup = new ButtonGroup(); + btnGroup.add(mNo); + btnGroup.add(mYes); + + mHeading = createTextArea(mResource.getString( + "REMOTEKRAWIZARD_TEXT_HEADING_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.insets = new Insets(0,4*COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mHeading, gbc); + + mHostLbl = makeJLabel("HOST"); + CMSAdminUtil.resetGBC(gbc); + gbc.fill = gbc.NONE; + gbc.anchor = gbc.EAST; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + add(mHostLbl, gbc); + + mHostText = makeJTextField(30); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mHostText, gbc); + mActiveColor = mHostText.getBackground(); + + mPortLbl = makeJLabel("PORT"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0, + COMPONENT_SPACE); + add(mPortLbl, gbc); + + mPortText = makeJTextField(10); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mPortText, gbc); + + mTimeoutLbl = makeJLabel("TIMEOUT"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.EAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + add(mTimeoutLbl, gbc); + + mTimeoutText = makeJTextField("30", 10); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mTimeoutText, gbc); + + /*mTimeunitLbl = makeJLabel("TIMEUNIT"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 0, 0, + COMPONENT_SPACE); + add(mTimeunitLbl, gbc); + */ + + JLabel label = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(label, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } + + public void actionPerformed(ActionEvent e) { + if (mYes.isSelected()) { + enableFields(true, mActiveColor); + } else { + enableFields(false, getBackground()); + } + } + + private void enableFields(boolean enabled, Color color) { + mHeading.setEnabled(enabled); + mHostLbl.setEnabled(enabled); + mPortLbl.setEnabled(enabled); + mTimeoutLbl.setEnabled(enabled); + mHostText.setEnabled(enabled); + mHostText.setEditable(enabled); + mHostText.setBackground(color); + mPortText.setEnabled(enabled); + mPortText.setEditable(enabled); + mPortText.setBackground(color); + mTimeoutText.setEnabled(enabled); + mTimeoutText.setEditable(enabled); + mTimeoutText.setBackground(color); + CMSAdminUtil.repaintComp(mHeading); + CMSAdminUtil.repaintComp(mHostLbl); + CMSAdminUtil.repaintComp(mHostText); + CMSAdminUtil.repaintComp(mPortLbl); + CMSAdminUtil.repaintComp(mPortText); + CMSAdminUtil.repaintComp(mTimeoutLbl); + CMSAdminUtil.repaintComp(mTimeoutText); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIReplAgreementPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIReplAgreementPage.java new file mode 100644 index 000000000..df9bb1ab0 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIReplAgreementPage.java @@ -0,0 +1,417 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.event.*; +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Replication Agreeemnt + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIReplAgreementPage extends WizardBasePanel implements IWizardPanel { + private Color mActiveColor; + private JCheckBox mEnable; + private JTextField mAgreementText1, mAgreementText2; + private JPasswordField mManagerPwd1, mManagerPwdAgain1; + private JPasswordField mManagerPwd2, mManagerPwdAgain2; + + private static final String PANELNAME = "REPLDBWIZARD"; + private static final String HELPINDEX = + "install-internaldb-configuration-wizard-help"; + private static final String EMPTYSTR = " "; + + WIReplAgreementPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIReplAgreementPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource().equals(mEnable)) { + enableAgreement(mEnable.isSelected()); + } + } + + private void enableAgreement(boolean e) { + Color c; + if (e) { + c = mActiveColor; + } else { + c = getBackground(); + } + mAgreementText1.setEditable(e); + mAgreementText1.setEnabled(e); + mAgreementText1.setBackground(c); + mManagerPwd1.setEditable(e); + mManagerPwd1.setEnabled(e); + mManagerPwd1.setBackground(c); + mManagerPwdAgain1.setEditable(e); + mManagerPwdAgain1.setEnabled(e); + mManagerPwdAgain1.setBackground(c); + mAgreementText2.setEditable(e); + mAgreementText2.setEnabled(e); + mAgreementText2.setBackground(c); + mManagerPwd2.setEditable(e); + mManagerPwd2.setEnabled(e); + mManagerPwd2.setBackground(c); + mManagerPwdAgain2.setEditable(e); + mManagerPwdAgain2.setEnabled(e); + mManagerPwdAgain2.setBackground(c); + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (!wizardInfo.isCloneDBCreated()) + return false; + + if (wizardInfo.isCloning() && !wizardInfo.isAgreementDone()) { + setBorder(makeTitledBorder(PANELNAME)); + mAgreementText1.setText("masterToconsumer"); + mAgreementText2.setText("consumerTomaster"); + return true; + } + return false; + } + + public boolean validatePanel() { + if (!mEnable.isSelected()) + return true; + String passwd1 = mManagerPwd1.getText().trim(); + String passwdAgain1 = mManagerPwdAgain1.getText().trim(); + String name1 = mAgreementText1.getText().trim(); + + if (passwd1.equals("") || passwdAgain1.equals("")) { + setErrorMessage("EMPTYPASSWORD"); + return false; + } + + if (!passwdAgain1.equals(passwd1)) { + setErrorMessage("NOTSAMEPASSWORD"); + return false; + } + + if (name1.equals("")) { + setErrorMessage("EMPTYNAME"); + return false; + } + + String passwd2 = mManagerPwd2.getText().trim(); + String passwdAgain2 = mManagerPwdAgain2.getText().trim(); + String name2 = mAgreementText2.getText().trim(); + + if (passwd2.equals("") || passwdAgain2.equals("")) { + setErrorMessage("EMPTYPASSWORD"); + return false; + } + + if (!passwdAgain2.equals(passwd2)) { + setErrorMessage("NOTSAMEPASSWORD"); + return false; + } + + if (name2.equals("")) { + setErrorMessage("EMPTYNAME"); + return false; + } + + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_CREATE_REPLICATION_AGREEMENT; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + boolean ready = false; + if (!mEnable.isSelected()) { + rawData = rawData+"&"+ConfigConstants.PR_ENABLE_REPLICATION+"="+ + ConfigConstants.FALSE; + ready = send(rawData, wizardInfo); + } else { + rawData = rawData+"&"+ConfigConstants.PR_ENABLE_REPLICATION+"="+ + ConfigConstants.TRUE; + rawData = rawData+"&"+ConfigConstants.PR_AGREEMENT_NAME_1+"="+ + mAgreementText1.getText().trim(); + rawData = rawData+"&"+ConfigConstants.PR_REPLICATION_MANAGER_PASSWD_1+"="+mManagerPwd1.getText().trim(); + rawData = rawData+"&"+ConfigConstants.PR_AGREEMENT_NAME_2+"="+mAgreementText2.getText().trim(); + rawData = rawData+"&"+ConfigConstants.PR_REPLICATION_MANAGER_PASSWD_2+"="+mManagerPwd2.getText().trim(); + + startProgressStatus(); +/* + CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, + "CGITASK", "CREATEREPLICATIONAGREEMENT"); +*/ + ready = send(rawData, wizardInfo); + // dlg.setVisible(false); + endProgressStatus(); + } + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JTextArea desc = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + CMSAdminUtil.resetGBC(gbc); + mEnable = makeJCheckBox("ENABLE"); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mEnable, gbc); + mEnable.setSelected(true); + + CMSAdminUtil.resetGBC(gbc); + JTextArea desc1 = createTextArea(mResource.getString( + PANELNAME+"_TEXT_MASTER1_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc1, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel passwdLbl1 = makeJLabel("PASSWORD"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(passwdLbl1, gbc); + + CMSAdminUtil.resetGBC(gbc); + mManagerPwd1 = makeJPasswordField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + //gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mManagerPwd1, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel passwdAgainLbl1 = makeJLabel("PASSWORDAGAIN"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 4*COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(passwdAgainLbl1, gbc); + + CMSAdminUtil.resetGBC(gbc); + mManagerPwdAgain1 = makeJPasswordField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + //gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mManagerPwdAgain1, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel desc2 = makeJLabel("MASTER2"); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc2, gbc); +/* + JTextArea desc2 = createTextArea(mResource.getString( + PANELNAME+"_TEXT_MASTER2_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc2, gbc); +*/ + + CMSAdminUtil.resetGBC(gbc); + JLabel passwdLbl2 = makeJLabel("PASSWORD"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(passwdLbl2, gbc); + + CMSAdminUtil.resetGBC(gbc); + mManagerPwd2 = makeJPasswordField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + //gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mManagerPwd2, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel passwdAgainLbl2 = makeJLabel("PASSWORDAGAIN"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 4*COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(passwdAgainLbl2, gbc); + + CMSAdminUtil.resetGBC(gbc); + mManagerPwdAgain2 = makeJPasswordField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + //gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mManagerPwdAgain2, gbc); + + CMSAdminUtil.resetGBC(gbc); + JTextArea desc3 = createTextArea(mResource.getString( + PANELNAME+"_TEXT_AGREEMENT_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(2*COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc3, gbc); + + CMSAdminUtil.resetGBC(gbc); + JTextArea desc4 = createTextArea(mResource.getString( + PANELNAME+"_TEXT_AGREEMENT1_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc4, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel agreementLbl1 = makeJLabel("NAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(agreementLbl1, gbc); + + CMSAdminUtil.resetGBC(gbc); + mAgreementText1 = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + //gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mAgreementText1, gbc); + mActiveColor = mAgreementText1.getBackground(); + + CMSAdminUtil.resetGBC(gbc); + JTextArea desc5 = createTextArea(mResource.getString( + PANELNAME+"_TEXT_AGREEMENT2_LABEL")); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc5, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel agreementLbl2 = makeJLabel("NAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(agreementLbl2, gbc); + + CMSAdminUtil.resetGBC(gbc); + mAgreementText2 = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + //gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mAgreementText2, gbc); + mActiveColor = mAgreementText2.getBackground(); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.setAgreementDone(ConfigConstants.TRUE); + if (!mEnable.isSelected()) + wizardInfo.setReplicationEnabled(ConfigConstants.FALSE); + else + wizardInfo.setReplicationEnabled(ConfigConstants.TRUE); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIRequestResultPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIRequestResultPage.java new file mode 100644 index 000000000..e3f9c53f3 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIRequestResultPage.java @@ -0,0 +1,148 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.util.*; +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.border.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.install.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.util.*; + +/** + * Certificate wizard request result page + * + * @author Michelle Zhao + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +public class WIRequestResultPage extends WizardBasePanel implements IWizardPanel { + private static final String PANELNAME = "REQUESTRESULTWIZARD"; + private static final String HELPINDEX = + "install-request-result-wizard-help"; + + protected String mPanelName = PANELNAME; + protected String mHelpIndex = HELPINDEX; + protected JTextArea mDesc; + protected boolean print2RequestIDs = false; + + protected String mRequestId; + + WIRequestResultPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIRequestResultPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (!wizardInfo.requestSent()) + return false; + + setBorder(makeTitledBorder(PANELNAME)); + + String status = wizardInfo.getX509RequestStatus(); + String str = wizardInfo.getX509RequestID(); + String error = wizardInfo.getX509RequestError(); + + if (str != null && !str.equals("")) { + if (status != null && status.equals(Constants.PR_REQUEST_REJECTED)) { + // rejected + mDesc.setText(mResource.getString(mPanelName+"_TEXT_REJECT_LABEL") + + error + "\n\n"+ mResource.getString(mPanelName+"_TEXT_ID_LABEL") + str + + mResource.getString(mPanelName+"_TEXT_REJECTEND_LABEL")); + } else { + mDesc.setText(mResource.getString(mPanelName+"_TEXT_DESC_LABEL") + + mResource.getString(mPanelName+"_TEXT_ID_LABEL") + str + + mResource.getString(mPanelName+"_TEXT_END_LABEL")); + } + } else if (error != null && !error.equals("")) + mDesc.setText(error); + else + mDesc.setText(mResource.getString(mPanelName+"_TEXT_DESC_LABEL") + + mResource.getString(mPanelName+"_TEXT_NOID_LABEL")); + + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + mDesc = createTextArea(mResource.getString( + mPanelName+"_TEXT_DESC_LABEL")); + //mDesc = createTextArea("request id"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mDesc, gbc); + + JLabel label = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.WEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(label, gbc); + + super.init(); + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + public void getUpdateInfo(WizardInfo info) { + } + + public void actionPerformed(ActionEvent event) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WISMTPPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WISMTPPage.java new file mode 100644 index 000000000..3b7ba9d00 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WISMTPPage.java @@ -0,0 +1,129 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * SMTP page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WISMTPPage extends WizardBasePanel implements IWizardPanel { + private JTextField mServerTxt, mPortTxt; + private static final String PANELNAME = "SMTPWIZARD"; + private static final String HELPINDEX = + "configuration-kra-wizard-change-keyscheme-help"; + + WISMTPPage() { + super(PANELNAME); + init(); + } + + public boolean initializePanel(WizardInfo info) { + return true; + } + + public boolean isLastPage() { + return false; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + JLabel headingLbl = makeJLabel("HEADING"); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + add(headingLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel serverLbl = makeJLabel("SERVERNAME"); + gbc.anchor = gbc.NORTHEAST; + gbc.weightx = 0.0; + gbc.weighty = 0.0; + gbc.fill = gbc.NONE; + add(serverLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mServerTxt = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 0.0; + gbc.weighty = 0.0; + add(mServerTxt, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel dummy2 = new JLabel(" "); + gbc.anchor = gbc.NORTHEAST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.gridwidth = gbc.REMAINDER; + add(dummy2, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel portLbl = makeJLabel("PORT"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.weightx = 0.0; + gbc.weighty = 1.0; + add(portLbl, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPortTxt = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 0.0; + gbc.weighty = 1.0; + add(mPortTxt, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel dummy3 = new JLabel(" "); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.gridwidth = gbc.REMAINDER; + add(dummy3, gbc); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WISSLMessageDigestPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WISSLMessageDigestPage.java new file mode 100644 index 000000000..820c17646 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WISSLMessageDigestPage.java @@ -0,0 +1,79 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.text.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Setup the message digest information for the installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WISSLMessageDigestPage extends WMessageDigestPage { + + private static final String PANELNAME = "INSTALLSSLMESSAGEDIGESTWIZARD"; + + WISSLMessageDigestPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WISSLMessageDigestPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning()) + return false; + if (wizardInfo.isMigrationEnable() || !wizardInfo.isSSLCertLocalCA() || + wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertRequestDone() || + wizardInfo.isSSLCertInstalledDone()) + return false; + + mCAKeyType = wizardInfo.getCAKeyType(); + + return super.initializePanel(info); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mDSAHashTypeBox.isVisible()) + wizardInfo.setHashType((String)mDSAHashTypeBox.getSelectedItem()); + else + wizardInfo.setHashType((String)mRSAHashTypeBox.getSelectedItem()); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WISSLRequestResultPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WISSLRequestResultPage.java new file mode 100644 index 000000000..119221105 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WISSLRequestResultPage.java @@ -0,0 +1,58 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Display the SSL certificate request result + * + * @author Michelle Zhao + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WISSLRequestResultPage extends WIRequestResultPage { + + WISSLRequestResultPage(JDialog parent) { + super(parent); + } + + WISSLRequestResultPage(JDialog parent, JFrame adminFrame) { + super( parent, adminFrame); + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning()) + return false; + if (wizardInfo.isSSLCertLocalCA() || wizardInfo.isMigrationEnable() || + wizardInfo.isSSLLocalCertDone()|| + (wizardInfo.isSSLCertRequestSucc() && wizardInfo.isSSLReqResultDisplayed()) || + wizardInfo.isSSLCertInstalledDone()) + return false; + + wizardInfo.setSSLReqResultDisplayed(Constants.TRUE); + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WISSLTokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WISSLTokenLogonPage.java new file mode 100644 index 000000000..ff1ed7826 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WISSLTokenLogonPage.java @@ -0,0 +1,72 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * This panel asks for the information of the current internal database. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WISSLTokenLogonPage extends WITokenLogonPage implements IWizardPanel { + + private static final String HELPINDEX = "install-ssltoken-logon-wizard-help"; + private static final String PANELNAME = "SSLTOKENLOGONWIZARD"; + + WISSLTokenLogonPage(JDialog dialog) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = dialog; + } + + WISSLTokenLogonPage(JDialog dialog, JFrame adminFrame) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = dialog; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String tokenname = wizardInfo.getSSLTokenName(); + String pwd = (String)wizardInfo.get("TOKEN:"+tokenname); + if (wizardInfo.isCloning()) + return false; + if (wizardInfo.isSSLCertLocalCA() || !wizardInfo.isInstallCertNow() || + wizardInfo.isMigrationEnable() || wizardInfo.isSSLCertInstalledDone()) + return false; + if (pwd != null) + return false; + + mTokenName = tokenname; + mTokenText.setText(tokenname); + return super.initializePanel(info); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertDNPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertDNPage.java new file mode 100644 index 000000000..b6ee85acc --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertDNPage.java @@ -0,0 +1,116 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import com.netscape.admin.certsrv.wizard.*; +import javax.swing.*; + +/** + * Subject DN page for SSL server certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIServerCertDNPage extends WICertDNPage { + private static final String PANELNAME = "INSTALLSSLCERTDNWIZARD"; + private static final String LOCALHELPINDEX = "install-sslcertlocal-subjectdn-wizard-help"; + private static final String REMOTEHELPINDEX = "install-sslcertsub-subjectdn-wizard-help"; + + WIServerCertDNPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIServerCertDNPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning()) + return false; + if (wizardInfo.isMigrationEnable() || wizardInfo.isSSLLocalCertDone() || + wizardInfo.isSSLCertRequestDone() || wizardInfo.isSSLCertInstalledDone()) + return false; + String machineName = wizardInfo.getMachineName(); +// dnDesc.setText("CN="+machineName+", O=Netscape Communications, C=US"); + String str = wizardInfo.getSSLSubjectName(); +/* + if (wizardInfo.isCAInstalled()) { // It is for SSL Server cert for CA + // get O component + OComp = wizardInfo.getCAOComp(); + CComp = wizardInfo.getCACComp(); + } + else if (wizardInfo.isRAInstalled()) { // It is for SSL Server cert for RA + OComp = wizardInfo.getRAOComp(); + CComp = wizardInfo.getRACComp(); + } +*/ + + String OUComp = wizardInfo.getOUComponent(); + String OComp = wizardInfo.getOComponent(); + String LComp = wizardInfo.getLComponent(); + String STComp = wizardInfo.getSTComponent(); + String CComp = wizardInfo.getCComponent(); + + if (str == null || str.equals("")) { + str = "CN="+machineName; + if (OUComp != null && !OUComp.equals("")) { + str = str+", OU="+OUComp; + } + if (OComp != null && !OComp.equals("")) { + str = str+", O="+OComp; + } + if (LComp != null && !LComp.equals("")) { + str = str+", L="+LComp; + } + if (STComp != null && !STComp.equals("")) { + str = str+", ST="+STComp; + } + if (CComp != null && !CComp.equals("")) { + str = str+", C="+CComp; + } else { + str = str+", "+SERVER_C; + } + } + wizardInfo.setSSLSubjectName(str); + populateDN(str); + + if (wizardInfo.isSSLCertLocalCA()) + mHelpIndex = LOCALHELPINDEX; + else + mHelpIndex = REMOTEHELPINDEX; + + return super.initializePanel(info); + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + if (super.concludePanel(info)) { + wizardInfo.setSSLSubjectName(mStr); + return true; + } + + return false; + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertExtensionPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertExtensionPage.java new file mode 100644 index 000000000..f958c88a1 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertExtensionPage.java @@ -0,0 +1,71 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.border.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Certificate Extension page for SSL server Certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIServerCertExtensionPage extends WICertExtensionPage { + private static final String PANELNAME = "INSTALLSERVERCERTEXTENSION1WIZARD"; + private static final String HELPINDEX = "install-sslcert-extension-wizard-help"; + + WIServerCertExtensionPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + mHelpIndex = HELPINDEX; + } + + WIServerCertExtensionPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mHelpIndex = HELPINDEX; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning()) + return false; + if (wizardInfo.isMigrationEnable() || + wizardInfo.isSSLLocalCertDone() || wizardInfo.isSSLCertRequestDone() || + wizardInfo.isSSLCertInstalledDone()) + return false; + + if (!mModified) { + mExtendedKeyCheckBox.setSelected(true); + mAKICheckBox.setSelected(true); + mSSLServer.setSelected(true); + mSSLClient.setSelected(true); + } + return super.initializePanel(info); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertSubmitPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertSubmitPage.java new file mode 100644 index 000000000..417e706a5 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertSubmitPage.java @@ -0,0 +1,89 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * Server Certificate Submission. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIServerCertSubmitPage extends WICertSubmitPage implements IWizardPanel { + private static final String PANELNAME = "INSTALLSERVERCERTWIZARD"; + private static final String CALOCALHELPINDEX = "install-cassltypelocal-wizard-help"; + private static final String CAREMOTEHELPINDEX = "install-cassltypesub-wizard-help"; + private static final String CAKRALOCALHELPINDEX = "install-cakrassltypelocal-wizard-help"; + private static final String CAKRAREMOTEHELPINDEX = "install-cakrassltypesub-wizard-help"; + + WIServerCertSubmitPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + wizardInfo.put(Constants.PR_CERTIFICATE_TYPE, + Constants.PR_SERVER_CERT); + + if (wizardInfo.isCloning()) + return false; + + if (wizardInfo.isMigrationEnable() || + wizardInfo.isSSLCertRequestDone() || wizardInfo.isSSLCertInstalledDone() || + !wizardInfo.isCAInstalled()) { + wizardInfo.setSSLCertLocalCA(Constants.FALSE); + return false; + } + + if (wizardInfo.isSSLLocalCertDone()) + return false; + + if (wizardInfo.isCAInstalled() && wizardInfo.isKRAInstalled()) { + if (wizardInfo.isSSLCertLocalCA()) { + mHelpIndex = CAKRALOCALHELPINDEX; + } else + mHelpIndex = CAKRAREMOTEHELPINDEX; + } else if (wizardInfo.isSSLCertLocalCA()) { + mHelpIndex = CALOCALHELPINDEX; + } else { + mHelpIndex = CAREMOTEHELPINDEX; + } + + return super.initializePanel(info); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mSelfButton.isSelected()) + wizardInfo.setSSLCertLocalCA(Constants.TRUE); + else + wizardInfo.setSSLCertLocalCA(Constants.FALSE); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertValidityPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertValidityPage.java new file mode 100644 index 000000000..047b9d7e8 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerCertValidityPage.java @@ -0,0 +1,69 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Validity page for SSL server certificate. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIServerCertValidityPage extends WICertValidityPage { + private static final String PANELNAME = "INSTALLSERVERCERTVALIDWIZARD"; + private static final String HELPINDEX = "install-sslcert-validity-wizard-help"; + + WIServerCertValidityPage(JDialog parent) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = parent; + } + + WIServerCertValidityPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mHelpIndex = HELPINDEX; + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (wizardInfo.isCloning()) + return false; + if (wizardInfo.isMigrationEnable() || wizardInfo.isSSLLocalCertDone() || + wizardInfo.isSSLCertRequestDone() || wizardInfo.isSSLCertInstalledDone()) + return false; + if (super.initializePanel(info)) { + if (!wizardInfo.isSSLCertLocalCA()) + return false; + return true; + } + return false; + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIServerKeyPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerKeyPage.java new file mode 100644 index 000000000..c14d0d2b3 --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIServerKeyPage.java @@ -0,0 +1,93 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; + +/** + * Setup key information for ssl server certificate + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIServerKeyPage extends WIKeyPage implements IWizardPanel { + private static final String PANELNAME = "INSTALLSERVERKEYWIZARD"; + private static final String LOCALHELPINDEX = + "install-serverkeylocal-configuration-wizard-help"; + private static final String REMOTEHELPINDEX = + "install-serverkeysub-configuration-wizard-help"; + + WIServerKeyPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + } + + WIServerKeyPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + } + + public boolean initializePanel(WizardInfo info) { + mWizardInfo = (InstallWizardInfo)info; + + if (mWizardInfo.isCloning()) + return false; + + if (mWizardInfo.isMigrationEnable() || mWizardInfo.isSSLLocalCertDone() || + mWizardInfo.isSSLCertRequestDone() || mWizardInfo.isSSLCertInstalledDone()) + return false; + if (super.initializePanel(info)) { + String sslTokenName = mWizardInfo.getSSLTokenName(); + if (sslTokenName == null || sslTokenName.equals("")) { + mTokenBox.setSelectedIndex(0); + } else { + if (sslTokenName.equals(Constants.PR_INTERNAL_TOKEN_NAME)) + mTokenBox.setSelectedIndex(0); + else + mTokenBox.setSelectedItem(sslTokenName); + } + } + + if (mWizardInfo.isSSLCertLocalCA()) + mHelpIndex = LOCALHELPINDEX; + else + mHelpIndex = REMOTEHELPINDEX; + + enableFields(); + mIsCAKey = false; + return true; + } + + public void getUpdateInfo(WizardInfo info) { + super.getUpdateInfo(info); + mWizardInfo.setSSLTokenName(mWizardInfo.getTokenName()); + } +} + diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WIServicesPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WIServicesPage.java new file mode 100644 index 000000000..fb524e62f --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WIServicesPage.java @@ -0,0 +1,425 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.util.*; + +/** + * Introduction page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WIServicesPage extends WizardBasePanel implements IWizardPanel { + private JRadioButton mCACheckBox; + private JRadioButton mRACheckBox; + private JRadioButton mOCSPCheckBox; + private JRadioButton mKRACheckBox; + + private JRadioButton mTKSCheckBox; + private JTextArea mServiceLbl; + + private static final String PANELNAME = "SERVICESWIZARD"; + private static final String HELPINDEX = + "install-services-configuration-wizard-help"; + + private String mClonedSubsystem = null; + + WIServicesPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WIServicesPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + /* bug#54369 - disable RA for netkey */ + mRACheckBox.setEnabled(false); + + mClonedSubsystem = wizardInfo.getCloneSubsystem(); + + + if(mClonedSubsystem != null) + { + + mServiceLbl.setText(mResource.getString(PANELNAME +"_LABEL_INSTALL_CLONE_LABEL")); + if(mClonedSubsystem.equals(ConfigConstants.PR_CA)) + { + mCACheckBox.setSelected(true); + } + else + mCACheckBox.setEnabled(false); + + /* bug#54369 - disable RA for netkey + if(mClonedSubsystem.equals(ConfigConstants.PR_RA)) + { + mRACheckBox.setSelected(true); + } + else + mRACheckBox.setEnabled(false); + */ + + if(mClonedSubsystem.equals(ConfigConstants.PR_KRA)) + { + mKRACheckBox.setSelected(true); + } + else + mKRACheckBox.setEnabled(false); + + if(mClonedSubsystem.equals(ConfigConstants.PR_TKS)) + { + mTKSCheckBox.setSelected(true); + } + else + mTKSCheckBox.setEnabled(false); + + if(mClonedSubsystem.equals(ConfigConstants.PR_OCSP)) + { + mOCSPCheckBox.setSelected(true); + } + else + mOCSPCheckBox.setEnabled(false); + + } + + + Debug.println("WIServicesPage: initializePanel."); + Debug.println("WIServicesPage: mClonedSubsystem " + mClonedSubsystem); + + + if (wizardInfo.isServicesDone()) + return false; + + setBorder(makeTitledBorder(PANELNAME)); + String subsystemList = wizardInfo.getSubsystems(); + if (subsystemList == null || subsystemList.equals("")) { + if (!mRACheckBox.isSelected() && mClonedSubsystem == null) + mCACheckBox.setSelected(true); + + return true; + } + + + + // get the subsystems from the list + int start = 0; + int end; + do { + end = subsystemList.indexOf(':', start); + if( end == -1 ) { + end = subsystemList.length(); // last string ends at end-of-line + } + if( end-start < 1 ) { + setErrorMessage("INCORRECTRESPONSE"); + return false; + } + String sub = subsystemList.substring(start, end); + if( ConfigConstants.PR_CA.equals(sub) ) { + mCACheckBox.setSelected(true); + } else if( ConfigConstants.PR_RA.equals(sub) ) { + mRACheckBox.setSelected(true); + } else if( ConfigConstants.PR_KRA.equals(sub) ) { + mKRACheckBox.setSelected(true); + } else if( ConfigConstants.PR_TKS.equals(sub) ) { + mTKSCheckBox.setSelected(true); + } else if( ConfigConstants.PR_OCSP.equals(sub) ) { + mOCSPCheckBox.setSelected(true); + } else { + setErrorMessage("INCORRECTRESPONSE"); + return false; + } + start = end+1; + } while( start < subsystemList.length() ); + + return true; + } + + public boolean validatePanel() { + if (mCACheckBox.isSelected() && mRACheckBox.isSelected()) { + setErrorMessage("NOCOLOCATED"); + return false; + } + + if (!mCACheckBox.isSelected() && !mRACheckBox.isSelected() && + !mOCSPCheckBox.isSelected() && !mKRACheckBox.isSelected() && !mTKSCheckBox.isSelected()) { + setErrorMessage("NOSERVICESINSTALLED"); + return false; + } + + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + Hashtable data = new Hashtable(); + String services = ""; + if (mCACheckBox.isSelected()) { + wizardInfo.setInstalledCA(ConfigConstants.TRUE); + data.put(ConfigConstants.PR_CA, ConfigConstants.TRUE); + if (!services.equals("")) + services = services+":"; + services=services+ConfigConstants.PR_CA; + } else { + wizardInfo.setInstalledCA(ConfigConstants.FALSE); + data.put(ConfigConstants.PR_CA, ConfigConstants.FALSE); + } + + if (mRACheckBox.isSelected()) { + wizardInfo.setInstalledRA(ConfigConstants.TRUE); + data.put(ConfigConstants.PR_RA, ConfigConstants.TRUE); + if (!services.equals("")) + services = services+":"; + services=services+ConfigConstants.PR_RA; + } else { + wizardInfo.setInstalledRA(ConfigConstants.FALSE); + data.put(ConfigConstants.PR_RA, ConfigConstants.FALSE); + } + if (mKRACheckBox.isSelected()) { + wizardInfo.setInstalledKRA(ConfigConstants.TRUE); + data.put(ConfigConstants.PR_KRA, ConfigConstants.TRUE); + if (!services.equals("")) + services = services+":"; + services=services+ConfigConstants.PR_KRA; + } else { + wizardInfo.setInstalledKRA(ConfigConstants.FALSE); + data.put(ConfigConstants.PR_KRA, ConfigConstants.FALSE); + } + if (mTKSCheckBox.isSelected()) { + wizardInfo.setInstalledTKS(ConfigConstants.TRUE); + data.put(ConfigConstants.PR_TKS, ConfigConstants.TRUE); + if (!services.equals("")) + services = services+":"; + services=services+ConfigConstants.PR_TKS; + } else { + wizardInfo.setInstalledTKS(ConfigConstants.FALSE); + data.put(ConfigConstants.PR_TKS, ConfigConstants.FALSE); + } + if (mOCSPCheckBox.isSelected()) { + wizardInfo.setInstalledOCSP(ConfigConstants.TRUE); + data.put(ConfigConstants.PR_OCSP, ConfigConstants.TRUE); + if (!services.equals("")) + services = services+":"; + services=services+ConfigConstants.PR_OCSP; + } else { + wizardInfo.setInstalledOCSP(ConfigConstants.FALSE); + data.put(ConfigConstants.PR_OCSP, ConfigConstants.FALSE); + } + + if (services != null && !services.equals("")) { + wizardInfo.setSubsystems(services); + } + + + String rawData = ConfigConstants.PR_SUBSYSTEMS+"="+services; + rawData = rawData+"&"+ConfigConstants.TASKID+"="+TaskId.TASK_SELECT_SUBSYSTEMS; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + if (wizardInfo.getDBBindDN() != null) + rawData = rawData+"&"+ConfigConstants.PR_DB_BINDDN+"="+wizardInfo.getDBBindDN(); + if (wizardInfo.getInternalDBPasswd() != null) + rawData = rawData+"&"+ConfigConstants.PR_DB_PWD+"="+ + wizardInfo.getInternalDBPasswd(); + + rawData = rawData+"&"+ConfigConstants.REMOTE_KRA_ENABLED+"="+ + ConfigConstants.FALSE; + wizardInfo.enableRemoteDRM(ConfigConstants.FALSE); + startProgressStatus(); + + //CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CREATESUB"); + boolean ready = send(rawData, wizardInfo); + //dlg.setVisible(false); + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource().equals(mCACheckBox)) { + mTKSCheckBox.setSelected(false); + mKRACheckBox.setSelected(false); + mOCSPCheckBox.setSelected(false); + if(mClonedSubsystem != null) + mCACheckBox.setSelected(true); + + mRACheckBox.setSelected(false); + } else if (e.getSource().equals(mOCSPCheckBox)) { + mTKSCheckBox.setSelected(false); + mKRACheckBox.setSelected(false); + mCACheckBox.setSelected(false); + mRACheckBox.setSelected(false); + if(mClonedSubsystem != null) + mOCSPCheckBox.setSelected(true); + } else if (e.getSource().equals(mRACheckBox)) { + mCACheckBox.setSelected(false); + mTKSCheckBox.setSelected(false); + mKRACheckBox.setSelected(false); + mOCSPCheckBox.setSelected(false); + if(mClonedSubsystem != null) + mRACheckBox.setSelected(true); + } else if (e.getSource().equals(mKRACheckBox)) { + mTKSCheckBox.setSelected(false); + mCACheckBox.setSelected(false); + mRACheckBox.setSelected(false); + mOCSPCheckBox.setSelected(false); + if(mClonedSubsystem != null) + mKRACheckBox.setSelected(true); + }else if (e.getSource().equals(mTKSCheckBox)) { + mCACheckBox.setSelected(false); + mRACheckBox.setSelected(false); + mOCSPCheckBox.setSelected(false); + mKRACheckBox.setSelected(false); + if(mClonedSubsystem != null) + mTKSCheckBox.setSelected(true); + } + + super.actionPerformed(e); + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + mServiceLbl = createTextArea(mResource.getString( + PANELNAME+"_LABEL_INSTALL_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mServiceLbl, gbc); + + mCACheckBox = makeJRadioButton("CA"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mCACheckBox, gbc); + + mOCSPCheckBox = makeJRadioButton("OCSP"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mOCSPCheckBox, gbc); + + mRACheckBox = makeJRadioButton("RA"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mRACheckBox, gbc); + + mKRACheckBox = makeJRadioButton("KRA"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + //gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mKRACheckBox, gbc); + + mTKSCheckBox = makeJRadioButton("TKS"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + //gbc.weighty = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mTKSCheckBox, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy, gbc); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + if (mCACheckBox.isSelected()) + wizardInfo.setInstalledCA(ConfigConstants.TRUE); + else + wizardInfo.setInstalledCA(ConfigConstants.FALSE); + if (mRACheckBox.isSelected()) + wizardInfo.setInstalledRA(ConfigConstants.TRUE); + else + wizardInfo.setInstalledRA(ConfigConstants.FALSE); + if (mKRACheckBox.isSelected()) + wizardInfo.setInstalledKRA(ConfigConstants.TRUE); + else + wizardInfo.setInstalledKRA(ConfigConstants.FALSE); + if (mTKSCheckBox.isSelected()) + wizardInfo.setInstalledTKS(ConfigConstants.TRUE); + else + wizardInfo.setInstalledTKS(ConfigConstants.FALSE); + if (mOCSPCheckBox.isSelected()) + wizardInfo.setInstalledOCSP(ConfigConstants.TRUE); + else + wizardInfo.setInstalledOCSP(ConfigConstants.FALSE); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WISingleSignonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WISingleSignonPage.java new file mode 100644 index 000000000..49e06ac1e --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WISingleSignonPage.java @@ -0,0 +1,532 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.io.*; +import java.net.*; +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; +import javax.swing.text.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.config.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; +import com.netscape.management.client.comm.*; +import com.netscape.management.client.util.*; + +/** + * Setup Single Signon for the installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WISingleSignonPage extends WizardBasePanel implements IWizardPanel, CommClient { + + public static final String PW_TAG_INTERNAL_LDAP_DB = "Internal LDAP Database"; + public static final String PW_TAG_INTERNAL_STORAGE_TOKEN = "internal"; + + private Color mActiveColor; + // private JPasswordField mSingleSignonPassword, mSingleSignonPasswordAgain; + private JCheckBox mPasswordConf; + private static final String HELPINDEX = "install-single-signon-wizard-help"; + private static final String PANELNAME = "INSTALLSINGLESIGNON"; + private boolean ca; + private boolean ra; + private boolean kra; + private String mDBPasswd; + private String capassword, rapassword, krapassword, sslpassword; + private JComboBox mTokenBox; + private static final String START_TASK_CGI = "Tasks/Operation/start"; + private static final String PREFIX = "CGITASK"; + private boolean mFinished = false; + protected String mCmd = null; + private String mAdminURL = null; + protected boolean mSuccess = false; + private String mReply = null; + protected String mSection = ""; + protected String mErrorMsg = ""; + private ConsoleInfo _consoleInfo = null; + + WISingleSignonPage(JDialog parent) { + super(PANELNAME); + mParent = parent; + init(); + } + + WISingleSignonPage(JDialog parent, JFrame adminFrame) { + super(PANELNAME); + mParent = parent; + mAdminFrame = adminFrame; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + String tokenList = wizardInfo.getTokensList(); + StringTokenizer st1 = new StringTokenizer(tokenList, ":"); + + mTokenBox.removeAllItems(); + while (st1.hasMoreElements()) { + String t1 = (String)st1.nextElement(); + mTokenBox.addItem(t1); + } + + mDBPasswd = wizardInfo.getInternalDBPasswd(); + + String tokenname = ""; + String password = ""; + if (wizardInfo.isCAInstalled()) { + tokenname = wizardInfo.getCATokenName(); + password = (String)wizardInfo.get("TOKEN:"+tokenname); + if (password == null || password.equals("")) { + capassword = ""; + } else { + capassword = password; + } + ca = true; + } else { + capassword = ""; + ca = false; + } + + if (wizardInfo.isRAInstalled()) { + tokenname = wizardInfo.getRATokenName(); + password = (String)wizardInfo.get("TOKEN:"+tokenname); + if (password == null || password.equals("")) { + rapassword = ""; + } else { + rapassword = password; + } + ra = true; + } else { + rapassword = ""; + ra = false; + } + + if (wizardInfo.isKRAInstalled()) { + tokenname = wizardInfo.getKRATokenName(); + password = (String)wizardInfo.get("TOKEN:"+tokenname); + if (password == null || password.equals("")) { + krapassword = ""; + } else { + krapassword = password; + } + kra = true; + } else { + krapassword = ""; + kra = false; + } + + tokenname = wizardInfo.getSSLTokenName(); + password = (String)wizardInfo.get("TOKEN:"+tokenname); + if (password == null || password.equals("")) { + sslpassword = ""; + } else { + sslpassword = password; + } + setBorder(makeTitledBorder(PANELNAME)); + return true; + } + + public boolean validatePanel() { + return true; + } + + + /** + * Copy from CGITask.java + */ + public boolean run(String cmd) { + // get the admin URL location first + String mAdminURL = _consoleInfo.getAdminURL(); + if ( mAdminURL == null ) { + return false; + } + + // Allow specifying e.g. "slapd-install" for instance + String instance = (String)_consoleInfo.get( cmd ); + if (instance == null) + instance = (String)_consoleInfo.get( "ServerInstance" ); + String fullCmd = mAdminURL + instance + "/" + cmd; + + HttpManager h = new HttpManager(); + // tell the http manager to use UTF8 encoding + h.setSendUTF8(true); + + try { + mSuccess = false; + mFinished = false; + + // _consoleInfo.get("arguments") is a hashtable of key/value pairs + // to use as the arguments to the CGI + Hashtable args = (Hashtable)_consoleInfo.get("arguments"); + ByteArrayInputStream data = null; + if (args != null && !args.isEmpty()) + data = com.netscape.admin.certsrv.task.CGITask.encode(args); + Debug.println( "Posting " + fullCmd ); + // tell the http manager to notify us immediately of replies + // if we're using async mode + int flags = 0; + if (data == null) + h.post(new URL(fullCmd), this, null, null, 0, flags); + else + h.post(new URL(fullCmd), this, null, data, data.available(), + flags); + awaitSuccess(); + Debug.println( "Command executed: " + fullCmd ); + } catch (Exception e) { + if (e instanceof java.net.ConnectException) { + CMSAdminUtil.showMessageDialog(mResource, + PREFIX, "SERVERDOWN", CMSAdminUtil.ERROR_MESSAGE); + } + Debug.println( "Command " + fullCmd + " failed: " + e ); + } + return mSuccess; + } + + /** + * waiting for the http transaction to be finished. + */ + public synchronized void awaitSuccess() { + while (!mFinished) { + try { + wait(); + } catch (Exception e) { } + } + } + + /** + * http transaction finished, notify the process + */ + public synchronized void finish() { + mFinished = true; + notifyAll(); + } + + /** + * the operation is finished after we receive the http stream + */ + public void replyHandler(InputStream response, CommRecord cr) { + try { + int nBytes = response.available(); + if ( nBytes > 0 ) { + // the response from the DS CGIs will typically be in + // UTF8 encoding + byte[] data = new byte[nBytes]; + nBytes = response.read( data ); + mReply = new String( data, 0, nBytes, "UTF8" ); + Debug.println( "CGITask.replyHandler: Response (" + nBytes + + " bytes) = " + mReply ); + int index = 0; + if ((mReply.indexOf("NMC_") != -1) && + ((index = mReply.indexOf(":")) != -1)) { + String sName = mReply.substring(0, index).trim(); + String sValue = mReply.substring(index+1).trim(); + if (sName.equalsIgnoreCase("NMC_Status")) { + int code = Integer.parseInt(sValue); + mSuccess = (code == 0); + } else if (sName.equalsIgnoreCase("NMC_ERRINFO")) { + mErrorMsg = sValue; } + } + } + } catch ( Exception e ) { + Debug.println( "CGITask.replyHandler: " + e.toString() ); + } + finish(); + } + + /** + * this function will be called if error occurs + */ + public void errorHandler(Exception error, CommRecord cr) { + Debug.println("CGITask.errorHandler: " + error ); + + // this is a hack. now we dont know how to set the timeout period longer. + // We always assume everything is fine so that we can proceed to the next + // config-cert panel. + mSuccess = true; + finish(); + } + + /** + * pass the username to the admin server + */ + public String username(Object authObject, CommRecord cr) { + Debug.println( "username = " + + (String)_consoleInfo.getAuthenticationDN()); + return _consoleInfo.getAuthenticationDN(); + } + + /** + * pass the user password to the admin server + */ + public String password(Object authObject, CommRecord cr) { + Debug.println( "password = " + + (String)_consoleInfo.get( "AdminUserPassword" ) ); + return (String)_consoleInfo.get( "AdminUserPassword" ); + } + /** + * Starts CMS server. + */ + public boolean startServer(InstallWizardInfo info) { + _consoleInfo = info.getAdminConsoleInfo(); + + Hashtable configParams = new Hashtable(); + configParams.put("serverRoot",_consoleInfo.get("serverRoot")); + String servid = (String)_consoleInfo.get("servid"); + int index = servid.indexOf("-"); + if (index != -1) { + servid = servid.substring(index+1); + } + configParams.put("instanceID", servid); + // configParams.put("password", info.getSingleSignOnPassword()); + _consoleInfo.put( "ServerInstance", "cert-" + servid); + _consoleInfo.put("arguments", configParams); + // Debug.println("password "+dialog.getPassword()); + + if (_consoleInfo.get("AdminUsername") == null) { + _consoleInfo.put("AdminUsername", _consoleInfo.getAuthenticationDN() +); + } + Debug.println("AdminUsername = " + _consoleInfo.get("AdminUsername")); + + if (_consoleInfo.get("AdminUserPassword") == null) { + _consoleInfo.put("AdminUserPassword", _consoleInfo.getAuthenticationPassword()); + } + Debug.println("AdminUserPassword = " + _consoleInfo.get("AdminUserPassword")); + // call the CGI program + Debug.println("CMSStart: start() before run task="+START_TASK_CGI); + boolean status; + try { + status = run(START_TASK_CGI); + } catch (Exception e) { + Debug.println("Unexpected Error"+e.toString()); + status = false; + } + Debug.println("CMSStart: start() after run status="+status); + + return true; + } + + public boolean concludePanel(WizardInfo info) { + // Comment out the single signon codes for now. + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_SINGLE_SIGNON; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + String tags = PW_TAG_INTERNAL_LDAP_DB; + rawData = rawData+"&"+PW_TAG_INTERNAL_LDAP_DB+"="+mDBPasswd; + rawData = rawData+"&pwcTokenname="+(String)(mTokenBox.getSelectedItem()); + + String tokenname = ""; + if (!capassword.equals("")) { + tokenname = wizardInfo.getCATokenName(); + rawData = rawData+"&"+tokenname+"="+capassword; + tags = tags+":"+tokenname; + } + + if (!rapassword.equals("")) { + tokenname = wizardInfo.getRATokenName(); + rawData = rawData+"&"+tokenname+"="+rapassword; + tags = tags+":"+tokenname; + } + + if (!krapassword.equals("")) { + tokenname = wizardInfo.getKRATokenName(); + rawData = rawData+"&"+tokenname+"="+krapassword; + tags = tags+":"+tokenname; + } + + if (!sslpassword.equals("")) { + tokenname = wizardInfo.getSSLTokenName(); + rawData = rawData+"&"+tokenname+"="+sslpassword; + tags = tags+":"+tokenname; + } + + if (mPasswordConf.isSelected()) { + rawData = rawData+"&"+ConfigConstants.PR_DELETE_PASSWD_CONF+"="+ + ConfigConstants.TRUE; + } else { + rawData = rawData+"&"+ConfigConstants.PR_DELETE_PASSWD_CONF+"="+ + ConfigConstants.FALSE; + } + rawData = rawData+"&"+ConfigConstants.PR_SINGLE_SIGNON_PW_TAGS+"="+tags; + //data.put(ConfigConstants.PR_SINGLE_SIGNON, ConfigConstants.FALSE); + + startProgressStatus(); + //CMSMessageBox dlg = new CMSMessageBox(mAdminFrame, "CGITASK", "CREATESSON"); + + // boolean ready = send(rawData, wizardInfo); + + boolean ready = true; + if (ready) { + rawData = ConfigConstants.TASKID+"="+TaskId.TASK_MISCELLANEOUS; +/* + data.put(ConfigConstants.PR_ADMIN_PASSWD, + (String)consoleInfo.get(ConfigConstants.PR_ADMIN_PASSWD)); +*/ + ready = send(rawData, wizardInfo); + } else { + String str = getErrorMessage(); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + //dlg.setVisible(false); + + endProgressStatus(); + return false; + } + + //startServer(wizardInfo); + + //dlg.setVisible(false); + + endProgressStatus(); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str.equals("")) { + String errorMsg = mResource.getString( + PANELNAME+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JTextArea desc = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + +/* + JPanel panel1 = new JPanel(); + GridBagLayout gb1 = new GridBagLayout(); + panel1.setLayout(gb1); + //panel1.setBorder(new EtchedBorder()); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE, COMPONENT_SPACE); + add(panel1, gbc); +*/ + + JTextArea heading = createTextArea(mResource.getString( + PANELNAME+"_TEXT_HEADING1_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + //gbc.fill = gbc.NONE; + gbc.weightx = 1.0; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(2*COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, 0); + add(heading, gbc); + + JLabel tokenLbl = makeJLabel("TOKEN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + //gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, 4*COMPONENT_SPACE, 0, COMPONENT_SPACE); + add(tokenLbl, gbc); + + mTokenBox = new JComboBox(); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + //gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, 0); + add(mTokenBox, gbc); + + JLabel dum = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.fill = gbc.BOTH; + gbc.weightx = 1.0; + gbc.insets = new Insets(COMPONENT_SPACE, COMPONENT_SPACE, 0, 0); + add(dum, gbc); + + JTextArea passwordConfText = createTextArea(mResource.getString( + PANELNAME+"_TEXT_PASSWDCONF_LABEL")); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(4*COMPONENT_SPACE,COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(passwordConfText, gbc); + + mPasswordConf = makeJCheckBox("PASSWDCONF"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,2*COMPONENT_SPACE, 0, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mPasswordConf, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.fill = gbc.BOTH; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WITokenLogonPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WITokenLogonPage.java new file mode 100644 index 000000000..b3ecdbf5a --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WITokenLogonPage.java @@ -0,0 +1,255 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import javax.swing.text.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; +import com.netscape.admin.certsrv.task.*; +import com.netscape.management.client.console.*; + +/** + * This panel asks for the information of the current internal database. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WITokenLogonPage extends WizardBasePanel implements IWizardPanel { + protected JTextField mTokenText; + protected JLabel mPasswordAgainLabel; + protected JPasswordField mPasswordText, mPasswordAgainText; + private static final String EMPTYSTR = " "; + protected String mHelpIndex; + protected String mPanelName; + protected JTextArea mDesc; + protected Color mActiveColor; + protected String mTokenName; + + WITokenLogonPage(String panelName) { + super(panelName); + mPanelName = panelName; + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + setBorder(makeTitledBorder(mPanelName)); + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + + String tokenList = wizardInfo.getTokensList(); + String tokenLoggedIn = wizardInfo.getTokensLogin(); + String tokenInits = wizardInfo.getTokensInit(); + StringTokenizer tokenizer = new StringTokenizer(tokenList, ":"); + StringTokenizer tokenizerLoggedIn = new StringTokenizer(tokenLoggedIn, ":"); + StringTokenizer tokenizerInits = new StringTokenizer(tokenInits, ":"); + int index = 0; + String loggedIn = ""; + String inits = ""; + while (tokenizer.hasMoreElements()) { + String token = (String)tokenizer.nextElement(); + loggedIn = (String)tokenizerLoggedIn.nextElement(); + inits = (String)tokenizerInits.nextElement(); + if (token.equalsIgnoreCase(mTokenName)) { + break; + } + index++; + } + + if (inits.equals(Constants.FALSE)) { + mDesc.setText(mResource.getString(mPanelName+"_TEXT_INIT_LABEL")); + enableFields(mPasswordAgainLabel, mPasswordAgainText, true, mActiveColor); + } else { + mDesc.setText(mResource.getString(mPanelName+"_TEXT_HEADING_LABEL")); + enableFields(mPasswordAgainLabel, mPasswordAgainText, false, getBackground()); + } + + mTokenText.setEnabled(false); + mTokenText.setEditable(false); + mTokenText.setBackground(getBackground()); + CMSAdminUtil.repaintComp(mTokenText); + + return true; + } + + public boolean validatePanel() { + String passwd = mPasswordText.getText(); + if (passwd.equals("")) { + setErrorMessage("BLANKPASSWD"); + return false; + } + if (mPasswordAgainText.isEnabled()) { + String passwdAgain = mPasswordAgainText.getText(); + if (!passwd.equals(passwdAgain)) { + setErrorMessage("NOTSAMEPASSWD"); + return false; + } + } + + return true; + } + + public boolean concludePanel(WizardInfo info) { + InstallWizardInfo wizardInfo = (InstallWizardInfo)info; + cleanUpWizardInfo(wizardInfo); + + String tokenname = mTokenText.getText().trim(); + String pwd = mPasswordText.getText().trim(); + wizardInfo.put("TOKEN:"+tokenname, pwd); + + String rawData = ConfigConstants.TASKID+"="+TaskId.TASK_INIT_TOKEN; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_MODIFY; + rawData = rawData+"&"+ConfigConstants.PR_TOKEN_NAME+"="+tokenname; + rawData = rawData+"&"+ConfigConstants.PR_TOKEN_PASSWD+"="+pwd; + rawData = rawData+"&"+ConfigConstants.PR_CMS_SEED+"="+ + (new Long(WizardBasePanel.mSeed).toString()); + + startProgressStatus(); + boolean ready = send(rawData, wizardInfo); + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str == null) { + String errorMsg = mResource.getString( + mPanelName+"_ERRORMSG"); + setErrorMessage(errorMsg); + } else + setErrorMessage(str); + } else { + rawData = ConfigConstants.TASKID+"="+TaskId.TASK_TOKEN_INFO; + rawData = rawData+"&"+ConfigConstants.OPTYPE+"="+OpDef.OP_READ; + ready = send(rawData, wizardInfo); + } + + if (!ready) { + String str = getErrorMessage(wizardInfo); + if (str.equals("")) + setErrorMessage("Server Error"); + else + setErrorMessage(str); + } + + endProgressStatus(); + + return ready; + } + + public void callHelp() { + CMSAdminUtil.help(mHelpIndex); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + CMSAdminUtil.resetGBC(gbc); + mDesc = createTextArea(""); +/* + mDesc = createTextArea(mResource.getString( + mPanelName+"_TEXT_HEADING_LABEL")); +*/ + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(mDesc, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel tokenLabel = makeJLabel("TOKEN"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(tokenLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mTokenText = makeJTextField(30); + gbc.anchor = gbc.NORTHWEST; + //gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mTokenText, gbc); + + CMSAdminUtil.resetGBC(gbc); + JLabel passwordLabel = makeJLabel("PWD"); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, 0, COMPONENT_SPACE, + COMPONENT_SPACE); + add(passwordLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPasswordText = makeJPasswordField(30); + gbc.anchor = gbc.NORTHWEST; + // gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mPasswordText, gbc); + mActiveColor = mPasswordText.getBackground(); + + CMSAdminUtil.resetGBC(gbc); + mPasswordAgainLabel = makeJLabel("PWDAGAIN"); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mPasswordAgainLabel, gbc); + + CMSAdminUtil.resetGBC(gbc); + mPasswordAgainText = makeJPasswordField(30); + gbc.anchor = gbc.NORTHWEST; + // gbc.fill = gbc.NONE; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(0, COMPONENT_SPACE, COMPONENT_SPACE, + COMPONENT_SPACE); + add(mPasswordAgainText, gbc); + + JLabel dummy = new JLabel(" "); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.gridwidth = gbc.REMAINDER; + gbc.gridheight = gbc.REMAINDER; + gbc.weighty = 1.0; + add(dummy, gbc); + } + + public void getUpdateInfo(WizardInfo info) { + } + + protected void enableFields(JComponent comp1, JTextComponent comp2, boolean enable, Color color) { + comp1.setEnabled(enable); + comp2.setEnabled(enable); + comp2.setEditable(enable); + comp2.setBackground(color); + CMSAdminUtil.repaintComp(comp1); + CMSAdminUtil.repaintComp(comp2); + } +} diff --git a/base/console/src/com/netscape/admin/certsrv/config/install/WITrustDBPage.java b/base/console/src/com/netscape/admin/certsrv/config/install/WITrustDBPage.java new file mode 100644 index 000000000..cd19963ff --- /dev/null +++ b/base/console/src/com/netscape/admin/certsrv/config/install/WITrustDBPage.java @@ -0,0 +1,138 @@ +// --- 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) 2007 Red Hat, Inc. +// All rights reserved. +// --- END COPYRIGHT BLOCK --- +package com.netscape.admin.certsrv.config.install; + +import java.awt.*; +import javax.swing.*; +import com.netscape.admin.certsrv.*; +import com.netscape.admin.certsrv.connection.*; +import com.netscape.admin.certsrv.wizard.*; +import com.netscape.certsrv.common.*; + +/** + * Trust database page for installation wizard. + * + * @author Christine Ho + * @version $Revision$, $Date$ + * @see com.netscape.admin.certsrv.config.install + */ +class WITrustDBPage extends WizardBasePanel implements IWizardPanel { + private JPasswordField mPassword; + private JPasswordField mPasswordAgain; + private static final String PANELNAME = "TRUSTDBWIZARD"; + private static final String HELPINDEX = + "configuration-kra-wizard-change-keyscheme-help"; + + WITrustDBPage() { + super(PANELNAME); + init(); + } + + public boolean isLastPage() { + return false; + } + + public boolean initializePanel(WizardInfo info) { + return true; + } + + public boolean validatePanel() { + return true; + } + + public boolean concludePanel(WizardInfo info) { + return true; + } + + public void callHelp() { + CMSAdminUtil.help(HELPINDEX); + } + + protected void init() { + GridBagLayout gb = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + setLayout(gb); + + JTextArea desc = createTextArea( + CMSAdminUtil.wrapText(mResource.getString( + "TRUSTDBWIZARD_TEXT_DESC_LABEL"), 80), 2, 80); + + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.weightx = 1.0; + gbc.weighty = 0.0; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(desc, gbc); + + JLabel passwdLbl = makeJLabel("PASSWD"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(passwdLbl, gbc); + + mPassword = makeJPasswordField(20); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(mPassword, gbc); + + JTextArea dummy = createTextArea(" ", 1, 15); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.gridwidth = gbc.REMAINDER; + gbc.insets = new Insets(COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE,COMPONENT_SPACE); + add(dummy, gbc); + + JLabel passwdAgainLbl = makeJLabel("PASSWDAGAIN"); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHEAST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0,COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE); + gbc.weighty = 1.0; + add(passwdAgainLbl, gbc); + + mPasswordAgain = makeJPasswordField(20); + CMSAdminUtil.resetGBC(gbc); + gbc.anchor = gbc.NORTHWEST; + gbc.fill = gbc.NONE; + gbc.insets = new Insets(0, COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE); + gbc.weighty = 1.0; + add(mPasswordAgain, gbc); + + JTextArea dummy1 = createTextArea(" ", 1, 15); + CMSAdminUtil.resetGBC(gbc); + gbc.insets = new Insets(0, COMPONENT_SPACE,COMPONENT_SPACE, + COMPONENT_SPACE); + gbc.gridwidth = gbc.REMAINDER; + add(dummy1, gbc); + + super.init(); + } + + public void getUpdateInfo(WizardInfo info) { + } +} |