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: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ The minimal app per platform that the [ThunderID docs](https://thunderid.dev) qu
| [`flutter`](quickstarts/flutter) | [![release](https://img.shields.io/github/v/release/thunder-id/samples?filter=sample/quickstarts/flutter/*)](https://github.com/thunder-id/samples/releases?q=sample%2Fquickstarts%2Fflutter&expanded=true) | Flutter app using the [`thunderid_flutter`](https://pub.dev/packages/thunderid_flutter) package |
| [`ios`](quickstarts/ios) | [![release](https://img.shields.io/github/v/release/thunder-id/samples?filter=sample/quickstarts/ios/*)](https://github.com/thunder-id/samples/releases?q=sample%2Fquickstarts%2Fios&expanded=true) | iOS (SwiftUI) app using the [ThunderID iOS SDK](https://github.com/thunder-id/ios-sdks) |
| [`nextjs`](quickstarts/nextjs) | [![release](https://img.shields.io/github/v/release/thunder-id/samples?filter=sample/quickstarts/nextjs/*)](https://github.com/thunder-id/samples/releases?q=sample%2Fquickstarts%2Fnextjs&expanded=true) | Next.js app using `@thunderid/nextjs` |
| [`nextjs-b2b`](quickstarts/nextjs-b2b) | [![release](https://img.shields.io/github/v/release/thunder-id/samples?filter=sample/quickstarts/nextjs-b2b/*)](https://github.com/thunder-id/samples/releases?q=sample%2Fquickstarts%2Fnextjs-b2b&expanded=true) | B2B Next.js app using `@thunderid/nextjs`: company sign-up, organization switching and per-company enterprise SSO |
| [`nextjs-b2b`](quickstarts/nextjs-b2b) | [![release](https://img.shields.io/github/v/release/thunder-id/samples?filter=sample/quickstarts/nextjs-b2b/*)](https://github.com/thunder-id/samples/releases?q=sample%2Fquickstarts%2Fnextjs-b2b&expanded=true) | B2B Next.js app using `@thunderid/nextjs` |
| [`node`](quickstarts/node) | [![release](https://img.shields.io/github/v/release/thunder-id/samples?filter=sample/quickstarts/node/*)](https://github.com/thunder-id/samples/releases?q=sample%2Fquickstarts%2Fnode&expanded=true) | Node.js service using `@thunderid/node` for machine-to-machine access |
| [`nuxt`](quickstarts/nuxt) | [![release](https://img.shields.io/github/v/release/thunder-id/samples?filter=sample/quickstarts/nuxt/*)](https://github.com/thunder-id/samples/releases?q=sample%2Fquickstarts%2Fnuxt&expanded=true) | Nuxt app using `@thunderid/nuxt` |
| [`react`](quickstarts/react) | [![release](https://img.shields.io/github/v/release/thunder-id/samples?filter=sample/quickstarts/react/*)](https://github.com/thunder-id/samples/releases?q=sample%2Fquickstarts%2Freact&expanded=true) | React app using `@thunderid/react` |
| [`react-b2b`](quickstarts/react-b2b) | [![release](https://img.shields.io/github/v/release/thunder-id/samples?filter=sample/quickstarts/react-b2b/*)](https://github.com/thunder-id/samples/releases?q=sample%2Fquickstarts%2Freact-b2b&expanded=true) | B2B React app using `@thunderid/react`: company sign-up, organization switching and per-company enterprise SSO |
| [`react-b2b`](quickstarts/react-b2b) | [![release](https://img.shields.io/github/v/release/thunder-id/samples?filter=sample/quickstarts/react-b2b/*)](https://github.com/thunder-id/samples/releases?q=sample%2Fquickstarts%2Freact-b2b&expanded=true) | B2B React app using `@thunderid/react` |
| [`vue`](quickstarts/vue) | [![release](https://img.shields.io/github/v/release/thunder-id/samples?filter=sample/quickstarts/vue/*)](https://github.com/thunder-id/samples/releases?q=sample%2Fquickstarts%2Fvue&expanded=true) | Vue app using `@thunderid/vue` |

### Integrations
Expand Down
12 changes: 7 additions & 5 deletions b2b/wayfinder-enterprise/.env.example
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
## Copy this file to .env.local. Values without NEXT_PUBLIC_ are read only on the server.

# The ThunderID server, and the application the declarative import creates.
# The ThunderID server, and the application the declarative import creates. Set THUNDERID_CLIENT_SECRET
# to the value you set as WAYFINDER_ENTERPRISE_CLIENT_SECRET when you imported thunderid.env.
NEXT_PUBLIC_THUNDERID_BASE_URL=https://localhost:8090
NEXT_PUBLIC_THUNDERID_CLIENT_ID=WAYFINDER_ENTERPRISE
THUNDERID_CLIENT_SECRET=wayfinder-enterprise-secret
THUNDERID_CLIENT_SECRET=
NEXT_PUBLIC_THUNDERID_APPLICATION_ID=019f0a10-0000-7000-8000-000000000031
NEXT_PUBLIC_THUNDERID_AFTER_SIGN_IN_URL=http://localhost:3000
NEXT_PUBLIC_THUNDERID_AFTER_SIGN_OUT_URL=http://localhost:3000
NEXT_PUBLIC_THUNDERID_SCOPES=openid profile email roles ou booking:view booking:create booking:manage policy:view policy:manage user:view user:manage group:view group:manage role:view role:manage sso:view sso:manage

# Encrypts the session cookie. Generate it with `openssl rand -base64 32`.
THUNDERID_SECRET=replace-with-a-long-random-string
THUNDERID_SECRET=

# Where the app runs. The admin components reach the backend routes under /api/admin from here.
WAYFINDER_APP_URL=http://localhost:3000
Expand All @@ -27,7 +28,8 @@ WAYFINDER_USER_TYPE=wayfinder-user

# The backend client that calls the root-only management APIs on a company admin's behalf, and the
# resource server that holds the root "system" permission. The app gets the client's token at the
# admin's company's token endpoint (/ou/{ouId}/oauth2/token), so each token names that company.
# admin's company's token endpoint (/ou/{ouId}/oauth2/token), so each token names that company. Set
# WAYFINDER_BACKEND_CLIENT_SECRET to the value you set as WAYFINDER_ENTERPRISE_BACKEND_CLIENT_SECRET.
WAYFINDER_BACKEND_CLIENT_ID=WAYFINDER_ENTERPRISE_BACKEND
WAYFINDER_BACKEND_CLIENT_SECRET=wayfinder-enterprise-backend-secret
WAYFINDER_BACKEND_CLIENT_SECRET=
THUNDERID_SYSTEM_RESOURCE=https://localhost:8090/mcp
15 changes: 8 additions & 7 deletions b2b/wayfinder-enterprise/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ cd my-app

The `thunderid-config/` directory holds two importable files that create every resource the app needs, with fixed IDs so the app's configuration works unchanged. Import them through the ThunderID Console, in this order:

1. Sign in to the ThunderID Console. With the quickstart image it is the Control Plane console, `https://localhost:8095/console`.
2. Choose **Import / Export**, then **Import**.
3. Upload `thunderid-config/organization-unit.yaml` as the configuration file. It needs no environment file. Choose **Continue**, and once the import test passes, choose **Import configuration**.
4. Choose **Import / Export**, then **Import** again. Upload `thunderid-config/thunderid-config.yaml` as the configuration file and `thunderid-config/thunderid.env` as the environment variables file. Choose **Continue**, then **Import configuration**.
1. Generate a client secret for each of the two applications, for example with `openssl rand -base64 32`, and set them as `WAYFINDER_ENTERPRISE_CLIENT_SECRET` and `WAYFINDER_ENTERPRISE_BACKEND_CLIENT_SECRET` in `thunderid-config/thunderid.env`. The sample ships without them, and the Console does not import the file until both are set. You can also enter them in the Console's **Environment variables** editor during the import. Keep the values for the app's `.env.local`.
2. Sign in to the ThunderID Console. With the quickstart image it is the Control Plane console, `https://localhost:8095/console`.
3. Choose **Import / Export**, then **Import**.
4. Upload `thunderid-config/organization-unit.yaml` as the configuration file. It needs no environment file. Choose **Continue**, and once the import test passes, choose **Import configuration**.
5. Choose **Import / Export**, then **Import** again. Upload `thunderid-config/thunderid-config.yaml` as the configuration file and `thunderid-config/thunderid.env` as the environment variables file. Choose **Continue**, then **Import configuration**.

The Console tests each import before it runs it, and that test only finds an organization unit that already exists. The second file places every resource in the organization unit the first one creates, so import the first one on its own.

Expand All @@ -73,7 +74,7 @@ The bundle sets the `defaultResourceServer` server config. An import replaces th

#### Environment variables in `thunderid-config/thunderid.env`

The defaults work as they are for a local setup.
The other defaults work as they are for a local setup. The two client secrets are empty in the sample, so set your own.

| Variable | Description |
|---|---|
Expand All @@ -84,7 +85,7 @@ The defaults work as they are for a local setup.
| `WAYFINDER_ENTERPRISE_BACKEND_CLIENT_ID` | Client ID of the `Wayfinder Enterprise Backend` application |
| `WAYFINDER_ENTERPRISE_BACKEND_CLIENT_SECRET` | Client secret of the `Wayfinder Enterprise Backend` application |

Change a client secret here before you import, and set the same value in the app's `.env.local`.
Set the same client secrets in the app's `.env.local`, as `THUNDERID_CLIENT_SECRET` and `WAYFINDER_BACKEND_CLIENT_SECRET`.

### Configure the app

Expand All @@ -94,7 +95,7 @@ Create your `.env.local`:
cp .env.example .env.local
```

The defaults match the import. Set `THUNDERID_SECRET` in `.env.local` to a long random string; the SDK encrypts the session cookie with it. Generate one with:
The other defaults match the import. In `.env.local`, set `THUNDERID_CLIENT_SECRET` and `WAYFINDER_BACKEND_CLIENT_SECRET` to the client secrets you set in `thunderid.env`, and `THUNDERID_SECRET` to a long random string; the SDK encrypts the session cookie with it. Generate one with:

```bash
openssl rand -base64 32
Expand Down
7 changes: 5 additions & 2 deletions b2b/wayfinder-enterprise/thunderid-config/thunderid.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Client secrets of the two applications. The sample ships without them: generate a value for each,
# for example with `openssl rand -base64 32`, and set the same values in the app's .env.local as
# THUNDERID_CLIENT_SECRET and WAYFINDER_BACKEND_CLIENT_SECRET.
WAYFINDER_ENTERPRISE_CLIENT_ID=WAYFINDER_ENTERPRISE
WAYFINDER_ENTERPRISE_CLIENT_SECRET=wayfinder-enterprise-secret
WAYFINDER_ENTERPRISE_CLIENT_SECRET=
WAYFINDER_ENTERPRISE_REDIRECT_URIS=["http://localhost:3000"]
WAYFINDER_ENTERPRISE_POST_LOGOUT_REDIRECT_URIS=["http://localhost:3000"]
WAYFINDER_ENTERPRISE_BACKEND_CLIENT_ID=WAYFINDER_ENTERPRISE_BACKEND
WAYFINDER_ENTERPRISE_BACKEND_CLIENT_SECRET=wayfinder-enterprise-backend-secret
WAYFINDER_ENTERPRISE_BACKEND_CLIENT_SECRET=
12 changes: 7 additions & 5 deletions quickstarts/nextjs-b2b/.env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Base URL of your ThunderID server.
NEXT_PUBLIC_THUNDERID_BASE_URL=https://localhost:8090

# Credentials of the application the import creates. Match thunderid-config/thunderid.env.
# Credentials of the application the import creates. Set THUNDERID_CLIENT_SECRET to the client secret
# you set as NEXTJS_B2B_CLIENT_SECRET when you imported thunderid-config/thunderid.env.
NEXT_PUBLIC_THUNDERID_CLIENT_ID=NEXTJS_B2B_QUICKSTART
THUNDERID_CLIENT_SECRET=nextjs-b2b-quickstart-secret
THUNDERID_CLIENT_SECRET=

# Where ThunderID returns the browser after sign-in.
NEXT_PUBLIC_THUNDERID_AFTER_SIGN_IN_URL=http://localhost:3000
Expand All @@ -13,13 +14,14 @@ NEXT_PUBLIC_THUNDERID_AFTER_SIGN_OUT_URL=http://localhost:3000

# `ou` and `roles` put the company and the user's roles there into the tokens. `org` asks for the
# permission a company admin needs to manage their company, such as its identity provider.
NEXT_PUBLIC_THUNDERID_SCOPES=openid profile email roles ou org
# `device_sso` asks for a device secret, which lets the server switch companies without a redirect.
NEXT_PUBLIC_THUNDERID_SCOPES=openid profile email roles ou org device_sso

# ID of the sign-in flow the import creates. A company admin sets the flow's enterpriseIdp variable for their company.
NEXT_PUBLIC_THUNDERID_SIGN_IN_FLOW_ID=019f0b20-0000-7000-8000-000000000021

# Encrypts the session cookie. Generate it with `openssl rand -base64 32`.
THUNDERID_SECRET=replace-with-a-long-random-string
# Signs the session cookie. Generate it with `openssl rand -base64 32`.
THUNDERID_SECRET=

# DANGER: Disables ALL TLS verification. Only for local development with self-signed certs. NEVER use in production.
NODE_TLS_REJECT_UNAUTHORIZED=0
Loading
Loading