Skip to content

magento/magento2#: Remove oauthUserContext from app/code/Magento/GraphQl/etc/graphql/di.xml #27373

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

Conversation

atwixfirster
Copy link
Contributor

@atwixfirster atwixfirster commented Mar 20, 2020

Description (*)

Issue:
With an active customer's cookies and empty Authorization token GraphQl uses cookies to retrieve a type of user and it's ID.

27373

That's incorrect behavior because GraphQl should use an Authorization token ONLY to retrieve a type of user and it's ID.

Technical details:
Magento_Customer/etc/graphql/di.xml adds customerSessionUserContext into \Magento\Authorization\Model\CompositeUserContext. It allows to retrieves a customer ID from the session (cookies) wihtin GraphQl operations.

Related Pull Requests

Fixed Issues (if relevant)

  1. GraphQl. Retrieve customer's shopping cart without an authorization token #28040: GraphQl. Retrieve customer's shopping cart without an authorization token

Manual testing scenarios (*)

Preconditions:

  • Cloud environment
  • PWA and Magento installed on the same <Magento_root> folder
  • PWA and Magento are available for user per configured Magento_UpwardConnector
  1. PWA storefront: login as registered user
  2. PWA storefront: as a customer please add any product into shopping cart
  3. Open a new tab in the same browser window and login as a registered customer in Magento standard storefront
  4. PWA storefront: customer makes a logout
  5. PWA storefront: verify Shopping cart.

Actual result: guest sees a product which customer has been added into shopping cart. Current quote as a masked quote ID of registered customer.

Expected result: a new guest quote has been created after customer's logout.

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@magento-engcom-team magento-engcom-team added Component: Customer Release Line: 2.4 Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner labels Mar 20, 2020
@dmytro-ch dmytro-ch self-assigned this Mar 20, 2020
@atwixfirster
Copy link
Contributor Author

atwixfirster commented Mar 25, 2020

Failed Functional tests are not tie to the PR changes.

@atwixfirster atwixfirster force-pushed the graphql-remove-customerSessionUserContext branch 2 times, most recently from b8d9aba to e601c74 Compare March 25, 2020 19:46
Copy link
Contributor

@dmytro-ch dmytro-ch left a comment

Choose a reason for hiding this comment

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

Hello @atwixfirster, thank you for your contribution!
Due to Magento Definition of Done the changes should be covered by automated tests. Could you please cover this case by API functional test?
Thank you!

@atwixfirster atwixfirster changed the title magento/magento2#: Remove customerSessionUserContext from \Magento\Authorization\Model\CompositeUserContext in GraphQl operations magento/magento2#28040: Remove customerSessionUserContext from \Magento\Authorization\Model\CompositeUserContext in GraphQl operations Apr 29, 2020
@atwixfirster atwixfirster force-pushed the graphql-remove-customerSessionUserContext branch from 5c57d52 to 7361a79 Compare April 29, 2020 14:54
@atwixfirster
Copy link
Contributor Author

Could you please cover this case by API functional test?

done

Thank you, @dmytro-ch

@ghost ghost added Severity: S1 Affects critical data or functionality and forces users to employ a workaround. Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. labels Apr 29, 2020
@lenaorobei lenaorobei closed this Apr 30, 2020
@m2-assistant
Copy link

m2-assistant bot commented Apr 30, 2020

Hi @atwixfirster, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@lenaorobei lenaorobei reopened this Apr 30, 2020
@m2-assistant
Copy link

m2-assistant bot commented Apr 30, 2020

Hi @atwixfirster. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

Copy link
Contributor

@lenaorobei lenaorobei left a comment

Choose a reason for hiding this comment

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

Please see comment #28040 (comment)

Could you please remove oauthUserContext from the ce/app/code/Magento/GraphQl/etc/graphql/di.xml:18 instead.

…thorization\Model\CompositeUserContext in GraphQl operations
@atwixfirster atwixfirster force-pushed the graphql-remove-customerSessionUserContext branch from 429aad8 to b96c8e9 Compare May 2, 2020 17:05
@atwixfirster atwixfirster changed the title magento/magento2#28040: Remove customerSessionUserContext from \Magento\Authorization\Model\CompositeUserContext in GraphQl operations magento/magento2#: Remove customerSessionUserContext from \Magento\Authorization\Model\CompositeUserContext in GraphQl operations May 2, 2020
@atwixfirster atwixfirster changed the title magento/magento2#: Remove customerSessionUserContext from \Magento\Authorization\Model\CompositeUserContext in GraphQl operations magento/magento2#: Remove oauthUserContext from app/code/Magento/GraphQl/etc/graphql/di.xml May 2, 2020
@atwixfirster
Copy link
Contributor Author

Could you please remove oauthUserContext from the ce/app/code/Magento/GraphQl/etc/graphql/di.xml:18 instead.

@lenaorobei ,

done

@magento-engcom-team
Copy link
Contributor

Hi @lenaorobei, thank you for the review.
ENGCOM-7512 has been created to process this Pull Request
✳️ @lenaorobei, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@dmytro-ch dmytro-ch added Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests Award: category of expertise labels May 6, 2020
@nrkapoor nrkapoor requested review from cpartica and dthampy May 8, 2020 21:57
@ghost ghost assigned dthampy May 13, 2020
@lenaorobei lenaorobei added Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests and removed Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests labels Jun 2, 2020
@lenaorobei lenaorobei added this to the 2.4.1 milestone Jun 2, 2020
magento-engcom-team pushed a commit that referenced this pull request Jun 5, 2020
@magento-engcom-team magento-engcom-team merged commit 9381f01 into magento:2.4-develop Jun 5, 2020
@m2-assistant
Copy link

m2-assistant bot commented Jun 5, 2020

Hi @atwixfirster, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@nrkapoor
Copy link

@danielrenaud @lenaorobei @paliarush Will this PR break the staging functionality in GraphQL?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Award: category of expertise Component: GraphQL GraphQL Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: accept Release Line: 2.4 Severity: S1 Affects critical data or functionality and forces users to employ a workaround.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants