Skip to content

Commit 333879f

Browse files
Merge pull request #10 from solid/bump-rp-dep
Update oidc-rp dep to 0.4.1
2 parents f977241 + 944b9e2 commit 333879f

File tree

5 files changed

+40
-10
lines changed

5 files changed

+40
-10
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sudo: false
22
language: node_js
33
node_js:
4-
- ">=7.0"
4+
- ">=6.0"
55

66
cache:
77
directories:

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "solid-auth-oidc",
33
"version": "0.1.3",
44
"engines": {
5-
"node": ">= 7.0"
5+
"node": ">= 6.0"
66
},
77
"description": "Authentication library for Solid client based on OAuth2/OpenID Connect",
88
"main": "./lib/index.js",
@@ -56,7 +56,7 @@
5656
},
5757
"homepage": "https://github.com/solid/solid-auth-oidc",
5858
"dependencies": {
59-
"oidc-rp": "git://github.com/anvilresearch/oidc-rp.git#rc-005"
59+
"@trust/oidc-rp": "^0.4.1"
6060
},
6161
"devDependencies": {
6262
"babel-cli": "^6.24.1",
@@ -72,7 +72,8 @@
7272
"sinon": "^2.1.0",
7373
"sinon-chai": "^2.9.0",
7474
"standard": "^10.0.2",
75-
"webpack": "^2.5.1"
75+
"webpack": "^2.5.1",
76+
"whatwg-url": "^6.1.0"
7677
},
7778
"standard": {
7879
"globals": [

src/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
https://github.com/solid/solid
2626
*/
2727
'use strict'
28-
const RelyingParty = require('oidc-rp')
28+
const RelyingParty = require('@trust/oidc-rp')
29+
const PoPToken = require('@trust/oidc-rp/lib/PoPToken')
2930
const providerSelectPopupSource = require('./provider-select-popup')
3031

3132
// URI parameter types
@@ -388,6 +389,10 @@ class ClientAuthOIDC {
388389
return this.sendAuthRequest(client)
389390
}
390391

392+
issuePoPTokenFor (uri, session) {
393+
return PoPToken.issueFor(uri, session)
394+
}
395+
391396
/**
392397
* Validates the auth response in the current uri, initializes the current
393398
* user's ID Token and Access token, and returns the user's WebID
@@ -401,8 +406,9 @@ class ClientAuthOIDC {
401406
initUserFromResponse (client) {
402407
return client.validateResponse(this.currentLocation(), this.store)
403408
.then(response => {
404-
this.idToken = response.params.id_token
405-
this.accessToken = response.params.access_token
409+
this.idToken = response.idToken
410+
this.accessToken = response.accessToken
411+
this.session = response
406412

407413
this.clearAuthResponseFromUrl()
408414

test/auth.test.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

3-
global.URL = require('url').URL
4-
global.URLSearchParams = require('url').URLSearchParams
3+
global.URL = require('whatwg-url').URL
4+
global.URLSearchParams = require('whatwg-url').URLSearchParams
55

66
const localStorage = require('localstorage-memory')
77

@@ -17,6 +17,7 @@ chai.should()
1717
const expect = chai.expect
1818

1919
const SolidAuthOIDC = require('../src/index')
20+
const PoPToken = require('@trust/oidc-rp/lib/PoPToken')
2021

2122
describe('SolidAuthOIDC', () => {
2223
var auth
@@ -494,4 +495,25 @@ describe('SolidAuthOIDC', () => {
494495
expect(url).to.equal('https://example.com/')
495496
})
496497
})
498+
499+
describe('issuePoPTokenFor()', () => {
500+
before(() => {
501+
sinon.stub(PoPToken, 'issueFor').resolves()
502+
})
503+
504+
after(() => {
505+
PoPToken.issueFor.restore()
506+
})
507+
508+
it('should invoke PoPToken.issueFor', () => {
509+
let auth = new SolidAuthOIDC()
510+
let uri = 'https://rs.com'
511+
let session = {}
512+
513+
return auth.issuePoPTokenFor(uri, session)
514+
.then(() => {
515+
expect(PoPToken.issueFor).to.have.been.calledWith(uri, session)
516+
})
517+
})
518+
})
497519
})

webpack.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = {
1515
{
1616
test: /\.js$/,
1717
loader: 'babel-loader',
18+
exclude: /(node_modules)/,
1819
query: {
1920
presets: ['es2015']
2021
}
@@ -25,7 +26,7 @@ module.exports = {
2526
'node-fetch': 'fetch',
2627
'text-encoding': 'TextEncoder',
2728
'urlutils': 'URL',
28-
'webcrypto': 'crypto'
29+
'@trust/webcrypto': 'crypto'
2930
},
3031
devtool: 'source-map'
3132
}

0 commit comments

Comments
 (0)