From e4a3ee6ef0fc304c9e1f2af3c5fe326218ab80db Mon Sep 17 00:00:00 2001 From: Precious Oritsedere Date: Wed, 5 Nov 2025 14:43:27 +0000 Subject: [PATCH] feat: make oidc issuer configurable --- .env.example | 4 ++++ README.md | 8 ++++++-- src/Config.ts | 9 +++++++++ src/components/ui/ListEditor.tsx | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index c9dd148..4c1e2c2 100644 --- a/.env.example +++ b/.env.example @@ -11,6 +11,10 @@ NEXT_PUBLIC_MANIFEST_RESOURCE_URI="resource.ttl" # Admin WebID used for booting the demo (replace with your WebID) NEXT_PUBLIC_ADMIN_WEBID="https://id.inrupt.com/your-webid" +# OIDC issuer URL for authentication +# Default Inrupt provider, can be changed to other Solid-compatible providers +NEXT_PUBLIC_OIDC_ISSUER="https://login.inrupt.com" + # Notes: # - Never commit secrets. This file is safe to commit because it contains placeholders only. # - For private credentials (if any), keep them in `.env` or `.env.local` which are ignored by git. diff --git a/README.md b/README.md index 0f9bf1f..e0e3e29 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,16 @@ Therefore, you need a [WebID](https://solid.github.io/webid-profile/) to correct A WebID is a URL you control and can use to sign in to Solid Apps. -Before running the app, set the `NEXT_PUBLIC_ADMIN_WEBID` environment variable in `.env.local`. +Before running the app, set the `NEXT_PUBLIC_ADMIN_WEBID` and `NEXT_PUBLIC_OIDC_ISSUER` environment variable in `.env.local`. Environment variables --------------------- -This project includes a `.env.example` file with the placeholders for environment variables used by the app (for example `NEXT_PUBLIC_BASE_URI`, `NEXT_PUBLIC_MANIFEST_RESOURCE_URI`, and `NEXT_PUBLIC_ADMIN_WEBID`). +This project includes a `.env.example` file with the placeholders for environment variables used by the app: +- `NEXT_PUBLIC_BASE_URI` - Base URI for the Solid server +- `NEXT_PUBLIC_MANIFEST_RESOURCE_URI` - URI for the manifest resource +- `NEXT_PUBLIC_ADMIN_WEBID` - WebID of the admin user +- `NEXT_PUBLIC_OIDC_ISSUER` - OIDC issuer URL for authentication (e.g., `https://login.inrupt.com`) Copy the example to a local env file and edit values before running the app diff --git a/src/Config.ts b/src/Config.ts index 222e01d..72c42d7 100644 --- a/src/Config.ts +++ b/src/Config.ts @@ -32,4 +32,13 @@ export class Config { return value; } + + public static get oidcIssuer(): string { + const value = process.env.NEXT_PUBLIC_OIDC_ISSUER; + if (value === undefined) { + throw new Error(`${errorTemplate}NEXT_PUBLIC_OIDC_ISSUER`); + } + + return value; + } } diff --git a/src/components/ui/ListEditor.tsx b/src/components/ui/ListEditor.tsx index 2db981e..4586bf5 100644 --- a/src/components/ui/ListEditor.tsx +++ b/src/components/ui/ListEditor.tsx @@ -178,7 +178,7 @@ export function ListEditor() { console.log("unauthenticated"); await login({ - oidcIssuer: "https://login.inrupt.com", // TODO: config + oidcIssuer: Config.oidcIssuer, clientName: "My application", }); }