Esempio n. 1
0
 /**
  * @param string           $redirectURL
  * @param string           $currentURL
  * @param string           $message
  * @param SessionInterface $session
  */
 public function __construct($redirectURL, $currentURL = null, $message = null, SessionInterface $session = null)
 {
     $this->redirectURL = $redirectURL;
     $this->currentURL = $currentURL;
     if (!$this->currentURL) {
         $URI = '';
         $HTTPS = array_get('HTTPS', $_SERVER);
         if ($HTTPS && $HTTPS !== 'on' || array_get('HTTP_X_FORWARDED_PROTO', $_SERVER) === 'https') {
             $URI = 'https://';
         } else {
             $URI = 'http://';
         }
         $URI .= array_get('HTTP_HOST', $_SERVER, '');
         $URI .= array_get('REQUEST_URI', $_SERVER, '');
         $this->currentURL = $URI;
     }
     $this->message = $message ?: I18N::__('Please log in.', ['context' => 'elixir']);
     $this->session = $session ?: Session::instance();
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function clearIdentities()
 {
     $identities = array_get(self::STORAGE_KEY, $this->session, []);
     foreach ($identities as $identity) {
         $identity->setDomain(null);
         $this->unObserve($identity);
     }
     array_remove(self::STORAGE_KEY, $this->session);
 }
Esempio n. 3
0
 public function invalidate()
 {
     $tokens = array_get(self::TOKEN_KEY, $this->storage, []);
     $time = time();
     foreach ($tokens as $key => $config) {
         $expire = isset($config['expire']) ? $config['expire'] : 0;
         if ($time > $value) {
             unset($tokens[$key]);
         }
     }
     array_set(self::TOKEN_KEY, $tokens, $this->storage);
 }
 /**
  * @param mixed $option
  * @param mixed $default
  *
  * @return mixed
  */
 public function getOption($option, $default = null)
 {
     return array_get($option, $this->options, $default);
 }