Esempio n. 1
0
 /**
  * Create oauth token for the SNIP user
  * @param User $user
  */
 protected function createSnipToken($user)
 {
     $consumer = $this->getSnipConsumer();
     $token = OAuthToken::createAuthorized($consumer, $user);
     $user->authenticate_id = $token->token;
     $user->save();
     return $token;
 }
Esempio n. 2
0
 public function testcreateAuthorized()
 {
     $oauthKey = new OAuthKey();
     $oauthKey->id = '1';
     $user = new User();
     $user->retrieve('1');
     $oauthToken = OAuthToken::createAuthorized($oauthKey, $user);
     $this->assertEquals($oauthKey->id, $oauthToken->consumer);
     $this->assertEquals($oauthKey, $oauthToken->consumer_obj);
     $this->assertEquals($oauthToken::ACCESS, $oauthToken->tstate);
     $this->assertEquals($user->id, $oauthToken->assigned_user_id);
     //execute copyAuthData method
     $oauthToken->authdata = 'test';
     $this->copyAuthData($oauthToken);
     //finally mark deleted for cleanup
     $oauthToken->mark_deleted($oauthToken->id);
 }