streamlive-loggedin v0.2.7
Streamlive-LoggedIn middleware
## Introduction
The logged-in middleware is aimed to check if the client of a connector is already logged in Calderanet and Streamlive.
## How to use
When using express
const bunyan = require('bunyan');
const slLoggedIn = require('streamlive-loggedin');
const express = require('express');
var app = express();
app.use(slLoggedIn({
'options' : {
'tolerance' : 1, // clockTolerance in JWT verification
'workspace': 'WorkspaceId', // (optional) workspace number required
'cert_calnet': 'RSA key string', // (optional) specified to check validity of calderanet_sso cookie, must use public key
'jwt_cert': 'RSA key string', // (optional) specified to check validity of sl_jwt cookie, must use public key
'token': ''JWT-token', // (optional) specified to check the (connector's) token that contains the current workspace
},
'api' : require('streamlive-api')([... options for your module ...]), // the Streamlive API for Javascript
'logger' : new bunyan({ name : 'loggedIn' }) // A logger system, with the methods : info, error, warning
});
Token format
{ type: 'user', uid: '5a3bdcb8637f592f3936d254', firstname: 'Maxime', name: 'Alves', email: null, wid: '53', workspace: 'Caldera', locale: 'fr', date_format: 'YYYY/MM/DD', time_format: 'HH:mm:ss', timezone: '', owner: '5a3bdcb8637f592f3936d257', avatar: '', admin: true, access: 15, iss: 'http://api.streamlive.caldera.com', iat: 1516888612, exp: 1516892212 }
Testing
Jasmine unit test is included in the package. Please write unit tests for every feature added.
## TODO
When the retrieval of the public key will be managed for connectors, we should remove the code for unverified tokens (l.72 of index.js).
Credits
All credits belong to Caldera. Author is Maxime Alves