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
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
8cb55098
Commit
8cb55098
authored
9 years ago
by
Jaime Perez Crespo
Browse files
Options
Downloads
Patches
Plain Diff
Reformat SimpleSAML_Metadata_MetaDataStorageHandlerXML.
parent
adc7ddc5
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/MetaDataStorageHandlerXML.php
+100
-97
100 additions, 97 deletions
lib/SimpleSAML/Metadata/MetaDataStorageHandlerXML.php
with
100 additions
and
97 deletions
lib/SimpleSAML/Metadata/MetaDataStorageHandlerXML.php
+
100
−
97
View file @
8cb55098
<?php
<?php
/**
/**
* This class implements a metadata source which loads metadata from XML files.
* This class implements a metadata source which loads metadata from XML files.
* The XML files should be in the SAML 2.0 metadata format.
* The XML files should be in the SAML 2.0 metadata format.
*
*
* @author Olav Morken, UNINETT AS.
* @author Olav Morken, UNINETT AS.
* @package
s
impleSAMLphp
* @package
S
impleSAMLphp
*/
*/
class
SimpleSAML_Metadata_MetaDataStorageHandlerXML
extends
SimpleSAML_Metadata_MetaDataStorageSource
{
class
SimpleSAML_Metadata_MetaDataStorageHandlerXML
extends
SimpleSAML_Metadata_MetaDataStorageSource
{
/**
* This variable contains an associative array with the parsed metadata.
/**
*
* This variable contains an associative array with the parsed metadata.
* @var array
*
*/
* @var array
private
$metadata
;
*/
private
$metadata
;
/**
* This function initializes the XML metadata source. The configuration must contain one of
/**
* the following options:
* This function initializes the XML metadata source. The configuration must contain one of
* - 'file': Path to a file with the metadata. This path is relative to the simpleSAMLphp
* the following options:
* base directory.
* - 'file': Path to a file with the metadata. This path is relative to the simpleSAMLphp
* - 'url': URL we should download the metadata from. This is only meant for testing.
* base directory.
*
* - 'url': URL we should download the metadata from. This is only meant for testing.
* @param array $config The configuration for this instance of the XML metadata source.
*
*
* @param array $config The configuration for this instance of the XML metadata source.
* @throws Exception If neither the 'file' or 'url' options are defined in the configuration.
*
*/
* @throws Exception If neither the 'file' or 'url' options are defined in the configuration.
protected
function
__construct
(
$config
)
{
*/
protected
function
__construct
(
$config
)
/* Get the configuration. */
{
$globalConfig
=
SimpleSAML_Configuration
::
getInstance
();
// get the configuration
$globalConfig
=
SimpleSAML_Configuration
::
getInstance
();
if
(
array_key_exists
(
'file'
,
$config
))
{
$src
=
$globalConfig
->
resolvePath
(
$config
[
'file'
]);
if
(
array_key_exists
(
'file'
,
$config
))
{
}
elseif
(
array_key_exists
(
'url'
,
$config
))
{
$src
=
$globalConfig
->
resolvePath
(
$config
[
'file'
]);
$src
=
$config
[
'url'
];
}
elseif
(
array_key_exists
(
'url'
,
$config
))
{
}
else
{
$src
=
$config
[
'url'
];
throw
new
Exception
(
"Missing either 'file' or 'url' in XML metadata source configuration."
);
}
else
{
}
throw
new
Exception
(
"Missing either 'file' or 'url' in XML metadata source configuration."
);
}
$SP1x
=
array
();
$IdP1x
=
array
();
$SP1x
=
array
();
$SP20
=
array
();
$IdP1x
=
array
();
$IdP20
=
array
();
$SP20
=
array
();
$AAD
=
array
();
$IdP20
=
array
();
$AAD
=
array
();
$entities
=
SimpleSAML_Metadata_SAMLParser
::
parseDescriptorsFile
(
$src
);
foreach
(
$entities
as
$entityId
=>
$entity
)
{
$entities
=
SimpleSAML_Metadata_SAMLParser
::
parseDescriptorsFile
(
$src
);
foreach
(
$entities
as
$entityId
=>
$entity
)
{
$md
=
$entity
->
getMetadata1xSP
();
if
(
$md
!==
NULL
)
{
$md
=
$entity
->
getMetadata1xSP
();
$SP1x
[
$entityId
]
=
$md
;
if
(
$md
!==
null
)
{
}
$SP1x
[
$entityId
]
=
$md
;
}
$md
=
$entity
->
getMetadata1xIdP
();
if
(
$md
!==
NULL
)
{
$md
=
$entity
->
getMetadata1xIdP
();
$IdP1x
[
$entityId
]
=
$md
;
if
(
$md
!==
null
)
{
}
$IdP1x
[
$entityId
]
=
$md
;
}
$md
=
$entity
->
getMetadata20SP
();
if
(
$md
!==
NULL
)
{
$md
=
$entity
->
getMetadata20SP
();
$SP20
[
$entityId
]
=
$md
;
if
(
$md
!==
null
)
{
}
$SP20
[
$entityId
]
=
$md
;
}
$md
=
$entity
->
getMetadata20IdP
();
if
(
$md
!==
NULL
)
{
$md
=
$entity
->
getMetadata20IdP
();
$IdP20
[
$entityId
]
=
$md
;
if
(
$md
!==
null
)
{
}
$IdP20
[
$entityId
]
=
$md
;
}
$md
=
$entity
->
getAttributeAuthorities
();
if
(
count
(
$md
)
>
0
)
{
$md
=
$entity
->
getAttributeAuthorities
();
$AAD
[
$entityId
]
=
$md
[
0
];
if
(
count
(
$md
)
>
0
)
{
}
$AAD
[
$entityId
]
=
$md
[
0
];
}
}
}
$this
->
metadata
=
array
(
'shib13-sp-remote'
=>
$SP1x
,
$this
->
metadata
=
array
(
'shib13-idp-remote'
=>
$IdP1x
,
'shib13-sp-remote'
=>
$SP1x
,
'saml20-sp-remote'
=>
$SP20
,
'shib13-idp-remote'
=>
$IdP1x
,
'saml20-idp-remote'
=>
$IdP20
,
'saml20-sp-remote'
=>
$SP20
,
'attributeauthority-remote'
=>
$AAD
,
'saml20-idp-remote'
=>
$IdP20
,
);
'attributeauthority-remote'
=>
$AAD
,
);
}
}
/**
/**
* This function returns an associative array with metadata for all entities in the given set. The
* This function returns an associative array with metadata for all entities in the given set. The
* key of the array is the entity id.
* key of the array is the entity id.
*
*
* @param string $set The set we want to list metadata for.
* @param string $set The set we want to list metadata for.
* @return array An associative array with all entities in the given set.
*
*/
* @return array An associative array with all entities in the given set.
public
function
getMetadataSet
(
$set
)
{
*/
if
(
array_key_exists
(
$set
,
$this
->
metadata
))
{
public
function
getMetadataSet
(
$set
)
return
$this
->
metadata
[
$set
];
{
}
if
(
array_key_exists
(
$set
,
$this
->
metadata
))
{
return
$this
->
metadata
[
$set
];
/* We don't have this metadata set. */
}
return
array
();
}
// we don't have this metadata set
return
array
();
}
}
}
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