Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fit into SAI #4

Closed
wants to merge 4 commits into from
Closed
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
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,14 @@ In the project directory, you can run:
npm install
npm run start
```

## Add this app to your pod using SAI
In order to add this app to your pod:
* use [this branch of SAI](https://github.com/michielbdejong/sai-js/tree/investigating-77), and run it on localhost according to the instructions there

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the people to request authorization you will need to remove the ldo-react-tutorial one you added.
You will also need to add at least one data registry using your shapetree, for example here https://github.com/janeirodigital/sai-js/tree/main/packages/css-storage-fixture/alice-home/dataRegistry

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if Alice uses this app for the first time and doesn't have the data registry it needs yet?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* run this app according to the instructions above
* go to http://localhost:4200/applications
* click '+ ADD APPLICATION'
* fill in http://localhost:3600 as the Client ID
Comment on lines +19 to +21
Copy link

@elf-pavlik elf-pavlik Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* go to http://localhost:4200/applications
* click '+ ADD APPLICATION'
* fill in http://localhost:3600 as the Client ID
* login at http://localhost:4200/ and connect server
* login at http://localhost:3600 and request authorization

you can find out how to do it at https://github.com/janeirodigital/sai-js/blob/main/examples/vuejectron/src/store/core.ts#L53-L59

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those instructions will fail unless you also add that code into this app, right?
Does the + ADD APPLICATION button not work?

Copy link

@elf-pavlik elf-pavlik Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does work; you still need a valid Client ID document janeirodigital/sai-js#77 (comment)

I still think requesting authorization from the app is more intuitive than making sure one passes a valid client ID into the input field. But since we are currently talking about app developers, it should not matter.

* click Next
* grant access
* launch the app
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"start": "PORT=3006 react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
Expand Down Expand Up @@ -48,4 +48,4 @@
"@types/shexj": "^2.1.1",
"ldo-cli": "^0.1.0"
}
}
}
33 changes: 33 additions & 0 deletions public/access-needs.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX interop: <http://www.w3.org/ns/solid/interop#>
PREFIX acl: <http://www.w3.org/ns/auth/acl#>
PREFIX shape

<#this>
a interop:AccessNeedGroup ;
interop:accessNecessity interop:accessRequired ;
interop:accessScenario interop:PersonalAccess ;
interop:authenticatesAs interop:SocialAgent ;
interop:hasAccessDescriptionSet
<./descriptions-en> ,
<./descriptions-es> ;
interop:hasAccessNeed <#need-foaf-profile> .

<#need-foaf-profile>
a interop:AccessNeed ;
interop:registeredShapeTree <#profileTree> ;
interop:accessNecessity interop:AccessRequired ;
interop:accessMode acl:Read, acl:Create, acl:Update, acl:Delete .

<#profileTree>
a shapetrees:ShapeTree ;
shapetrees:expectsType shapetrees:Resource ;
shapetrees:shape <./foafProfile.txt> ;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ShExC syntax registers text/shex media type with .shex file extension.

shapetrees:describesInstance rdfs:label .

<./descriptions-en>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You still need to add those descriptions; I think you should focus on English and remove Spanish below.

interop:usesLanguage "en"^^xsd:language .

<./descriptions-es>
interop:usesLanguage "es"^^xsd:language .
15 changes: 15 additions & 0 deletions public/foafProfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PREFIX ex: <https://example.com/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

ex:FoafProfile EXTRA a {
a [ foaf:Person ]
// rdfs:comment "Defines the node as a Person (from foaf)" ;
foaf:name xsd:string ?
// rdfs:comment "Define a person's name." ;
foaf:img xsd:string ?
// rdfs:comment "Photo link but in string form" ;
foaf:knows @ex:FoafProfile *
// rdfs:comment "A list of WebIds for all the people this user knows." ;
}
15 changes: 15 additions & 0 deletions public/id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"@context": [
"https://www.w3.org/ns/solid/oidc-context.jsonld",
{
"interop": "http://www.w3.org/ns/solid/interop#"
}
] ,
"client_id": "http://localhost:3006/id.json",
"client_name": "LDO React Tutorial",
"logo_uri": "https://robohash.org/ldo-react-tutorial?set=set3",
"redirect_uris": ["http://localhost:3006/callback"],
"grant_types" : ["refresh_token","authorization_code"],
"interop:hasAccessNeedGroup": "http://localhost:3006/access-needs.ttl",
"interop:hasAuthorizationCallbackEndpoint": "http://localhost:4500"
}