-
Notifications
You must be signed in to change notification settings - Fork 3
feat(journey-client): wellknown-endpoint-config-support #525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| --- | ||
| '@forgerock/journey-client': minor | ||
| '@forgerock/sdk-oidc': minor | ||
| '@forgerock/sdk-utilities': minor | ||
| '@forgerock/davinci-client': patch | ||
| '@forgerock/oidc-client': patch | ||
| --- | ||
|
|
||
| ### @forgerock/journey-client | ||
|
|
||
| Add well-known OIDC endpoint discovery support. The journey client can now fetch configuration from the `.well-known/openid-configuration` endpoint: | ||
|
|
||
| ```typescript | ||
| const client = await journey({ | ||
| serverConfig: { | ||
| baseUrl: 'https://am.example.com/am/', | ||
| wellknown: | ||
| 'https://am.example.com/am/oauth2/realms/root/realms/alpha/.well-known/openid-configuration', | ||
| }, | ||
| }); | ||
| ``` | ||
|
|
||
| The realm path can be automatically inferred from the well-known issuer URL. | ||
|
|
||
| ### @forgerock/sdk-oidc | ||
|
|
||
| Add shared well-known module with RTK Query API for OIDC endpoint discovery: | ||
|
|
||
| - `wellknownApi` - RTK Query API for fetching well-known configuration | ||
| - `createWellknownSelector` - Selector factory for cached well-known data | ||
| - `createWellknownError` - Typed error creation from fetch failures | ||
| - Re-exports pure utilities from `@forgerock/sdk-utilities` | ||
|
|
||
| ### @forgerock/sdk-utilities | ||
|
|
||
| Add pure well-known utilities: | ||
|
|
||
| - `inferRealmFromIssuer` - Extract realm path from AM issuer URLs | ||
| - `isValidWellknownUrl` - Validate well-known URLs (HTTPS required, HTTP allowed for localhost) | ||
|
|
||
| ### @forgerock/davinci-client | ||
|
|
||
| Refactored to use shared well-known module from `@forgerock/sdk-oidc`. | ||
|
|
||
| ### @forgerock/oidc-client | ||
|
|
||
| Refactored to use shared well-known module from `@forgerock/sdk-oidc`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| --- | ||
| '@forgerock/journey-client': major | ||
| --- | ||
|
|
||
| BREAKING: Unify journey-client around wellknown-only configuration | ||
|
|
||
| This release simplifies the configuration API by requiring the `wellknown` URL and automatically inferring `baseUrl` and `realmPath`. | ||
|
|
||
| ## Breaking Changes | ||
|
|
||
| - **Removed `baseUrl` from `JourneyServerConfig`**: The `baseUrl` is now always inferred from the wellknown URL. If inference fails (non-AM server), an error is returned. | ||
| - **Removed `hasWellknownConfig` export**: This type guard is no longer needed since all configs use wellknown. | ||
|
|
||
| ## Migration | ||
|
|
||
| **Before:** | ||
| ```typescript | ||
| journey({ | ||
| config: { | ||
| serverConfig: { baseUrl: 'https://am.example.com/am/' }, | ||
| realmPath: 'alpha', | ||
| }, | ||
| }); | ||
| ``` | ||
|
|
||
| **After:** | ||
| ```typescript | ||
| journey({ | ||
| config: { | ||
| serverConfig: { | ||
| wellknown: 'https://am.example.com/am/oauth2/alpha/.well-known/openid-configuration', | ||
| }, | ||
| // realmPath is now optional - inferred from wellknown issuer | ||
| }, | ||
| }); | ||
| ``` | ||
|
|
||
| ## Features | ||
|
|
||
| - Automatic `baseUrl` inference from wellknown URL (extracts path before `/oauth2/`) | ||
| - Automatic `realmPath` inference from wellknown issuer | ||
| - Improved error messages for non-AM servers, guiding users to appropriate clients | ||
| - Updated README with comprehensive API documentation |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,7 +63,7 @@ async function authorization(req, res, next) { | |
|
|
||
| export default function (app) { | ||
| // Passthrough route that enforces authentication | ||
| app.all('/resource/*', async (req, res, next) => { | ||
| app.all('/resource/{*splat}', async (req, res, next) => { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed when i rebased open-deps (part of this express upgrade) |
||
| if (env.NODE_ENV === 'LIVE' && req.hostname === FORGEOPS) { | ||
| // Only enforce authentication if IG is not used | ||
| // In other words, the call comes directly from app | ||
|
|
@@ -156,7 +156,7 @@ export default function (app) { | |
| } | ||
| }); | ||
|
|
||
| app.get('/resource/rest/*', wait, authorization, async (req, res) => { | ||
| app.get('/resource/rest/{*splat}', wait, authorization, async (req, res) => { | ||
| if (env.NODE_ENV === 'live') { | ||
| if (req.access.actions && req.access.actions.GET) { | ||
| res.json({ message: 'Successfully retrieved resource!' }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,7 +126,6 @@ | |
| "buildTargetName": "nxBuild", | ||
| "serveTargetName": "nxServe", | ||
| "previewTargetName": "nxPreview", | ||
| "testTargetName": "nxTest", | ||
| "serveStaticTargetName": "serve-static", | ||
| "typecheckTargetName": "typecheck", | ||
| "buildDepsTargetName": "vite:build-deps", | ||
|
|
@@ -146,6 +145,13 @@ | |
| "configName": "tsconfig.lib.json" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "plugin": "@nx/vitest", | ||
| "options": { | ||
| "testTargetName": "nxTest" | ||
| }, | ||
| "include": ["packages/**/**/*", "e2e/**/**/*", "tools/**/**/*"] | ||
| } | ||
|
Comment on lines
+150
to
155
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's examine the full nx.json file to see targetDefaults structure
cat nx.json | head -200Repository: ForgeRock/ping-javascript-sdk Length of output: 4536 🏁 Script executed: # Search for testTargetName and nxTest references
rg -n "testTargetName|nxTest" .Repository: ForgeRock/ping-javascript-sdk Length of output: 2267 🏁 Script executed: # Look for test target references in CI workflows
find .github/workflows -type f -name "*.yml" -o -name "*.yaml" | head -20Repository: ForgeRock/ping-javascript-sdk Length of output: 200 🏁 Script executed: # Search for nx test/affected calls in workflows and scripts
rg -n "nx\s+(affected|run-many|test)" .github/workflows/ 2>/dev/null || echo "No matches in workflows"
rg -n "\bnx\s+test\b|\bnx\s+affected.*test" . --type yml --type yaml 2>/dev/null || echo "Checking workflows separately"Repository: ForgeRock/ping-javascript-sdk Length of output: 292 🏁 Script executed: # Check for targetDefaults entries for test-related targets
rg -n -A5 '"targetDefaults"' nx.jsonRepository: ForgeRock/ping-javascript-sdk Length of output: 222 CI workflow will not run vitest tests due to target name mismatch. The Additionally, Choose one approach:
🤖 Prompt for AI Agents |
||
| ], | ||
| "parallel": 1, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.