Example #1
0
 public function acceptFriendAction(PendingFriend $friend, $hide = false)
 {
     $grantTypes = array('authorization_code', 'password', 'refresh_token', 'token', 'client_credentials');
     $client = $this->createClient();
     $client->setAllowedGrantTypes($grantTypes);
     $client->setName($friend->getName());
     $client->setRedirectUris(array($friend->getHost() . '/oauth/v2/log/' . $friend->getName()));
     $this->updateClient($client);
     $url = $friend->getHost() . '/admin/oauth/id/' . $client->getId() . '_' . $client->getRandomId() . '/secret/' . $client->getSecret() . '/name/' . $friend->getName();
     $data = $this->curlManager->exec($url);
     if (!json_decode($data)) {
         $this->om->remove($client);
         $this->om->remove($friend);
         $this->om->flush();
         throw new \Exception('The friend request host was not found for the url ' . $url);
     } else {
         $this->om->remove($friend);
         $this->om->flush();
     }
     return $client;
 }
Example #2
0
 /**
  * @EXT\Route(
  *     "/request/pending/remove/{friend}",
  *     name="oauth_pending_friend_remove",
  *     options = {"expose"=true}
  * )
  * @SEC\PreAuthorize("canOpenAdminTool('platform_parameters')")
  *
  * @return Response
  */
 public function removePendingFriend(PendingFriend $friend)
 {
     $oldid = $friend->getId();
     $this->oauthManager->removePendingFriend($friend);
     return new JsonResponse(array('id' => $oldid));
 }