Uploaded image for project: 'Shindig'
  1. Shindig
  2. SHINDIG-1313

/gagdets/metadata request doesn't work in PHP shindig

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Cannot Reproduce
    • None
    • None
    • PHP
    • None

    Description

      I tried to execute POST request to shindig/gadgets/metadata. It does
      work for java version, but it doesn't work for php.

      Here is a curl command
      curl -i -X POST -H "Accept: application/json" -H "Content-Type:
      application/json"
      -d
      '{"context":

      {"country":"default","language":"default","view":"default","container":"default"}

      ,"gadgets":[

      {"url":"http://hosting.gmodules.com/ig/gadgets/file/108085167802252611023/wikipedia.xml", "moduleId":0}

      ]}'
      http://shindig/gadgets/metadata

      The output is:
      {"gadgets":[

      {"errors":["Can't get ownerId from an anonymous token"],"moduleId":0,"url":"http:\/\/hosting.gmodules.com\/ig\/gadgets\/file\/108085167802252611023\/wikipedia.xml"}

      ]}
      If I supply a token ?st=1:1:1:1:1:1:1, it works

      It seems as the problem is in BasicSecurityToken.php.

      public function isAnonymous()

      { return ($this->tokenData[$this->OWNER_KEY] === SecurityToken::$ANONYMOUS) && ($this->tokenData[$this->VIEWER_KEY] === SecurityToken::$ANONYMOUS); }

      ...
      public function getOwnerId() {
      if ($this->isAnonymous())

      { throw new Exception("Can't get ownerId from an anonymous token"); }

      return $this->tokenData[$this->OWNER_KEY];
      }

      In java version there is different implementation.

      public boolean isAnonymous()

      { return false; }

      ...
      public String getOwnerId()

      { return tokenData.get(OWNER_KEY); }

      Should we remove isAnonymous check from BasicSecurityToken.php?
      Or it should be done on a higher level, and if the token is anonymous
      the functions of BasicSecurityToken shouldn't be called at all?

      Attachments

        Activity

          People

            Unassigned Unassigned
            vohtaski Evgeny Bogdanov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: