File tree Expand file tree Collapse file tree 5 files changed +40
-10
lines changed Expand file tree Collapse file tree 5 files changed +40
-10
lines changed Original file line number Diff line number Diff line change 11sudo : false
22language : node_js
33node_js :
4- - " >=7 .0"
4+ - " >=6 .0"
55
66cache :
77 directories :
Original file line number Diff line number Diff line change 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" ,
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" ,
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" : [
Original file line number Diff line number Diff line change 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' )
2930const 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
Original file line number Diff line number Diff line change 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
66const localStorage = require ( 'localstorage-memory' )
77
@@ -17,6 +17,7 @@ chai.should()
1717const expect = chai . expect
1818
1919const SolidAuthOIDC = require ( '../src/index' )
20+ const PoPToken = require ( '@trust/oidc-rp/lib/PoPToken' )
2021
2122describe ( '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} )
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ module.exports = {
1515 {
1616 test : / \. j s $ / ,
1717 loader : 'babel-loader' ,
18+ exclude : / ( n o d e _ m o d u l e s ) / ,
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}
You can’t perform that action at this time.
0 commit comments