Skip to content

Commit 01261ea

Browse files
Merge branch 'master' into oidc-dev
2 parents fc3ab8f + 6c346f0 commit 01261ea

File tree

4 files changed

+65
-1
lines changed

4 files changed

+65
-1
lines changed

lib/api/accounts/user-accounts.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const express = require('express')
44
const bodyParser = require('body-parser').urlencoded({ extended: false })
55
const debug = require('../../debug').accounts
6+
const path = require('path')
67

78
const CreateAccountRequest = require('../../requests/create-account-request')
89
const AddCertificateRequest = require('../../requests/add-cert-request')

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "solid-server",
33
"description": "Solid server on top of the file-system",
4-
"version": "3.5.0",
4+
"version": "3.5.1",
55
"author": {
66
"name": "Tim Berners-Lee",
77
"email": "timbl@w3.org"

static/signup.html.acl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# ACL resource for the static resources
2+
3+
@prefix acl: <http://www.w3.org/ns/auth/acl#>.
4+
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
5+
6+
# Public-readable
7+
<#public>
8+
a acl:Authorization;
9+
10+
acl:agentClass foaf:Agent; # everyone
11+
12+
acl:accessTo <./signup.html>;
13+
14+
acl:mode acl:Read.

test/integration/account-creation-oidc.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const fs = require('fs-extra')
99

1010
describe('AccountManager (OIDC account creation tests)', function () {
1111
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
12+
this.timeout(10000)
1213

1314
var serverUri = 'https://localhost:3457'
1415
var host = 'localhost:3457'
@@ -200,3 +201,51 @@ describe('AccountManager (OIDC account creation tests)', function () {
200201
})
201202
})
202203
})
204+
205+
describe('Single User signup page', () => {
206+
const serverUri = 'https://localhost:7457'
207+
const port = 7457
208+
var ldpHttpsServer
209+
const rootDir = path.join(__dirname, '/resources/accounts/single-user/')
210+
const ldp = ldnode.createServer({
211+
port,
212+
root: rootDir,
213+
sslKey: path.join(__dirname, '/keys/key.pem'),
214+
sslCert: path.join(__dirname, '/keys/cert.pem'),
215+
webid: true,
216+
idp: false,
217+
strictOrigin: true
218+
})
219+
const server = supertest(serverUri)
220+
221+
before(function (done) {
222+
ldpHttpsServer = ldp.listen(port, done)
223+
})
224+
225+
after(function () {
226+
if (ldpHttpsServer) ldpHttpsServer.close()
227+
fs.removeSync(path.join(rootDir))
228+
})
229+
230+
it('should return a 401 unauthorized without accept text/html', done => {
231+
server.get('/')
232+
.set('accept', 'text/plain')
233+
.expect(401)
234+
.end(done)
235+
})
236+
237+
it('should redirect to signup with accept text/html', done => {
238+
server.get('/')
239+
.set('accept', 'text/html')
240+
.expect(302)
241+
.expect('location', '/signup.html')
242+
.end(done)
243+
})
244+
245+
it('it should serve the signup page', done => {
246+
server.get('/signup.html')
247+
.expect(200)
248+
.expect(/<title>Admin Signup<\/title>/)
249+
.end(done)
250+
})
251+
})

0 commit comments

Comments
 (0)