-
Notifications
You must be signed in to change notification settings - Fork 3
fix(journey-client): align config with DaVinci and OIDC clients #557
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
Open
ryanbas21
wants to merge
1
commit into
main
Choose a base branch
from
fix-jc-missing-properties
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| '@forgerock/journey-client': patch | ||
| --- | ||
|
|
||
| Extend `JourneyClientConfig` from `AsyncLegacyConfigOptions` so the same config object can be shared across journey-client, davinci-client, and oidc-client | ||
|
|
||
| - `clientId`, `scope`, `redirectUri`, and other inherited properties are now accepted but ignored — a warning is logged when they are provided | ||
| - `serverConfig.wellknown` remains required |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| /* | ||
| * Copyright (c) 2025 Ping Identity Corporation. All rights reserved. | ||
| * | ||
| * This software may be modified and distributed under the terms | ||
| * of the MIT license. See the LICENSE file for details. | ||
| */ | ||
| import { describe, expectTypeOf, it } from 'vitest'; | ||
| import type { | ||
| JourneyClientConfig, | ||
| JourneyServerConfig, | ||
| InternalJourneyClientConfig, | ||
| } from './config.types.js'; | ||
| import type { AsyncLegacyConfigOptions } from '@forgerock/sdk-types'; | ||
| import type { ResolvedServerConfig } from './wellknown.utils.js'; | ||
|
|
||
| describe('Config Types', () => { | ||
| describe('JourneyClientConfig', () => { | ||
| it('should extend AsyncLegacyConfigOptions', () => { | ||
| expectTypeOf<JourneyClientConfig>().toMatchTypeOf<AsyncLegacyConfigOptions>(); | ||
| }); | ||
|
|
||
| it('should narrow serverConfig to JourneyServerConfig', () => { | ||
| expectTypeOf<JourneyClientConfig['serverConfig']>().toMatchTypeOf<JourneyServerConfig>(); | ||
| expectTypeOf<JourneyClientConfig['serverConfig']['wellknown']>().toBeString(); | ||
| }); | ||
|
|
||
| it('should reject config without wellknown', () => { | ||
| // @ts-expect-error - wellknown is required on serverConfig | ||
| const config: JourneyClientConfig = { serverConfig: {} }; | ||
| expectTypeOf(config).toMatchTypeOf<JourneyClientConfig>(); | ||
| }); | ||
|
|
||
| it('should allow AsyncLegacyConfigOptions properties', () => { | ||
| const config: JourneyClientConfig = { | ||
| clientId: 'test-client', | ||
| scope: 'openid profile', | ||
| redirectUri: 'https://app.example.com/callback', | ||
| serverConfig: { | ||
| wellknown: 'https://am.example.com/am/oauth2/alpha/.well-known/openid-configuration', | ||
| timeout: 30000, | ||
| }, | ||
| }; | ||
| expectTypeOf(config).toMatchTypeOf<JourneyClientConfig>(); | ||
| }); | ||
|
|
||
| it('should not require inherited properties like clientId', () => { | ||
| const config: JourneyClientConfig = { | ||
| serverConfig: { | ||
| wellknown: 'https://am.example.com/am/oauth2/alpha/.well-known/openid-configuration', | ||
| }, | ||
| }; | ||
| expectTypeOf(config).toMatchTypeOf<JourneyClientConfig>(); | ||
| }); | ||
|
|
||
| it('should have optional timeout on serverConfig', () => { | ||
| expectTypeOf<JourneyClientConfig['serverConfig']>().toHaveProperty('timeout'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('InternalJourneyClientConfig', () => { | ||
| it('should have ResolvedServerConfig', () => { | ||
| expectTypeOf<InternalJourneyClientConfig>() | ||
| .toHaveProperty('serverConfig') | ||
| .toMatchTypeOf<ResolvedServerConfig>(); | ||
| }); | ||
|
|
||
| it('should have optional error', () => { | ||
| expectTypeOf<InternalJourneyClientConfig>().toHaveProperty('error').toBeNullable(); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
serverConfig.timeoutis silently ignored without a warning.JourneyServerConfignow acceptstimeout, but this warning path only checks top-level keys. Since onlywellknownis read later,timeoutis effectively ignored with no signal to callers.🔧 Proposed fix
const ignoredProperties = [ 'callbackFactory', 'clientId', 'middleware', 'oauthThreshold', 'platformHeader', 'prefix', 'realmPath', 'redirectUri', 'scope', 'tokenStore', 'tree', 'type', ] as const; - const providedIgnored = ignoredProperties.filter((prop) => config[prop] !== undefined); + const providedIgnored = ignoredProperties.filter( + (prop) => Object.prototype.hasOwnProperty.call(config, prop) && config[prop] !== undefined, + ); + + if (config.serverConfig?.timeout !== undefined) { + providedIgnored.push('serverConfig.timeout' as (typeof ignoredProperties)[number]); + } if (providedIgnored.length > 0) { log.warn( `The following configuration properties are not used by journey-client and will be ignored: ${providedIgnored.join(', ')}`, ); }🤖 Prompt for AI Agents