fxa-auth-server/routes/idp.js

69 строки
1.7 KiB
JavaScript
Исходник Обычный вид История

2013-05-16 00:42:25 +04:00
/* 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/. */
var b64 = require('jwcrypto/lib/utils').base64urlencode
var bigint = require('bigint')
2013-10-27 06:02:54 +04:00
module.exports = function (log, serverPublicKey) {
2013-05-15 03:23:36 +04:00
2013-07-23 22:16:44 +04:00
var routes = [
{
method: 'GET',
path: '/.well-known/browserid',
config: {
cache: {
privacy: 'public',
expiresIn: 10000
}
},
2014-08-23 05:06:34 +04:00
handler: function browserid(request, reply) {
log.begin('browserid', request)
reply(
{
'public-key': serverPublicKey,
'authentication': '/.well-known/browserid/sign_in.html',
'provisioning': '/.well-known/browserid/provision.html'
}
)
2013-05-16 00:42:25 +04:00
}
2013-07-23 22:16:44 +04:00
},
2014-08-23 05:06:34 +04:00
{
method: 'GET',
path: '/.well-known/public-keys',
handler: function (request, reply) {
// FOR DEV PURPOSES ONLY
reply(
{
keys: [
{
2014-09-04 00:51:55 +04:00
kid: "dev-1",
2014-09-04 00:57:18 +04:00
use: "sig",
2014-08-23 05:06:34 +04:00
kty: "RSA",
n: b64(bigint(serverPublicKey.n).toBuffer()),
2014-09-04 00:51:55 +04:00
e: b64(bigint(serverPublicKey.e).toBuffer())
2014-08-23 05:06:34 +04:00
}
]
}
)
}
},
2013-07-23 22:16:44 +04:00
{
method: 'GET',
path: '/.well-known/browserid/sign_in.html',
handler: {
file: './routes/static/sign_in.html'
2013-05-15 03:23:36 +04:00
}
2013-07-23 22:16:44 +04:00
},
{
method: 'GET',
path: '/.well-known/browserid/provision.html',
handler: {
file: './routes/static/provision.html'
}
2013-08-20 02:00:28 +04:00
}
2013-07-23 22:16:44 +04:00
]
2013-07-23 22:16:44 +04:00
return routes
2013-07-04 01:46:22 +04:00
}