当前位置: 首页>>代码示例>>PHP>>正文


PHP rest::get_access_token方法代码示例

本文整理汇总了PHP中rest::get_access_token方法的典型用法代码示例。如果您正苦于以下问题:PHP rest::get_access_token方法的具体用法?PHP rest::get_access_token怎么用?PHP rest::get_access_token使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rest的用法示例。


在下文中一共展示了rest::get_access_token方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_with_access_key_test

 public function get_with_access_key_test()
 {
     $key = rest::get_access_token(1);
     // admin user
     $_SERVER["REQUEST_METHOD"] = "GET";
     $_SERVER["HTTP_X_GALLERY_REQUEST_KEY"] = $key->access_key;
     $_GET["key"] = "value";
     $this->assert_array_equal_to_json(array("params" => array("key" => "value"), "method" => "get", "access_token" => $key->access_key, "url" => "http://./index.php/gallery_unit_test"), test::call_and_capture(array(new Rest_Controller(), "mock")));
 }
开发者ID:andyst,项目名称:gallery3,代码行数:9,代码来源:Rest_Controller_Test.php

示例2: index

 public function index()
 {
     $username = Input::instance()->post("user");
     $password = Input::instance()->post("password");
     $user = identity::lookup_user_by_name($username);
     if (empty($user) || !identity::is_correct_password($user, $password)) {
         throw new Rest_Exception("Forbidden", 403);
     }
     $key = rest::get_access_token($user->id);
     rest::reply($key->access_key);
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:11,代码来源:rest.php

示例3: index

 public function index()
 {
     $username = Input::instance()->post("user");
     $password = Input::instance()->post("password");
     if (empty($username) || auth::too_many_failures($username)) {
         throw new Rest_Exception("Forbidden", 403);
     }
     $user = identity::lookup_user_by_name($username);
     if (empty($user) || !identity::is_correct_password($user, $password)) {
         module::event("user_login_failed", $username);
         throw new Rest_Exception("Forbidden", 403);
     }
     auth::login($user);
     $key = rest::get_access_token($user->id);
     rest::reply($key->access_key);
 }
开发者ID:andyst,项目名称:gallery3,代码行数:16,代码来源:rest.php


注:本文中的rest::get_access_token方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。