SimpleSAML_Utilities::parseAttributes PHP Method

parseAttributes() public static method

Deprecation: This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\Attributes::normalizeAttributesArray() instead.
public static parseAttributes ( $attributes )
    public static function parseAttributes($attributes)
    {
        return SimpleSAML\Utils\Attributes::normalizeAttributesArray($attributes);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Constructor for this authentication source.
  *
  * @param array $info  Information about this authentication source.
  * @param array $config  Configuration.
  */
 public function __construct($info, $config)
 {
     assert('is_array($info)');
     assert('is_array($config)');
     /* Call the parent constructor first, as required by the interface. */
     parent::__construct($info, $config);
     $this->users = array();
     /* Validate and parse our configuration. */
     foreach ($config as $userpass => $attributes) {
         if (!is_string($userpass)) {
             throw new Exception('Invalid <username>:<passwordhash> for authentication source ' . $this->authId . ': ' . $userpass);
         }
         $userpass = explode(':', $userpass, 2);
         if (count($userpass) !== 2) {
             throw new Exception('Invalid <username>:<passwordhash> for authentication source ' . $this->authId . ': ' . $userpass[0]);
         }
         $username = $userpass[0];
         $passwordhash = $userpass[1];
         try {
             $attributes = SimpleSAML_Utilities::parseAttributes($attributes);
         } catch (Exception $e) {
             throw new Exception('Invalid attributes for user ' . $username . ' in authentication source ' . $this->authId . ': ' . $e->getMessage());
         }
         $this->users[$username . ':' . $passwordhash] = $attributes;
     }
 }
All Usage Examples Of SimpleSAML_Utilities::parseAttributes