di.xml 4.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?xml version="1.0"?>
  2. <!--
  3. /**
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. -->
  8. <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
  9. <type name="Magento\Webapi\Model\Authorization\OauthUserContext">
  10. <arguments>
  11. <argument name="request" xsi:type="object">Magento\Framework\Webapi\Rest\Request</argument>
  12. </arguments>
  13. </type>
  14. <type name="Magento\Authorization\Model\CompositeUserContext">
  15. <arguments>
  16. <argument name="userContexts" xsi:type="array">
  17. <item name="tokenUserContext" xsi:type="array">
  18. <item name="type" xsi:type="object">Magento\Webapi\Model\Authorization\TokenUserContext</item>
  19. <item name="sortOrder" xsi:type="string">10</item>
  20. </item>
  21. <item name="oauthUserContext" xsi:type="array">
  22. <item name="type" xsi:type="object">Magento\Webapi\Model\Authorization\OauthUserContext</item>
  23. <item name="sortOrder" xsi:type="string">40</item>
  24. </item>
  25. <item name="guestUserContext" xsi:type="array">
  26. <item name="type" xsi:type="object">Magento\Webapi\Model\Authorization\GuestUserContext</item>
  27. <item name="sortOrder" xsi:type="string">100</item>
  28. </item>
  29. </argument>
  30. </arguments>
  31. </type>
  32. <preference for="Magento\Framework\App\FrontControllerInterface" type="Magento\Webapi\Controller\Rest" />
  33. <preference for="Magento\Framework\Model\ActionValidator\RemoveAction" type="Magento\Framework\Model\ActionValidator\RemoveAction\Allowed" />
  34. <type name="Magento\Webapi\Controller\Rest\Router\Route" shared="false" />
  35. <type name="Magento\Webapi\Controller\Rest">
  36. <arguments>
  37. <argument name="request" xsi:type="object">Magento\Framework\Webapi\Rest\Request\Proxy</argument>
  38. <argument name="response" xsi:type="object">Magento\Framework\Webapi\Rest\Response\Proxy</argument>
  39. <argument name="router" xsi:type="object">Magento\Webapi\Controller\Rest\Router\Proxy</argument>
  40. <argument name="oauthHelper" xsi:type="object">Magento\Framework\Oauth\Helper\Request\Proxy</argument>
  41. </arguments>
  42. </type>
  43. <preference for="Magento\Framework\Authorization\RoleLocatorInterface" type="Magento\Webapi\Model\WebapiRoleLocator" />
  44. <type name="Magento\Framework\Authorization">
  45. <plugin name="guestAuthorization" type="Magento\Webapi\Model\Plugin\GuestAuthorization" />
  46. </type>
  47. <!-- Configuration to check that the permissions are checked on fields -->
  48. <virtualType name="Magento\Framework\Reflection\ExtensionAttributesProcessorPermissionChecked" type="Magento\Framework\Reflection\ExtensionAttributesProcessor">
  49. <arguments>
  50. <argument name="isPermissionChecked" xsi:type="boolean">true</argument>
  51. <argument name="dataObjectProcessor" xsi:type="object">Magento\Framework\Reflection\DataObjectProcessor\Proxy</argument>
  52. </arguments>
  53. </virtualType>
  54. <virtualType name="Magento\Framework\Reflection\DataObjectProcessorPermissionChecked" type="Magento\Framework\Reflection\DataObjectProcessor">
  55. <arguments>
  56. <argument name="extensionAttributesProcessor" xsi:type="object">Magento\Framework\Reflection\ExtensionAttributesProcessorPermissionChecked</argument>
  57. <argument name="customAttributesProcessor" xsi:type="object">Magento\Framework\Reflection\CustomAttributesProcessor\Proxy</argument>
  58. </arguments>
  59. </virtualType>
  60. <type name="Magento\Customer\Model\Authorization\CustomerSessionUserContext">
  61. <plugin name="webApiCustomerSessionUserContext" type="Magento\Webapi\Model\Plugin\Authorization\CustomerSessionUserContext" />
  62. </type>
  63. <type name="Magento\Framework\Webapi\ServiceOutputProcessor">
  64. <arguments>
  65. <argument name="dataObjectProcessor" xsi:type="object">Magento\Framework\Reflection\DataObjectProcessorPermissionChecked</argument>
  66. </arguments>
  67. </type>
  68. <!-- End of configuration to check that permissions are checked on fields -->
  69. <preference for="Magento\Webapi\Controller\Rest\RequestProcessorInterface" type="Magento\Webapi\Controller\Rest\RequestProcessorPool" />
  70. <type name="Magento\Webapi\Controller\Rest\RequestProcessorPool">
  71. <arguments>
  72. <argument name="requestProcessors" xsi:type="array">
  73. <item name="syncSchema" xsi:type="object" sortOrder="50">Magento\Webapi\Controller\Rest\SchemaRequestProcessor</item>
  74. <item name="sync" xsi:type="object" sortOrder="100">Magento\Webapi\Controller\Rest\SynchronousRequestProcessor</item>
  75. </argument>
  76. </arguments>
  77. </type>
  78. </config>