Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow container creation via PUT #513

Closed
wants to merge 71 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
c70c1ff
OIDC Integration - WIP
dmitrizagidulin May 27, 2016
2efc42f
Extract /logout handler to LogoutRequest
dmitrizagidulin Mar 8, 2017
2aa41c1
Move Provider initialization logic
dmitrizagidulin Mar 8, 2017
639828b
Handle user manually going to /login without app
dmitrizagidulin Mar 9, 2017
1fb1a86
Extract auth api logic to oidc-auth-manager
dmitrizagidulin Mar 10, 2017
ad6add0
Add --db-path config option
dmitrizagidulin Mar 16, 2017
308061a
Move oidc-manager test from unit to integration
dmitrizagidulin Mar 16, 2017
ef9ef9a
Refactor config defaults. (webid: true by default)
dmitrizagidulin Mar 16, 2017
ffe2716
Move default-account-template/ to default-templates/new-account
dmitrizagidulin Mar 16, 2017
f60abe9
Move default-email-templates/ to default-templates/emails
dmitrizagidulin Mar 16, 2017
a4ee756
Add --config-path parameter (for default templates and apps)
dmitrizagidulin Mar 17, 2017
72b5e27
Serve public common/ dir (for shared CSS files, etc)
dmitrizagidulin Mar 17, 2017
2a14d94
Add boostrap.min.css v3.3.7 to common/css/
dmitrizagidulin Mar 17, 2017
01827fe
Make views/ customizable like templates
dmitrizagidulin Mar 17, 2017
a069f6f
Rename DiscoverProviderRequest to SelectProviderRequest
dmitrizagidulin Mar 17, 2017
d3dfaf1
Move goodbye.html to views
dmitrizagidulin Mar 17, 2017
3746048
Add a /login default view
dmitrizagidulin Mar 17, 2017
379c8c3
Add db configs to speed up integration tests
dmitrizagidulin Mar 17, 2017
a2ff736
Display errors on the login form
dmitrizagidulin Mar 20, 2017
03f6b79
Pass returnToUrl to /register, refactor
dmitrizagidulin Mar 20, 2017
2e51a9d
Add /register view
dmitrizagidulin Mar 20, 2017
47dd697
Redirect to original url after account creation
dmitrizagidulin Mar 21, 2017
fe498cc
Fix logout handler
dmitrizagidulin Mar 21, 2017
76d6d17
Add a default index.html for server root
dmitrizagidulin Mar 21, 2017
9740b84
Initialize a default index.html for new user accounts
dmitrizagidulin Mar 21, 2017
9ce5635
Bump oidc-auth-manager dep (moved from bcrypt to bcryptjs)
dmitrizagidulin Mar 23, 2017
eba36da
Pre-populate provider on select-provider view
dmitrizagidulin Mar 27, 2017
189b623
Extract SelectProviderRequest and auth callback code to Auth Manager
dmitrizagidulin Apr 3, 2017
ebcf600
Add serverUri to startup debug, bump auth manager dep
dmitrizagidulin Apr 5, 2017
9e11367
Add tests
dmitrizagidulin Apr 5, 2017
594d3b1
Extract template init code to server-config.js
dmitrizagidulin Apr 7, 2017
1c06a1c
Refactor createApp()
dmitrizagidulin Apr 7, 2017
42fe4e3
Move acl.js test and resources/ folder to acl-tls
dmitrizagidulin Apr 11, 2017
3ddce53
Add acl-related OIDC integration tests
dmitrizagidulin Apr 12, 2017
7abe470
Fix file browser redirect test
dmitrizagidulin Apr 13, 2017
bb036a9
Add tests for userIdFromRequest()
dmitrizagidulin Apr 13, 2017
6cd2e38
Add tests for TokenService
dmitrizagidulin Apr 18, 2017
231d964
Refactor TokenService and account manager, add tests
dmitrizagidulin Apr 24, 2017
3f7bd3a
Implement password reset request and tests
dmitrizagidulin Apr 25, 2017
d1bf5eb
Implement reset token validation and change password page
dmitrizagidulin Apr 26, 2017
4e9bcc7
Add support for --force-user flag for oidc auth
dmitrizagidulin Apr 27, 2017
0e3ff32
Fix account creation welcome email logic
dmitrizagidulin Apr 27, 2017
8303982
Remove broken /messages api code
dmitrizagidulin Apr 27, 2017
722d0e8
Remove old account-recovery handler
dmitrizagidulin Apr 27, 2017
313fa7a
Remove WebID-TLS authentication code
dmitrizagidulin Apr 28, 2017
5a74b55
Clean up params integration tests
dmitrizagidulin Apr 28, 2017
79f777e
Add tests for PasswordChangeRequest handler
dmitrizagidulin Apr 28, 2017
e5dec6c
Add test for fullUrlForReq()
dmitrizagidulin May 1, 2017
acfeb76
Add auth-related docstrings
dmitrizagidulin May 1, 2017
7b6299b
Add a fix for utils.debrack() and unit tests
dmitrizagidulin May 1, 2017
80cfedc
Set User: response header if authenticated (for legacy compat)
dmitrizagidulin May 4, 2017
9583471
Bump oidc-auth-manager dep to 0.7.1
dmitrizagidulin May 11, 2017
6c5d18c
Re-add WebID-TLS auth code
dmitrizagidulin May 18, 2017
1250590
Add a Login with Certificate button to login screen
dmitrizagidulin May 1, 2017
3fc1389
Implement Login via WebID-TLS cert local auth strategy
dmitrizagidulin May 22, 2017
17434b4
Merge branch 'login-with-tls' into oidc-dev
dmitrizagidulin May 24, 2017
2af40a0
Fix 401 error handling, add tests (#507)
dmitrizagidulin Jun 7, 2017
1d8e88a
Make ./data the default root folder (#510)
dmitrizagidulin Jun 22, 2017
a381d21
Move patch handlers to separate files.
RubenVerborgh Jun 22, 2017
7ae8282
Use same patch logic regardless of content type.
RubenVerborgh Jun 22, 2017
2bd65fb
Use "415 Unsupported Media Type" for unsupported patches.
RubenVerborgh Jun 22, 2017
aa49b04
Deduplicate graph reading code.
RubenVerborgh Jun 23, 2017
750817b
Remove incomplete SPARQL PATCH handler.
RubenVerborgh Jun 23, 2017
6d8d770
Move patch writing to generic PATCH handler.
RubenVerborgh Jun 23, 2017
1a3b676
Delegate body parsing to middleware.
RubenVerborgh Jun 23, 2017
c09b89f
Prettify patch code.
RubenVerborgh Jun 23, 2017
b5e2364
Allow container creation via PUT
dmitrizagidulin Jun 29, 2017
9bbd170
Simplify isDirectory check
dmitrizagidulin Jun 30, 2017
05acfb8
Remove before() cleanup
dmitrizagidulin Jun 30, 2017
35ab538
Make the PUT update test self-contained
dmitrizagidulin Jun 30, 2017
b9f0b31
Do not hardcode the .meta suffix
dmitrizagidulin Jun 30, 2017
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
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ node_modules/
*.swp
.tern-port
npm-debug.log
config/account-template
config/email-templates
/config/account-template
/config/email-templates
/accounts
/profile
/inbox
/.acl
/config.json
/config/templates
/config/views
/settings
/.db
.nyc_output
coverage
/data
23 changes: 17 additions & 6 deletions bin/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ module.exports = [
// },
{
name: 'root',
help: "Root folder to serve (defaut: './')",
help: "Root folder to serve (default: './data')",
question: 'Path to the folder you want to serve. Default is',
default: './',
default: './data',
prompt: true,
filter: (value) => path.resolve(value)
},
Expand Down Expand Up @@ -46,18 +46,30 @@ module.exports = [
default: '/',
prompt: true
},
{
name: 'config-path',
question: 'Path to the config directory (for example: /etc/solid-server)',
default: './config',
prompt: true
},
{
name: 'db-path',
question: 'Path to the server metadata db directory (for users/apps etc)',
default: './.db',
prompt: true
},
{
name: 'auth',
help: 'Pick an authentication strategy for WebID: `tls` or `oidc`',
question: 'Select authentication strategy',
type: 'list',
choices: [
'WebID-TLS'
'WebID-OpenID Connect'
],
prompt: false,
default: 'WebID-TLS',
default: 'WebID-OpenID Connect',
filter: (value) => {
if (value === 'WebID-TLS') return 'tls'
if (value === 'WebID-OpenID Connect') return 'oidc'
},
when: (answers) => {
return answers.webid
Expand Down Expand Up @@ -132,7 +144,6 @@ module.exports = [
default: '/proxy',
prompt: true
},

{
name: 'file-browser',
help: 'Type the URL of default app to use for browsing files (or use default)',
Expand Down
6 changes: 6 additions & 0 deletions common/css/bootstrap.min.css

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions config/defaults.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
'use strict'

module.exports = {
'AUTH_METHOD': 'tls',
'DEFAULT_PORT': 8443,
'DEFAULT_URI': 'https://localhost:8443' // default serverUri
'auth': 'oidc',
'localAuth': {
'tls': true,
'password': true
},
'configPath': './config',
'dbPath': './.db',
'port': 8443,
'serverUri': 'https://localhost:8443',
'webid': true
}
File renamed without changes.
49 changes: 49 additions & 0 deletions default-templates/emails/reset-password.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
'use strict'

/**
* Returns a partial Email object (minus the `to` and `from` properties),
* suitable for sending with Nodemailer.
*
* Used to send a Reset Password email, upon user request
*
* @param data {Object}
*
* @param data.resetUrl {string}
* @param data.webId {string}
*
* @return {Object}
*/
function render (data) {
return {
subject: 'Account password reset',

/**
* Text version
*/
text: `Hi,

We received a request to reset your password for your Solid account, ${data.webId}

To reset your password, click on the following link:

${data.resetUrl}

If you did not mean to reset your password, ignore this email, your password will not change.`,

/**
* HTML version
*/
html: `<p>Hi,</p>

<p>We received a request to reset your password for your Solid account, ${data.webId}</p>

<p>To reset your password, click on the following link:</p>

<p><a href="${data.resetUrl}">${data.resetUrl}</a></p>

<p>If you did not mean to reset your password, ignore this email, your password will not change.</p>
`
}
}

module.exports.render = render
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
function render (data) {
return {
subject: `Welcome to Solid`,
subject: 'Welcome to Solid',

/**
* Text version of the Welcome email
Expand Down
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions default-templates/new-account/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Solid User Profile</title>
<link rel="stylesheet" href="/common/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h3>Solid User Profile</h3>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<p style="margin-top: 3em; margin-bottom: 3em;">
Welcome to your Solid user profile.
</p>
<p>
Your Web ID is:<br />

<code>{{webId}}</code>
</p>
</div>
</div>
</div>
</body>
</html>
22 changes: 22 additions & 0 deletions default-templates/new-account/index.html.acl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@prefix acl: <http://www.w3.org/ns/auth/acl#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.

<#owner>
a acl:Authorization;

acl:agent
<{{webId}}>;

acl:accessTo </index.html>;

acl:mode
acl:Read, acl:Write, acl:Control.

<#public>
a acl:Authorization;

acl:agentClass foaf:Agent; # everyone

acl:accessTo <./index.html>;

acl:mode acl:Read.
35 changes: 35 additions & 0 deletions default-templates/server/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Welcome to Solid</title>
<link rel="stylesheet" href="/common/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h3>Welcome to Solid</h3>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<p style="margin-top: 3em; margin-bottom: 3em;">
If you have not already done so, please create an account.
</p>
</div>
</div>
<div class="row">
<div class="col-md-2">
<form method="get" action="/register">
<button type="submit" class="btn btn-primary" id="register">Register</button>
</form>
</div>
<div class="col-md-10">
<form method="get" action="/login">
<button type="submit" class="btn btn-primary" id="login">Login</button>
</form>
</div>
</div>
</div>
</body>
</html>
11 changes: 11 additions & 0 deletions default-templates/server/index.html.acl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@prefix acl: <http://www.w3.org/ns/auth/acl#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.

<#public>
a acl:Authorization;

acl:agentClass foaf:Agent; # everyone

acl:accessTo <./index.html>;

acl:mode acl:Read.
4 changes: 4 additions & 0 deletions default-views/account/register-disabled.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<p>
Registering a new account is disabled for the WebID-TLS authentication method.
Please restart the server using another mode.
</p>
55 changes: 55 additions & 0 deletions default-views/account/register-form.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<form method="post" action="/api/accounts/new">
<div class="form-group">
{{#if error}}
<div class="row">
<div class="col-md-12">
<p class="text-danger"><strong>{{error}}</strong></p>
</div>
</div>
{{/if}}
<div class="row">
<div class="col-md-12">
<label for="username">Username:</label>
<input type="text" class="form-control" name="username" id="username" placeholder="alice" />
</div>
</div>
<div class="row">
<div class="col-md-12">
<label for="password">Password:</label>
<input type="password" class="form-control" name="password" id="password" />
</div>
</div>
<div class="row">
<div class="col-md-12">
<label for="name">Name:</label>
<input type="name" class="form-control" name="name" id="name" />
</div>
</div>
<div class="row">
<div class="col-md-12">
<label for="email">Email:</label>
<input type="email" class="form-control" name="email" id="email" />
</div>
</div>
<input type="hidden" name="returnToUrl" value="{{returnToUrl}}" />
</div>

<div class="form-group">
<div class="row">
<div class="col-md-2">
<button type="submit" class="btn btn-primary" id="register">Register</button>

{{> auth/auth-hidden-fields}}
</div>

<div class="col-md-10">
<div>Already have an account?
<a class="btn btn-xs btn-default"
href="{{{loginUrl}}}">
Log In
</a>
</div>
</div>
</div>
</div>
</form>
21 changes: 21 additions & 0 deletions default-views/account/register.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Register</title>
<link rel="stylesheet" href="/common/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h4>Register</h4>
</div>
<div class="container">
{{#if registerDisabled}}
{{> account/register-disabled}}
{{else}}
{{> account/register-form}}
{{/if}}
</div>
</body>
</html>
7 changes: 7 additions & 0 deletions default-views/auth/auth-hidden-fields.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<input type="hidden" name="response_type" id="response_type" value="{{response_type}}" />
<input type="hidden" name="display" id="display" value="{{display}}" />
<input type="hidden" name="scope" id="scope" value="{{scope}}" />
<input type="hidden" name="client_id" id="client_id" value="{{client_id}}" />
<input type="hidden" name="redirect_uri" id="redirect_uri" value="{{redirect_uri}}" />
<input type="hidden" name="state" id="state" value="{{state}}" />
<input type="hidden" name="nonce" id="nonce" value="{{nonce}}" />
Loading