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'),
477 changes: 18 additions & 459 deletions lib/wsapi.js

Large diffs are not rendered by default.

560 changes: 6 additions & 554 deletions resources/static/common/css/style.css

Large diffs are not rendered by default.

547 changes: 11 additions & 536 deletions resources/static/include_js/_include.js

Large diffs are not rendered by default.

790 changes: 33 additions & 757 deletions resources/static/pages/css/style.css

Large diffs are not rendered by default.

47 changes: 8 additions & 39 deletions resources/views/layout.ejs
Original file line number Diff line number Diff line change
@@ -13,61 +13,30 @@
<!--[if lt IE 9]>
<%- cachify_css('/production/ie8_main.css') %>
<![endif]-->
<%- cachify_js(util.format('/production/%s/browserid.js', locale)) %>
<link rel="shortcut icon" href=<%- cachify('/favicon.ico') -%>>
<% /* the title comes from the server when the page is loaded.
It still needs translated, so wrap it in its own gettext
*/ %>
<title><%= format(gettext("Mozilla Persona: %s"), [gettext(title)]) %></title>
</head>
<body class="loading <%- typeof embedded !== "undefined" && embedded === true ? "embedded" : "" %>" <%- typeof start_blank !== "undefined" ? 'style="display: none;"' : "" %>>
<% if (enable_development_menu) { %>
<a href="#" id="showDevelopment">&nbsp;</a>
<% } %>
<div id="errorBackground"></div>
<body>
<header id="header" class="cf">
<a class="home" href="/"><%= gettext("Persona Home") %></a>
</header>

<div id="wrapper">
<% if (typeof embedded === "undefined" || embedded !== true) { %>
<header id="header" class="cf">
<a class="home" href="/"><%= gettext("Persona Home") %></a>
<ul class="nav cf">
<li><a href="/about"><%= gettext("How it works") %></a></li>
<li class="ifAuthenticated"><a href="/"><%= gettext("Account") %></a></li>
<li class="ifNotAuthenticated"><a class="signIn" href="/signin"><%= gettext("Sign In") %></a></li>
<li class="ifAuthenticated"><a class="signOut" href="/"><%= gettext("Sign Out") %></a></li>
</ul>
</header>
<% } %>

<div class="notice">
<p>As of November 30th 2016, the persona.org service is no longer supported. It will be shut down in December 2016.&nbsp;&nbsp;<a href="https://wiki.mozilla.org/Identity/Persona_Shutdown_Guidelines_for_Reliers">More Info...</a></p>
<p>The persona.org service has shut down. <br>
<a href="https://wiki.mozilla.org/Identity/Persona_Shutdown_Guidelines_for_Reliers">More Info...</a>
</p>
</div>

<div id="wait" class="message_screen"><div class="contents"></div></div>
<div id="error" class="message_screen"><div class="contents"></div></div>
<div id="delay" class="message_screen"><div class="contents"></div></div>

<%- body %>

</div>

<% if (typeof embedded === "undefined" || embedded !== true) { %>
<footer style="position: absolute; bottom: 0;">
<footer>
<ul class="cf">
<li><%- format(gettext('By the <a %s>Identity Team</a> @ <a %s>Mozilla</a>'),
[" href='http://identity.mozilla.com' target='_blank'", " href='https://mozilla.org' target='_blank'"]) %></li>
<li><a href="/<%= lang %>/privacy"><%= gettext('Privacy &rarr;') %></a></li>
<li><a href="/<%= lang %>/tos"><%= gettext('TOS &rarr;') %></a></li>
<li><a href="https://developer.mozilla.org/docs/persona" target="_blank"><%= gettext("Developers &rarr;") %></a></li>
<li class="help"><a
href="https://support.mozilla.com/kb/what-is-persona-and-how-does-it-work" target="_blank"><%= gettext('Need Help? &rarr;') %></a></li>
</ul>
</footer>
<% } %>
<script src="https://login.persona.org/include.js"></script>

