Skip to content

Remove trusted_issuer and enable runtime SDK overrides via sdk config block#3078

Open
JayaShakthi97 wants to merge 1 commit into
thunder-id:mainfrom
JayaShakthi97:feature/console-sdk-config-override
Open

Remove trusted_issuer and enable runtime SDK overrides via sdk config block#3078
JayaShakthi97 wants to merge 1 commit into
thunder-id:mainfrom
JayaShakthi97:feature/console-sdk-config-override

Conversation

@JayaShakthi97
Copy link
Copy Markdown
Contributor

@JayaShakthi97 JayaShakthi97 commented May 29, 2026

Purpose

Removes the trusted_issuer first-class config key from the console in favour of the sdk block introduced in #2991. Operators can configure baseUrl, clientId, scopes, signInOptions, preferences, and sendCookiesInRequests directly in the sdk block without needing a separate config key.

Approach

Removed TrustedIssuerConfig and all related types, context methods, and conditional logic:

  • TrustedIssuerConfig type and trusted_issuer field from ProductConfig
  • getTrustedIssuerUrl, getTrustedIssuerClientId, getTrustedIssuerScopes, isTrustedIssuerGenericOidc from ConfigContextType and ConfigProvider
  • All trusted_issuer-driven conditional logic in withConfig.tsx
  • Generic-OIDC custom sign-out path in DashboardLayout.tsx
  • trusted_issuer Helm template block in install/helm/conf/apps/console/config.js
  • All related tests

Updated docs/content/guides/guides/trusted-issuer.mdx to document the equivalent sdk block configuration pattern.

Related Issues

Related PRs

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided.
    • Ran Vale and fixed all errors and warnings
  • Tests provided.
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards in WSO2 Secure Coding Guidelines
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

Summary by CodeRabbit

  • Documentation

    • Updated console authentication guide and Helm examples to use the new SDK-based runtime configuration and updated troubleshooting guidance.
  • Refactor

    • Simplified console auth and sign-out flows to rely on the SDK configuration model and removed legacy trusted-issuer behavior.
  • Tests

    • Streamlined and refocused tests to validate env defaults and SDK override behavior.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a092e32-66eb-43ad-a10b-998041263e5e

📥 Commits

Reviewing files that changed from the base of the PR and between 1853771 and 7091694.

📒 Files selected for processing (12)
  • docs/content/guides/guides/trusted-issuer.mdx
  • frontend/apps/console/src/__tests__/AppWithDecorators.test.tsx
  • frontend/apps/console/src/hocs/__tests__/withConfig.test.tsx
  • frontend/apps/console/src/hocs/withConfig.tsx
  • frontend/apps/console/src/layouts/DashboardLayout.tsx
  • frontend/apps/console/src/layouts/__tests__/DashboardLayout.test.tsx
  • frontend/packages/contexts/src/Config/ConfigContext.tsx
  • frontend/packages/contexts/src/Config/ConfigProvider.tsx
  • frontend/packages/contexts/src/Config/__tests__/ConfigProvider.test.tsx
  • frontend/packages/contexts/src/Config/types.ts
  • frontend/packages/contexts/src/index.ts
  • install/helm/conf/apps/console/config.js
💤 Files with no reviewable changes (4)
  • install/helm/conf/apps/console/config.js
  • frontend/packages/contexts/src/Config/tests/ConfigProvider.test.tsx
  • frontend/packages/contexts/src/Config/ConfigContext.tsx
  • frontend/packages/contexts/src/Config/ConfigProvider.tsx
✅ Files skipped from review due to trivial changes (1)
  • docs/content/guides/guides/trusted-issuer.mdx
🚧 Files skipped from review as they are similar to previous changes (5)
  • frontend/packages/contexts/src/index.ts
  • frontend/apps/console/src/layouts/DashboardLayout.tsx
  • frontend/apps/console/src/hocs/tests/withConfig.test.tsx
  • frontend/apps/console/src/hocs/withConfig.tsx
  • frontend/packages/contexts/src/Config/types.ts

📝 Walkthrough

