Skip to content
Open
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 id.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"token_endpoint_auth_method": "none",
"client_id": "http://localhost:8080/id.jsonld",
"redirect_uris": [
"http://localhost:8080/callback.html"
],
"response_types": [
"code"
],
"@context": "https://www.w3.org/ns/solid/oidc-context.jsonld"
}
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
CachingAuthorizationServerProvider,
CachingClientProvider,
CachingIssuerProvider,
// ClientIdClientProvider,
DPoPTokenProvider,
DynamicRegistrationClientProvider,
ReactiveFetchManager,
Expand All @@ -34,6 +35,7 @@
const cachingASProvider = new CachingAuthorizationServerProvider(asProvider)
const callbackUri = new URL("/callback.html", location.href).toString()
const clientProvider = new DynamicRegistrationClientProvider
// const clientProvider = new ClientIdClientProvider(new URL("./id.jsonld", location.href))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we have things commented out in a PR?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This index.html file is what currently goes for test/demo harness.
These commented lines facilitate experimentation with the new feature.

This is far from done, to be replaced down the line with unit tests, documentation comments and example code.

Would you like me to remove here or are you OK for this to evolve slowly?

const cachingClientProvider = new CachingClientProvider(clientProvider)

const dPoPTokenProvider = new DPoPTokenProvider(callbackUri, ui, cachingASProvider, cachingClientProvider)
Expand Down
12 changes: 12 additions & 0 deletions src/ClientIdClientProvider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { ClientProvider } from "./ClientProvider.js"
import * as oauth from "oauth4webapi"

export class ClientIdClientProvider implements ClientProvider {
constructor(private clientIdDocUri: URL) {
}

async getClient(_: oauth.AuthorizationServer, __: string, signal: AbortSignal): Promise<oauth.Client> {
const response = await fetch(this.clientIdDocUri, {signal})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks like it will get overriden when we are monkey patching and so suffer from the issues that #21 tries to fix.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, relying on the global fetch makes this prone to the same problem.
I'd rather not mitigate that here but treat it holistically across the codebase.
Especially considering #19 and the potential to eliminate monkey patching altogether.

I imagine the best approach would be (as hinted in #21) would be for our API to take a fetch and perhaps for the manager to pass its original fetch to these methods. Even regardless of not monkey patching.

return await response.json()
}
}
1 change: 1 addition & 0 deletions src/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ export * from "./CachingAuthorizationServerProvider.js"
export * from "./ClientProvider.js"
export * from "./DynamicRegistrationClientProvider.js"
export * from "./CachingClientProvider.js"
export * from "./ClientIdClientProvider.js"
Loading