[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Pki-devel] [PATCH] 964 Added access banner for PKI console.



The PKI console has been modified to retrieve access banner from
the server and ask for user confirmation at the beginning of the
program.

https://fedorahosted.org/pki/ticket/2582

--
Endi S. Dewata
>From d4385d04056ef9e5a7aa2b82a81a92ab1e8e1c7f Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata redhat com>
Date: Mon, 30 Jan 2017 18:19:32 +0100
Subject: [PATCH] Added access banner for PKI console.

The PKI console has been modified to retrieve access banner from
the server and ask for user confirmation at the beginning of the
program.

https://fedorahosted.org/pki/ticket/2582
---
 .../src/com/netscape/admin/certsrv/Console.java    | 35 +++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/base/console/src/com/netscape/admin/certsrv/Console.java b/base/console/src/com/netscape/admin/certsrv/Console.java
index d6d653f168376e666542eb6e34891e7e91b5d2be..83be43ff0de089bb2350806b072725dd9909d1fd 100644
--- a/base/console/src/com/netscape/admin/certsrv/Console.java
+++ b/base/console/src/com/netscape/admin/certsrv/Console.java
@@ -44,6 +44,11 @@ import javax.swing.JFrame;
 import javax.swing.JOptionPane;
 import javax.swing.UIManager;
 
+import org.dogtagpki.common.Info;
+import org.dogtagpki.common.InfoClient;
+
+import com.netscape.certsrv.client.ClientConfig;
+import com.netscape.certsrv.client.PKIClient;
 import com.netscape.management.client.Framework;
 import com.netscape.management.client.IPage;
 import com.netscape.management.client.IResourceObject;
@@ -1572,7 +1577,8 @@ public class Console implements CommClient {
       * @param parameters list
       */
 
-    static public void main(String argv[]) {
+    static public void main(String argv[]) throws Exception {
+
 		GetOpt opt = new GetOpt("h:a:A:f:l:u:w:s:D:x:", argv);
 
         if (opt.hasOption('f')) {
@@ -1760,6 +1766,33 @@ public class Console implements CommClient {
                                "\n         Default port number is 9443.\n");
         */
         }
+
+        UtilConsoleGlobals.initJSS();
+
+        ClientConfig config = new ClientConfig();
+        config.setServerURL(protocol, hostName, portNumber);
+
+        PKIClient client = new PKIClient(config);
+
+        InfoClient infoClient = new InfoClient(client);
+        Info info = infoClient.getInfo();
+        String banner = info.getBanner();
+
+        if (banner != null) {
+
+            System.out.println(banner.trim());
+            System.out.println();
+            System.out.print("Do you want to proceed (y/N)? ");
+            System.out.flush();
+
+            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
+            String line = reader.readLine().trim();
+
+            if (!line.equalsIgnoreCase("Y")) {
+                return;
+            }
+        }
+
         cinfo.put("cmsHost", url.getHost());
         cinfo.put("cmsPort", Integer.toString(portNumber));
         cinfo.put("cmsPath", path);
-- 
2.9.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]