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 = "") {