GitXplorerGitXplorer
i

rendezvous

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
f9358d2031b0aae720c7848a0466b2839cb8fbfb

Update README.md

iimgntn committed 11 years ago
Unverified
269af50b2fd5c3fa917c5766d8462028ca38d6cd

generate regcode displays to client

iimgntn committed 12 years ago
Unverified
d8d992ed543eb2bc018371f604ebe2ee9b3ea552

render regcode to user

iimgntn committed 12 years ago
Unverified
6ea2cfe8736dcc8384b73b862fe090eb3b5bde4e

rdme

iimgntn committed 12 years ago
Unverified
52d48701057b69ff1e86cac6deb3f8df3a92af5c

rdme

iimgntn committed 12 years ago
Unverified
9fcacb7423caccfca67fa97245f1969b21553124

rdme

iimgntn committed 12 years ago

README

The README file for this repository.

To-Do: An example of a user registration/login module and example front-end UI; generate fake device id for examples

Reference Rendezvous Implementation

by James B. Pollack Overview:
This pattern is used to link a device, such as a Smart TV or Roku, with a particular user account. It minimizes user input on the device itself due to limited input modalities.

Table of Contents

* The Pattern * Dependencies * Setup (1,2,3) * Using (1,2,3,4,5,6) * Screenshots

The Pattern:

--The client requests a registration code from the server by sending it a device ID.
--The server generates a registration code and returns it to the client.
--The client displays the code to the user.
--The user enters their account information, along with the registration code, on the provider website.
--The provider verifies the account and sends a message to the server with the registration code and an expiration date for the subscription.
--The server associates the registration code with the device ID and authorizes the subscription.
--The client polls the server until it recieves authorization and changes state*.
--The database will use its expiration functions to purge both old registration codes and old subscriptions.

*I would like to replace this step with a socket to prevent unnecessary polling, but device support is not yet robust.

Dependencies:

see Setup for installation notes
server: node.js
database: mongodb
node modules: restify connect mongoose ms node-uuid (and an included modified local version of mongoose-ttl)

Setup:

Setup #1 -- Installing node.js
Use package installer at http://nodejs.org/

Setup #2 -- Installing mongoDB (OS X)

-1. download from http://www.mongodb.org/dr/fastdl.mongodb.org/osx/mongodb-osx-x86_64-2.4.3.tgz/download
-2. extract the contents to /usr/local/mongodb
-3. cd /usr/local/mongodb and run the following commands

$ sudo mkdir -p /data/db
$ whoami
your_User
$ sudo chown your_User /data/db

-4. run the following commands to add mongo to your path
vi ~/.profile (or ~/.bash_profile) and add the following
export MONGO_PATH=/usr/local/mongodb
export PATH=$PATH:$MONGO_PATH/bin

-5.1mongod (starts server)

-6 open a new tab and type in mongo (starts client)
-6.1 type show dbs -> shows local (empty)
-6.2 type use rdzv (or call it whatever you want by typing use yourDatabaseName. Be sure to change the config.js file to match)
-6.3 type db.users.save({username:'username'});
-6.4 type show dbs -> should now show rdvz

-7. to setup auto start on the server http://www.mkyong.com/mongodb/how-to-install-mongodb-on-mac-os-x/

Setup # 3 -- Installing node.js packages (inside rendezvous folder)

npm install restify connect mongoose ms node-uuid
proper package file is forthcoming

Using:

Using # 1 --To start the server: (inside rendezvous folder) * cp sampleconfig.js config.js * edit config.js so it points to mongodb://localhost/yourDatabaseName i.e. mongodb://localhost/rdzv
* node server.js (optionally, a process manager like forever.js is recommended to launch the server)
This will run servers on two ports right now, 8081 (the server) and 3001 (the client).

To use the dev client, visit http://localhost:3001 in a browser.
Using # 2 -- To register a device: (on the client)
mainClient.init('your_deviceID')
*where your_deviceID is the unique identifier of the device
on device this should happen automatically but for dev run it in your javascript console at localhost:3001

Using # 3 -- To send an authorization for a device to the server after provider authorization of the user account
$.post('http://localhost:8081/authenticateDevice',{regCode:'your_regCode'})
*where your_regCode is the regCode provided to the user

Using # 4 -- Client-side Authorization State Change (on the client)
You'll see that mainClient.authorized=false when the client is not authorized, but mainclient.authorized=false after polling authorizes the device. Use this flag to drive behavior on the client.

Using # 5 -- Client-side UI (on the client)
Needs at least two button elements on the Link Account Page: "New Registration Code" and "Unlink Device"
There are two client-side methods to associate:

  • mainClient.generateRegCode('deviceID')
  • mainClient.unLinkDevice('deviceID')

Using # 5 -- Admin Functions

Screenshots:



Show a registration code to the user on the device.



Form on provider website where logged in user enters the registration code.
It's also possible to provide device unlinking funcitonality at this level.


Device is authorized.