Authenticate WS connection using token

Safari doesn't support basic authentication for websocket sessions.
This commit introduces a token-based authentication only for websocket
connection.
The token is shared by all clients and that might be not secure. However,
basic authentication itself is insecure and the credential is already
shared by clients, so don't mind.
This commit is contained in:
Iwasaki Yudai 2015-08-31 15:54:34 +09:00
parent e7e607b3d7
commit 0e81c484a9
4 changed files with 47 additions and 34 deletions

View file

@ -10,6 +10,8 @@
var term;
ws.onopen = function(event) {
ws.send(gotty_auth_token);
hterm.defaultStorage = new lib.Storage.Local();
hterm.defaultStorage.clear();

View file

@ -8,6 +8,7 @@
<body>
<div id="terminal"></div>
<script src="./js/hterm.js"></script>
<script src="./auth_token.js"></script>
<script src="./js/gotty.js"></script>
</body>
</html>