Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
ff13760a
Commit
ff13760a
authored
6 years ago
by
Thijs Kinkhorst
Browse files
Options
Downloads
Plain Diff
Merge branch 'manu0401-getMetaDataPdo'
parents
05b18826
41aa1f60
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php
+42
-0
42 additions, 0 deletions
lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php
with
42 additions
and
0 deletions
lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php
+
42
−
0
View file @
ff13760a
...
...
@@ -142,6 +142,48 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerPdo extends SimpleSAML_Metadata_
return
$metadataSet
;
}
/**
* Retrieve a metadata entry.
*
* @param string $entityId The entityId we are looking up.
* @param string $set The set we are looking for metadata in.
*
* @return array An associative array with metadata for the given entity, or NULL if we are unable to
* locate the entity.
*/
public
function
getMetaData
(
$entityId
,
$set
)
{
assert
(
is_string
(
$entityId
));
assert
(
is_string
(
$set
));
$tableName
=
$this
->
getTableName
(
$set
);
if
(
!
in_array
(
$set
,
$this
->
supportedSets
,
true
))
{
return
null
;
}
$stmt
=
$this
->
db
->
read
(
"SELECT entity_id, entity_data FROM
$tableName
WHERE entity_id=:entityId"
,
array
(
'entityId'
=>
$entityId
));
if
(
$stmt
->
execute
())
{
$rowCount
=
0
;
while
(
$d
=
$stmt
->
fetch
())
{
if
(
++
$rowCount
>
1
)
{
SimpleSAML\Logger
::
warning
(
"Duplicate match for
$entityId
in set
$set
"
);
break
;
}
$data
=
json_decode
(
$d
[
'entity_data'
],
true
);
if
(
$data
===
null
)
{
throw
new
SimpleSAML_Error_Exception
(
"Cannot decode metadata for entity '${d['entity_id']}'"
);
}
if
(
!
array_key_exists
(
'entityid'
,
$data
))
{
$data
[
'entityid'
]
=
$d
[
'entity_id'
];
}
}
return
$data
;
}
else
{
throw
new
Exception
(
'PDO metadata handler: Database error: '
.
var_export
(
$this
->
db
->
getLastError
(),
true
));
}
}
private
function
generateDynamicHostedEntityID
(
$set
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment