@solid/oidc-auth-manager 0.24.5 → 0.25.0-0e9ec48e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/LICENSE.md +0 -0
  2. package/README.md +0 -0
  3. package/coverage/base.css +224 -0
  4. package/coverage/block-navigation.js +87 -0
  5. package/coverage/favicon.png +0 -0
  6. package/coverage/index.html +146 -0
  7. package/coverage/prettify.css +1 -0
  8. package/coverage/prettify.js +2 -0
  9. package/coverage/sort-arrow-sprite.png +0 -0
  10. package/coverage/sorter.js +210 -0
  11. package/coverage/src/errors/auth-response-sent.js.html +118 -0
  12. package/coverage/src/errors/index.html +116 -0
  13. package/coverage/src/handlers/auth-callback-request.js.html +586 -0
  14. package/coverage/src/handlers/index.html +161 -0
  15. package/coverage/src/handlers/login-consent-request.js.html +514 -0
  16. package/coverage/src/handlers/logout-request.js.html +271 -0
  17. package/coverage/src/handlers/select-provider-request.js.html +748 -0
  18. package/coverage/src/host-api.js.html +424 -0
  19. package/coverage/src/index.html +161 -0
  20. package/coverage/src/oidc-manager.js.html +1603 -0
  21. package/coverage/src/preferred-provider.js.html +520 -0
  22. package/coverage/src/user-store.js.html +1120 -0
  23. package/package.json +17 -15
  24. package/src/errors/auth-response-sent.js +0 -0
  25. package/src/handlers/auth-callback-request.js +0 -0
  26. package/src/handlers/index.js +0 -0
  27. package/src/handlers/login-consent-request.js +6 -8
  28. package/src/handlers/logout-request.js +0 -0
  29. package/src/handlers/select-provider-request.js +0 -0
  30. package/src/host-api.js +4 -6
  31. package/src/index.js +0 -0
  32. package/src/oidc-manager.js +0 -0
  33. package/src/preferred-provider.js +0 -0
  34. package/src/user-store.js +0 -0
  35. package/test/integration/oidc-manager-test.js +0 -0
  36. package/test/integration/user-store-test.js +0 -0
  37. package/test/resources/sample-webid-profile-with-oidc-issuer.js +0 -0
  38. package/test/resources/sample-webid-profile.js +0 -0
  39. package/test/unit/auth-callback-request.js +0 -0
  40. package/test/unit/auth-success-exception.js +0 -0
  41. package/test/unit/host-api-test.js +0 -0
  42. package/test/unit/login-consent-request.js +0 -0
  43. package/test/unit/logout-request.js +0 -0
  44. package/test/unit/oidc-manager-test.js +0 -0
  45. package/test/unit/preferred-provider-test.js +0 -0
  46. package/test/unit/select-provider-request.js +0 -0
  47. package/test/unit/user-store-test.js +2 -2
  48. package/.github/workflows/ci.yml +0 -59
  49. package/.travis.yml +0 -8
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@solid/oidc-auth-manager",
3
- "version": "0.24.5",
3
+ "version": "0.25.0-0e9ec48e",
4
4
  "description": "An OpenID Connect (OIDC) authentication manager (OP, RP and RS) for decentralized peer-to-peer authentication",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
7
7
  "build": "echo nothing to build",
8
8
  "standard": "standard",
9
+ "standard-fix": "standard --fix",
9
10
  "test": "npm run standard && npm run mocha",
10
11
  "mocha": "nyc mocha --exit --recursive --timeout 20000",
11
12
  "preversion": "npm test",
12
- "postversion": "git push --follow-tags"
13
+ "postversion": "git push --follow-tags",
14
+ "ignore:prepublishOnly": "npm test"
13
15
  },
14
16
  "engines": {
15
17
  "node": ">=8.10"
@@ -39,33 +41,33 @@
39
41
  },
40
42
  "homepage": "https://github.com/solid/oidc-auth-manager",
