Skip to content

Commit ae354ee

Browse files
committed
add webID iss
1 parent 15ff6ba commit ae354ee

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/DpopIDToken.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ class DpopIDToken extends JWT {
5757
let header = { alg, kid }
5858
let payload = { iss, aud, azp, sub, exp, iat, jti }
5959

60+
// Add webid claim for Solid OIDC compliance
61+
if (sub) {
62+
payload.webid = sub
63+
}
64+
6065
if (at_hash) { payload.at_hash = at_hash }
6166
if (c_hash) { payload.c_hash = c_hash }
6267
if (cnf) { payload.cnf = cnf }

src/IDToken.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ class IDToken extends JWT {
5757
let header = { alg, kid }
5858
let payload = { iss, aud, azp, sub, exp, iat, jti, nonce }
5959

60+
// Add webid claim for Solid OIDC compliance
61+
if (sub) {
62+
payload.webid = sub
63+
}
64+
6065
if (at_hash) { payload.at_hash = at_hash }
6166
if (c_hash) { payload.c_hash = c_hash }
6267
if (cnf) { payload.cnf = cnf }

test/IDTokenSpec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ describe('IDToken', () => {
7373
expect(token.header.alg).to.equal('RS256')
7474
expect(token.payload.iss).to.equal(providerUri)
7575
expect(token.payload.sub).to.equal('user123')
76+
expect(token.payload.webid).to.equal('user123')
7677
expect(token.payload.aud).to.equal('client123')
7778
expect(token.payload.azp).to.equal('client123')
7879
expect(token.payload.cnf).to.eql({ jwk: cnfKey })
@@ -106,6 +107,7 @@ describe('IDToken', () => {
106107
expect(token.header.alg).to.equal('RS256')
107108
expect(token.payload.iss).to.equal(providerUri)
108109
expect(token.payload.sub).to.equal('user123')
110+
expect(token.payload.webid).to.equal('user123')
109111
expect(token.payload.aud).to.equal('client123')
110112
expect(token.payload.azp).to.equal('client123')
111113
expect(token.payload.nonce).to.equal('nonce123')
@@ -139,6 +141,7 @@ describe('IDToken', () => {
139141
expect(token.payload.aud).to.equal('client123')
140142
expect(token.payload.azp).to.equal('client123')
141143
expect(token.payload.sub).to.equal('user123')
144+
expect(token.payload.webid).to.equal('user123')
142145
expect(token.payload.nonce).to.equal(options.nonce)
143146
expect(token.payload.at_hash).to.equal(options.at_hash)
144147
expect(token.payload.c_hash).to.equal(options.c_hash)

0 commit comments

Comments
 (0)