File: README.md

package info (click to toggle)
python-autobahn 17.10.1%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,452 kB
  • sloc: python: 22,598; javascript: 2,705; makefile: 497; sh: 3
file content (46 lines) | stat: -rw-r--r-- 1,698 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
WebSocket Authentication with Mozilla Persona
=============================================

This example shows how to authenticate WebSocket connections using [Mozilla Persona](http://www.mozilla.org/en-US/persona/) and HTTP Cookies. The example works with purely static Web pages and WebSocket only.

Tested with:

 * Firefox 27
 * Chrome 33
 * IE11

Note: On IE11, using `localhost` as URL [does NOT work](https://groups.google.com/d/msg/mozilla.dev.identity/keEkVpvfLA8/2WIu7Q1mW10J). You must use `127.0.0.1` instead.

References:

* [Mozilla Persona Developer Site](https://developer.mozilla.org/en-US/Persona)


Running
-------

Run the server by doing

    python server.py

and open

    http://localhost:8080/

in your browser.

Here is the log output produced (on server) for a successful login:

    $ python server.py
    2014-03-11 12:20:05+0100 [-] Log opened.
    2014-03-11 12:20:05+0100 [-] Running Autobahn|Python 0.8.4-3
    2014-03-11 12:20:05+0100 [-] Site starting on 8080
    2014-03-11 12:20:05+0100 [-] Starting factory <twisted.web.server.Site instance at 0x038113C8>
    2014-03-11 12:20:23+0100 [HTTPChannel,1,127.0.0.1] Setting new cookie: 82vrA1drjZ_9lcBv
    2014-03-11 12:20:36+0100 [HTTPChannel,1,127.0.0.1] Starting factory <HTTPClientFactory: https://verifier.login.persona.o
    rg/verify>
    2014-03-11 12:20:36+0100 [HTTPChannel,1,127.0.0.1] Authentication request sent.
    2014-03-11 12:20:37+0100 [HTTPPageGetter (TLSMemoryBIOProtocol),client] Authenticated user tobias.oberstein@gmail.com
    2014-03-11 12:20:37+0100 [HTTPPageGetter (TLSMemoryBIOProtocol),client] Stopping factory <HTTPClientFactory: https://verifier.login.persona.org/verify>
    ...