From 72af56af1786659f0c918d454b4763547c2ce75d Mon Sep 17 00:00:00 2001 From: Brion Date: Fri, 16 Oct 2026 12:52:26 +0530 Subject: [PATCH] Link integration guides to sample releases and drop their install cards Point the Flutter AppAuth guide at the samples repo root layout (integrations/flutter-app-auth) and offer the sample's released zip at the top of the page. A new optional `sample` entry field names the sample as /; SdkQuickstartDownload takes `type` and `prewiredWith` so it can look up a sample release instead of an SDK one. A guide documents a package someone else maintains, so drop the hero install card from the Flutter AppAuth and Spring Security guides and reject hero.aside on guide entries in the registry validator. The released zip carries the sample's README, so remove the Flutter AppAuth Sample app section and its Try the sample app guide, and drop the Beyond this guide link grid from both guides. Signed-off-by: Brion --- .../sdks-and-tools/flutter-appauth/entry.yaml | 157 +----------------- .../sdks-and-tools/spring-security/entry.yaml | 48 ------ docs/plugins/ecosystemPlugin/validate.ts | 9 + .../components/Ecosystem/Detail/Detail.tsx | 19 ++- docs/src/components/SdkQuickstartDownload.tsx | 21 ++- docs/src/types/ecosystem.ts | 7 + 6 files changed, 53 insertions(+), 208 deletions(-) diff --git a/docs/content/sdks-and-tools/flutter-appauth/entry.yaml b/docs/content/sdks-and-tools/flutter-appauth/entry.yaml index 389ac8f4eb..d212a12317 100644 --- a/docs/content/sdks-and-tools/flutter-appauth/entry.yaml +++ b/docs/content/sdks-and-tools/flutter-appauth/entry.yaml @@ -16,7 +16,9 @@ description: >- sign Flutter users in to {{ProductName}} with authorization code and PKCE. links: external: https://pub.dev/packages/flutter_appauth - samples: https://github.com/thunder-id/samples/tree/main/samples/integrations/flutter-app-auth + samples: https://github.com/thunder-id/samples/tree/main/integrations/flutter-app-auth +# Offers the sample's released zip at the top of the page, from the samples repo releases. +sample: integrations/flutter-app-auth hero: description: >- @@ -37,21 +39,10 @@ hero: - label: Get started href: "#setup" variant: primary - - label: Try the sample app - href: "#sample" - variant: secondary - label: flutter_appauth docs href: https://pub.dev/packages/flutter_appauth variant: secondary external: true - aside: - type: install - footnote: flutter_appauth 12 · Flutter 3.38+ · Android API 24+ · iOS 13+ - tabs: - - label: flutter - code: - lang: bash - content: flutter pub add flutter_appauth sections: - type: steps @@ -61,8 +52,8 @@ sections: intro: >- Works with a new Flutter application or one you already have. Requires a running {{ProductName}} instance; the steps use https://localhost:8090, the default for a local install. The scheme com.example.appauth is a - placeholder: use your own, in lowercase, everywhere it appears. To start from working code instead, the - ready-made sample app under Sample app below runs every step of this guide. + placeholder: use your own, in lowercase, everywhere it appears. To start from working code instead, download + the sample app above, which runs every step of this guide; its README covers setting it up. steps: - title: Create the application in {{ProductName}} description: >- @@ -293,14 +284,6 @@ sections: above opts in, and keeping it in the debug source set leaves release builds untouched. In production, serve {{ProductName}} with a certificate from a public certificate authority and skip this step. - - type: guides - id: sample - title: Sample app - intro: >- - A ready-made Flutter application that runs the code above, from the {{ProductName}} samples repository at - samples/integrations/flutter-app-auth. Register it in the Console, pass its client ID, and run it. - items: [try-the-sample-app] - - type: table id: endpoints title: Endpoint mapping @@ -335,25 +318,6 @@ sections: - cells: [iOS, "13+"] badge: {label: supported, tone: success} - - type: linkGrid - id: beyond - title: Beyond this guide - intro: >- - Everything past this configuration is ordinary flutter_appauth and AppAuth, documented by their - authors, plus the {{ProductName}} application settings this guide touches. - items: - - label: flutter_appauth README - href: https://pub.dev/packages/flutter_appauth - external: true - - label: AppAuth for Android - href: https://github.com/openid/AppAuth-Android - external: true - - label: AppAuth for iOS - href: https://github.com/openid/AppAuth-iOS - external: true - - label: "{{ProductName}} application settings" - href: /docs/next/guides/applications/application-settings - - type: support id: support title: Where to get help @@ -384,117 +348,6 @@ sections: variant: secondary external: true -guides: - - id: try-the-sample-app - title: Try the Flutter AppAuth Sample App - icon: terminal - description: >- - Run the ready-made sample to see sign-in, token refresh, session restore, and sign-out against - {{ProductName}} end to end. - intro: >- - The {{ProductName}} samples repository ships a sample in samples/integrations/flutter-app-auth that runs - the code from the Flutter AppAuth guide: sign-in with authorization code and PKCE in the system browser, - token refresh with rotation, session restore when the application restarts, and sign-out through the end - session endpoint, on Android and iOS. - sections: - - type: steps - id: steps - title: Try the sample - steps: - - title: Prerequisites - description: >- - Flutter 3.38.1 or later, an Android emulator (API 24+) or an iOS Simulator (iOS 13+), and a running - {{ProductName}} instance. The steps use https://localhost:8090, the default for a local install. - - title: Get the sample - description: >- - The sample lives in the {{ProductName}} samples repository. A sparse checkout downloads only the - sample directory rather than the whole repository. - code: - lang: bash - content: |- - git clone --depth 1 --filter=blob:none --sparse https://github.com/thunder-id/samples.git - cd samples - git sparse-checkout set samples/integrations/flutter-app-auth - cd samples/integrations/flutter-app-auth - flutter pub get - - title: Create the application in {{ProductName}} - description: >- - The sample uses the com.example.appauth scheme, so register its redirect URIs exactly as below. The - ID token attributes decide what the sample shows as the signed-in user's name. - uiPath: - - Open the Console at https://localhost:8090/console and navigate to Applications - - Click Add Application and select Flutter - - Under Sign-In Approach, select Redirect to {{ProductName}} Gate - - Under Deep Link / Universal Link, enter com.example.appauth://callback - - Click Create, then copy the Client ID - - On the Advanced tab, add com.example.appauth://logout under Post-Logout Redirect URIs and save - - On the Token tab, open User, then ID Token, and add email and name - - title: Trust the local certificate - description: >- - A local {{ProductName}} serves a self-signed certificate, which the device must trust before the - browser or AppAuth can reach it. Debug builds of the sample already trust user-installed certificates - through android/app/src/debug/res/xml/network_security_config.xml, so only the device needs setting - up. Run these once per emulator or simulator. - tabs: - - label: Android - code: - lang: bash - content: |- - # Forward the emulator's localhost:8090 to your machine. - adb reverse tcp:8090 tcp:8090 - - # Copy the certificate, then install it on the emulator: Settings > Security & privacy > - # More security & privacy > Encryption & credentials > Install a certificate > CA certificate, - # and select thunderid-dev.crt from Downloads. - adb push /config/certs/server.cert /sdcard/Download/thunderid-dev.crt - - label: iOS Simulator - code: - lang: bash - content: xcrun simctl keychain booted add-root-cert /config/certs/server.cert - - title: Configure and run - description: >- - The sample reads its settings at build time, so there is no file to edit. Pass the Client ID from - the Console with --dart-define. For an instance other than https://localhost:8090, also pass - THUNDERID_ISSUER. - code: - lang: bash - content: |- - flutter run --dart-define=THUNDERID_CLIENT_ID= - - # A different instance: - flutter run --dart-define=THUNDERID_CLIENT_ID= \ - --dart-define=THUNDERID_ISSUER=https://thunderid.example.com - - title: Try it out - description: >- - Tap Sign in and sign in on the {{ProductName}} page that opens in the browser. The application shows - the signed-in user's name and the access token's expiry. Tap Refresh tokens to exchange the refresh - token, restart the application to see the session restored from the stored refresh token, and tap - Sign out to end the {{ProductName}} session and return to the application. - - type: table - id: files - title: Sample contents - showHeader: true - columns: - - {label: File, style: code} - - {label: What it does, style: text} - rows: - - cells: [lib/auth_config.dart, "Issuer, client ID, redirect URIs, and scopes, read from --dart-define."] - - cells: [lib/auth_service.dart, "Sign-in, refresh, session restore, and sign-out with flutter_appauth."] - - cells: [lib/main.dart, A single screen that drives the service.] - - cells: [android/app/build.gradle.kts, Registers the com.example.appauth redirect scheme.] - - cells: [android/app/src/main/AndroidManifest.xml, "MainActivity without android:taskAffinity=\"\", so the redirect completes sign-in."] - - cells: [ios/Runner/Info.plist, Registers the same scheme under CFBundleURLTypes.] - - type: linkGrid - id: source - title: Sample source - items: - - label: Sample on GitHub - href: https://github.com/thunder-id/samples/tree/main/samples/integrations/flutter-app-auth - external: true - - label: Sample README - href: https://github.com/thunder-id/samples/blob/main/samples/integrations/flutter-app-auth/README.md - external: true - rail: statsTitle: Ownership stats: diff --git a/docs/content/sdks-and-tools/spring-security/entry.yaml b/docs/content/sdks-and-tools/spring-security/entry.yaml index c3ac163739..323dff6011 100644 --- a/docs/content/sdks-and-tools/spring-security/entry.yaml +++ b/docs/content/sdks-and-tools/spring-security/entry.yaml @@ -41,37 +41,6 @@ hero: href: https://docs.spring.io/spring-security/reference/ variant: secondary external: true - aside: - type: install - footnote: Spring's own starters · Boot 3.2+ · Java 17+ - tabs: - - label: gradle - code: - file: build.gradle.kts - lang: kotlin - content: |- - implementation("org.springframework.boot:spring-boot-starter-oauth2-client") - implementation("org.springframework.boot:spring-boot-starter-oauth2-resource-server") - - label: groovy - code: - file: build.gradle - lang: groovy - content: |- - implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' - implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' - - label: maven - code: - file: pom.xml - lang: xml - content: |- - - org.springframework.boot - spring-boot-starter-oauth2-client - - - org.springframework.boot - spring-boot-starter-oauth2-resource-server - sections: - type: steps @@ -207,23 +176,6 @@ sections: - cells: [Spring Boot 2.7 / Security 5, legacy] badge: {label: unsupported, tone: danger} - - type: linkGrid - id: beyond - title: Beyond this guide - intro: >- - Everything past this configuration is ordinary Spring Security, documented by the Spring team. These are - the pages worth bookmarking. - items: - - label: OAuth2 Login - href: https://docs.spring.io/spring-security/reference/servlet/oauth2/login/index.html - external: true - - label: OAuth2 Resource Server - href: https://docs.spring.io/spring-security/reference/servlet/oauth2/resource-server/index.html - external: true - - label: Method security - href: https://docs.spring.io/spring-security/reference/servlet/authorization/method-security.html - external: true - - type: support id: support title: Where to get help diff --git a/docs/plugins/ecosystemPlugin/validate.ts b/docs/plugins/ecosystemPlugin/validate.ts index 0c76c70662..083839895f 100644 --- a/docs/plugins/ecosystemPlugin/validate.ts +++ b/docs/plugins/ecosystemPlugin/validate.ts @@ -519,6 +519,10 @@ export function validateEntry( optionalString(p, raw, '', 'accent'); optionalString(p, raw, '', 'author'); optionalString(p, raw, '', 'version'); + optionalString(p, raw, '', 'sample'); + if (typeof raw.sample === 'string' && !/^[a-z0-9-]+\/[a-z0-9-]+$/.test(raw.sample)) { + p.add('sample', 'must be a samples repository path in the form "/"'); + } if (!isPlainObject(raw.package)) { p.add('package', 'is required and must be an object'); @@ -570,6 +574,11 @@ export function validateEntry( } if (raw.hero !== undefined) validateHero(p, raw.hero); + // A guide documents a third-party package, so the install card would promote + // someone else's package as if it were ours. Guides offer their sample instead. + if (raw.type === 'guide' && isPlainObject(raw.hero) && raw.hero.aside !== undefined) { + p.add('hero.aside', 'is not allowed on guide entries; name a sample with `sample` instead'); + } if (raw.rail !== undefined) validateRail(p, raw.rail); if (raw.apiReference !== undefined) { diff --git a/docs/src/components/Ecosystem/Detail/Detail.tsx b/docs/src/components/Ecosystem/Detail/Detail.tsx index 6eba158a2a..a630959f05 100644 --- a/docs/src/components/Ecosystem/Detail/Detail.tsx +++ b/docs/src/components/Ecosystem/Detail/Detail.tsx @@ -555,9 +555,11 @@ export function Shell({ * An entry's own page: the shell over the entry's sections. * * The sample callout is the same one the quickstarts carry, keyed on the entry - * id because that is what the release feed calls the package. It renders - * nothing for an entry with no published sample archive, so entries opt in by - * publishing one rather than by being listed here. + * id because that is what the release feed calls the package. An entry whose + * sample lives in the samples repository names it with `sample` instead, and + * the callout offers that sample's release. It renders nothing for an entry + * with no published sample archive, so entries opt in by publishing one rather + * than by being listed here. */ export default function Detail({entry}: {entry: EcosystemEntry}): JSX.Element { return ( @@ -569,7 +571,16 @@ export default function Detail({entry}: {entry: EcosystemEntry}): JSX.Element { // The callout carries its own bottom margin for prose pages; here the // column's own gap does that work. *': {mb: 0}}}> - } /> + {entry.sample ? ( + } + /> + ) : ( + } /> + )} } /> diff --git a/docs/src/components/SdkQuickstartDownload.tsx b/docs/src/components/SdkQuickstartDownload.tsx index 5c639b890c..e1238edaf7 100644 --- a/docs/src/components/SdkQuickstartDownload.tsx +++ b/docs/src/components/SdkQuickstartDownload.tsx @@ -32,9 +32,20 @@ interface EcosystemReleasesData { */ interface SdkQuickstartDownloadProps { /** - * The `packageId` of the SDK package, as tracked in `ecosystem-releases.json` (e.g. `react`, `nextjs`, `express`). + * The `packageId` of the release, as tracked in `ecosystem-releases.json`: an SDK package (e.g. `react`, + * `nextjs`, `express`) or, with `type="sample"`, a sample (e.g. `integrations/flutter-app-auth`). */ packageId: string; + /** + * Which kind of release `packageId` names. Defaults to `sdk`, whose quickstart sample ships in the SDK's + * own release. + */ + type?: 'sdk' | 'sample'; + /** + * The package the sample is wired with, shown as "prewired with ...". Defaults to the release's package + * name, which suits SDK releases; a sample's release name is not a package, so pass one for samples. + */ + prewiredWith?: string; /** * The framework logo to show in the icon badge, e.g. ``. */ @@ -116,6 +127,8 @@ const Actions = styled('div')({ */ export default function SdkQuickstartDownload({ packageId, + type = 'sdk', + prewiredWith = undefined, icon = undefined, promptFlow = undefined, }: SdkQuickstartDownloadProps): React.ReactElement | null { @@ -136,17 +149,17 @@ export default function SdkQuickstartDownload({ fetch(withBaseUrl('/data/ecosystem-releases.json'), {signal: controller.signal}) .then((r) => r.json() as Promise) .then((data) => { - const entry = data.releases?.find((release) => release.type === 'sdk' && release.packageId === packageId); + const entry = data.releases?.find((release) => release.type === type && release.packageId === packageId); const match = entry?.assets.find((a) => a.downloadUrl.endsWith('.zip')); if (!entry || !match) return; - setPackageName(entry.packageName ?? ''); + setPackageName(prewiredWith ?? entry.packageName ?? ''); setAsset(match); }) .catch((err: unknown) => { if (err instanceof DOMException && err.name === 'AbortError') return; }); return () => controller.abort(); - }, [withBaseUrl, packageId]); + }, [withBaseUrl, packageId, type, prewiredWith]); const handleCopyPrompt = async (): Promise => { if (!promptFlow || copyState === 'copying') return; diff --git a/docs/src/types/ecosystem.ts b/docs/src/types/ecosystem.ts index b6c7195be2..1e0167fe8a 100644 --- a/docs/src/types/ecosystem.ts +++ b/docs/src/types/ecosystem.ts @@ -381,6 +381,13 @@ export interface EcosystemEntry { version?: string; docs?: EcosystemDocs; links?: EcosystemLinks; + /** + * The sample in the `thunder-id/samples` repository whose released zip the + * page offers for download, as `/` (e.g. + * `integrations/flutter-app-auth`). Omit to offer the SDK quickstart sample + * released under this entry's id instead. + */ + sample?: string; hero?: EcosystemHero; sections?: EcosystemSection[]; /** Guides, each rendered on its own page. */