コード例 #1
0
 public function responseOauth()
 {
     $flow = new Basic(self::$authConfig);
     $token = $flow->getAccessToken($_GET['code']);
     $infoPersonal = $flow->getUserInfo($token);
     $rut = $infoPersonal['RUT'];
     \Auth::login($user);
     return Redirect::to('/usuario/autenticado/con/claveunica');
 }
コード例 #2
0
ファイル: autenticacion.php プロジェクト: e-gob/SIMPLE
 public function callback()
 {
     $flow = new Basic($this->authConfig);
     $token = $flow->getAccessToken($_GET['code']);
     $infoPersonal = $flow->getUserInfo($token);
     $rut = $infoPersonal['RUT'];
     $rut = str_replace(".", "", $rut);
     $CI =& get_instance();
     $CI->session->set_flashdata('openidcallback', 1);
     $CI->session->set_flashdata('rut', $rut);
     $redirectlogin = $_COOKIE['redirectlogin'];
     redirect($redirectlogin);
 }
コード例 #3
0
 public function next()
 {
     $config = Config::get('openid.client');
     $flow = new Basic(array('client_info' => $config));
     try {
         //$userInfo = $flow->process();
         $authorizationCode = $flow->getAuthorizationCode();
         $accessToken = $flow->getAccessToken($authorizationCode);
         $userInfo = $flow->getUserInfo($accessToken);
         // Get the user
         return $this->processLogin($accessToken, $userInfo);
     } catch (\Exception $e) {
         printf("Exception during user authentication: [%s] %s", get_class($e), $e->getMessage());
     }
 }
コード例 #4
0
<?php

use InoOicClient\Flow\Basic;
require __DIR__ . '/../../init_autoload.php';
$config = (require __DIR__ . '/config.php');
$flow = new Basic($config);
if (!isset($_GET['redirect'])) {
    try {
        $uri = $flow->getAuthorizationRequestUri('openid email profile');
        _dump($uri);
        printf("<pre>%s</pre><br>", $uri);
        printf("<a href=\"%s\">Login</a>", $uri);
    } catch (\Exception $e) {
        _dump("{$e}");
        printf("Exception during authorization URI creation: [%s] %s", get_class($e), $e->getMessage());
    }
} else {
    try {
        $userInfo = $flow->process();
        printf("<pre>%s</pre>", print_r($userInfo, true));
    } catch (\Exception $e) {
        _dump("{$e}");
        printf("Exception during user authentication: [%s] %s", get_class($e), $e->getMessage());
    }
}
コード例 #5
0
ファイル: Flow.php プロジェクト: AdriandeCita/tuleap
 /**
  * @return array
  */
 public function process()
 {
     $user_info = parent::process();
     $this->invalidState();
     return $user_info;
 }
コード例 #6
0
<?php

use InoOicClient\Flow\Basic;
require __DIR__ . '/../../init_autoload.php';
$config = (require __DIR__ . '/config.php');
$flow = new Basic($config);
if (!isset($_GET['redirect'])) {
    try {
        $uri = $flow->getAuthorizationRequestUri('user:email');
        _dump($uri);
        printf("<pre>%s</pre><br>", $uri);
        printf("<a href=\"%s\">Login</a>", $uri);
    } catch (\Exception $e) {
        _dump("{$e}");
        printf("Exception during authorization URI creation: [%s] %s", get_class($e), $e->getMessage());
    }
} else {
    try {
        $userInfo = $flow->process();
        printf("<pre>%s</pre>", print_r($userInfo, true));
    } catch (\Exception $e) {
        _dump("{$e}");
        printf("Exception during user authentication: <br><pre>%s</pre>", $e);
        echo "<br>";
        _dump($flow->getTokenDispatcher()->getLastHttpResponse()->getBody());
    }
}
コード例 #7
0
ファイル: callback.php プロジェクト: Yusuke-KOMIYAMA/sop
<?php

require_once __DIR__ . '/../../src/bootstrap.php';
\Sop\Database::setupRedBean();
use InoOicClient\Flow\Basic;
// 既存の情報はリセットする。
unset($_SESSION[\Sop\Session::getSiteData('siteKey')]);
if (\Sop\Config::get('debug_pseudo_sso')) {
    $userInfo = array('sub' => \Sop\Config::get('debug_pseudo_sso_user'), 'updated_at' => 1424903837, 'email' => '*****@*****.**', 'name' => 'test user', 'family_name' => 'YAMADA', 'given_name' => 'Taro');
    $_SESSION[\Sop\Session::getSiteData('siteKey')]['sso_user_id'] = $userInfo['sub'];
    \Sop\SingleSignOn::registerInitialUser($userInfo);
    \Sop\SingleSignOn::updateUserData($userInfo);
} else {
    $flow = new Basic(Sop\SingleSignOn::getConfig());
    try {
        $userInfo = $flow->process();
        if ($userInfo['sub']) {
            $_SESSION[\Sop\Session::getSiteData('siteKey')]['sso_user_id'] = $userInfo['sub'];
        }
        \Sop\SingleSignOn::registerInitialUser($userInfo);
        \Sop\SingleSignOn::updateUserData($userInfo);
    } catch (\Exception $e) {
        $_SESSION[\Sop\Session::getSiteData('siteKey')]['sso_errors'] = array('シングル・サインオンの認証でエラーが発生しました。もう一度ログインを試してみてください。', $e->getMessage());
    }
}
session_write_close();
header('Location:' . \Sop\Session::getSiteData('pathname'));
コード例 #8
0
<?php

use InoOicClient\Flow\Basic;
require __DIR__ . '/../init_autoload.php';
$config = (require __DIR__ . '/config.php');
$flow = new Basic($config);
if (!isset($_GET['redirect'])) {
    try {
        $uri = $flow->getAuthorizationRequestUri();
    } catch (\Exception $e) {
        _dump("{$e}");
        printf("Exception during authorization URI creation: [%s] %s", get_class($e), $e->getMessage());
    }
} else {
    try {
        $userInfo = $flow->process();
        printf("<pre>%s</pre>", print_r($userInfo));
    } catch (\Exception $e) {
        _dump("{$e}");
        printf("Exception during user authentication: [%s] %s", get_class($e), $e->getMessage());
    }
}
コード例 #9
0
ファイル: signin.php プロジェクト: Yusuke-KOMIYAMA/sop
<?php

require_once __DIR__ . '/../../src/bootstrap.php';
use InoOicClient\Flow\Basic;
if (!isset($_REQUEST['session_site_key']) || !isset($_REQUEST['pathname'])) {
    exit;
}
\Sop\Session::setSiteData('siteKey', $_REQUEST['session_site_key']);
\Sop\Session::setSiteData('pathname', $_REQUEST['pathname']);
if (\Sop\Config::get('debug_pseudo_sso')) {
    session_write_close();
    header('Location:' . 'callback');
} else {
    $flow = new Basic(Sop\SingleSignOn::getConfig());
    try {
        $uri = $flow->getAuthorizationRequestUri('openid email profile');
        session_write_close();
        header('Location: ' . $uri);
    } catch (\Exception $e) {
        printf("Exception during authorization URI creation: [%s] %s", get_class($e), $e->getMessage());
    }
}