Example #1
0
 public function actionAccess_token()
 {
     $server = new OAuthServer();
     /* ----------------------------------------------------------------- */
     $x_auth_mode = $this->module->getParam('x_auth_mode');
     if ($x_auth_mode == 'client_auth') {
         $username = $this->module->getParam('x_auth_username');
         $password = $this->module->getParam('x_auth_password');
         $model = new LoginForm();
         $arr = array('username' => $username, 'password' => $password);
         $model->attributes = $arr;
         if ($model->validate() && $model->login()) {
             $user_id = Yii::app()->user->id;
             $result = $server->xauthAccessToken($user_id);
             echo $result;
             exit;
         }
     }
     /* ----------------------------------------------------------------- */
     $server->accessToken();
     exit;
 }
Example #2
0
/*
 * Initialize OAuth store
 */
require_once get_config('docroot') . 'webservice/libs/oauth-php/OAuthServer.php';
require_once get_config('docroot') . 'webservice/libs/oauth-php/OAuthStore.php';
OAuthStore::instance('Mahara');
global $server;
$server = new OAuthServer();
!isset($_SERVER['PATH_INFO']) && ($_SERVER['PATH_INFO'] = null);
// Now - what kind of OAuth interaction are we handling?
if ($_SERVER['PATH_INFO'] == '/request_token') {
    $server->requestToken();
    exit;
} else {
    if ($_SERVER['PATH_INFO'] == '/access_token') {
        $server->accessToken();
        exit;
    } else {
        if ($_SERVER['PATH_INFO'] == '/authorize') {
            # logon
            require_once 'pieforms/pieform.php';
            if (!$USER->is_logged_in()) {
                $form = new Pieform(auth_get_login_form());
                auth_draw_login_page(null, $form);
                exit;
            }
            $rs = null;
            try {
                $rs = $server->authorizeVerify();
            } catch (OAuthException2 $e) {
                header('HTTP/1.1 400 Bad Request');
Example #3
0
 /**
  *
  **/
 public function access_token_action()
 {
     $server = new OAuthServer();
     $server->accessToken();
     $this->render_nothing();
 }
 private function accesstoken()
 {
     Neuron_Auth_OAuthStore::getStore();
     $server = new OAuthServer();
     $token = $server->accessToken();
 }
 public function executeAccessToken(sfWebRequest $request)
 {
     $store = $this->getStore();
     $server = new OAuthServer();
     try {
         $server->accessToken();
         sfContext::getInstance()->getLogger()->info("Got access token ");
         die;
     } catch (OAuthException $e) {
         sfContext::getInstance()->getLogger()->err("Access token: OAuth Execption: " . $e->getMessage());
     } catch (Exception $e) {
         sfContext::getInstance()->getLogger()->err("Access token error: " . $e->getMessage());
     }
 }
Example #6
0
 public function accesstokenAction()
 {
     $server = new OAuthServer();
     $server->accessToken();
     exit;
 }