Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 46 additions & 43 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 27 additions & 1 deletion test/integration/authentication-oidc-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ describe('Authentication API (OIDC)', () => {

// Step 6: Web App extracts tokens from the uri hash fragment, uses
// them to access protected resource
it('should use id token from the callback uri to access shared resource', () => {
it('should use id token from the callback uri to access shared resource (no origin)', () => {
auth.window.location.href = callbackUri

let protectedResourcePath = bobServerUri + '/shared-with-alice.txt'
Expand Down Expand Up @@ -633,6 +633,32 @@ describe('Authentication API (OIDC)', () => {
})
})

it('should use id token from the callback uri to access shared resource (untrusted origin)', () => {
auth.window.location.href = callbackUri

let protectedResourcePath = bobServerUri + '/shared-with-alice.txt'

return auth.initUserFromResponse(auth.currentClient)
.then(webId => {
expect(webId).to.equal(aliceWebId)

return auth.issuePoPTokenFor(bobServerUri, auth.session)
})
.then(popToken => {
bearerToken = popToken

return fetch(protectedResourcePath, {
headers: {
'Authorization': 'Bearer ' + bearerToken,
'Origin': 'https://untrusted.example.com' // shouldn't be allowed if strictOrigin is set to true
}
})
})
.then(res => {
expect(res.status).to.equal(403)
})
})

it('should not be able to reuse the bearer token for bob server on another server', () => {
let privateAliceResourcePath = aliceServerUri + '/private-for-alice.txt'

Expand Down
Loading