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
4 changes: 4 additions & 0 deletions src/webid/Agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export class Agent extends TermWrapper {
return SetFrom.subjectPredicate(this, SOLID.storage, NamedNodeAs.string, NamedNodeFrom.string)
}

get oidcIssuer(): Set<string> {
return SetFrom.subjectPredicate(this, SOLID.oidcIssuer, NamedNodeAs.string, NamedNodeFrom.string)
}

get email(): string | null {
return this.hasEmail?.value ?? null
}
Expand Down
33 changes: 33 additions & 0 deletions test/unit/agent.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { DataFactory, Parser, Store } from "n3"
import assert from "node:assert"
import { describe, it } from "node:test"

import { Agent } from "@solid/object"

describe("Agent oidcIssuer", () => {

const sampleRDF = `
@prefix solid: <http://www.w3.org/ns/solid/terms#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

<https://example.org/profile/card#me>
a foaf:Person ;
solid:oidcIssuer <https://idp.example.org/> , <https://idp.other.example/> .
`;

it("returns the set of solid:oidcIssuer values declared on the WebID", () => {
const store = new Store()
store.addQuads(new Parser().parse(sampleRDF))

const agent = new Agent(
DataFactory.namedNode("https://example.org/profile/card#me"),
store,
DataFactory
)

assert.deepStrictEqual(
new Set(agent.oidcIssuer),
new Set(["https://idp.example.org/", "https://idp.other.example/"])
)
})
})