getCredential() 공개 메소드

Returns internal credential value(s).
public getCredential ( mixed $name = null ) : mixed
$name mixed The credential value to get. If null, will return the entire credential list. Valid names: - 'change': (boolean) Do credentials need to be changed? - 'credentials': (array) The credentials needed to authenticate. - 'expire': (integer) UNIX timestamp of the credential expiration date. - 'userId': (string) The user ID.
리턴 mixed The credential information, or null if the credential doesn't exist.
예제 #1
0
파일: Application.php 프로젝트: horde/horde
 /**
  * Set authentication credentials in the Horde session.
  *
  * @return boolean  True on success, false on failure.
  */
 protected function _setAuth()
 {
     global $registry;
     if ($registry->isAuthenticated(array('app' => $this->_app, 'notransparent' => true))) {
         return true;
     }
     /* Grab the current language before we destroy the session. */
     $language = $registry->preferredLang();
     /* Destroy any existing session on login and make sure to use a
      * new session ID, to avoid session fixation issues. */
     if (($userId = $registry->getAuth()) === false) {
         $GLOBALS['session']->clean();
         $userId = $this->getCredential('userId');
     }
     $credentials = $this->getCredential('credentials');
     try {
         list(, $credentials) = $this->runHook($userId, $credentials, 'postauthenticate');
     } catch (Horde_Auth_Exception $e) {
         return false;
     }
     $registry->setAuth($userId, $credentials, array('app' => $this->_app, 'change' => $this->getCredential('change'), 'language' => $language));
     /* Only set the view mode on initial authentication */
     if (!$GLOBALS['session']->exists('horde', 'view')) {
         $this->_setView();
     }
     if ($this->_base && isset($GLOBALS['notification']) && ($expire = $this->_base->getCredential('expire'))) {
         $toexpire = ($expire - time()) / 86400;
         $GLOBALS['notification']->push(sprintf(Horde_Core_Translation::ngettext("%d day until your password expires.", "%d days until your password expires.", $toexpire), $toexpire), 'horde.warning');
     }
     return true;
 }
예제 #2
0
 /**
  */
 public function getCredential($name = null)
 {
     return $this->_base->getCredential($name);
 }