63        assert(
'is_array($config)');
 
   81    private function load($set)
 
   83        assert(
'is_string($set)');
 
   87        if (!in_array($set, $this->supportedSets, 
true)) {
 
   91        $stmt = $this->db->read(
"SELECT entity_id, entity_data FROM $tableName");
 
   92        if ($stmt->execute()) {
 
   95            while (
$d = $stmt->fetch()) {
 
   96                $data = json_decode(
$d[
'entity_data'], 
true);
 
  100                if (!array_key_exists(
'entityid', 
$data)) {
 
  101                    $data[
'entityid'] = 
$d[
'entity_id'];
 
  108            throw new Exception(
'PDO metadata handler: Database error: '.var_export($this->db->getLastError(), 
true));
 
  122        assert(
'is_string($set)');
 
  124        if (array_key_exists($set, $this->cachedMetadata)) {
 
  125            return $this->cachedMetadata[$set];
 
  128        $metadataSet = $this->
load($set);
 
  129        if ($metadataSet === 
null) {
 
  130            $metadataSet = array();
 
  133        foreach ($metadataSet as 
$entityId => &$entry) {
 
  134            if (preg_match(
'/__DYNAMIC(:[0-9]+)?__/', 
$entityId)) {
 
  141        $this->cachedMetadata[$set] = $metadataSet;
 
  148        assert(
'is_string($set)');
 
  153        if ($set === 
'saml20-idp-hosted') {
 
  154            return $baseurl.
'saml2/idp/metadata.php';
 
  155        } elseif ($set === 
'saml20-sp-hosted') {
 
  156            return $baseurl.
'saml2/sp/metadata.php';
 
  157        } elseif ($set === 
'shib13-idp-hosted') {
 
  158            return $baseurl.
'shib13/idp/metadata.php';
 
  159        } elseif ($set === 
'shib13-sp-hosted') {
 
  160            return $baseurl.
'shib13/sp/metadata.php';
 
  161        } elseif ($set === 
'wsfed-sp-hosted') {
 
  162            return 'urn:federation:'.\SimpleSAML\Utils\HTTP::getSelfHost();
 
  163        } elseif ($set === 
'adfs-idp-hosted') {
 
  164            return 'urn:federation:'.\SimpleSAML\Utils\HTTP::getSelfHost().
':idp';
 
  166            throw new Exception(
'Can not generate dynamic EntityID for metadata of this type: ['.$set.
']');
 
  182        assert(
'is_string($index)');
 
  183        assert(
'is_string($set)');
 
  184        assert(
'is_array($entityData)');
 
  186        if (!in_array($set, $this->supportedSets, 
true)) {
 
  193            "SELECT entity_id, entity_data FROM $tableName WHERE entity_id = :entity_id",
 
  203            'entity_data' => json_encode($entityData),
 
  206        if ($retrivedEntityIDs !== 
false && count($retrivedEntityIDs) > 0) {
 
  207            $rows = $this->db->write(
 
  208                "UPDATE $tableName SET entity_data = :entity_data WHERE entity_id = :entity_id",
 
  212            $rows = $this->db->write(
 
  213                "INSERT INTO $tableName (entity_id, entity_data) VALUES (:entity_id, :entity_data)",
 
  232        assert(
'is_string($table)');
 
  234        return $this->db->applyPrefix(str_replace(
"-", 
"_", $this->tablePrefix.$table));
 
  247        foreach ($this->supportedSets as $set) {
 
  249            $rows = $this->db->write(
 
  250                "CREATE TABLE IF NOT EXISTS $tableName (entity_id VARCHAR(255) PRIMARY KEY NOT NULL, entity_data ".
 
$metadata['__DYNAMIC:1__']
An exception for terminatinating execution or to throw for unit testing.
static getInstance($altConfig=null)
Retrieves the current database instance.
static getBaseURL()
Retrieve the base URL of the SimpleSAMLphp installation.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
if(empty($password)) $table