Adding chrome extension and host messaging files
authorMark Donnelly <mark@painless-security.com>
Fri, 26 Sep 2014 16:33:54 +0000 (12:33 -0400)
committerMark Donnelly <mark@painless-security.com>
Fri, 26 Sep 2014 16:33:54 +0000 (12:33 -0400)
chrome/app/gssweb.html [new file with mode: 0644]
chrome/app/gssweb.js [new file with mode: 0644]
chrome/app/manifest.json [new file with mode: 0644]
chrome/host/README [new file with mode: 0644]
chrome/host/com.painlesssecurity.jsongss.json [new file with mode: 0644]

diff --git a/chrome/app/gssweb.html b/chrome/app/gssweb.html
new file mode 100644 (file)
index 0000000..0f6a06d
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <script src="./gssweb.js"></script>
+  </head>
+  <body>
+    <button id='connect'>Connect</button>
+    <input id='gss_command' />
+    <button id='send-message'>Send</button>
+    <div id='response'></div>
+  </body>
+</html>
diff --git a/chrome/app/gssweb.js b/chrome/app/gssweb.js
new file mode 100644 (file)
index 0000000..c21428b
--- /dev/null
@@ -0,0 +1,35 @@
+
+
+var gssAppPort = null;
+
+function report(msg) {
+  var response = document.getElementById('response');
+  response.innerHTML = '<p>' + msg + '</p>' + response.innerHTML;
+}
+
+function onGSSResponse(msg) {
+  report('Response from GSS: ' + JSON.stringify(msg) );
+}
+
+function connectToNativeHost() {
+  report('Connecting to json_gssapi command line.');
+  // var host = 'com.google.chrome.example.echo';
+  var host = 'com.painlesssecurity.jsongss'
+  gssAppPort = chrome.runtime.connectNative( host );
+  if (gssAppPort) {report("Connected.");};
+  gssAppPort.onMessage.addListener( onGSSResponse );
+}
+
+function sendNativeMessage() {
+  var msg = JSON.parse( document.getElementById('gss_command').value );
+  gssAppPort.postMessage(msg);
+  report('Sent message: ' + msg);
+}
+
+
+document.addEventListener('DOMContentLoaded', function () {
+  document.getElementById('connect').addEventListener(
+      'click', connectToNativeHost);
+  document.getElementById('send-message').addEventListener(
+      'click', sendNativeMessage);
+});
diff --git a/chrome/app/manifest.json b/chrome/app/manifest.json
new file mode 100644 (file)
index 0000000..d4cbb8c
--- /dev/null
@@ -0,0 +1,13 @@
+{
+   "app": {
+      "launch": {
+         "local_path": "gssweb.html"
+      }
+   },
+   "description": "Chrome plugin to supply GSSAPI calls.",
+   "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyuV9oMZvryLveAqvoFrbQGGU/NOPSFqBymsGLuQKS4i6LfQ/z+pRUTri4r/YWgWvfGGZhjdBy935QWJ0lpfq+dX+XCYSZLzFSllrLB/NM8MI9OQQKeyrnf8ie1pTU92KJGNVAeN7KpgdZjI2G6SNzV6CGz1D7FWkcOyeyk1GWyiFeUc7yEVSTuDhREiD2zEelgc29i9bUh/JZs+yTbWkIkBxdvhBEaU0MJIVyNUhrUbTFANqBu3kigbji+LCb63c0u567jBGkQDtDVS4rstsBwTjuCbCfzppNsMvexrx3kA2FpUj4otHEO2I6W0xlSsv8wza6OFwbV+MISK7CiBmkwIDAQAB",
+   "manifest_version": 2,
+   "name": "GSS Web Plugin",
+   "permissions": [ "nativeMessaging" ],
+   "version": "1.0"
+}
diff --git a/chrome/host/README b/chrome/host/README
new file mode 100644 (file)
index 0000000..019fba0
--- /dev/null
@@ -0,0 +1,17 @@
+The manifest.json file in this directory will be used by chrome/chromium to
+identify which extensions are allowed to talk to the json_gssapi command
+line executable. This file must (1) be edited correctly, and (2) be placed
+in the correct location.
+
+Editing
+-------------------------------------
+The file contains a path to locate the json_gssapi command.  Edit the path
+to be correct for your system.
+
+Installing
+-------------------------------------
+The file must be located in one of three places:
+  global             /etc/opt/chrome/native-messaging-hosts
+  Personal:
+    google-chrome    ~/.config/google-chrome/NativeMessagingHosts
+    chromium-browser ~/.config/chromium/NativeMessagingHosts
diff --git a/chrome/host/com.painlesssecurity.jsongss.json b/chrome/host/com.painlesssecurity.jsongss.json
new file mode 100644 (file)
index 0000000..221e19b
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "name": "com.painlesssecurity.jsongss",
+  "description": "GSSAPI Extension",
+  "path": "/home/mark/projects/gssweb.git/json_gssapi/debug/json_gssapi",
+  "type": "stdio",
+  "allowed_origins": [
+    "chrome-extension://bhaockekcfjjdmbalaanalballokgedd/"
+  ]
+}