-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Saml redirect mfe #36197
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
Saml redirect mfe #36197
Conversation
|
Thanks for the pull request, @leoaulasneo98! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
|
Hi, @leoaulasneo98. While we do a code review of this change, could you look into getting a signed Contributor Agreement? That's necessarily a blocker before we can merge. Thank you, and welcome! |
9f8c0a9 to
967a981
Compare
Hello, thank you very much, I will then follow the indicated steps |
@leoaulasneo98 you can be added to the existing entity CLA (agreement) we have with Aulasneo. Please ask your manager to send the request to oscm@axim.org. Thanks! |
|
|
@leoaulasneo98 hi there! You can try running the checks again on this, as your CLA has been processed. |
Hi Michelle, yes sure. Sorry for not answering, I'm already processing it. |
The original request was that enterprise users with tpa hint and SAML should not be redirected to MFE. The current condition also excludes regular non-enterprise users with SAML authentication from the MFE.
This test validates the conditional redirection to the authentication microfrontend (MFE) for enterprise and SAML authentication scenarios. The test covers different combinations of: - Enterprise customer presence - Third-party authentication provider - SAML provider status - Redirection setting Ensures that enterprise customers with SAML providers are not redirected to the authentication MFE, while other scenarios follow the standard redirection rules.
967a981 to
affb44a
Compare
fe623d6 to
5d69279
Compare
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.
PR Overview
This pull request fixes a bug in the authentication microfrontend redirection logic for enterprise users authenticating via SAML. The changes include adding parameterized tests in test_logistration.py to cover enterprise SAML redirection scenarios and updating the redirection condition in login_form.py to prevent redirecting enterprise SAML users to the authentication MFE.
Reviewed Changes
| File | Description |
|---|---|
| openedx/core/djangoapps/user_authn/views/tests/test_logistration.py | Added tests to verify redirection behavior for enterprise customers using SAML authentication |
| openedx/core/djangoapps/user_authn/views/login_form.py | Modified redirection logic to bypass MFE redirection for enterprise SAML users |
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
openedx/core/djangoapps/user_authn/views/login_form.py:200
- [nitpick] The combined condition may be hard to read and could risk misinterpretation of the intended logic. Consider refactoring or breaking up the condition into clearer, separately named sub-conditions to improve maintainability.
if should_redirect_to_authn_microfrontend() and not (enterprise_customer and tpa_hint_provider and saml_provider):
openedx/core/djangoapps/user_authn/views/login_form.py:190
- [nitpick] The inline comment above the redirection condition could be more explicit by stating that redirection is skipped only if all three conditions (enterprise customer, tpa_hint_provider, and SAML provider) are met. Clarifying this would help maintainers understand the updated logic.
# except if user is an enterprise user with tpa_hint_provider coming from a SAML IDP.
|
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
|
2U Release Notice: This PR has been deployed to the edX production environment. |
* fix: Redirect non-enterprise SAML to authn MFE The original request was that enterprise users with tpa hint and SAML should not be redirected to MFE. The current condition also excludes regular non-enterprise users with SAML authentication from the MFE. * test: Add test for enterprise SAML authentication MFE redirection logic This test validates the conditional redirection to the authentication microfrontend (MFE) for enterprise and SAML authentication scenarios. The test covers different combinations of: - Enterprise customer presence - Third-party authentication provider - SAML provider status - Redirection setting Ensures that enterprise customers with SAML providers are not redirected to the authentication MFE, while other scenarios follow the standard redirection rules. * fix: change spaced between line codes in test_logistration.py --------- Co-authored-by: Andrés González <andres@aulasneo.com>
* fix: Redirect non-enterprise SAML to authn MFE The original request was that enterprise users with tpa hint and SAML should not be redirected to MFE. The current condition also excludes regular non-enterprise users with SAML authentication from the MFE. * test: Add test for enterprise SAML authentication MFE redirection logic This test validates the conditional redirection to the authentication microfrontend (MFE) for enterprise and SAML authentication scenarios. The test covers different combinations of: - Enterprise customer presence - Third-party authentication provider - SAML provider status - Redirection setting Ensures that enterprise customers with SAML providers are not redirected to the authentication MFE, while other scenarios follow the standard redirection rules. * fix: change spaced between line codes in test_logistration.py --------- Co-authored-by: Andrés González <andres@aulasneo.com>
This reverts commit 0a05dc2.
* fix: Redirect non-enterprise SAML to authn MFE The original request was that enterprise users with tpa hint and SAML should not be redirected to MFE. The current condition also excludes regular non-enterprise users with SAML authentication from the MFE. * test: Add test for enterprise SAML authentication MFE redirection logic This test validates the conditional redirection to the authentication microfrontend (MFE) for enterprise and SAML authentication scenarios. The test covers different combinations of: - Enterprise customer presence - Third-party authentication provider - SAML provider status - Redirection setting Ensures that enterprise customers with SAML providers are not redirected to the authentication MFE, while other scenarios follow the standard redirection rules. * fix: change spaced between line codes in test_logistration.py --------- Co-authored-by: Andrés González <andres@aulasneo.com>
This reverts commit 0a05dc2.
…penedx#36554) This reverts commit 447cd79.
…6550)" (openedx#36554)" (openedx#36569) This reverts commit 51a48b4.
* fix: Redirect non-enterprise SAML to authn MFE The original request was that enterprise users with tpa hint and SAML should not be redirected to MFE. The current condition also excludes regular non-enterprise users with SAML authentication from the MFE. * test: Add test for enterprise SAML authentication MFE redirection logic This test validates the conditional redirection to the authentication microfrontend (MFE) for enterprise and SAML authentication scenarios. The test covers different combinations of: - Enterprise customer presence - Third-party authentication provider - SAML provider status - Redirection setting Ensures that enterprise customers with SAML providers are not redirected to the authentication MFE, while other scenarios follow the standard redirection rules. * fix: change spaced between line codes in test_logistration.py --------- Co-authored-by: Andrés González <andres@aulasneo.com>
Description
This pull request fixes a bug in the authentication microfrontend (MFE) redirection logic. It ensures that enterprise users who are authenticating via a SAML identity provider are not incorrectly redirected to the MFE.
The change involves modifying the should_redirect_to_authn_microfrontend() function to add an additional check for the presence of an enterprise customer and a SAML-based third-party authentication provider. If both conditions are met, the user will not be redirected to the MFE, and the authentication flow will be handled within the LMS.
This change impacts "Developer" and "Operator" roles, as it affects the authentication and authorization logic within the Open edX platform.
Supporting information
The issue was discovered during internal testing and is not currently reported in any public issue trackers. The change is based on the analysis and solution proposed in the following commits:
Commit 1: Redirect non-enterprise SAML to authn MFE
Commit 2: Add test for enterprise SAML authentication MFE redirection logic
Testing instructions
To test this change:
Ensure the authentication MFE is enabled in your Open edX environment.
Create a test enterprise customer in the platform.
Configure a SAML identity provider for the enterprise customer.
Authenticate as a user who belongs to the enterprise customer and is using the SAML provider.
Verify that the user is not redirected to the authentication MFE, but instead the authentication flow is handled within the LMS.
Repeat the test with a non-enterprise user who is authenticating via SAML. Ensure they are redirected to the authentication MFE.
Deadline
There is no urgent deadline for this change. It can be included in the next scheduled release of the Open edX platform.
Other information
This change does not depend on any other changes elsewhere in the codebase. There are no special concerns or limitations, and the change does not involve any database migrations. CopyRetryClaude does not have internet access. Links provided may not be accurate or up to date.