Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
bbdc11d
OIDC Integration - WIP
dmitrizagidulin May 27, 2016
7a0376f
Extract /logout handler to LogoutRequest
dmitrizagidulin Mar 8, 2017
3fb8047
Move Provider initialization logic
dmitrizagidulin Mar 8, 2017
935be63
Handle user manually going to /login without app
dmitrizagidulin Mar 9, 2017
e7b4d0f
Extract auth api logic to oidc-auth-manager
dmitrizagidulin Mar 10, 2017
2921a54
Add --db-path config option
dmitrizagidulin Mar 16, 2017
2b77734
Move oidc-manager test from unit to integration
dmitrizagidulin Mar 16, 2017
5d1b3ae
Refactor config defaults. (webid: true by default)
dmitrizagidulin Mar 16, 2017
6bb6f38
Move default-account-template/ to default-templates/new-account
dmitrizagidulin Mar 16, 2017
6614f23
Move default-email-templates/ to default-templates/emails
dmitrizagidulin Mar 16, 2017
89fe55e
Add --config-path parameter (for default templates and apps)
dmitrizagidulin Mar 17, 2017
d608422
Serve public common/ dir (for shared CSS files, etc)
dmitrizagidulin Mar 17, 2017
73d3c23
Add boostrap.min.css v3.3.7 to common/css/
dmitrizagidulin Mar 17, 2017
4bbf131
Make views/ customizable like templates
dmitrizagidulin Mar 17, 2017
fa2b96c
Rename DiscoverProviderRequest to SelectProviderRequest
dmitrizagidulin Mar 17, 2017
344511c
Move goodbye.html to views
dmitrizagidulin Mar 17, 2017
dea5733
Add a /login default view
dmitrizagidulin Mar 17, 2017
df54a75
Add db configs to speed up integration tests
dmitrizagidulin Mar 17, 2017
18d75da
Display errors on the login form
dmitrizagidulin Mar 20, 2017
9161d11
Pass returnToUrl to /register, refactor
dmitrizagidulin Mar 20, 2017
fa20647
Add /register view
dmitrizagidulin Mar 20, 2017
4220d66
Redirect to original url after account creation
dmitrizagidulin Mar 21, 2017
b27244c
Fix logout handler
dmitrizagidulin Mar 21, 2017
8eaf259
Add a default index.html for server root
dmitrizagidulin Mar 21, 2017
e4d0b8d
Initialize a default index.html for new user accounts
dmitrizagidulin Mar 21, 2017
c6a683d
Bump oidc-auth-manager dep (moved from bcrypt to bcryptjs)
dmitrizagidulin Mar 23, 2017
a5906b8
Pre-populate provider on select-provider view
dmitrizagidulin Mar 27, 2017
478a354
Extract SelectProviderRequest and auth callback code to Auth Manager
dmitrizagidulin Apr 3, 2017
d5f53f0
Add serverUri to startup debug, bump auth manager dep
dmitrizagidulin Apr 5, 2017
0012143
Add tests
dmitrizagidulin Apr 5, 2017
d47d160
Extract template init code to server-config.js
dmitrizagidulin Apr 7, 2017
b21ae11
Refactor createApp()
dmitrizagidulin Apr 7, 2017
04e6c9c
Move acl.js test and resources/ folder to acl-tls
dmitrizagidulin Apr 11, 2017
d935642
Add acl-related OIDC integration tests
dmitrizagidulin Apr 12, 2017
10dccdb
Fix file browser redirect test
dmitrizagidulin Apr 13, 2017
60792fb
Add tests for userIdFromRequest()
dmitrizagidulin Apr 13, 2017
412f488
Add tests for TokenService
dmitrizagidulin Apr 18, 2017
357da35
Refactor TokenService and account manager, add tests
dmitrizagidulin Apr 24, 2017
3b915ff
Implement password reset request and tests
dmitrizagidulin Apr 25, 2017
4ca105e
Implement reset token validation and change password page
dmitrizagidulin Apr 26, 2017
d170650
Add support for --force-user flag for oidc auth
dmitrizagidulin Apr 27, 2017
b49082a
Fix account creation welcome email logic
dmitrizagidulin Apr 27, 2017
182cde7
Remove broken /messages api code
dmitrizagidulin Apr 27, 2017
477c0e0
Remove old account-recovery handler
dmitrizagidulin Apr 27, 2017
b753954
Remove WebID-TLS authentication code
dmitrizagidulin Apr 28, 2017
6b39dcf
Clean up params integration tests
dmitrizagidulin Apr 28, 2017
917cd29
Add tests for PasswordChangeRequest handler
dmitrizagidulin Apr 28, 2017
e2d68fe
Add test for fullUrlForReq()
dmitrizagidulin May 1, 2017
fc0a7b3
Add auth-related docstrings
dmitrizagidulin May 1, 2017
97dac71
Add a fix for utils.debrack() and unit tests
dmitrizagidulin May 1, 2017
e79f025
Set User: response header if authenticated (for legacy compat)
dmitrizagidulin May 4, 2017
9e71eb9
Bump oidc-auth-manager dep to 0.7.1
dmitrizagidulin May 11, 2017
b5f3dc4
Re-add WebID-TLS auth code
dmitrizagidulin May 18, 2017
0786e08
Add a Login with Certificate button to login screen
dmitrizagidulin May 1, 2017
9b19974
Implement Login via WebID-TLS cert local auth strategy
dmitrizagidulin May 22, 2017
eca2d4b
Fix 401 error handling, add tests (#507)
dmitrizagidulin Jun 7, 2017
3659b65
Make ./data the default root folder (#510)
dmitrizagidulin Jun 22, 2017
0b03de7
Move patch handlers to separate files.
RubenVerborgh Jun 22, 2017
a79d19d
Use same patch logic regardless of content type.
RubenVerborgh Jun 22, 2017
acc7151
Use "415 Unsupported Media Type" for unsupported patches.
RubenVerborgh Jun 22, 2017
f55a2a0
Deduplicate graph reading code.
RubenVerborgh Jun 23, 2017
3d05378
Remove incomplete SPARQL PATCH handler.
RubenVerborgh Jun 23, 2017
90c218a
Move patch writing to generic PATCH handler.
RubenVerborgh Jun 23, 2017
fc42bbc
Delegate body parsing to middleware.
RubenVerborgh Jun 23, 2017
c92c6ad
Prettify patch code.
RubenVerborgh Jun 23, 2017
a3f8a77
Refactor SPARQL update patcher with promises.
RubenVerborgh Jun 23, 2017
71c3101
Add preliminary N3 patch support.
RubenVerborgh Jun 26, 2017
aed5b6a
Construct the patch URI through a hash of its contents.
RubenVerborgh Jun 27, 2017
c44c9a1
Clean up SPARQL UPDATE PATCH tests.
RubenVerborgh Jun 27, 2017
4d1e746
Set up new PATCH tests.
RubenVerborgh Jun 27, 2017
f04b5ef
Syntactically and structurally validate patches.
RubenVerborgh Jun 28, 2017
351463d
Enable and test PATCH appending.
RubenVerborgh Jun 29, 2017
338795e
Use single-user setup for PATCH tests.
RubenVerborgh Jun 30, 2017
4c6c275
Test PATCH deletion.
RubenVerborgh Jun 30, 2017
1d55d0e
Test PATCH combined deletion and insertion.
RubenVerborgh Jun 30, 2017
c463d73
Add WHERE support to N3 patches.
RubenVerborgh Jun 30, 2017
d4315b4
Refactor patch handler to perform everything but parsing.
RubenVerborgh Jul 1, 2017
2a895f6
Expose ACL and user ID on request.
RubenVerborgh Jul 1, 2017
9a3597b
Verify read and write permissions for patches.
RubenVerborgh Jul 1, 2017
d108753
Refactor PATCH tests with helper method.
RubenVerborgh Jul 2, 2017
180a114
Support client certificates via X-SSL-Cert header.
RubenVerborgh Jul 13, 2017
97322a0
Make x509 dependency optional.
RubenVerborgh Jul 13, 2017
c541a0a
Add acceptCertificateHeader option.
RubenVerborgh Jul 13, 2017
b0591af
WebID through header doesn't require TLS.
RubenVerborgh Jul 13, 2017
de6012c
Make certificate header name customizable.
RubenVerborgh Jul 13, 2017
60a14ef
Add reverse proxy documentation link.
RubenVerborgh Jul 13, 2017
95701d9
Only set User header with WebID-TLS.
RubenVerborgh Jul 25, 2017
f853711
Reject cookies from third-party applications.
RubenVerborgh Jul 25, 2017
fc3ab8f
Fix missing foaf: prefix in prefs.ttl
dmitrizagidulin Jul 27, 2017
01261ea
Merge branch 'master' into oidc-dev
dmitrizagidulin Aug 8, 2017
c81b51d
Fix merge oddness
dmitrizagidulin Aug 8, 2017
2b4bbe4
Add support for 'request' auth param
dmitrizagidulin Aug 8, 2017
775b46d
Return scope='openid webid' in oidc WWW-Authenticate header response
dmitrizagidulin Aug 8, 2017
da8df9b
Use http-proxy-middleware for CORS proxy.
RubenVerborgh Aug 8, 2017
1696e35
Correct proxy error codes.
RubenVerborgh Aug 8, 2017
1afb00a
Update IP packages.
RubenVerborgh Aug 8, 2017
e61de87
Ensure the host is not a local IP.
RubenVerborgh Aug 8, 2017
883373e
Pass the Host header.
RubenVerborgh Aug 8, 2017
d7dfb16
Expose ACL and user ID on request.
RubenVerborgh Jul 1, 2017
22b2f6c
Test on Node 8.
RubenVerborgh Jul 6, 2017
e785193
Allow additional HTTPS options.
RubenVerborgh Jul 6, 2017
aa0b6b9
Fix ACL TLS test.
RubenVerborgh Jul 6, 2017
5bb0672
Set NODE_TLS_REJECT_UNAUTHORIZED for tests (only).
RubenVerborgh Jul 6, 2017
d9b77a8
Update nock.
RubenVerborgh Aug 8, 2017
01550b0
Move OIDC-specific details out of createApp.
RubenVerborgh Aug 10, 2017
bde91b2
Move TLS-specific details out of createApp.
RubenVerborgh Aug 10, 2017
2e435ff
Make forceUser a separate module.
RubenVerborgh Aug 10, 2017
1f4fd48
Make create-app auth-agnostic.
RubenVerborgh Aug 10, 2017
47697ca
Remove redundant "identified" setting.
RubenVerborgh Aug 10, 2017
e9b5509
Expose request.userId in OIDC handler.
RubenVerborgh Aug 10, 2017
c9467b0
Remove userId from allow handler.
RubenVerborgh Aug 10, 2017
42011d6
Only set User header for TLS.
RubenVerborgh Aug 10, 2017
c2463bc
Rename proxy to corsProxy.
RubenVerborgh Aug 8, 2017
bf3b95c
Add Auth Proxy.
RubenVerborgh Aug 9, 2017
89b6133
Set User header on proxied requests.
RubenVerborgh Aug 9, 2017
2a14bc7
Set Host header on proxied requests.
RubenVerborgh Aug 9, 2017
70f8716
Set Forwarded header on proxied requests.
RubenVerborgh Aug 10, 2017
822d58c
Add authProxy option.
RubenVerborgh Aug 9, 2017
1e6ab20
Set default test timeout to 10 seconds.
RubenVerborgh Aug 9, 2017
0b5a675
Rename main executable to solid.
RubenVerborgh Aug 11, 2017
ae946b0
Add solid-test script.
RubenVerborgh Aug 11, 2017
66e8f8a
Document solid-test executable.
RubenVerborgh Aug 11, 2017
4cf7fd5
Follow Mocha naming conventions.
RubenVerborgh Aug 11, 2017
a1a36c7
Remove specific test commands.
RubenVerborgh Aug 11, 2017
ad09398
Remove clean scripts.
RubenVerborgh Aug 11, 2017
e273032
Add a 'two pods plus external web app' integration test
dmitrizagidulin May 26, 2017
f8db96b
Add support for Proof of Possession tokens, update tests
dmitrizagidulin Aug 14, 2017
0ab52a8
Add token reuse test
dmitrizagidulin Aug 14, 2017
bfcfeca
Merge branch 'master' into dz_oidc
dmitrizagidulin Aug 15, 2017
ff3d3be
Add package-lock.json
dmitrizagidulin Aug 15, 2017
9ba7cb3
Switch to the official oidc issuer link rel value
dmitrizagidulin Aug 15, 2017
dbffa3d
Verify webid provider when extracting webid from claim
dmitrizagidulin Aug 15, 2017
9af2c51
Remove deprecated solid:inbox term from account template
dmitrizagidulin Aug 15, 2017
4bcd7fc
Cache APT packages on Travis CI.
RubenVerborgh Aug 16, 2017
bf83152
Correct certificate-header flag name.
RubenVerborgh Aug 16, 2017
c734cf6
Add --no-reject-unauthorized flag.
RubenVerborgh Aug 16, 2017
b3b755b
Disable rejectUnauthorized on solid-test.
RubenVerborgh Aug 16, 2017
5fe555d
Display error messages on Select Provider page
dmitrizagidulin Aug 16, 2017
560c570
Allow login via TLS with externally hosted WebIDs
dmitrizagidulin Aug 16, 2017
1782ba3
TlsAuthenticator - minor refactor/cleanup
dmitrizagidulin Aug 16, 2017
fb7235d
Add link to issuer discovery spec on error
dmitrizagidulin Aug 17, 2017
b0d543f
Merge remote-tracking branch 'origin/master' into dz_oidc
dmitrizagidulin Aug 18, 2017
eed6c40
Convert checkAccess to promise.
RubenVerborgh Aug 18, 2017
27f6b88
Convert can to promise.
RubenVerborgh Aug 18, 2017
c7ca72b
Move getNearestACL into separate method.
RubenVerborgh Aug 18, 2017
83da96b
Move getPermissionSet into separate method.
RubenVerborgh Aug 18, 2017
554d198
Change accessType into isContainer.
RubenVerborgh Aug 18, 2017
c723009
Pass permission set to checkAccess.
RubenVerborgh Aug 18, 2017
ab00c74
Move resource parameter to constructor.
RubenVerborgh Aug 18, 2017
31d396a
Move all options to constructor.
RubenVerborgh Aug 18, 2017
180de68
Cache the permission set.
RubenVerborgh Aug 18, 2017
0a58ac5
Clean up ACLChecker.
RubenVerborgh Aug 18, 2017
d7a429f
Simplify ACL path algorithm.
RubenVerborgh Aug 18, 2017
3161b68
Indent then and catch.
RubenVerborgh Aug 18, 2017
2b8f18b
Expose the user's permissions through a header.
RubenVerborgh Aug 17, 2017
91c8106
Migrate to Solid vocabulary.
RubenVerborgh Aug 17, 2017
30a57ed
Merge branch 'rv/patch/n3' into dz_oidc
RubenVerborgh Aug 18, 2017
e126aad
Merge branch 'master' into dz_oidc
dmitrizagidulin Aug 18, 2017
6c1938b
Fix rename missed in merge
dmitrizagidulin Aug 18, 2017
82af9ec
Implement fetchDocument without async.
RubenVerborgh Aug 18, 2017
de7b93a
Implement globHandler without async.
RubenVerborgh Aug 21, 2017
67a6b48
Implement CORS proxy test without async.
RubenVerborgh Aug 21, 2017
ace60c7
Implement LDP without async.
RubenVerborgh Aug 21, 2017
d54f958
Remove async dependency.
RubenVerborgh Aug 21, 2017
5746766
Expose WAC-Allow to browser clients.
RubenVerborgh Aug 21, 2017
41da733
Verify presence of test DNS entries. (#549)
RubenVerborgh Aug 25, 2017
34ca3a6
Bump oidc-auth-manager dep to 0.12.0
dmitrizagidulin Aug 28, 2017
9a3022a
Expand error message for unverified web id
dmitrizagidulin Aug 28, 2017
a710be5
Log whole error in error handler
dmitrizagidulin Aug 29, 2017
d0b4749
Do not check for user header in oidc test
dmitrizagidulin Aug 30, 2017
1c09007
Move RS options to oidc-auth-manager initialization
dmitrizagidulin Aug 30, 2017
c8e9109
Add support for external WebIDs registering with username & password
dmitrizagidulin Aug 18, 2017
8b1dc11
Remove solid:inbox from template
dmitrizagidulin Aug 30, 2017
49fb741
Tweak account index page phrasing
dmitrizagidulin Aug 30, 2017
c868ab1
Serve static common/ dir relative to __dirname
dmitrizagidulin Aug 30, 2017
0dfc619
Disable rejectUnauthorized on the WebID-TLS endpoint. (#561)
RubenVerborgh Aug 30, 2017
bc58c7d
Add current hash to redirect. (#562)
RubenVerborgh Aug 30, 2017
cc569a8
Add bootstrap.min.css.map to common/css/
dmitrizagidulin Aug 30, 2017
0d9a472
Fix requirement for additional verification logging in with WebID-TLS
dmitrizagidulin Aug 31, 2017
e7d7ec3
Remove debug overhead on ACL (#566)
RubenVerborgh Aug 31, 2017
928ff50
Update Data Browser html file
dmitrizagidulin Aug 31, 2017
d45d65d
Add a /public folder in new accounts (#569)
RubenVerborgh Sep 1, 2017
bae020f
Rename the idp option into multiuser (#570)
RubenVerborgh Sep 3, 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
Prev Previous commit
Next Next commit
Allow login via TLS with externally hosted WebIDs
  • Loading branch information
dmitrizagidulin committed Aug 17, 2017
commit 560c57084af8856f2a04b81cf175784aba78a8d9
9 changes: 5 additions & 4 deletions lib/models/account-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,18 +345,19 @@ class AccountManager {
username: userData.username,
email: userData.email,
name: userData.name,
externalWebId: userData.externalWebId,
webId: userData.webid || userData.webId ||
this.accountWebIdFor(userData.username)
}

if (userConfig.webId && !userConfig.username) {
userConfig.username = this.usernameFromWebId(userConfig.webId)
}

if (!userConfig.webId && !userConfig.username) {
throw new Error('Username or web id is required')
}

if (userConfig.webId && !userConfig.username) {
userConfig.username = this.usernameFromWebId(userConfig.webId)
}

return UserAccount.from(userConfig)
}

Expand Down
28 changes: 24 additions & 4 deletions lib/models/authenticator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
const debug = require('./../debug').authentication
const validUrl = require('valid-url')
const webid = require('webid/tls')
const provider = require('oidc-auth-manager/src/preferred-provider')
const { domainMatches } = require('oidc-auth-manager/src/oidc-manager')

/**
* Abstract Authenticator class, representing a local login strategy.
Expand Down Expand Up @@ -293,6 +295,10 @@ class TlsAuthenticator extends Authenticator {
webid.verify(certificate, callback)
}

discoverProviderFor (webId) {
return provider.discoverProviderFor(webId)
}

/**
* Ensures that the extracted WebID URI is hosted on this server. If it is,
* returns a UserAccount instance for that WebID, throws an error otherwise.
Expand All @@ -304,13 +310,27 @@ class TlsAuthenticator extends Authenticator {
* @return {UserAccount}
*/
ensureLocalUser (webId) {
if (this.accountManager.externalAccount(webId)) {
debug(`WebID URI ${JSON.stringify(webId)} is not a local account`)
const serverUri = this.accountManager.host.serverUri

throw new Error('Cannot login: Selected Web ID is not hosted on this server')
// if (this.accountManager.externalAccount(webId)) {
if (domainMatches(serverUri, webId)) {
// This is a locally hosted Web ID
return Promise.resolve(this.accountManager.userAccountFrom({ webId }))
}

return this.accountManager.userAccountFrom({ webId })
debug(`WebID URI ${JSON.stringify(webId)} is not a local account, verifying preferred provider`)

return this.discoverProviderFor(webId)
.then(preferredProvider => {
debug(`Preferred provider for ${webId} is ${preferredProvider}`)

if (preferredProvider === serverUri) { // everything checks out
return this.accountManager.userAccountFrom({ webId, username: webId, externalWebId: true })
}

throw new Error(`This server is not the preferred provider for Web ID ${webId}`)
})
// return Promise.reject(new Error('Cannot login: Selected Web ID is not hosted on this server'))
}
}

Expand Down
49 changes: 36 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"node-forge": "^0.6.38",
"nodemailer": "^3.1.4",
"nomnom": "^1.8.1",
"oidc-auth-manager": "^0.10.0",
"oidc-auth-manager": "^0.11.1",
"oidc-op-express": "^0.0.3",
"rdflib": "^0.15.0",
"recursive-readdir": "^2.1.0",
Expand Down
32 changes: 26 additions & 6 deletions test/unit/tls-authenticator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,44 @@ describe('TlsAuthenticator', () => {
})

describe('ensureLocalUser()', () => {
it('should throw an error if the user is not local to this server', () => {
it('should throw an error if external user and this server not the preferred provider', done => {
let tlsAuth = new TlsAuthenticator({ accountManager })

let externalWebId = 'https://alice.someothersite.com#me'

expect(() => tlsAuth.ensureLocalUser(externalWebId))
.to.throw(/Cannot login: Selected Web ID is not hosted on this server/)
tlsAuth.discoverProviderFor = sinon.stub().resolves('https://another-provider.com')

tlsAuth.ensureLocalUser(externalWebId)
.catch(err => {
expect(err.message).to.match(/This server is not the preferred provider for Web ID https:\/\/alice.someothersite.com#me/)
done()
})
})

it('should return a user instance if the webid is local', () => {
let tlsAuth = new TlsAuthenticator({ accountManager })

let webId = 'https://alice.example.com/#me'

let user = tlsAuth.ensureLocalUser(webId)
return tlsAuth.ensureLocalUser(webId)
.then(user => {
expect(user.username).to.equal('alice')
expect(user.webId).to.equal(webId)
})
})

it('should return a user instance if external user and this server is preferred provider', () => {
let tlsAuth = new TlsAuthenticator({ accountManager })

let externalWebId = 'https://alice.someothersite.com#me'

tlsAuth.discoverProviderFor = sinon.stub().resolves('https://example.com')

expect(user.username).to.equal('alice')
expect(user.webId).to.equal(webId)
tlsAuth.ensureLocalUser(externalWebId)
.then(user => {
expect(user.username).to.equal(externalWebId)
expect(user.webId).to.equal(externalWebId)
})
})
})

Expand Down