File tree Expand file tree Collapse file tree 3 files changed +93
-0
lines changed
Expand file tree Collapse file tree 3 files changed +93
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "name" : " solid-multi-rp-client" ,
3+ "version" : " 0.0.1" ,
4+ "description" : " OpenID Connect client for multiple Relying Parties for Solid" ,
5+ "main" : " ./src/index.js" ,
6+ "scripts" : {
7+ "standard" : " standard src/*" ,
8+ "tape" : " tape test/unit/*.js" ,
9+ "test" : " npm run standard && npm run tape" ,
10+ "preversion" : " npm test" ,
11+ "postversion" : " git push --follow-tags"
12+ },
13+ "engines" : {
14+ "node" : " >=6.0"
15+ },
16+ "repository" : {
17+ "type" : " git" ,
18+ "url" : " https://github.com/solid/solid-multi-rp-client"
19+ },
20+ "keywords" : [
21+ " solid" ,
22+ " decentralized" ,
23+ " web" ,
24+ " oidc" ,
25+ " openid" ,
26+ " connect" ,
27+ " authentication" ,
28+ " linked" ,
29+ " data"
30+ ],
31+ "author" : {
32+ "name" : " Dmitri Zagidulin" ,
33+ "url" : " https://github.com/dmitrizagidulin/"
34+ },
35+ "license" : " MIT" ,
36+ "bugs" : {
37+ "url" : " https://github.com/solid/solid-multi-rp-client/issues"
38+ },
39+ "homepage" : " https://github.com/solid/solid-multi-rp-client" ,
40+ "dependencies" : {},
41+ "devDependencies" : {
42+ "standard" : " ^5.4.1" ,
43+ "tape" : " ^4.6.2"
44+ },
45+ "standard" : {
46+ "globals" : []
47+ }
48+ }
Original file line number Diff line number Diff line change 1+ module . exports = class OIDCClientStore {
2+ constructor ( ) {
3+ this . clients = { }
4+ }
5+ put ( expressClient ) {
6+ return Promise . resolve ( )
7+ . then ( ( ) => {
8+ this . clients [ expressClient . client . issuer ] = expressClient
9+ } )
10+ }
11+ get ( issuer ) {
12+ return Promise . resolve ( )
13+ . then ( ( ) => {
14+ if ( issuer in this . clients ) {
15+ return this . clients [ issuer ]
16+ } else {
17+ return null
18+ }
19+ } )
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ 'use strict'
2+
3+ const test = require ( 'tape' )
4+ const ClientStore = require ( '../../src/store' )
5+
6+
7+ test ( 'client store and retrieve test' , t => {
8+ let issuerUrl = 'https://oidc.example.com'
9+ let store = new ClientStore ( )
10+ let expressClient = {
11+ client : {
12+ issuer : issuerUrl
13+ }
14+ }
15+ store . put ( expressClient )
16+ . then ( ( ) => {
17+ return store . get ( issuerUrl )
18+ } )
19+ . then ( retrievedClient => {
20+ t . equals ( retrievedClient , expressClient ,
21+ 'Should be able to retrieve the stored client' )
22+ t . end ( )
23+ } )
24+ } )
You can’t perform that action at this time.
0 commit comments