OS-1 : insecure UI websocket.
- notes on authentication of UI web socket connection.
- new classes: UiSessionToken, UiTokenService.
- UiExtensionManager now implements UiTokenService.
- UiWebSocket now expects an authentication event from the client
- websocket.js now sends authentication event as first event
- (fix websocket Jasmine test)

Change-Id: I4303c67f57fc618e911be244091f00bcc2823c91
diff --git a/core/api/src/main/java/org/onosproject/ui/UiSessionToken.java b/core/api/src/main/java/org/onosproject/ui/UiSessionToken.java
new file mode 100644
index 0000000..b4b3d49
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/ui/UiSessionToken.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.onosproject.ui;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Encapsulates a session token pertaining to a Web UI websocket connection.
+ */
+public class UiSessionToken {
+
+    private final String token;
+
+    /**
+     * Creates a session token from the given string.
+     *
+     * @param token the token in string form
+     * @throws NullPointerException if token is null
+     */
+    public UiSessionToken(String token) {
+        this.token = checkNotNull(token);
+    }
+
+    @Override
+    public String toString() {
+        return token;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+
+        UiSessionToken that = (UiSessionToken) o;
+        return token.equals(that.token);
+    }
+
+    @Override
+    public int hashCode() {
+        return token.hashCode();
+    }
+}