Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-60161

'Accept: application/json' is being set multiple times in the Oauth library

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      While I cannot find an API service that generates an error, except the one we integrate with Mulesoft, here is an example where you could get multiple accept: application/json in the header because the foreach loop and $this->boxclient->upload_file, which would eventually calls oauth2_client::request, is being called multiple times.

      This issue is now covered by a unit test

      Show
      While I cannot find an API service that generates an error, except the one we integrate with Mulesoft, here is an example where you could get multiple accept: application/json in the header because the foreach loop and $this->boxclient->upload_file , which would eventually calls oauth2_client::request , is being called multiple times. This issue is now covered by a unit test
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-60161-master-test

      Description

      This is related to a fix committed to MDL-59473.  In lib/oauthlib.php, line 618, we should check to see if the header is already set before calling $this->setHeader('Accept: application/json').  The API calls were failing on some OAuth systems because of multiple "Accept: application/json" showing up in the header.

      I have checked the following API services that Moodle core uses, but none of them have any issue handling duplicate 'Accept: application/json' in the header.  The API service we use with our SIS system is handled by Mulesoft.  They are giving us this exception, org.mule.api.MessagingException: null (java.lang.ClassCastException). If someone else out there uses Mulesoft, it would be great if you can test this too.

      The API services I have checked:

      • Box.com
      • Google drive
      • Dropbox
      • Microsoft OneDrive

       

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  15/Jan/18