phpCAS::getAttribute PHP Method

getAttribute() public static method

Answer an attribute for the authenticated user.
public static getAttribute ( string $key ) : mixed
$key string attribute name
return mixed string for a single value or an array if multiple values exist.
    public static function getAttribute($key)
    {
        phpCAS::_validateClientExists();
        try {
            return self::$_PHPCAS_CLIENT->getAttribute($key);
        } catch (Exception $e) {
            phpCAS::error(get_class($e) . ': ' . $e->getMessage());
        }
    }

Usage Example

示例#1
0
 private function setName()
 {
     if ($this->config->get('cas-name-attribute-key') !== null && phpCAS::hasAttribute($this->config->get('cas-name-attribute-key'))) {
         $_SESSION[':cas']['name'] = phpCAS::getAttribute($this->config->get('cas-name-attribute-key'));
     } else {
         $_SESSION[':cas']['name'] = $this->getUser();
     }
 }
All Usage Examples Of phpCAS::getAttribute