Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Persona end of life. #4237

Open
wants to merge 1 commit into
base: train-2014.07.19
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Persona end of life.
* All frontend routes show a "Persona has shutdown... See more" message.
* All wsapi requests return 410 (Gone).
* All navigator.id calls are gutted except those that open the Persona EOL dialog.
* Add tests in eol-tests to ensure all wsapi routes return 410.

So long, and thanks for all the fish.
Shane Tomlinson committed Dec 9, 2016
commit 3611594e1a0cfcbf181aae80aa87ca0d18218594
68 changes: 68 additions & 0 deletions eol-tests/wsapi-routes-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env node

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */


require('../tests/lib/test_env.js');

const assert = require('assert');
const http = require('http');
const vows = require('vows');
const start_stop = require('../tests/lib/start-stop.js');
const wsapi = require('../lib/wsapi.js');

const WSAPI_PREFIX = '/wsapi/';
const allAPIs = wsapi.allAPIs();

var suite = vows.describe('wsapi routes');

// disable vows (often flakey?) async error behavior
suite.options.error = false;

start_stop.addStartupBatches(suite);

const batch = {};

Object.keys(allAPIs).forEach(function (apiName) {
const API = allAPIs[apiName];
addRouteTest(API.method, apiName, 410);
});

addRouteTest('get', 'non-existent', 404);
addRouteTest('post', 'non-existent', 404);

suite.addBatch(batch);

function addRouteTest (method, pathname, expectedStatus) {
batch[method + ': ' + pathname] = {
topic: function () {
makeRequest(method, pathname, this.callback);
},

'returns the expected status': function (res) {
assert.equal(res.statusCode, expectedStatus);
}
};
}

function makeRequest(method, pathname, done) {
var req = http.request({
host: '127.0.0.1',
port: '10002',
path: WSAPI_PREFIX + pathname,
agent: false,
method: method.toUpperCase()
}, function (res) {
res.on('end', done(res));
});

req.end();
}

start_stop.addShutdownBatches(suite);

// run or export the suite.
if (process.argv[1] === __filename) suite.run();
else suite.export(module);
71 changes: 71 additions & 0 deletions eol-tests/wsapi-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env node

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */


require('../tests/lib/test_env.js');

const assert = require('assert');
const vows = require('vows');
const start_stop = require('../tests/lib/start-stop.js');
const wsapi = require('../lib/wsapi.js');

var suite = vows.describe('wsapi');

// disable vows (often flakey?) async error behavior
suite.options.error = false;

start_stop.addStartupBatches(suite);

suite.addBatch({
'allAPIs': {
topic: function() {
return wsapi.allAPIs();
},

'works': function(allAPIs) {
assert.equal(typeof allAPIs, 'object');
assert.equal(Object.keys(allAPIs).length, 38);
}
}
});

var appMock;
suite.addBatch({
'routeSetup': {
topic: function() {
appMock = {
getCount: 0,
postCount: 0,
routeCount: 0,

get: function (route, callback) {
this.getCount++;
this.routeCount++;
},

post: function () {
this.postCount++;
this.routeCount++;
}
};

wsapi.routeSetup(appMock);
return true;
},

'sets up the appropriate number of routes': function () {
assert.equal(appMock.getCount, 16);
assert.equal(appMock.postCount, 22);
assert.equal(appMock.routeCount, 38);
}
}
});

start_stop.addShutdownBatches(suite);

// run or export the suite.
if (process.argv[1] === __filename) suite.run();
else suite.export(module);
23 changes: 13 additions & 10 deletions lib/static/views.js
Original file line number Diff line number Diff line change
@@ -209,7 +209,7 @@ exports.setup = function(app) {
app.get('/sign_in', function(req, res) {
renderCachableView(req, res, 'dialog.ejs', {
title: _('A Better Way to Sign In'),
layout: 'dialog_layout.ejs',
layout: 'layout.ejs',
useJavascript: true,
measureDomLoading: config.get('measure_dom_loading'),
production: config.get('use_minified_resources'),
@@ -219,15 +219,16 @@ exports.setup = function(app) {

app.get('/communication_iframe', function(req, res) {
renderCachableView(req, res, 'communication_iframe.ejs', {
layout: false,
title: _('Persona communication iframe'),
layout: 'layout.ejs',
production: config.get('use_minified_resources')
});
});

app.get("/unsupported_dialog", function(req,res) {
renderCachableView(req, res, 'unsupported_dialog.ejs', {
title: _('Unsupported Browser'),
layout: 'dialog_layout.ejs',
layout: 'layout.ejs',
useJavascript: false,
// without the javascript bundle, there is no point in measuring the
// window opened time.
@@ -239,7 +240,7 @@ exports.setup = function(app) {
app.get("/unsupported_dialog_without_watch", function(req,res) {
renderCachableView(req, res, 'unsupported_dialog_without_watch.ejs', {
title: _('Unsupported Browser without Watch'),
layout: 'dialog_layout.ejs',
layout: 'layout.ejs',
useJavascript: false,
// without the javascript bundle, there is no point in measuring the
// window opened time.
@@ -251,7 +252,7 @@ exports.setup = function(app) {
app.get("/cookies_disabled", function(req,res) {
renderCachableView(req, res, 'cookies_disabled.ejs', {
title: _('Cookies Are Disabled'),
layout: 'dialog_layout.ejs',
layout: 'layout.ejs',
useJavascript: false,
// without the javascript bundle, there is no point in measuring the
// window opened time.
@@ -263,23 +264,25 @@ exports.setup = function(app) {
// Used for a relay page for communication.
app.get("/relay", function(req, res) {
renderCachableView(req, res, 'relay.ejs', {
layout: false,
production: config.get('use_minified_resources')
layout: 'layout.ejs',
production: config.get('use_minified_resources'),
title: _('Persona relay page')
});
});

// Native IdP Support
app.get('/provision', function(req, res) {
renderCachableView(req, res, 'provision.ejs', {
layout: false,
production: config.get('use_minified_resources')
layout: 'layout.ejs',
production: config.get('use_minified_resources'),
title: _('Persona provisioning page')
});
});

app.get('/auth', function(req, res) {
renderCachableView(req, res, 'dialog.ejs', {
title: _('A Better Way to Sign In'),
layout: 'authenticate_layout.ejs',
layout: 'layout.ejs',
useJavascript: true,
measureDomLoading: config.get('measure_dom_loading'),
production: config.get('use_minified_resources'),
Loading