Interacting with Standards
Hands-on Fedora
Esmé Cowles, Yinlin Chen, and Mike Durbin
http://bit.ly/c4l18-fedora
Getting Started
Esmé Cowles
Introductions
Schedule
9:30 | 10:00 | Getting Started |
10:00 | 10:10 | Fedora API Specification |
10:10 | 11:00 | Linked Data Platform |
11:00 | 11:20 | Break |
11:20 | 11:30 | Fixity |
11:30 | 11:40 | Versioning |
11:40 | 12:00 | Activity Streams |
12:00 | 12:20 | Web Access Control |
Environment Setup
https://github.com/fcrepo4-exts/fcrepo4-vagrant/archive/fcrepo4-vagrant-4.7.5-RC-2.zip
$ unzip fcrepo4-vagrant-4.7.5-RC-2.zip�$ cd fcrepo4-vagrant-fcrepo4-vagrant-4.7.5-RC-2�$ vagrant up
Pre-requisites
Vagrant Environment
Fedora
API Specification
Esmé Cowles
Why?
Standards, Standards, Standards
Status
Linked Data Platform
Agenda
Learning Outcomes
Linked Data Overview
“...is a method of publishing structured data so that it can be interlinked and become more useful through semantic queries … This enables data from different sources to be connected and queried.”
- https://en.wikipedia.org/wiki/Linked_data
Resource Description Framework - RDF
<subject> <predicate> <object>
“2003”
“How to Train Your Dragon”�
“Cressida Cowell (born 15 April 1966) is an English children's author, popularly known for the novel series, How to Train Your Dragon…”
Data from http://dbpedia.org/page/How_to_Train_Your_Dragon
http://dbpedia.org/resource/
Category:Fictional_Vikings
http://dbpedia.org/resource/Cressida_Cowell
http://dbpedia.org/resource/
How_to_Train_Your_Dragon
genre
hasLabel
datePublished
hasAuthor
hasAbstract
Subject
Predicate
Object
Ontologies
Ontologies are formal specifications of shared conceptualizations
Well-known ontologies:
Fedora4 community ontology:
Less well-known ontologies:
Vocabularies
Controlled list of terms, each with a URI.
Building blocks that you can use to make an ontology or describe data with.
Well known vocabularies:
Linked Data Serializations
N-Triples:
<localhost:8080/fcrepo/rest/path/to/resource> <http://purl.org/dc/elements/1.1/title> “The Sloth” .
Turtle:
@prefix dc:<http://purl.org/dc/elements/1.1/> .
<localhost:8080/fcrepo/rest/path/to/resource> dc:title “The Sloth” .
|
|
|
rdf:type
@prefix yago:<http://yago-knowledge.org/resource/>
http://dbpedia.org/page/How_to_Train_Your_Dragon> a yago:Fiction106367107 ,
Turtle Serialization
@prefix dbr:<http://dbpedia.org/resource/> .
@prefix dbp:<http://dbpedia.org/property/> .
@prefix dbc:<http://dbpedia.org/resource/Category:> .
@prefix dbo:<http://dbpedia.org/ontology/> .
@prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd:<http://www.w3.org/2001/XMLSchema#> .
@prefix dcterms:<http://purl.org/dc/terms/> .
dbr:How_to_Train_Your_Dragon rdfs:label “How To Train Your Dragon”@en, “Le eroiche disavventure di Topicco Terribilis Totanus III”@it ;
dbp:author dbr:Cressida_Cowell ;
dbp:pubDate "2003"^^xsd:integer ;
dcterms:subject dbc:Fictional_Vikings .
dbr:Cressida_Cowell a yago:author ;
dbo:abstract “Cressida Cowell (born 15 April 1966) is an English children's author, popularly known for
the novel series, How to Train Your Dragon”@en .
http://dbpedia.org/data/How_to_Train_Your_Dragon.n3
N-Triples Serialization
<http://dbpedia.org/resource/How_to_Train_Your_Dragon> <http://www.w3.org/2000/01/rdf-schema#label> “How To Train Your Dragon”@en .
<http://dbpedia.org/resource/How_to_Train_Your_Dragon> <http://www.w3.org/2000/01/rdf-schema#label> "Le eroiche disavventure di Topicco Terribilis Totanus III"@it .
<http://dbpedia.org/resource/How_to_Train_Your_Dragon> <http://dbpedia.org/property/author> <http://dbpedia.org/resource/Cressida_Cowell> .
<http://dbpedia.org/resource/How_to_Train_Your_Dragon> <http://dbpedia.org/property/pubDate> "2003"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://dbpedia.org/resource/How_to_Train_Your_Dragon> <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:Fictional_Vikings> .
<http://dbpedia.org/resource/Cressida_Cowell> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/author> .
<http://dbpedia.org/resource/Cressida_Cowell> <http://dbpedia.org/ontology/abstract> “Cressida Cowell (born 15 April 1966) is an English children's author, popularly known for the novel series, How to Train Your Dragon...”@en .
RDF/XML Serialization
<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:dbp="http://dbpedia.org/property/">
<rdf:Description rdf:about="http://dbpedia.org/resource/How_to_Train_Your_Dragon">
<rdfs:label xml:lang="en">How to Train Your Dragon</rdfs:label>
<rdfs:label xml:lang="it">Le eroiche disavventure di Topicco Terribilis Totanus III</rdfs:label>
<dct:subject rdf:resource="http://dbpedia.org/resource/Category:Fictional_Vikings" />
<dbp:author rdf:resource="http://dbpedia.org/resource/Cressida_Cowell" />
<dbp:pubDate rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">2003</dbp:pubDate>
</rdf:Description>
</rdf:RDF>
RDF Blank Nodes (bnodes)
<> dcterms:extent [ rdf:value “1 volume (420 pages): photographs” ]
<> dcterms:extent _:b .
_:b rdf:value “1 volume (420 pages): photographs” .
Linked Data “Rules”
Linked Data Recommendations
Linked Data Platform (LDP)
Linked Data Platform (LDP)
Linked Data Platform and Fedora
Applied CRUD
Our primary way of managing Fedora resources
Hands-on: Fedora CRUD
CRUD via HTML UI
Fundamental operations
Available Operations via HTML UI
Startup
HTML Interface Cheatsheet
PATCH
Slug
{
POST
GET
DELETE
Resource URI
Step 1a: RDF Resource Creation (POST)�
This will create a new RDF Resource (LDP Basic Container) and redirect us to our next slide!
Step 1b: RDF Resource Creation (POST)�
This will create a new RDF Resource (LDP Basic Container) and redirect us to our next slide.
Step 1c: RDF Resource Creation (POST)�
This will create a new RDF Resource (LDP Basic Container) and redirect us to our next slide!
Step 2: Resource Retrieval (GET) �
Binaries
Step 3: Binary Resource Creation (POST)
This will create a new Binary Resource (LDP Non RDF Source) and redirect us to our next slide!
Step 4: Binary Resource Retrieval (GET)�
Why? LDP says that an server can create an additional descriptive resource containing RDF describing binaries
Step 5: Update RDF Properties (PATCH)
DELETE {}�INSERT { <> ebucore:width "100"}�WHERE {}
c. Press “Update”
Our updated RDF Properties from step 5.
Last step: Delete a resource (DELETE)
What do you see?
Departed
Fedora 4 Creates tombstone resources at “original/path/fcr:tombstone” URL, in this case
“basic/images/loc.jpg/fcr:tombstone” �(try that last path in your Browser)
So, to recreate a resource at that same PATH you need to delete the tombstone placeholder first and that can not be done via HTML UI
Discovered tombstone resource at /basic/images/loc.jpg, departed: 2018-01-21T15:44:01.373Z
CRUD via CURL
Interacting with Fedora HTTP API
Quick reminder on how to use curl
$ curl -X METHOD -u user:password -v -i -H “headername: headervalue” --data-binary “@filename” URL
GET: Containers
Controlling Response Serialization via Request Header
$ curl -i -H "Accept:text/turtle" -ufedoraAdmin:secret3 http://localhost:8080/fcrepo/rest
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 00:00:00 UTC
Link: <http://www.w3.org/ns/ldp#Resource>;rel="type"
Link: <http://www.w3.org/ns/ldp#Container>;rel="type"
Link: <http://www.w3.org/ns/ldp#BasicContainer>;rel="type"
Accept-Patch: application/sparql-update
Accept-Post: text/turtle,text/rdf+n3,text/n3,application/rdf+xml,application/n-triples,application/ld+json,multipart/form-data,application/sparql-update
Allow: MOVE,COPY,DELETE,POST,HEAD,GET,PUT,PATCH,OPTIONS
Preference-Applied: return=representation
Vary: Prefer
Vary: Accept, Range, Accept-Encoding, Accept-Language
Content-Type: text/turtle;charset=utf-8
Content-Length: 1410
Date: Thu, 18 Jan 2018 18:48:28 GMT
@prefix premis: <http://www.loc.gov/premis/rdf/v1#> .
@prefix test: <info:fedora/test/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsi: <http://www.w3.org/2001/XMLSchema-instance> .
@prefix xmlns: <http://www.w3.org/2000/xmlns/> .
...
Response Headers
Response
Body
...
@prefix premis: <http://www.loc.gov/premis/rdf/v1#> .
@prefix test: <info:fedora/test/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsi: <http://www.w3.org/2001/XMLSchema-instance> .
@prefix xmlns: <http://www.w3.org/2000/xmlns/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix fedora: <http://fedora.info/definitions/v4/repository#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix ebucore: <http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#> .
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix xs: <http://www.w3.org/2001/XMLSchema> .
@prefix fedoraconfig: <http://fedora.info/definitions/v4/config#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix authz: <http://fedora.info/definitions/v4/authorization#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
<http://localhost:8080/fcrepo/rest/>
rdf:type ldp:RDFSource ;
rdf:type ldp:Container ;
rdf:type ldp:BasicContainer ;
fedora:writable "true"^^<http://www.w3.org/2001/XMLSchema#boolean> ;
rdf:type fedora:RepositoryRoot ;
rdf:type fedora:Resource ;
rdf:type fedora:Container ;
fedora:hasTransactionProvider <http://localhost:8080/fcrepo/rest/fcr:tx> .
Namespace
Prefixes
POST Containers/Binaries
Controlling Resource Creation via Request Header
$ curl -i -X POST -ufedoraAdmin:secret3 -H "Slug:abc" -H "Content-Type:text/plain" -d "abc" http://localhost:8080/fcrepo/rest
curl -i -X POST -u fedoraAdmin:secret3 -H "Slug:abc"
-H "Content-Type:text/plain" -d "abc" http://localhost:8080/fcrepo/rest
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
ETag: "08cd3a9db9060a18d78e9522747330cff32fbcc2"
Last-Modified: Thu, 18 Jan 2018 18:56:11 GMT
Link: <http://localhost:8080/fcrepo/rest/abc/fcr:metadata>; rel="describedby"; anchor="http://localhost:8080/fcrepo/rest/abc"
Location: http://localhost:8080/fcrepo/rest/abc
Content-Type: text/plain
Content-Length: 37
Date: Thu, 18 Jan 2018 18:56:11 GMT
http://localhost:8080/fcrepo/rest/abc
This is the final Path of your New resource
It is a binary, so rdf description is here
Always check your response Codes
$ curl -i -X POST -u fedoraAdmin:secret3 -H "Slug:abc" -H "Content-Type:text/plain" -d "abc" http://localhost:8080/fcrepo/rest
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
ETag: "89c26230b3703581d021d20fb8ce014fc85a9fd3"
Last-Modified: Thu, 18 Jan 2018 18:56:17 GMT
Link: <http://localhost:8080/fcrepo/rest/2a/79/ee/0c/2a79ee0c-593e-4289-8e10-3272084942e9/fcr:metadata>; rel="describedby"; anchor="http://localhost:8080/fcrepo/rest/2a/79/ee/0c/2a79ee0c-593e-4289-8e10-3272084942e9"
Location: http://localhost:8080/fcrepo/rest/2a/79/ee/0c/2a79ee0c-593e-4289-8e10-3272084942e9
Content-Type: text/plain
Content-Length: 82
Date: Thu, 18 Jan 2018 18:56:17 GMT
http://localhost:8080/fcrepo/rest/2a/79/ee/0c/2a79ee0c-593e-4289-8e10-3272084942e9
Run the same curl command again
Slug can’t be respected, so F4 uses Internal PID Minter
GET: Binaries
$ curl -I -ufedoraAdmin:secret3 http://localhost:8080/fcrepo/rest/abc
$ curl -i -ufedoraAdmin:secret3 http://localhost:8080/fcrepo/rest/abc/fcr:metadata
PUT Containers/Binaries
Similar to POST but:
$ curl -i -XPUT -ufedoraAdmin:secret3 -H"Content-Type:text/turtle" -d 'PREFIX dc: <http://purl.org/dc/elements/1.1/> <> dc:title "Demo Resource"' http://localhost:8080/fcrepo/rest/demoresource
PUT: local Binaries
# This will download a binary image to the current directory
$ curl -L -o loc.jpg https://goo.gl/Nfrv7s
# This will PUT the binary into Fedora
$ curl -i -X PUT -u fedoraAdmin:secret3 -H "Content-Type: image/jpeg" --data-binary "@loc.jpg" http://localhost:8080/fcrepo/rest/curl/loc.jpg
PATCH: Containers (RDF)
PATCH
$ curl -i -XPATCH -H "Content-type:application/sparql-update" -ufedoraAdmin:secret3 -d "INSERT DATA {<> <http://purl.org/dc/elements/1.1/title> 'Library of Congress'}" http://localhost:8080/fcrepo/rest/curl/loc.jpg/fcr:metadata
$ curl -i -XPATCH -H "Content-type:application/sparql-update" -ufedoraAdmin:secret3 -d "DELETE {<> <http://purl.org/dc/elements/1.1/title> ?o} INSERT {<> <http://purl.org/dc/elements/1.1/title> 'Great Hall at the Library of Congress'} WHERE {<> <http://purl.org/dc/elements/1.1/title> ?o}" http://localhost:8080/fcrepo/rest/curl/loc.jpg/fcr:metadata
It’s easier/cleaner to build your sparql-update commands in an external file (e.g. myupdate.sparql), then pass as --data-binary “@myupdate.sparql”
DELETE
$ curl -i -XDELETE -ufedoraAdmin:secret3 http://localhost:8080/fcrepo/rest/curl/loc.jpg
HTTP/1.1 204 No Content
Date: Fri, 19 Jan 2018 20:03:15 GMT
HTTP/1.1 410 Gone
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 00:00:00 UTC
Link: <http://localhost:8080/fcrepo/rest/curl/loc.jpg/fcr:tombstone>; rel="hasTombstone"
Content-Type: text/plain
Content-Length: 82
Date: Fri, 19 Jan 2018 20:04:11 GMT
$ curl -i -ufedoraAdmin:secret3 http://localhost:8080/fcrepo/rest/curl/loc.jpg
DELETE, for real!
$ curl -i -X PUT -ufedoraAdmin:secret3 -H "Content-Type: image/jpeg" --data-binary "@loc.jpg" http://localhost:8080/fcrepo/rest/curl/loc.jpg
HTTP/1.1 410 Gone
...
Link: <http://localhost:8080/fcrepo/rest/curl/loc.jpg/fcr:tombstone>; rel="hasTombstone"
...
Date: Fri, 19 Jan 2018 20:06:06 GMT
Discovered tombstone resource at /curl/loc.jpg, departed: 2018-01-19T19:53:52.768Z
$ curl -i -XDELETE -ufedoraAdmin:secret3 http://localhost:8080/fcrepo/rest/curl/loc.jpg/fcr:tombstone
DELETE, for real!
$ curl -i -ufedoraAdmin:secret3 http://localhost:8080/fcrepo/rest/curl/loc.jpg
HTTP/1.1 404
$ curl -i -X PUT -ufedoraAdmin:secret3 -H "Content-Type: image/jpeg" --data-binary "@loc.jpg" http://localhost:8080/fcrepo/rest/curl/loc.jpg
HTTP/1.1 201
Summary
For more information:
https://wiki.duraspace.org/x/fAsCB
Break
Resume at 11:20
Fixity
Esmé Cowles
Fixity
Two Kinds of Fixity
Transmission Fixity
Persistence Fixity
Fixity via CURL
Interacting with HTTP
Creating a sample data file
$ head -c 8192 /dev/zero > file1.dat
$ shasum file1.dat
0631457264ff7f8d5fb1edc2c0211992a67c73e6 file1.dat
Transmission Fixity Failure
$ curl -i -u fedoraAdmin:secret3 -X PUT --data-binary @file1.dat \� -H "Digest: sha1=bad" http://localhost:8080/fcrepo/rest/file1
Transmission Fixity Failure
HTTP/1.1 409 Conflict
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 00:00:00 UTC
Content-Type: text/plain;charset=utf-8
Content-Length: 88
Date: Sat, 13 Jan 2018 12:36:11 GMT
Checksum Mismatch of urn:sha1:bad and urn:sha1:0631457264ff7f8d5fb1edc2c0211992a67c73e6
Transmission Fixity Success
$ curl -i -u fedoraAdmin:secret3 -X PUT --data-binary @file1.dat \� -H "Digest: sha1=0631457264ff7f8d5fb1edc2c0211992a67c73e6" \� http://localhost:8080/fcrepo/rest/file1
Transmission Fixity Success
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 00:00:00 UTC
ETag: "4a2cd452fee08d0b7dabb20c093daf154b822840"
Last-Modified: Sat, 13 Jan 2018 12:36:36 GMT
Link: <http://localhost:8080/fcrepo/rest/file1/fcr:metadata>; rel="describedby"; anchor="http://localhost:8080/fcrepo/rest/file1"
Location: http://localhost:8080/fcrepo/rest/file1
Content-Type: text/plain
Content-Length: 39
Date: Sat, 13 Jan 2018 12:36:36 GMT
http://localhost:8080/fcrepo/rest/file1
Persistence Fixity Success
$ curl -i -u fedoraAdmin:secret3 http://localhost:8080/fcrepo/rest/file1/fcr:fixity
Persistence Fixity Success
<http://localhost:8080/fcrepo/rest/file1>
premis:hasFixity <http://localhost:8080/fcrepo/rest/file1#fixity/1515847016030> .
<http://localhost:8080/fcrepo/rest/file1#fixity/1515847016030>
rdf:type premis:Fixity ;
rdf:type premis:EventOutcomeDetail ;
premis:hasEventOutcome "SUCCESS" ;
premis:hasMessageDigestAlgorithm "SHA-1"^^ ;
premis:hasMessageDigest <urn:sha1:0631457264ff7f8d5fb1edc2c0211992a67c73e6> ;
premis:hasSize "8192" .
Extra Credit: Persistence Fixity Failure
$ vagrant ssh�vagrant$ sudo -s�root$ echo "corruption" > /var/lib/tomcat7/fcrepo4-data/fcrepo.binary.directory/06/31/45/0631457264ff7f8d5fb1edc2c0211992a67c73e6
$ curl -i -u fedoraAdmin:secret3 \� http://localhost:8080/fcrepo/rest/file1/fcr:fixity
Extra Credit: Persistence Fixity Failure (headers)
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 00:00:00 UTC
Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
Link: <http://www.w3.org/ns/ldp#RDFSource>; rel="type"
Content-Type: text/turtle;charset=utf-8
Content-Length: 1601
Date: Sat, 13 Jan 2018 12:41:15 GMT
Extra Credit: Persistence Fixity Failure (body)
<http://localhost:8080/fcrepo/rest/file1>
premis:hasFixity <http://localhost:8080/fcrepo/rest/file1#fixity/1515847275733> .
<http://localhost:8080/fcrepo/rest/file1#fixity/1515847275733>
rdf:type premis:Fixity ;
rdf:type premis:EventOutcomeDetail ;
premis:hasEventOutcome "BAD_CHECKSUM" ;
premis:hasEventOutcome "BAD_SIZE" ;
premis:hasMessageDigestAlgorithm "SHA-1" ;
premis:hasMessageDigest <urn:sha1:6a7bb2556144babe3899b25e5428123735bb1e27> ;
premis:hasSize "11" .
Fixity: API Specification
$ curl -I -u fedoraAdmin:secret3 -H "Want-Digest: sha1" \� http://localhost:8080/fcrepo/rest/file1
Versioning
Esmé Cowles
Versioning via CURL
Interacting with HTTP
Creating a Version
$ curl -i -u fedoraAdmin:secret3 -X POST -H "Slug: v1" \� http://localhost:8080/fcrepo/rest/file1/fcr:versions
Updating the resource
$ curl -i -u fedoraAdmin:secret3 -X PUT -d "updated stuff" \� http://localhost:8080/fcrepo/rest/file1
Discover versions
<http://localhost:8080/fcrepo/rest/file1>
fedora:hasVersion <http://localhost:8080/fcrepo/rest/file1/fcr:versions/v1> .
<http://localhost:8080/fcrepo/rest/file1/fcr:versions/v1>
fedora:hasVersionLabel "v1"^^<http://www.w3.org/2001/XMLSchema#string> ;
fedora:created "2018-01-13T12:20:44.95Z" .
$ curl -i -u fedoraAdmin:secret3 \� http://localhost:8080/fcrepo/rest/file1/fcr:versions
Retrieve a previous version
$ curl -i -u fedoraAdmin:secret3 \� http://localhost:8080/fcrepo/rest/file1/fcr:versions/v1
Memento
Memento in Fedora
Activity Streams
Notifications in Fedora
Mike Durbin
What are Activity Streams?
Fundamental concepts
Notification Events in Fedora
“For every resource whose state is changed as a result of an HTTP operation, there MUST be a corresponding notification made available describing that change.”
Terminology Clarification
Throughout the history of this project, the following terms are used to describe the same aspect of the repository software:
Roles and Responsibilities
Key characteristics
Messaging Clients
Messages
When does Fedora 4 emit messages?
When Events happen that are related to durable changes to your resources in Fedora 4 (CUD)
Messaging Patterns: Topics
Messaging Patterns: Queues
Messaging technologies
Deployment Considerations
Beyond CRUD
Let’s try!
Download a utility to view messages
vagrant ssh
sudo wget -O /usr/local/bin/fcr-listen \
https://github.com/birkland/fcr-listen/releases/download/0.0.1/fcr-listen-Linux-x86_64�sudo chmod +x /usr/local/bin/fcr-listen
fcr-listen
Let’s try!
We will inspect the messages emitted by Fedora
Let’s try! (continued)
Let’s inspect the JSON message body
sudo apt-get install jq
fcr-listen | grep '{' | jq .
Let’s try! (continued)
Let’s inspect the JSON message body
Example: Message Headers
expires 0
org.fcrepo.jms.identifier = /msg
org.fcrepo.jms.user = fedoraAdmin
org.fcrepo.jms.resourceType = http://www.w3.org/ns/ldp#Container,http://fedora.info/definitions/v4/repository#Resource,http://fedora.info/definitions/v4/repository#Container,http://www.w3.org/ns/ldp#RDFSource
destination = /topic/fedora
ack = ID:fedora4-55273-1516219368164-25:1
org.fcrepo.jms.eventType = http://fedora.info/definitions/v4/event#ResourceModification
subscription = 1
priority = 4
org.fcrepo.jms.baseURL = http://localhost:8080/fcrepo/rest
org.fcrepo.jms.eventID = urn:uuid:5fbcc81a-7b1b-42fc-8f31-4561a8b52a94
org.fcrepo.jms.timestamp = 1516223977540
message-id = ID:fedora4-55273-1516219368164-4:1:1:1:43
persistent = true
org.fcrepo.jms.userAgent = Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
timestamp = 1516223977556
Example: JSON-LD
{
"id": "http://localhost:8080/fcrepo/rest/msg",
"type": ["http://www.w3.org/ns/ldp#Container", "http://fedora.info/definitions/v4/repository#Resource"],
"isPartOf": "http://localhost:8080/fcrepo/rest",
"wasGeneratedBy": {
"atTime": "2018-01-17T21:13:36.851Z",
"identifier": "urn:uuid:9f4ec7d7-3676-4154-a3fe-c3b7b2486860",
"type": [
"http://fedora.info/definitions/v4/event#ResourceModification",
"http://www.w3.org/ns/prov#Activity"
]
}
"wasAttributedTo": [
{
"name": "fedoraAdmin",
"type": "http://www.w3.org/ns/prov#Person"
},
{
"name": "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0",
"type": "http://www.w3.org/ns/prov#SoftwareAgent"
}
],
}
Sample Clients
Serialization service writes all repository content to disk. Let’s see what it wrote.
Indexing service updates a triplestore or solr index in response to changes.
cat /opt/karaf/etc/org.fcrepo.camel.serialization.cfg | grep descriptions
ls /tmp/descriptions/fcrepo/rest
Activity Stream Links
Web Access Control
(WebAC)
Mike Durbin
Authentication and Authorization
AuthN: verification of who you are
verifying a username/password
verifying a token
AuthZ: verification of what you can do
can the client access this resource?
can the client perform this operation?
Fedora does Authorization
WebAC Authorization
Solid Web AC Specification
Hands On Web AC
Scenario:
We’ve got some images that can only be shared with the “fedoraadmin” user.
Hands On WebAC
Create the following containers:
Final result (structure)
Final result (structure)
“images” must point to its ACL
acl:accessControl
Define the “acl” as a webac:Acl
Define the “authorization”
Link “acl” to “images” Resource
List Preconfigured Users
Log into the vagrant VM:
vagrant ssh
View the users configured for tomcat
tail /etc/tomcat7/tomcat-users.xml
Preconfigured Users
<role rolename="fedoraUser"/>
<role rolename="fedoraAdmin"/>
<user username="testuser" password="password1" roles="fedoraUser"/>
<user username="adminuser" password="password2" roles="fedoraUser"/>
<user username="fedoraAdmin" password="secret3" roles="fedoraAdmin"/>
</tomcat-users>
Verify authZ (warning: cURL ahead)
curl -I http://localhost:8080/fcrepo/rest/basic/images
> 401
�curl -I -ufedoraAdmin:secret3 http://localhost:8080/fcrepo/rest/basic/images�> 200
curl -I -uadminuser:password2 http://localhost:8080/fcrepo/rest/basic/images�> 200
curl -I -utestuser:password1 http://localhost:8080/fcrepo/rest/basic/images�> 403
Applies to children, as well
curl -I http://localhost:8080/fcrepo/rest/basic/images/files
> 401
�curl -I -ufedoraAdmin:secret3 http://localhost:8080/fcrepo/rest/basic/images/files�> 200
curl -I -uadminuser:password2 http://localhost:8080/fcrepo/rest/basic/images/files�> 200
curl -I -utestuser:password1 http://localhost:8080/fcrepo/rest/basic/images/files�> 403
Authentication
NOT done by Fedora, but instead possibly done by:
Shibboleth Scenario
The user, “testuser”, is a part of the “adminuser” group.
Configurable header: “some-header”
Shibboleth Scenario
Fedora Server
Web Server (enforcing Shibboleth Authentication)
Add’s header (stripls any user-header)
Verify AuthZ - Shibboleth Scenario
curl -I -uadminuser:password2 http://localhost:8080/fcrepo/rest/basic/images�> 200
curl -I -utestuser:password1 http://localhost:8080/fcrepo/rest/basic/images�> 403
curl -I -utestuser:password1 -H"some-header: adminuser" http://localhost:8080/fcrepo/rest/basic/images�> 200
More Web AC resources
Contact Info
Yinlin Chen (ylchen@vt.edu)
Esmé Cowles (escowles@princeton.edu)
Mike Durbin (md5wz@virginia.edu)
Fedora Community Resources
http://groups.google.com/d/forum/fedora-tech
https://wiki.duraspace.org/display/FF/Mailing+Lists+etc