Walkthrough

Removes trusted-issuer types and context helpers, switches console runtime and Helm wiring to an sdk runtime shape (config.sdk), refactors console HOC and layout to use config.sdk and env vars, updates tests and Helm template, and replaces docs with the new sdk guidance.

Changes

Trusted-Issuer Config Removal

Layer / File(s) Summary
Configuration API cleanup
frontend/packages/contexts/src/Config/types.ts, frontend/packages/contexts/src/Config/ConfigContext.tsx, frontend/packages/contexts/src/index.ts
TrustedIssuerConfig removed from types; ProductConfig no longer has trusted_issuer; ConfigContextType trimmed to end after getClientUuid; TrustedIssuerConfig removed from public re-exports.
Runtime template & provider value changes
install/helm/conf/apps/console/config.js, frontend/packages/contexts/src/Config/ConfigProvider.tsx, frontend/packages/contexts/src/Config/__tests__/ConfigProvider.test.tsx
Helm runtime template no longer emits a trusted_issuer block; ConfigProvider.contextValue no longer exposes trusted-issuer helper methods; provider tests updated to remove assertions for those helpers.
Console wiring, components, and tests
frontend/apps/console/src/hocs/withConfig.tsx, frontend/apps/console/src/hocs/__tests__/withConfig.test.tsx, frontend/apps/console/src/layouts/DashboardLayout.tsx, tests under frontend/apps/console/src/__tests__/*
withConfig now merges minimal sdkDefaults (discovery.wellKnown.enabled) with config.sdk and stops deriving identity props from trusted-issuer; ThunderIDProvider receives env-derived baseUrl/clientId and afterSignInUrl from getClientUrl() with fallback; scopes from trusted-issuer are omitted; DashboardLayout sign-out simplified to signOut()signIn(); tests and mocks updated to reflect config.sdk overrides and removed trusted-issuer behavior.
Documentation updates
docs/content/guides/guides/trusted-issuer.mdx
Docs replaced console runtime trusted_issuer example with an sdk block (baseUrl, clientId, scopes, signInOptions, preferences, sendCookiesInRequests), updated Helm values example to configuration.consoleClient.sdk, and adjusted troubleshooting guidance to reference consoleClient.sdk.baseUrl.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • thunder-id/thunderid#2991: Introduced config.sdk overrides and updated ThunderIDProvider wiring; directly related to the SDK-based approach used here.
  • thunder-id/thunderid#3073: Modifies withConfig merge implementation and related SDK merge behavior; potentially overlaps with this PR's config.sdk merging changes.
  • thunder-id/thunderid#2314: Previous work adding generic OIDC/trusted-issuer handling; may conflict with removals in this PR.

Suggested labels

Type/Docs, documentation

Suggested reviewers

  • jeradrutnam
  • DonOmalVindula
  • brionmario
  • rajithacharith
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: removing trusted_issuer configuration and enabling SDK config overrides, matching the primary objective of this PR.
Description check ✅ Passed The description covers Purpose, Approach with detailed removals/changes, Related Issues/PRs, and a comprehensive Checklist with most boxes checked; all key changes are documented.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

docs/content/guides/guides/trusted-issuer.mdx

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

frontend/apps/console/src/__tests__/AppWithDecorators.test.tsx

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

frontend/apps/console/src/hocs/__tests__/withConfig.test.tsx

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.

  • 5 others

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@JayaShakthi97 JayaShakthi97 force-pushed the feature/console-sdk-config-override branch from 18cfc1c to 1853771 Compare May 29, 2026 09:03
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
frontend/apps/console/src/hocs/withConfig.tsx (1)

27-27: ⚡ Quick win

Trusted-issuer getters remain only in test mocks; withConfig no longer uses them.

frontend/apps/console/src/hocs/withConfig.tsx only destructures getClientUrl and config from useConfig, so getTrustedIssuerUrl/getTrustedIssuerClientId/getTrustedIssuerScopes/isTrustedIssuerGenericOidc aren’t referenced there. The identifiers still appear in __tests__ useConfig mocks (e.g., frontend/apps/console/src/__tests__/AppWithDecorators.test.tsx and other */__tests__/*.test.tsx), so those mocks are likely stale and can be removed/trimmed if unused.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/apps/console/src/hocs/withConfig.tsx` at line 27, withConfig.tsx now
only uses useConfig's getClientUrl and config, so the trusted-issuer getters
(getTrustedIssuerUrl, getTrustedIssuerClientId, getTrustedIssuerScopes,
isTrustedIssuerGenericOidc) in the useConfig test mocks are stale; update the
tests by removing or trimming those unused mock properties (e.g., in
__tests__/AppWithDecorators.test.tsx and other */__tests__/*.test.tsx) so mocks
only provide getClientUrl and config (and any other actually used keys),
ensuring mock shapes match what withConfig.tsx and useConfig() expect.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/content/guides/guides/trusted-issuer.mdx`:
- Line 59: Replace the hardcoded brand literal "ThunderID-specific" inside the
fenced code block comment with the placeholder "{{ProductName}}-specific" so the
docs remain brand-agnostic; locate the fenced block containing the comment text
"and allow CORS-safe uncredentialed token requests." and update the comment
string "ThunderID-specific" to "{{ProductName}}-specific".
- Around line 144-155: The docs reference a Helm key
configuration.consoleClient.sdk (and fields like consoleClient.sdk.baseUrl)
which doesn’t match the current chart/runtime that exposes consoleClient.path,
clientId, scopes and renders only brand/client/server in
window.__THUNDERID_RUNTIME_CONFIG__; update the guide to match the actual chart
contract by replacing references to configuration.consoleClient.sdk and its
nested fields with the correct keys (consoleClient.path, consoleClient.clientId,
consoleClient.scopes, etc.) and show the exact runtime shape
(window.__THUNDERID_RUNTIME_CONFIG__ with brand/client/server and the
consoleClient keys), or alternatively update the chart to emit the sdk subtree
if you intend to keep the doc as-is—ensure all mentions (including the other
location noted) are made consistent.

In `@frontend/apps/console/src/hocs/__tests__/withConfig.test.tsx`:
- Around line 187-192: The test name claims merging but only replaces
preferences because sdkDefaults has no preferences; update the test to exercise
actual merge by ensuring sdkDefaults includes sibling keys (e.g., add a default
preferences object with another key like timeout or theme in the sdkDefaults
fixture) and then set mockConfig.sdk = {preferences: {resolveFromMeta: true}}
and assert that capturedProviderProps.preferences equals the merged object
containing both resolveFromMeta and the default sibling(s) (referencing
sdkDefaults, mockConfig.sdk, WithConfigComponent, and
capturedProviderProps.preferences), or alternatively rename the test to "sets
preferences" if you intend not to test merge behavior.

In `@frontend/packages/contexts/src/Config/types.ts`:
- Around line 162-165: The doc comment in ThunderIDProvider types incorrectly
says baseUrl, clientId, afterSignInUrl and scopes are "set from env vars";
update the comment to accurately reflect how values are sourced: state that only
baseUrl and clientId are pulled from env vars (via withConfig.tsx),
afterSignInUrl is derived from getClientUrl() with env as a fallback, and scopes
are not provided by env by default and only apply when supplied via config.sdk;
reference ThunderIDProvider, withConfig.tsx, getClientUrl(), and config.sdk so
the maintainer can locate and correct the comment accordingly.

---

Nitpick comments:
In `@frontend/apps/console/src/hocs/withConfig.tsx`:
- Line 27: withConfig.tsx now only uses useConfig's getClientUrl and config, so
the trusted-issuer getters (getTrustedIssuerUrl, getTrustedIssuerClientId,
getTrustedIssuerScopes, isTrustedIssuerGenericOidc) in the useConfig test mocks
are stale; update the tests by removing or trimming those unused mock properties
(e.g., in __tests__/AppWithDecorators.test.tsx and other */__tests__/*.test.tsx)
so mocks only provide getClientUrl and config (and any other actually used
keys), ensuring mock shapes match what withConfig.tsx and useConfig() expect.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b31ac2f4-bdf4-49c6-9fa9-7ad016f04189

📥 Commits

Reviewing files that changed from the base of the PR and between 111ad3c and 18cfc1c.

📒 Files selected for processing (10)
  • docs/content/guides/guides/trusted-issuer.mdx
  • frontend/apps/console/src/hocs/__tests__/withConfig.test.tsx
  • frontend/apps/console/src/hocs/withConfig.tsx
  • frontend/apps/console/src/layouts/DashboardLayout.tsx
  • frontend/packages/contexts/src/Config/ConfigContext.tsx
  • frontend/packages/contexts/src/Config/ConfigProvider.tsx
  • frontend/packages/contexts/src/Config/__tests__/ConfigProvider.test.tsx
  • frontend/packages/contexts/src/Config/types.ts
  • frontend/packages/contexts/src/index.ts
  • install/helm/conf/apps/console/config.js
💤 Files with no reviewable changes (4)
  • frontend/packages/contexts/src/Config/tests/ConfigProvider.test.tsx
  • install/helm/conf/apps/console/config.js
  • frontend/packages/contexts/src/Config/ConfigContext.tsx
  • frontend/packages/contexts/src/Config/ConfigProvider.tsx

type: "generic",
signInOptions: {resource: "https://<this-thunderid-instance-url>"},
// For generic OIDC providers: suppress ThunderID-specific bootstrap calls
// and allow CORS-safe uncredentialed token requests.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Replace hardcoded ThunderID in docs code snippet commentary.

Line 59 uses a hardcoded brand literal (ThunderID-specific) in a fenced block comment. Replace it with {{ProductName}}-specific so docs remain brand-agnostic.

As per coding guidelines: “docs/**: Scan for hardcoded occurrences of Thunder or ThunderID… flag every occurrence as a major issue… .mdx fenced code blocks… Product name → {{ProductName}} placeholder.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/content/guides/guides/trusted-issuer.mdx` at line 59, Replace the
hardcoded brand literal "ThunderID-specific" inside the fenced code block
comment with the placeholder "{{ProductName}}-specific" so the docs remain
brand-agnostic; locate the fenced block containing the comment text "and allow
CORS-safe uncredentialed token requests." and update the comment string
"ThunderID-specific" to "{{ProductName}}-specific".

Comment thread docs/content/guides/guides/trusted-issuer.mdx
Comment on lines +187 to 192
it('merges config.sdk.preferences, preserving unspecified sibling keys', () => {
mockConfig.sdk = {preferences: {resolveFromMeta: true}};

render(<WithConfigComponent />);
expect(capturedProviderProps.preferences).toEqual({
resolveFromMeta: false,
theme: {inheritFromBranding: false},
});
expect(capturedProviderProps.preferences).toEqual({resolveFromMeta: true});
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Test name claims merge behavior it doesn't exercise.

sdkDefaults contains no preferences, so there are no default sibling keys to preserve — the result is simply config.sdk.preferences verbatim, identical to the earlier "sets preferences" test. As written it gives false confidence that nested merge preserves siblings (which ties directly to the deep-vs-shallow merge question). Either rename it to reflect that it just sets preferences, or restructure to actually assert sibling preservation against a known default.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/apps/console/src/hocs/__tests__/withConfig.test.tsx` around lines
187 - 192, The test name claims merging but only replaces preferences because
sdkDefaults has no preferences; update the test to exercise actual merge by
ensuring sdkDefaults includes sibling keys (e.g., add a default preferences
object with another key like timeout or theme in the sdkDefaults fixture) and
then set mockConfig.sdk = {preferences: {resolveFromMeta: true}} and assert that
capturedProviderProps.preferences equals the merged object containing both
resolveFromMeta and the default sibling(s) (referencing sdkDefaults,
mockConfig.sdk, WithConfigComponent, and capturedProviderProps.preferences), or
alternatively rename the test to "sets preferences" if you intend not to test
merge behavior.

Comment on lines 162 to +165
* Accepts any valid ThunderIDProvider prop. Values are deep-merged on top of
* the defaults derived from the application config, so only fields that need
* to differ from the computed defaults must be specified.
* `config.sdk` takes the highest precedence — it overrides both the defaults
* derived from `trusted_issuer` and the identity-related props (baseUrl,
* clientId, afterSignInUrl, scopes) resolved from the server/client config.
* the application defaults, so only fields that need to differ must be specified.
* `config.sdk` takes the highest precedence — it overrides the identity-related
* props (baseUrl, clientId, afterSignInUrl, scopes) set from env vars.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Doc comment overstates which props are "set from env vars".

Cross-referencing withConfig.tsx: only baseUrl/clientId come from env vars. afterSignInUrl is derived from getClientUrl() (env is only the fallback), and scopes is not set by default at all — it only exists when supplied via config.sdk. Listing afterSignInUrl and scopes as env-derived props may send operators looking for a non-existent scopes env var.

📝 Suggested wording
- * `config.sdk` takes the highest precedence — it overrides the identity-related
- * props (baseUrl, clientId, afterSignInUrl, scopes) set from env vars.
+ * `config.sdk` takes the highest precedence — it overrides the identity-related
+ * props derived elsewhere: `baseUrl`/`clientId` (from env vars), `afterSignInUrl`
+ * (from the resolved client URL, with an env-var fallback), and `scopes`.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* Accepts any valid ThunderIDProvider prop. Values are deep-merged on top of
* the defaults derived from the application config, so only fields that need
* to differ from the computed defaults must be specified.
* `config.sdk` takes the highest precedence it overrides both the defaults
* derived from `trusted_issuer` and the identity-related props (baseUrl,
* clientId, afterSignInUrl, scopes) resolved from the server/client config.
* the application defaults, so only fields that need to differ must be specified.
* `config.sdk` takes the highest precedence it overrides the identity-related
* props (baseUrl, clientId, afterSignInUrl, scopes) set from env vars.
* Accepts any valid ThunderIDProvider prop. Values are deep-merged on top of
* the application defaults, so only fields that need to differ must be specified.
* `config.sdk` takes the highest precedence it overrides the identity-related
* props derived elsewhere: `baseUrl`/`clientId` (from env vars), `afterSignInUrl`
* (from the resolved client URL, with an env-var fallback), and `scopes`.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/packages/contexts/src/Config/types.ts` around lines 162 - 165, The
doc comment in ThunderIDProvider types incorrectly says baseUrl, clientId,
afterSignInUrl and scopes are "set from env vars"; update the comment to
accurately reflect how values are sourced: state that only baseUrl and clientId
are pulled from env vars (via withConfig.tsx), afterSignInUrl is derived from
getClientUrl() with env as a fallback, and scopes are not provided by env by
default and only apply when supplied via config.sdk; reference
ThunderIDProvider, withConfig.tsx, getClientUrl(), and config.sdk so the
maintainer can locate and correct the comment accordingly.

The trusted_issuer block in config.js let operators point the console at
an external auth server, but it duplicated what the sdk block (introduced
in thunder-id#2991) already provides. Operators can now supply baseUrl, clientId,
scopes, signInOptions, preferences, and sendCookiesInRequests directly
via sdk without needing a separate first-class config key.

Removed:
- TrustedIssuerConfig type and trusted_issuer field from ProductConfig
- getTrustedIssuerUrl, getTrustedIssuerClientId, getTrustedIssuerScopes,
  isTrustedIssuerGenericOidc from ConfigContextType and ConfigProvider
- All trusted_issuer-driven conditional logic in withConfig.tsx
- Generic-OIDC custom sign-out path in DashboardLayout.tsx
- trusted_issuer Helm template block in install/helm/conf/apps/console/config.js
- All related tests

Updated docs/content/guides/guides/trusted-issuer.mdx to describe the
equivalent sdk block configuration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@JayaShakthi97 JayaShakthi97 force-pushed the feature/console-sdk-config-override branch from 1853771 to 7091694 Compare May 29, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant