public function setAuthorizationCode($code, $client_id, $user_id, $redirect_uri, $expires, $scope = null)
    {
        $client = $this->em->getRepository('OAuth2ServerBundle:Client')->find($client_id);

        if (!$client) throw new \Exception('Unknown client identifier');

        $authorizationCode = new \OAuth2\ServerBundle\Entity\AuthorizationCode();
        $authorizationCode->setCode($code);
        $authorizationCode->setClient($client);
        $authorizationCode->setUserId($user_id);
        $authorizationCode->setRedirectUri($redirect_uri);
        $authorizationCode->setExpires($expires);
        $authorizationCode->setScope($scope);

        $this->em->persist($authorizationCode);
        $this->em->flush();
    }
public function setAuthorizationCode($code, $client_id, $user_id, $redirect_uri, $expires, $scope = null)
    {
        $client = $this->em->getRepository('OAuth2ServerBundle:Client')->find($client_id);

        if (!$client) throw new \Exception('Unknown client identifier');

        $authorizationCode = new \OAuth2\ServerBundle\Entity\AuthorizationCode();
        $authorizationCode->setCode($code);
        $authorizationCode->setClient($client);
        $authorizationCode->setUserId($user_id);
        $authorizationCode->setRedirectUri($redirect_uri);
        $authorizationCode->setExpires($expires);
        $authorizationCode->setScope($scope);

        $this->em->persist($authorizationCode);
        $this->em->flush();
    }
public function setAuthorizationCode ( $ code , $ client_id , $ user_id , $ redirect_uri , $ expires , $ scope = null ) { $ client = $ this -> em -> getRepository ( 'OAuth2ServerBundle:Client' ) -> find ( $ client_id ) ; if ( ! $ client ) throw new \ Exception ( 'Unknown client identifier' ) ; $ authorizationCode = new \ OAuth2 \ ServerBundle \ Entity \ AuthorizationCode ( ) ; $ authorizationCode -> setCode ( $ code ) ; $ authorizationCode -> setClient ( $ client ) ; $ authorizationCode -> setUserId ( $ user_id ) ; $ authorizationCode -> setRedirectUri ( $ redirect_uri ) ; $ authorizationCode -> setExpires ( $ expires ) ; $ authorizationCode -> setScope ( $ scope ) ; $ this -> em -> persist ( $ authorizationCode ) ; $ this -> em -> flush ( ) ; }
Take the provided authorization code values and store them somewhere.

This function should be the storage counterpart to getAuthCode().

If storage fails for some reason, we're not currently checking for
any sort of success/failure, so you should bail out of the script
and provide a descriptive fail message.

Required for OAuth2::GRANT_TYPE_AUTH_CODE.

@param $code
Authorization code to be stored.
@param $client_id
Client identifier to be stored.
@param $user_id
User identifier to be stored.
@param string $redirect_uri
Redirect URI(s) to be stored in a space-separated string.
@param int    $expires
Expiration to be stored as a Unix timestamp.
@param string $scope
(optional) Scopes to be stored in space-separated string.

@ingroup oauth2_section_4
Take the provided authorization code values and store them somewhere .