41
43
  "dependencies": {
42
- "@solid/oidc-op": "^0.11.7",
43
- "@solid/oidc-rp": "^0.11.7",
44
- "@solid/oidc-rs": "^0.5.7",
45
- "@solid/solid-multi-rp-client": "^0.6.4",
46
- "ajv": "^7.2.4",
47
- "bcryptjs": "^2.4.3",
48
- "fs-extra": "^9.1.0",
44
+ "@solid/oidc-op": "^0.12.0",
45
+ "@solid/oidc-rp": "^0.12.0",
46
+ "@solid/oidc-rs": "^0.7.0",
47
+ "@solid/solid-multi-rp-client": "0.7.0",
48
+ "ajv": "^8.17.1",
49
+ "bcryptjs": "^3.0.3",
50
+ "fs-extra": "^11.3.3",
49
51
  "kvplus-files": "0.0.4",
50
52
  "li": "^1.3.0",
51
53
  "node-fetch": "^2.7.0",
52
- "rdflib": "^2.3.0",
54
+ "rdflib": "^2.3.2",
53
55
  "valid-url": "^1.0.9"
54
56
  },
55
57
  "devDependencies": {
56
58
  "chai": "^4.5.0",
57
59
  "chai-as-promised": "^7.1.2",
58
60
  "dirty-chai": "^2.0.1",
59
- "mocha": "^8.4.0",
60
- "nock": "^13.5.6",
61
+ "mocha": "^11.7.5",
62
+ "nock": "^14.0.10",
61
63
  "node-mocks-http": "^1.17.2",
62
- "nyc": "^15.1.0",
64
+ "nyc": "^17.1.0",
63
65
  "sinon": "^9.2.4",
64
66
  "sinon-chai": "^3.7.0",
65
67
  "solid-auth-cli": "^1.0.15",
66
68
  "solid-auth-client": "^2.5.6",
67
- "standard": "^16.0.4",
68
- "whatwg-url": "^8.7.0"
69
+ "standard": "^17.1.2",
70
+ "whatwg-url": "^15.1.0"
69
71
  },
