FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
user-managed-access/scripts/test-uma-ODRL.ts at main · SolidLabResearch/user-managed-access · GitHub
SolidLabResearch
/
user-managed-access
Public
Notifications
You must be signed in to change notification settings
Fork
4
Star
9
Code
Issues
24
Pull requests
0
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
user-managed-access
/
scripts
/
test-uma-ODRL.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
24 lines (18 loc) · 1 KB
Breadcrumbs
user-managed-access
/
scripts
/
test-uma-ODRL.ts
Copy path
File metadata and controls
24 lines (18 loc) · 1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import
{
UserManagedAccessFetcher
}
from
"./util/UMA-client"
;
const
resource
=
"http://localhost:3000/alice/other/resource.txt"
const
claim_token
=
"https://example.pod.knows.idlab.ugent.be/profile/card#me"
const
claim_token_format
=
'urn:solidlab:uma:claims:formats:webid'
const
fetcher
=
new
UserManagedAccessFetcher
(
{
token
:
claim_token
,
token_format
:
claim_token_format
}
)
;
async
function
main
(
)
{
console
.
log
(
`Testing UMA flow using UMA Fetcher\n`
)
const
response
=
await
fetcher
.
fetch
(
resource
,
{
method
:
"PUT"
,
body
:
"some text"
}
)
console
.
log
(
`Creating document with RPT, expecting HTTP status in 200 range:
${
response
.
status
}
\n`
)
;
const
anonymousResponse
=
await
fetch
(
resource
)
console
.
log
(
`Reading document without RPT, expecting HTTP status in 400 range:
${
anonymousResponse
.
status
}
\n`
)
;
const
readingResponse
=
await
fetcher
.
fetch
(
resource
)
console
.
log
(
`Reading document with RPT, expecting the content written away:
${
await
readingResponse
.
text
(
)
}
\n`
)
;
}
main
(
)
Back
|
FazBrowse Home
|
New Git URL