示例#1
0
 /**
  * Request an instance of the OAuthSession
  */
 public static function instance($store = 'SESSION', $options = array())
 {
     if (!OAuthSession::$instance) {
         // Select the store you want to use
         if (strpos($store, '/') === false) {
             $class = 'OAuthSession' . $store;
             $file = dirname(__FILE__) . '/session/' . $class . '.php';
         } else {
             $file = $store;
             $store = basename($file, '.php');
             $class = $store;
         }
         if (is_file($file)) {
             require_once $file;
             if (class_exists($class)) {
                 OAuthSession::$instance = new $class($options);
             } else {
                 throw new OAuthException2('Could not find class ' . $class . ' in file ' . $file);
             }
         } else {
             throw new OAuthException2('No OAuthSession for ' . $store . ' (file ' . $file . ')');
         }
     }
     return OAuthSession::$instance;
 }
示例#2
0
 public function accessTokens($id)
 {
     if (!Auth::check() || Auth::id() != $id) {
         return Redirect::route('users.show', $id);
     }
     $user = User::findOrFail($id);
     $sessions = OAuthSession::where(['owner_type' => 'user', 'owner_id' => Auth::id()])->with('token')->lists('id') ?: [];
     $tokens = AccessToken::whereIn('session_id', $sessions)->get();
     return View::make('users.access_tokens', compact('user', 'tokens'));
 }
示例#3
0
 /**
  * Construct the request to be verified
  * 
  * @param string request
  * @param string method
  * @param array params The request parameters
  * @param string store The session storage class.
  * @param array store_options The session storage class parameters.
  * @param array options Extra options:
  *   - allowed_uri_schemes: list of allowed uri schemes.
  *   - disallowed_uri_schemes: list of unallowed uri schemes.
  * 
  * e.g. Allow only http and https
  * $options = array(
  *     'allowed_uri_schemes' => array('http', 'https'),
  *     'disallowed_uri_schemes' => array()
  * );
  * 
  * e.g. Disallow callto, mailto and file, allow everything else
  * $options = array(
  *     'allowed_uri_schemes' => array(),
  *     'disallowed_uri_schemes' => array('callto', 'mailto', 'file')
  * );
  * 
  * e.g. Allow everything
  * $options = array(
  *     'allowed_uri_schemes' => array(),
  *     'disallowed_uri_schemes' => array()
  * ); 
  *  
  */
 function __construct($uri = null, $method = null, $params = null, $store = 'SESSION', $store_options = array(), $options = array())
 {
     parent::__construct($uri, $method, $params);
     $this->session = OAuthSession::instance($store, $store_options);
     if (array_key_exists('allowed_uri_schemes', $options) && is_array($options['allowed_uri_schemes'])) {
         $this->allowed_uri_schemes = $options['allowed_uri_schemes'];
     }
     if (array_key_exists('disallowed_uri_schemes', $options) && is_array($options['disallowed_uri_schemes'])) {
         $this->disallowed_uri_schemes = $options['disallowed_uri_schemes'];
     }
 }
示例#4
0
 /**
  * Construct the request to be verified
  * 
  * @param string request
  * @param string method
  * @param array params The request parameters
  * @param string store The session storage class.
  * @param array store_options The session storage class parameters.
  */
 function __construct($uri = null, $method = null, $params = null, $store = 'SESSION', $store_options = array())
 {
     parent::__construct($uri, $method, $params);
     $this->session = OAuthSession::instance($store, $store_options);
 }