Skip to content
Snippets Groups Projects
Commit 1e2e25d7 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Adding cidr hints as Metadata Extensions and added extension handling on idp as well as sp

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1087 44740490-163a-0410-bde0-09ae8108e29a
parent dcfd5b24
No related branches found
No related tags found
No related merge requests found
...@@ -83,6 +83,18 @@ class SimpleSAML_Metadata_SAMLBuilder { ...@@ -83,6 +83,18 @@ class SimpleSAML_Metadata_SAMLBuilder {
} }
$extensions->appendChild($attr); $extensions->appendChild($attr);
} }
if (array_key_exists('hint.cidr', $metadata)) {
$includeExtensions = TRUE;
$attr = $this->createElement('saml:Attribute', 'urn:oasis:names:tc:SAML:2.0:assertion');
$attr->setAttribute('Name', 'hint.cidr');
$hints = self::arrayize($metadata['hint.cidr']);
foreach ($hints AS $hint) {
$attr->appendChild($this->createTextElement('saml:AttributeValue', $hint));
}
$extensions->appendChild($attr);
}
if (array_key_exists('scope', $metadata)) { if (array_key_exists('scope', $metadata)) {
$includeExtensions = TRUE; $includeExtensions = TRUE;
...@@ -92,10 +104,17 @@ class SimpleSAML_Metadata_SAMLBuilder { ...@@ -92,10 +104,17 @@ class SimpleSAML_Metadata_SAMLBuilder {
$scope->appendChild($this->document->createTextNode($scopetext)); $scope->appendChild($this->document->createTextNode($scopetext));
$extensions->appendChild($scope); $extensions->appendChild($scope);
} }
} }
if ($includeExtensions) $this->entityDescriptor->appendChild($extensions); if ($includeExtensions) $this->entityDescriptor->appendChild($extensions);
} }
public static function arrayize($data) {
if (is_array($data)) {
return $data;
} else {
return array($data);
}
}
...@@ -308,6 +327,8 @@ class SimpleSAML_Metadata_SAMLBuilder { ...@@ -308,6 +327,8 @@ class SimpleSAML_Metadata_SAMLBuilder {
if (array_key_exists('redirect.sign', $metadata) && $metadata['redirect.sign']) { if (array_key_exists('redirect.sign', $metadata) && $metadata['redirect.sign']) {
$e->setAttribute('WantAuthnRequestSigned', 'true'); $e->setAttribute('WantAuthnRequestSigned', 'true');
} }
$this->addExtensions($metadata);
$this->addCertificate($e, $metadata); $this->addCertificate($e, $metadata);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment