From 35c08833553790713ef87d4cd206a41414589a07 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Tue, 26 Nov 2013 10:04:02 +0000 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86card.westgis.ac.cn?= =?UTF-8?q?=E7=9A=84=E7=A7=91=E6=8A=80=E7=BD=91=E9=80=9A=E8=A1=8C=E8=AF=81?= =?UTF-8?q?Appkey=E5=92=8CAppsecret?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/module/Open/Source.php | 61 ++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/application/module/Open/Source.php b/application/module/Open/Source.php index 51e82760..49730998 100644 --- a/application/module/Open/Source.php +++ b/application/module/Open/Source.php @@ -50,8 +50,13 @@ class Source "code"=>"code" ); - if($this->website == 'westdc'){ + //新浪微博(新浪通行证) + $this->source->sina = new stdClass(); + $this->source->sina->param = array( + ); + + if($this->website == 'westdc'){ $this->source->escience->config = array( 'id' => '71852', 'secret' => 'ad7gd3jZgbzhQM6vIh9vPnQFZQoTGHZI', @@ -61,11 +66,9 @@ class Source 'theme'=>'full' ) ); - } if($this->website == 'heihedata'){ - $this->source->escience->config = array( 'id' => '78969', 'secret' => 'iTGKdCkUPakA2hza2TJ4XZ4cnwlh8Hqz', @@ -75,9 +78,48 @@ class Source 'theme'=>'full' ) ); - } + if($this->website == 'card'){ + $this->source->escience->config = array( + 'id' => '58176', + 'secret' => 'ZM5dEFX5GpJC62IcJ3iajx51T9hzhJkQ', + 'index' => 'http://card.westgis.ac.cn/', + 'callback' => 'http://card.westgis.ac.cn/account/callback/type/escience', + 'other' => array( + 'theme'=>'full' + ) + ); + } + + } + + //Oauth2登录目标 + /* + name : 名称 + code : 获取code的url + token : 获取 token的url + code_response : 获取token时使用的参数值(配合$this->source->OBJECTIVE->param中的code_response使用 + grant_type : 获得token的认证方式,按照oauth2标准,应该是authorization_code + */ + private function initTarget(){ + //中国科技网通行证 + $this->target->escience = array( + 'name' => '中国科技网通行证', + 'code' => 'http://passport.escience.cn/oauth2/authorize', + 'token' => 'https://passport.escience.cn/oauth2/token', + 'code_response' => 'code', + 'grant_type' => 'authorization_code', + ); + + //新浪 + $this->target->sina = array( + 'name' => '新浪微博', + 'code' => 'https://api.weibo.com/oauth2/authorize', + 'token' => '', + 'code_response' => 'code', + 'grant_type' => 'authorization_code' + ); } //获得一个源 @@ -96,17 +138,6 @@ class Source } } - //Oauth2登录目标 - private function initTarget(){ - $this->target->escience = array( - 'name' => '中国科技网通行证', - 'code' => 'http://passport.escience.cn/oauth2/authorize', - 'token' => 'https://passport.escience.cn/oauth2/token', - 'code_response' => 'code', - 'grant_type' => 'authorization_code', - ); - } - //获得Oauth2登录模板 public function getTarget($type = "") {