Skip to content

fix: centralize authn MFE branding and remove duplicate context#226

Open
subhashree-sahu31 wants to merge 2 commits intorelease-ulmofrom
AUT-112-organization-names-not-being-recognized-in-sso-login-screen-hotfix
Open

fix: centralize authn MFE branding and remove duplicate context#226
subhashree-sahu31 wants to merge 2 commits intorelease-ulmofrom
AUT-112-organization-names-not-being-recognized-in-sso-login-screen-hotfix

Conversation

@subhashree-sahu31
Copy link
Copy Markdown

@subhashree-sahu31 subhashree-sahu31 commented Apr 10, 2026

PR Description

This PR fixes the circular import risk affecting enterprise SSO/Authn MFE context generation by removing duplicate MFE context logic and centralizing enterprise branding assembly.

Problem

The enterprise and authn utility modules had overlapping responsibility for building Authn MFE context. That duplication created a fragile import relationship between:

  • utils.py
  • utils.py

In some load paths, that increased the risk of circular imports and partial module initialization, which could affect enterprise SSO/org-name resolution.

Fix

  • Removed the duplicate get_mfe_context implementation from utils.py
  • Kept a single canonical get_mfe_context in utils.py
  • Added a focused helper in enterprise support utils to build the enterpriseBranding payload
  • Updated the authn get_mfe_context to call that helper via a function-scoped import

Why This Is Safe

  • No change to the Authn MFE response contract
  • No change to provider selection or auth flow behavior
  • Enterprise branding fields are still populated from the same sidebar context
  • enterpriseSlug is still included in enterpriseBranding
  • This change reduces duplication and removes the circular-import entrypoint

Validation

Verified that:

  • only one get_mfe_context remains in the codebase
  • the Authn MFE API still uses the canonical authn implementation
  • enterprise branding data is still present when an enterprise customer is resolved

##Testing

  • Enterprise login page load with org flow
  • TPA hinted login flow
  • Non-enterprise login flow
  • Authn MFE context endpoint response shape unchanged

JIRA

https://2u-internal.atlassian.net/browse/AUT-112

Copilot AI review requested due to automatic review settings April 10, 2026 07:51
Copy link
Copy Markdown

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 refactors how enterprise branding is assembled for the Authn MFE context by centralizing the branding payload construction in enterprise_support.utils, and removing a duplicate/obsolete get_mfe_context implementation from that module.

Changes:

  • Added build_enterprise_branding_for_authn_mfe helper to build the enterpriseBranding payload from existing sidebar context.
  • Updated openedx.core.djangoapps.user_authn.views.utils.get_mfe_context to use the new helper.
  • Removed the duplicate get_mfe_context implementation from openedx.features.enterprise_support.utils.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
openedx/features/enterprise_support/utils.py Removes duplicate MFE context builder; introduces centralized enterprise branding payload helper.
openedx/core/djangoapps/user_authn/views/utils.py Uses the new centralized branding helper when assembling Authn MFE context.

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

Copy link
Copy Markdown

@nakhan-sonata-afk nakhan-sonata-afk left a comment

Choose a reason for hiding this comment

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

I have reviewed it, fix looks good. Circular import is fixed by moving the import inside the function.

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.

4 participants