ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
|
This is class for parsing of SAML 1.x and SAML 2.0 metadata. More...
Public Member Functions | |
getEntityId () | |
This function returns the entity id of this parsed entity. More... | |
getMetadata1xSP () | |
This function returns the metadata for SAML 1.x SPs in the format SimpleSAMLphp expects. More... | |
getMetadata1xIdP () | |
This function returns the metadata for SAML 1.x IdPs in the format SimpleSAMLphp expects. More... | |
getMetadata20SP () | |
This function returns the metadata for SAML 2.0 SPs in the format SimpleSAMLphp expects. More... | |
getMetadata20IdP () | |
This function returns the metadata for SAML 2.0 IdPs in the format SimpleSAMLphp expects. More... | |
getAttributeAuthorities () | |
Retrieve AttributeAuthorities from the metadata. More... | |
validateSignature ($certificates) | |
If this EntityDescriptor was signed this function use the public key to check the signature. More... | |
validateFingerprint ($fingerprint) | |
This function checks if this EntityDescriptor was signed with a certificate with the given fingerprint. More... | |
Static Public Member Functions | |
static | parseFile ($file) |
This function parses a file which contains XML encoded metadata. More... | |
static | parseString ($metadata) |
This function parses a string which contains XML encoded metadata. More... | |
static | parseDocument ($document) |
This function parses a DOMDocument which is assumed to contain a single EntityDescriptor element. More... | |
static | parseElement ($entityElement) |
This function parses a object which represents a EntityDescriptor element. More... | |
static | parseDescriptorsFile ($file) |
This function parses a file where the root node is either an EntityDescriptor element or an EntitiesDescriptor element. More... | |
static | parseDescriptorsString ($string) |
This function parses a string with XML data. More... | |
static | parseDescriptorsElement (DOMElement $element=null) |
This function parses a DOMElement which represents either an EntityDescriptor element or an EntitiesDescriptor element. More... | |
Private Member Functions | |
__construct (\SAML2\XML\md\EntityDescriptor $entityElement, $maxExpireTime, array $validators=array(), array $parentExtensions=null) | |
This is the constructor for the SAMLParser class. More... | |
getMetadataCommon () | |
addExtensions (array &$metadata, array $roleDescriptor) | |
Add data parsed from extensions to metadata. More... | |
processSPSSODescriptor (\SAML2\XML\md\SPSSODescriptor $element, $expireTime) | |
This function extracts metadata from a SPSSODescriptor element. More... | |
processIDPSSODescriptor (\SAML2\XML\md\IDPSSODescriptor $element, $expireTime) | |
This function extracts metadata from a IDPSSODescriptor element. More... | |
processAttributeAuthorityDescriptor (\SAML2\XML\md\AttributeAuthorityDescriptor $element, $expireTime) | |
This function extracts metadata from a AttributeAuthorityDescriptor element. More... | |
processOrganization (\SAML2\XML\md\Organization $element) | |
Parse and process a Organization element. More... | |
processContactPerson (\SAML2\XML\md\ContactPerson $element) | |
Parse and process a ContactPerson element. More... | |
getSPDescriptors ($protocols) | |
This function finds SP descriptors which supports one of the given protocols. More... | |
getIdPDescriptors ($protocols) | |
This function finds IdP descriptors which supports one of the given protocols. More... | |
Static Private Member Functions | |
static | getExpireTime ($element, $maxExpireTime) |
Determine how long a given element can be cached. More... | |
static | parseRoleDescriptorType (\SAML2\XML\md\RoleDescriptor $element, $expireTime) |
Parse a RoleDescriptorType element. More... | |
static | parseSSODescriptor (\SAML2\XML\md\SSODescriptorType $element, $expireTime) |
This function extracts metadata from a SSODescriptor element. More... | |
static | processExtensions ($element, $parentExtensions=array()) |
Parse an Extensions element. More... | |
static | parseAttributeConsumerService (\SAML2\XML\md\AttributeConsumingService $element, &$sp) |
This function parses AttributeConsumerService elements. More... | |
static | parseGenericEndpoint (\SAML2\XML\md\EndpointType $element) |
This function is a generic endpoint element parser. More... | |
static | extractEndpoints (array $endpoints) |
Extract generic endpoints. More... | |
static | parseKeyDescriptor (\SAML2\XML\md\KeyDescriptor $kd) |
This function parses a KeyDescriptor element. More... | |
static | findEntityDescriptor ($doc) |
This function locates the EntityDescriptor node in a DOMDocument. More... | |
Private Attributes | |
$entityId | |
$spDescriptors | |
$idpDescriptors | |
$attributeAuthorityDescriptors = array() | |
$organizationName = array() | |
$organizationDisplayName = array() | |
$organizationURL = array() | |
$contacts = array() | |
$scopes | |
$entityAttributes | |
$registrationInfo | |
$tags | |
$validators = array() | |
$entityDescriptor | |
Static Private Attributes | |
static | $SAML1xProtocols |
static | $SAML20Protocols |
This is class for parsing of SAML 1.x and SAML 2.0 metadata.
Metadata is loaded by calling the static methods parseFile, parseString or parseElement. These functions returns an instance of SimpleSAML_Metadata_SAMLParser. To get metadata from this object, use the methods getMetadata1xSP or getMetadata20SP.
To parse a file which can contain a collection of EntityDescriptor or EntitiesDescriptor elements, use the parseDescriptorsFile, parseDescriptorsString or parseDescriptorsElement methods. These functions will return an array of SAMLParser elements where each element represents an EntityDescriptor-element.
Definition at line 15 of file SAMLParser.php.
|
private |
This is the constructor for the SAMLParser class.
\SAML2\XML\md\EntityDescriptor | $entityElement | The EntityDescriptor. |
int | NULL | $maxExpireTime | The unix timestamp for when this entity should expire, or NULL if unknown. |
array | $validators | An array of parent elements that may validate this element. |
array | $parentExtensions | An optional array of extensions from the parent element. |
Definition at line 164 of file SAMLParser.php.
References $validators, array, processAttributeAuthorityDescriptor(), processContactPerson(), processIDPSSODescriptor(), processOrganization(), and processSPSSODescriptor().
Add data parsed from extensions to metadata.
array | &$metadata | The metadata that should be updated. |
array | $roleDescriptor | The parsed role descriptor. |
Definition at line 487 of file SAMLParser.php.
References $entityAttributes, $registrationInfo, $scopes, and $tags.
Referenced by getMetadata1xIdP(), getMetadata1xSP(), getMetadata20IdP(), and getMetadata20SP().
|
staticprivate |
Extract generic endpoints.
array | $endpoints | The endpoints we should parse. |
Definition at line 1293 of file SAMLParser.php.
|
staticprivate |
This function locates the EntityDescriptor node in a DOMDocument.
This node should be the first (and only) node in the document.
This function will throw an exception if it is unable to locate the node.
DOMDocument | $doc | The DOMDocument where we should find the EntityDescriptor node. |
Exception | If the document is empty or the first element is not an EntityDescriptor element. |
Definition at line 1410 of file SAMLParser.php.
SimpleSAML_Metadata_SAMLParser::getAttributeAuthorities | ( | ) |
Retrieve AttributeAuthorities from the metadata.
Definition at line 823 of file SAMLParser.php.
References $attributeAuthorityDescriptors.
Referenced by SimpleSAML\Metadata\Sources\MDQ\getParsedSet().
SimpleSAML_Metadata_SAMLParser::getEntityId | ( | ) |
This function returns the entity id of this parsed entity.
Definition at line 448 of file SAMLParser.php.
References $entityId.
|
staticprivate |
Determine how long a given element can be cached.
This function looks for the 'validUntil' attribute to determine how long a given XML-element is valid. It returns this as a unix timestamp.
mixed | $element | The element we should determine the expiry time of. |
int | NULL | $maxExpireTime | The maximum expiration time. |
Definition at line 430 of file SAMLParser.php.
References $expire.
|
private |
This function finds IdP descriptors which supports one of the given protocols.
$protocols | Array with the protocols we accept. |
Definition at line 1382 of file SAMLParser.php.
Referenced by getMetadata1xIdP(), and getMetadata20IdP().
SimpleSAML_Metadata_SAMLParser::getMetadata1xIdP | ( | ) |
This function returns the metadata for SAML 1.x IdPs in the format SimpleSAMLphp expects.
This is an associative array with the following fields:
Metadata must be loaded with one of the parse functions before this function can be called.
Definition at line 612 of file SAMLParser.php.
References $idp, $ret, addExtensions(), getIdPDescriptors(), and getMetadataCommon().
Referenced by SimpleSAML\Metadata\Sources\MDQ\getParsedSet().
SimpleSAML_Metadata_SAMLParser::getMetadata1xSP | ( | ) |
This function returns the metadata for SAML 1.x SPs in the format SimpleSAMLphp expects.
This is an associative array with the following fields:
Metadata must be loaded with one of the parse functions before this function can be called.
Definition at line 538 of file SAMLParser.php.
References $ret, addExtensions(), getMetadataCommon(), and getSPDescriptors().
Referenced by SimpleSAML\Metadata\Sources\MDQ\getParsedSet().
SimpleSAML_Metadata_SAMLParser::getMetadata20IdP | ( | ) |
This function returns the metadata for SAML 2.0 IdPs in the format SimpleSAMLphp expects.
This is an associative array with the following fields:
Metadata must be loaded with one of the parse functions before this function can be called.
Definition at line 765 of file SAMLParser.php.
References $idp, $ret, addExtensions(), getIdPDescriptors(), and getMetadataCommon().
Referenced by SimpleSAML\Metadata\Sources\MDQ\getParsedSet().
SimpleSAML_Metadata_SAMLParser::getMetadata20SP | ( | ) |
This function returns the metadata for SAML 2.0 SPs in the format SimpleSAMLphp expects.
This is an associative array with the following fields:
Metadata must be loaded with one of the parse functions before this function can be called.
Definition at line 668 of file SAMLParser.php.
References $ret, addExtensions(), getMetadataCommon(), and getSPDescriptors().
Referenced by SimpleSAML\Metadata\Sources\MDQ\getParsedSet().
|
private |
Definition at line 454 of file SAMLParser.php.
References $contacts, $entityDescriptor, $entityId, $organizationDisplayName, $organizationName, $organizationURL, $ret, and array.
Referenced by getMetadata1xIdP(), getMetadata1xSP(), getMetadata20IdP(), and getMetadata20SP().
|
private |
This function finds SP descriptors which supports one of the given protocols.
$protocols | Array with the protocols we accept. |
Definition at line 1358 of file SAMLParser.php.
Referenced by getMetadata1xSP(), and getMetadata20SP().
|
staticprivate |
This function parses AttributeConsumerService elements.
\SAML2\XML\md\AttributeConsumingService | $element | The AttributeConsumingService to parse. |
array | $sp | The array with the SP's metadata. |
Definition at line 1204 of file SAMLParser.php.
References $format, array, and SAML2\Constants\NAMEFORMAT_UNSPECIFIED.
|
static |
This function parses a DOMElement which represents either an EntityDescriptor element or an EntitiesDescriptor element.
It will return an associative array of SAMLParser instances in both cases.
DOMElement | NULL | $element | The DOMElement which contains the EntityDescriptor element or the EntitiesDescriptor element. |
Exception | if the document is empty or the root is an unexpected node. |
Definition at line 359 of file SAMLParser.php.
References $ret, $validators, and array.
Referenced by sspmod_metarefresh_MetaLoader\loadXML().
|
static |
This function parses a file where the root node is either an EntityDescriptor element or an EntitiesDescriptor element.
In both cases it will return an associative array of SAMLParser instances. If the file contains a single EntityDescriptorElement, then the array will contain a single SAMLParser instance.
string | $file | The path to the file which contains the EntityDescriptor or EntitiesDescriptor element. |
Exception | If the file does not parse as XML. |
Definition at line 302 of file SAMLParser.php.
References $data, $file, SimpleSAML\Utils\HTTP\fetch(), and SAML2\DOMDocumentFactory\fromString().
Referenced by SimpleSAML_Metadata_MetaDataStorageHandlerXML\__construct().
|
static |
This function parses a string with XML data.
The root node of the XML data is expected to be either an EntityDescriptor element or an EntitiesDescriptor element. It will return an associative array of SAMLParser instances.
string | $string | The string with XML data. |
Exception | If the string does not parse as XML. |
Definition at line 336 of file SAMLParser.php.
References SAML2\DOMDocumentFactory\fromString().
|
static |
This function parses a DOMDocument which is assumed to contain a single EntityDescriptor element.
DOMDocument | $document | The DOMDocument which contains the EntityDescriptor element. |
Definition at line 265 of file SAMLParser.php.
|
static |
This function parses a object which represents a EntityDescriptor element.
\SAML2\XML\md\EntityDescriptor | $entityElement | A object which represents a EntityDescriptor element. |
Definition at line 283 of file SAMLParser.php.
|
static |
This function parses a file which contains XML encoded metadata.
string | $file | The path to the file which contains the metadata. |
Exception | If the file does not parse as XML. |
Definition at line 224 of file SAMLParser.php.
References $data, $file, SimpleSAML\Utils\HTTP\fetch(), and SAML2\DOMDocumentFactory\fromString().
|
staticprivate |
This function is a generic endpoint element parser.
The returned associative array has the following elements:
\SAML2\XML\md\EndpointType | $element | The element which should be parsed. |
Definition at line 1263 of file SAMLParser.php.
References array.
|
staticprivate |
This function parses a KeyDescriptor element.
It currently only supports keys with a single X509 certificate.
The associative array for a key can contain:
\SAML2\XML\md\KeyDescriptor | $kd | The KeyDescriptor element. |
Definition at line 1318 of file SAMLParser.php.
References $d, $i, $r, and array.
|
staticprivate |
Parse a RoleDescriptorType element.
The returned associative array has the following elements:
\SAML2\XML\md\RoleDescriptor | $element | The element we should extract metadata from. |
int | NULL | $expireTime | The unix timestamp for when this element should expire, or NULL if unknown. |
Definition at line 843 of file SAMLParser.php.
References $key, $ret, and array.
|
staticprivate |
This function extracts metadata from a SSODescriptor element.
The returned associative array has the following elements:
\SAML2\XML\md\SSODescriptorType | $element | The element we should extract metadata from. |
int | NULL | $expireTime | The unix timestamp for when this element should expire, or NULL if unknown. |
Definition at line 894 of file SAMLParser.php.
|
static |
This function parses a string which contains XML encoded metadata.
string | $metadata | A string which contains XML encoded metadata. |
Exception | If the string does not parse as XML. |
Definition at line 246 of file SAMLParser.php.
References $metadata, and SAML2\DOMDocumentFactory\fromString().
|
private |
This function extracts metadata from a AttributeAuthorityDescriptor element.
\SAML2\XML\md\AttributeAuthorityDescriptor | $element | The element which should be parsed. |
int | NULL | $expireTime | The unix timestamp for when this element should expire, or NULL if unknown. |
Definition at line 983 of file SAMLParser.php.
References $entityId.
Referenced by __construct().
|
private |
Parse and process a ContactPerson element.
\SAML2\XML\md\ContactPerson | $element | The ContactPerson element. |
Definition at line 1171 of file SAMLParser.php.
References array.
Referenced by __construct().
|
staticprivate |
Parse an Extensions element.
Extensions may appear in multiple elements and certain extension may get inherited from a parent element.
mixed | $element | The element which contains the Extensions element. |
array | $parentExtensions | An optional array of extensions from the parent element. |
Definition at line 1010 of file SAMLParser.php.
References $name, $ret, array, and SimpleSAML\Logger\warning().
|
private |
This function extracts metadata from a IDPSSODescriptor element.
\SAML2\XML\md\IDPSSODescriptor | $element | The element which should be parsed. |
int | NULL | $expireTime | The unix timestamp for when this element should expire, or NULL if unknown. |
Definition at line 957 of file SAMLParser.php.
References $idp.
Referenced by __construct().
|
private |
Parse and process a Organization element.
\SAML2\XML\md\Organization | $element | The Organization element. |
Definition at line 1157 of file SAMLParser.php.
Referenced by __construct().
|
private |
This function extracts metadata from a SPSSODescriptor element.
\SAML2\XML\md\SPSSODescriptor | $element | The element which should be parsed. |
int | NULL | $expireTime | The unix timestamp for when this element should expire, or NULL if unknown. |
Definition at line 921 of file SAMLParser.php.
Referenced by __construct().
SimpleSAML_Metadata_SAMLParser::validateFingerprint | ( | $fingerprint | ) |
This function checks if this EntityDescriptor was signed with a certificate with the given fingerprint.
string | $fingerprint | Fingerprint of the certificate which should have been used to sign this EntityDescriptor. |
Definition at line 1476 of file SAMLParser.php.
References array, and SimpleSAML\Logger\debug().
SimpleSAML_Metadata_SAMLParser::validateSignature | ( | $certificates | ) |
If this EntityDescriptor was signed this function use the public key to check the signature.
array | $certificates | One ore more certificates with the public key. This makes it possible to do a key rollover. |
Exception | If the certificate file cannot be found. |
Definition at line 1438 of file SAMLParser.php.
References $certificates, $key, array, SimpleSAML\Logger\debug(), and SimpleSAML\Utils\Config\getCertPath().
|
private |
Definition at line 76 of file SAMLParser.php.
Referenced by getAttributeAuthorities().
|
private |
Definition at line 113 of file SAMLParser.php.
Referenced by getMetadataCommon().
|
private |
Definition at line 125 of file SAMLParser.php.
Referenced by addExtensions().
|
private |
Definition at line 152 of file SAMLParser.php.
Referenced by getMetadataCommon().
|
private |
Definition at line 44 of file SAMLParser.php.
Referenced by getEntityId(), getMetadataCommon(), and processAttributeAuthorityDescriptor().
|
private |
Definition at line 68 of file SAMLParser.php.
|
private |
Definition at line 96 of file SAMLParser.php.
Referenced by getMetadataCommon().
|
private |
Definition at line 86 of file SAMLParser.php.
Referenced by getMetadataCommon().
|
private |
Definition at line 105 of file SAMLParser.php.
Referenced by getMetadataCommon().
|
private |
Definition at line 131 of file SAMLParser.php.
Referenced by addExtensions().
|
staticprivate |
Definition at line 23 of file SAMLParser.php.
|
staticprivate |
Definition at line 34 of file SAMLParser.php.
|
private |
Definition at line 119 of file SAMLParser.php.
Referenced by addExtensions().
|
private |
Definition at line 57 of file SAMLParser.php.
|
private |
Definition at line 136 of file SAMLParser.php.
Referenced by addExtensions().
|
private |
Definition at line 144 of file SAMLParser.php.
Referenced by __construct(), and parseDescriptorsElement().