Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-22505

Basic auth does not work when extending REST API with eZ Publish 5.2

    XMLWordPrintable

Details

    Description

      Steps to reproduce:

      1. Set up basic auth for REST API:

      # ezpublish/config/security.yml
      ...
      ezpublish_rest:
      pattern: ^/api/ezp/v2
      stateless: true
      ezpublish_http_basic:
      realm: eZ Publish REST API
      

      2. Enable a suitable firewall rule e.g.

      access_control:
      - { path: ^/, roles: ROLE_USER }
      

      3. Extend REST API following the example provided on https://confluence.ez.no/display/EZP52/Extending+the+REST+API

      4. Try accessing REST API: /api/ezp/v2/my_rest_bundle/hello/myname. A "406 Not Acceptable" is returned.

      Response headers:

      Cache-Control no-cache
      Connection Keep-Alive
      Content-Type application/vnd.ez.api.ErrorMessage+xml
      Date Fri, 14 Mar 2014 00:07:18 GMT
      Keep-Alive timeout=5, max=100
      Server Apache/2.2.22 (Debian)
      Transfer-Encoding chunked
      X-Debug-Token b7b196
      X-Powered-By PHP/5.4.4-14+deb7u7
      status 406 Not Acceptable
      

      Symfony logs:

      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.request" to listener "SymfonyComponentHttpKernelEventListenerProfilerListener::onKernelRequest". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.request" to listener "eZBundleEzPublishCoreBundleEventListenerRequestEventListener::onKernelRequestSetup". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.request" to listener "SymfonyBundleFrameworkBundleEventListenerSessionListener::onKernelRequest". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.request" to listener "SymfonyComponentHttpKernelEventListenerFragmentListener::onKernelRequest". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.request" to listener "eZPublishCoreMVCSymfonyEventListenerSiteAccessMatchListener::onKernelRequest". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.request" to listener "SymfonyComponentHttpKernelEventListenerRouterListener::onKernelRequest". [] []
      [2014-03-14 00:04:50] request.INFO: Matched route "ovum_auth_test" (parameters: "_controller": "OvumAuthenticatorBundleControllerTestController::helloAction", "_route": "ovum_auth_test") [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.request" to listener "eZBundleEzPublishCoreBundleEventListenerLocaleListener::onKernelRequest". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.request" to listener "eZBundleEzPublishCoreBundleEventListenerRequestEventListener::onKernelRequestForward". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.request" to listener "SymfonyComponentSecurityHttpFirewall::onKernelRequest". [] []
      [2014-03-14 00:04:50] security.INFO: Basic Authentication Authorization header found for user "user" [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.exception" to listener "SymfonyComponentSecurityHttpFirewallExceptionListener::onKernelException". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.exception" to listener "OvumSiteBundleClassesUnauthorizedExceptionsListener::onKernelException". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.exception" to listener "SymfonyComponentHttpKernelEventListenerProfilerListener::onKernelException". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.exception" to listener "eZBundleEzPublishRestBundleEventListenerRestListener::onKernelExceptionView". [] []
      [2014-03-14 00:04:50] event.DEBUG: Listener "eZBundleEzPublishRestBundleEventListenerRestListener::onKernelExceptionView" stopped propagation of the event "kernel.exception". [] []
      [2014-03-14 00:04:50] event.DEBUG: Listener "SymfonyComponentHttpKernelEventListenerExceptionListener::onKernelException" was not called for event "kernel.exception". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.response" to listener "SymfonyBridgeMonologHandlerFirePHPHandler::onKernelResponse". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.response" to listener "SymfonyComponentHttpKernelEventListenerResponseListener::onKernelResponse". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.response" to listener "SymfonyComponentHttpKernelEventListenerEsiListener::onKernelResponse". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.response" to listener "SymfonyComponentSecurityHttpRememberMeResponseListener::onKernelResponse". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.response" to listener "eZPublishCoreMVCLegacySecurityFirewallLoginCleanupListener::onFilterResponse". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.response" to listener "SymfonyComponentHttpKernelEventListenerProfilerListener::onKernelResponse". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.response" to listener "SymfonyBundleWebProfilerBundleEventListenerWebDebugToolbarListener::onKernelResponse". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.response" to listener "SymfonyComponentHttpKernelEventListenerStreamedResponseListener::onKernelResponse". [] []
      [2014-03-14 00:04:50] event.DEBUG: Notified event "kernel.terminate" to listener "SymfonyBundleSwiftmailerBundleEventListenerEmailSenderListener::onKernelTerminate". [] []
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            nuno.oliveira-obsolete@ez.no Nuno Oliveira (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 30 minutes
                5h 30m