2017 © Pedro Peláez
 

project sso

sso login client sdk

image

wangjingchun/sso

sso login client sdk

  • Wednesday, November 2, 2016
  • by wangjingchun
  • Repository
  • 1 Watchers
  • 2 Stars
  • 25 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

sso login

composer

composer require wangjingchun/sso, (*1)

composer.json

"require": { "wangjingchun/sso": "^0.1.0" }, (*2)

参数

  1. $server_url,server同步登陆的请求地址
  2. $broker_id,调用方站点的id
  3. $broker_secret,调用方站点的secret

方法

  1. getUserInfo(),获取用户登陆信息
  2. login($username, $password),用户登陆,参数为用户名和密码
  3. logout(),退出登陆

例子程序

server_url, $this->broker_id, $this->broker_secret);

        try {
            $user = $mySso->getUserInfo();
        } catch (NotAttachedException $e) {
            header('Location: ' . $_SERVER['REQUEST_URI']);
            exit;
        } catch (SsoException $e) {
            header("Location: " . url('sso/error') . "?sso_error=" . $e->getMessage(), true, 307);
        }

        if (!$user) {
            header("Location: " . url('test/login'), true, 307);
            exit;
        } else {
            echo 'username->' . $user['username'] . '
'; echo 'fullname->' . $user['fullname'] . '
'; echo 'email->' . $user['email'] . '

'; echo 'logout'; } } public function login() { return view('test.login'); } public function postlogin(Request $request) { $username = $request->input('username'); $password = $request->input('password'); $mySso = new MySso($this->server_url, $this->broker_id, $this->broker_secret); if ($mySso->getUserInfo() || $mySso->login($username, $password)) { header("Location: " . URL('test/index'), true, 303); exit; } } public function logout() { $mySso = new MySso($this->server_url, $this->broker_id, $this->broker_secret); $mySso->logout(); header("Location: " . URL('test/index'), true, 303); exit; } public function error(Request $request) { $sso_error = $request->input('sso_error'); echo $sso_error; } } ?>

The Versions

02/11 2016

dev-master

9999999-dev

sso login client sdk

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

sdk sso

02/11 2016

v0.1.6

0.1.6.0

sso login client sdk

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

sdk sso

02/11 2016

v0.1.5

0.1.5.0

sso login client sdk

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

sdk sso

31/10 2016

v0.1.4

0.1.4.0

sso login client sdk

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

sdk sso

27/10 2016

v0.1.3

0.1.3.0

sso login client sdk

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

sdk sso

27/10 2016

v0.1.2

0.1.2.0

sso login client sdk

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

sdk sso

17/10 2016

v0.1.1

0.1.1.0

sso login client sdk

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

sdk sso

13/10 2016

v0.1.0

0.1.0.0

sso login client sdk

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

sdk sso