コード例 #1
0
 public function authorize()
 {
     $this->getUserProvider()->verifyUser();
     $request = Request::createFromGlobals();
     $response = new Response();
     // validate the authorize request
     if (!$this->server->validateAuthorizeRequest($request, $response)) {
         $response->send();
         die;
     }
     $client_id = $request->query("client_id");
     $client = $this->storage->getClientDetails($client_id);
     $user_id = $this->getUserProvider()->getUserId();
     $is_authorized = $this->authorized($client_id, $user_id);
     // display an authorization form
     if (empty($_POST) && !$is_authorized) {
         $html = Tpl::authorize($client);
         exit($html);
     }
     // print the authorization code if the user has authorized your client
     $this->server->handleAuthorizeRequest($request, $response, $is_authorized, $user_id);
     if ($is_authorized) {
         // this is only here so that you get to see your code in the cURL request. Otherwise, we'd redirect back to the client
         $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=') + 5, 40);
         $response->send();
         //exit("SUCCESS! Authorization Code: $code");
     }
     $response->send();
 }
コード例 #2
0
ファイル: PdoTest.php プロジェクト: manishkhanchandani/mkgxy
 public function testCreatePdoStorageUsingConfig()
 {
     $config = array('dsn' => sprintf('sqlite://%s', Bootstrap::getInstance()->getSqliteDir()));
     $storage = new Pdo($config);
     $this->assertNotNull($storage->getClientDetails('oauth_test_client'));
 }