</body>
</html>
2 changes: 0 additions & 2 deletions scripts/create_include.js
Original file line number Diff line number Diff line change
@@ -35,8 +35,6 @@ module.exports = function(done) {
output += '\tif (navigator.mozId) { navigator.id = navigator.mozId; }\n';
output += '\telse { (function() {\n';
output += '\tvar undefined;\n';
output += fs.readFileSync(path.join(dir, '_jschannel.js'));
output += fs.readFileSync(path.join(winchan_dir, 'winchan.js'));
output += fs.readFileSync(path.join(dir, '_include.js'));
output += '\t}());\n'; // end inner function
output += '\t}\n'; // end else
9 changes: 5 additions & 4 deletions scripts/run_locally.js
Original file line number Diff line number Diff line change
@@ -17,15 +17,15 @@ var daemons = exports.daemons = {};
const HOST = process.env['IP_ADDRESS'] || process.env['HOST'] || "127.0.0.1";

var daemonsToRun = {
verifier: { },
keysigner: { },
dbwriter: { },
// verifier: { },
// keysigner: { },
// dbwriter: { },
example: {
path: path.join(__dirname, "..", "scripts", "serve_example.js"),
PORT: 10001,
HOST: HOST
},
example_primary: {
/* example_primary: {
SHIMMED_DOMAIN: "example.domain",
path: path.join(__dirname, "..", "scripts", "serve_example_primary.js"),
PORT: 10005,
@@ -39,6 +39,7 @@ var daemonsToRun = {
},
proxy: { },
browserid: { },
*/
static: { },
router: { }
};
46 changes: 1 addition & 45 deletions scripts/test
Original file line number Diff line number Diff line change
@@ -2,22 +2,14 @@

// a script to RUN TESTS. You can specify WHAT TESTS to run by
// populating an environment variable 'WHAT_TESTS'. Values include:
// * 'front' - frontend unit tests run headlessly (requires phantomjs to be installed)
// * 'back' - backend unit tests with a zero-dependency json db
// * 'back_mysql - backend unit tests against mysql (requires mysql installed)
// * 'all' - of it

const
spawn = require('child_process').spawn,
exec = require('child_process').exec,
rimraf = require('rimraf'),
path = require('path');

// if running tests for backend coverage, remove any prior run's data.
if (process.env.PERSONA_WITH_COVER) {
rimraf.sync(path.join(__dirname, "..", ".coverage_data"));
}

// WHAT TESTS are we running?
var whatTests = [];
if (!process.env['WHAT_TESTS']) {
@@ -26,59 +18,25 @@ if (!process.env['WHAT_TESTS']) {
whatTests.push(process.env['WHAT_TESTS']);
}

if (whatTests[0] == 'all') whatTests = [ 'back_mysql', 'back', 'front' ];
if (whatTests[0] == 'all') whatTests = [ 'back' ];

var ec = 0;
var frontend_test_filter = process.env['FRONTEND_TEST_FILTER'] ?
' (filter: ' + process.env['FRONTEND_TEST_FILTER'] + ')' :
'';

function reportCoverage(ec) {
var pathToCover = path.join(__dirname, "..", "node_modules", ".bin", "cover");
var pathToReport = path.join(__dirname, "..", "cover_html");
rimraf.sync(pathToReport);
pathToReport = ['`open file://', pathToReport, '/index.html`'].join('');
exec(pathToCover + ' combine', function(err, stdout, stderr) {
if (err) throw err;
exec(pathToCover + ' report html', function(err, stdout, stderr) {
if (err) throw err;
console.log("\n**\n** Coverage report is available at",
pathToReport, '\n**\n');
process.exit(ec);
});
});
}

function run() {
if (!whatTests.length) {
if (process.env.PERSONA_WITH_COVER) {
return reportCoverage(ec);
}
process.exit(ec);
}

var testName = whatTests.shift();

const availConf = {
front: {
what: "Front end unit tests under PhantomJS" + frontend_test_filter,
node_env: 'test_json',
script: 'test_frontend'
},
back: {
what: "API level unit tests using a JSON database",
node_env: 'test_json',
script: 'test_backend'
},
back_mysql: {
what: "API level unit tests using MySQL",
node_env: 'test_mysql',
script: 'test_backend'
},
selenium: {
what: "Selenium tests against sauce labs",
node_env: 'test_json',
script: 'test_selenium'
}
};
var conf = availConf[testName];
@@ -91,8 +49,6 @@ function run() {
}

console.log(">>> Now Running:", conf.what);
if (conf.script === 'test_frontend')
console.log('NOTE: Warnings PhantomJS throws pretaining to focusing on elements can be safely ignored');
process.env['NODE_ENV'] = conf.node_env;
var kid = spawn(path.join(__dirname, conf.script));
kid.stdout.on('data', function(d) { process.stdout.write(d); });
3 changes: 1 addition & 2 deletions scripts/test_backend
Original file line number Diff line number Diff line change
@@ -17,9 +17,8 @@ fi
# vows hates absolute paths. sheesh.
cd $BASEDIR

$SCRIPT_DIR/test_db_connectivity.js
if [ $? = 0 ] ; then
for file in tests/*.js ; do
for file in eol-tests/*.js ; do
echo $file
vows $file
if [ $? != 0 ] ; then