Skip to content

Commit

Permalink
Merge pull request #827 from OpenConext/bugfix/metadata-emailaddress-…
Browse files Browse the repository at this point in the history
…needs-mailto

According to the spec, EmailAddress needs to have a mailto: prefix
  • Loading branch information
thijskh authored Feb 10, 2020
2 parents 3aec7ff + f1466b3 commit 2e42318
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions tests/unit/OpenConext/EngineBlock/Xml/MetadataRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use OpenConext\EngineBlock\Metadata\Factory\Adapter\ServiceProviderEntity;
use OpenConext\EngineBlock\Metadata\Factory\Collection\IdentityProviderEntityCollection;
use OpenConext\EngineBlock\Metadata\Factory\Decorator\EngineBlockIdentityProvider;
use OpenConext\EngineBlock\Metadata\ContactPerson;
use OpenConext\EngineBlock\Metadata\IndexedService;
use OpenConext\EngineBlock\Metadata\Logo;
use OpenConext\EngineBlock\Metadata\Organization;
Expand Down Expand Up @@ -141,6 +142,12 @@ public function the_metadata_factory_should_return_valid_signed_xml_for_sp()
Constants::BINDING_HTTP_POST,
0
);
$contactPersons[] = ContactPerson::from(
'administrative',
'John',
'Doe',
'[email protected]'
);

$sp = Utils::instantiate(
ServiceProvider::class,
Expand All @@ -149,6 +156,7 @@ public function the_metadata_factory_should_return_valid_signed_xml_for_sp()
'assertionConsumerServices' => $assertionConsumerServices,
'logo' => new Logo('/images/logo.gif'),
'organizationEn' => new Organization('Org', 'Organization', 'https://example.org'),
'contactPersons' => $contactPersons,
]
);

Expand All @@ -169,6 +177,9 @@ public function the_metadata_factory_should_return_valid_signed_xml_for_sp()
$entityDescriptor = new EntityDescriptor($dom->childNodes->item(1));
$this->assertInstanceOf(EntityDescriptor::class, $entityDescriptor);

// Verify that the requried "mailto:" prefix is present for the EmailAdress tag
$this->assertContains('<md:EmailAddress>mailto:[email protected]</md:EmailAddress>', $xml);

// Assert schema
$this->validateSchema($xml);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<md:ContactPerson contactType="{{ contactPerson.contactType }}">
<md:GivenName>{{ contactPerson.givenName }}</md:GivenName>
<md:SurName>{{ contactPerson.surName }}</md:SurName>
<md:EmailAddress>{{ contactPerson.emailAddress }}</md:EmailAddress>
<md:EmailAddress>mailto:{{ contactPerson.emailAddress }}</md:EmailAddress>
</md:ContactPerson>

0 comments on commit 2e42318

Please sign in to comment.