70
72
  "nyc": {
71
73
  "reporter": [
File without changes
File without changes
File without changes
@@ -1,8 +1,6 @@
1
1
  'use strict'
2
- /* eslint-disable node/no-deprecated-api */
3
2
 
4
3
  const AuthResponseSent = require('../errors/auth-response-sent')
5
- const url = require('url')
6
4
 
7
5
  class LoginConsentRequest {
8
6
  constructor (options) {
@@ -66,8 +64,8 @@ class LoginConsentRequest {
66
64
  static obtainConsent (consentRequest) {
67
65
  const { opAuthRequest, clientId } = consentRequest
68
66
 
69
- const parsedAppOrigin = url.parse(consentRequest.opAuthRequest.params.redirect_uri)
70
- const appOrigin = `${parsedAppOrigin.protocol}//${parsedAppOrigin.host}`
67
+ const parsedAppOrigin = new URL(consentRequest.opAuthRequest.params.redirect_uri)
68
+ const appOrigin = parsedAppOrigin.origin
71
69
 
72
70
  // Consent for the local RP client (the home pod) is implied
73
71
  if (consentRequest.isLocalRpClient(appOrigin)) {
@@ -126,10 +124,10 @@ class LoginConsentRequest {
126
124
 
127
125
  redirectToConsent (authRequest) {
128
126
  const { opAuthRequest } = this
129
- let consentUrl = url.parse('/sharing')
130
- consentUrl.query = opAuthRequest.req.query
131
-
132
- consentUrl = url.format(consentUrl)
127
+ console.log('Redirecting user to /sharing')
128
+ console.log(opAuthRequest.host)
129
+ const queryString = new URLSearchParams(opAuthRequest.req.query).toString()
130
+ const consentUrl = `/sharing${queryString ? '?' + queryString : ''}`
133
131
  opAuthRequest.subject = null
134
132
 
135
133
  opAuthRequest.res.redirect(consentUrl)
File without changes
File without changes
package/src/host-api.js CHANGED
@@ -1,7 +1,4 @@
1
1
  'use strict'
2
- /* eslint-disable node/no-deprecated-api */
3
-
4
- const url = require('url')
5
2
 
6
3
  const LogoutRequest = require('./handlers/logout-request')
7
4
  const LoginConsentRequest = require('./handlers/login-consent-request')
@@ -44,10 +41,11 @@ function authenticate (authRequest) {
44
41
  }
45
42
 
46
43
  function redirectToLogin (authRequest) {
47
- let loginUrl = url.parse('/login')
48
- loginUrl.query = authRequest.req.query
44
+ console.log('Redirecting user to /login')
45
+ console.log(authRequest.host)
49
46
 
50
- loginUrl = url.format(loginUrl)
47
+ const queryString = new URLSearchParams(authRequest.req.query).toString()
48
+ const loginUrl = `/login${queryString ? '?' + queryString : ''}`
51
49
  authRequest.subject = null
52
50
 
53
51
  authRequest.res.redirect(loginUrl)
package/src/index.js CHANGED
File without changes
File without changes
File without changes
package/src/user-store.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -194,7 +194,7 @@ describe('UserStore', () => {
194
194
 
195
195
  it('should look up user record by normalized email', () => {
196
196
  const email = 'alice@example.com'
197
- const user = { id: 'abc', email: email }
197
+ const user = { id: 'abc', email }
198
198
 
199
199
  store.backend.get = sinon.stub().resolves(user)
200
200
 
@@ -242,7 +242,7 @@ describe('UserStore', () => {
242
242
 
243
243
  store.backend.del = sinon.stub()
244
244
 
245
- return store.deleteUser({ id: userId, email: email })
245
+ return store.deleteUser({ id: userId, email })
246
246
  .then(() => {
247
247
  expect(store.backend.del).to.have.been.calledWith('users', UserStore.normalizeIdKey(userId))
248
248
  expect(store.backend.del).to.have.been.calledWith('users-by-email', UserStore.normalizeEmailKey(email))
@@ -1,59 +0,0 @@
1
- # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2
- # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
-
4
- name: CI
5
- permissions:
6
- contents: write
7
- pull-requests: write
8
- on:
9
- push:
10
- branches:
11
- - "**"
12
- pull_request:
13
- branches:
14
- - "**"
15
- workflow_dispatch:
16
-
17
- jobs:
18
- build:
19
-
20
- runs-on: ubuntu-latest
21
-
22
- strategy:
23
- matrix:
24
- node-version:
25
- - 18.x
26
- - 20.x
27
- - 22.x
28
-
29
- steps:
30
- - uses: actions/checkout@v5
31
- - name: Use Node.js ${{ matrix.node-version }}
32
- uses: actions/setup-node@v6
33
- with:
34
- node-version: ${{ matrix.node-version }}
35
- - run: npm ci
36
- - run: npm run lint --if-present
37
- - run: npm test
38
- - run: npm run build --if-present
39
- - name: Save build
40
- if: matrix.node-version == '20.x'
41
- uses: actions/upload-artifact@v5
42
- with:
43
- name: build
44
- path: |
45
- .
46
- !node_modules
47
- retention-days: 1
48
-
49
- dependabot:
50
- name: 'Dependabot'
51
- needs: build # After the E2E and build jobs, if one of them fails, it won't merge the PR.
52
- runs-on: ubuntu-latest
53
- if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}} # Detect that the PR author is dependabot
54
- steps:
55
- - name: Enable auto-merge for Dependabot PRs
56
- run: gh pr merge --auto --merge "$PR_URL" # Use Github CLI to merge automatically the PR
57
- env:
58
- PR_URL: ${{github.event.pull_request.html_url}}
59
- GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
package/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- sudo: false
2
- language: node_js
3
- node_js:
4
- - "12.0"
5
- - "node"
6
- cache:
7
- directories:
8
- - node_modules