Skip to content

SSO Success screen, enhancements#1045

Open
shobhit-cstk wants to merge 4 commits intodevfrom
feature/CMG-854
Open

SSO Success screen, enhancements#1045
shobhit-cstk wants to merge 4 commits intodevfrom
feature/CMG-854

Conversation

@shobhit-cstk
Copy link
Copy Markdown

No description provided.

…nfig

- Extract and map Contentful taxonomies from export; upload-api and mapper integration
- Contentful service: field/widget helpers, taxonomy metadata locale resolution (mapper + sys.locale)
- API: Vitest thresholds; migration and user unit tests (SSO, createTaxonomy mocks)
- app.json placeholder updates and related fixes
…ganization validation

- Updated saveOAuthToken to render HTML success and error pages upon OAuth token exchange.
- Introduced organization validation to ensure the correct organization is linked during authorization.
- Normalized Contentstack OAuth URLs to avoid issues with hash-style URLs.
- Added utility functions for building HTML responses and escaping text for safety.
- Enhanced the Login component to handle SSO success and error notifications.
- Added unit tests for new utility functions and updated existing tests for auth controller.
@shobhit-cstk shobhit-cstk requested a review from a team as a code owner April 21, 2026 12:08
…ty tests

- Decreased the branch coverage threshold from 56 to 55 in Vitest configuration.
- Added a new test case to the contentstack-oauth-url utility to handle empty or non-string inputs correctly.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the SSO/OAuth user experience (success screen + HTML callback pages) and extends the Contentful migration pipeline to extract/propagate taxonomy metadata into the API/UI mapping flow.

Changes:

  • Add OAuth callback HTML success/error pages and SSO org-mismatch handling across API + UI.
  • Add Contentful taxonomy extraction/serialization and include taxonomy data in mapper payloads and migration processing.
  • Refactor Content Mapper field re-hydration logic (incl. modular blocks) and adjust related dependency/test configs.

Reviewed changes

Copilot reviewed 28 out of 30 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
upload-api/src/services/contentful/index.ts Runs taxonomy extraction and includes taxonomies in mapper payload to the API.
upload-api/src/config/index.ts Updates default localPath placeholder.
upload-api/migration-contentful/libs/extractTaxonomy.js New helper to derive taxonomy schemes from Contentful export metadata and write a schema file.
upload-api/migration-contentful/libs/createInitialMapper.js Injects taxonomy field rows into the initial mapper based on Contentful content-type metadata.
upload-api/migration-contentful/index.js Exposes extractTaxonomy from the migration-contentful library.
ui/src/utilities/functions.ts Adds “persist” option to error toast helper.
ui/src/pages/Login/index.tsx Adds SSO success screen, improved polling cancellation, and OAuth callback postMessage handling.
ui/src/pages/Login/index.scss Styles for the SSO success screen.
ui/src/components/ContentMapper/index.tsx Refactors matching logic (esp. modular blocks) when rehydrating mappings.
api/src/controllers/auth.controller.ts /save-token now responds with HTML success/error pages (redirect flow) instead of JSON.
api/src/services/auth.service.ts Validates authorized org, normalizes authorize URL, improves org mismatch messaging.
api/src/utils/oauth-callback-html.utils.ts New HTML generators for OAuth callback success/error pages (incl. opener notification).
api/src/utils/contentstack-oauth-url.utils.ts Normalizes hash-style authorize URLs to path-style.
api/src/services/contentful/taxonomy.service.ts New Contentful taxonomy extraction into migration data layout.
api/src/services/contentful.service.ts Adds taxonomy assignment handling for entry metadata and wires taxonomy file generation.
api/src/services/migration.service.ts Calls Contentful taxonomy creation before entry creation in migrations.
api/src/services/contentMapper.service.ts Adds fallback to read Contentful taxonomies from upload-api’s generated schema file.
api/src/routes/auth.routes.ts Updates route documentation for OAuth callback.
api/tests/unit/* Adds/updates unit tests for new OAuth utilities and SSO/org-match behavior.
api/vitest.config.ts Lowers coverage thresholds slightly.
api/package.json + lockfiles Dependency and lockfile updates.
app.json Updates example SSO config values/timestamp.
Files not reviewed (2)
  • api/package-lock.json: Language not supported
  • upload-api/migration-aem/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

api/src/routes/auth.routes.ts:49

  • The JSDoc @route here says GET /save-token, but this router is mounted under /v2/auth (see src/server.ts), so the actual route is GET /v2/auth/save-token. Please update the comment to reflect the real public path to avoid misleading docs/consumers.
/**
 * OAuth redirect_uri: exchanges code, saves tokens, responds with HTML success page (or HTML error page).
 * @route GET /save-token
 */
router.get(
  "/save-token",
  asyncRouter(authController.saveOAuthToken)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread api/src/utils/oauth-callback-html.utils.ts
Comment thread upload-api/migration-contentful/libs/extractTaxonomy.js Outdated
Comment thread api/src/services/contentful/taxonomy.service.ts Outdated
Comment thread ui/src/utilities/functions.ts
Comment thread ui/src/pages/Login/index.tsx
Comment thread ui/src/pages/Login/index.tsx Outdated
Comment thread ui/src/pages/Login/index.tsx
Comment thread api/src/utils/oauth-callback-html.utils.ts
Comment thread api/src/services/contentful/taxonomy.service.ts Outdated
Comment thread api/src/services/contentful/taxonomy.service.ts Outdated
Comment thread api/src/services/contentful/taxonomy.service.ts Outdated
Comment thread api/src/services/contentful/taxonomy.service.ts Outdated
Comment thread api/src/services/contentful/taxonomy.service.ts Outdated
Comment thread api/tests/unit/services/user.service.test.ts Outdated
Comment thread api/tests/unit/utils/contentstack-oauth-url.utils.test.ts
Comment thread ui/src/components/ContentMapper/index.tsx
Comment thread ui/src/pages/Login/index.tsx
Comment thread ui/src/pages/Login/index.tsx
- Moved region configuration to a dedicated constants file for better organization and maintainability.
- Updated various services and components to utilize the new REGION_CONFIG, ensuring optional chaining is applied for safer access to properties.
- Corrected the spelling of 'failureNotification' in multiple locations for consistency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants