Skip to content

Commit

Permalink
make check function for ServiceName and ServiceDescription
Browse files Browse the repository at this point in the history
  • Loading branch information
temaotl committed Jan 8, 2025
1 parent f76240c commit b757207
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions app/Traits/ValidatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -766,16 +766,29 @@ public function checkServiceProviderRequestedAttributeNameValueDuplicity(object
}
}

public function checkServiceNameAttributeForContentExistence(object $xpath): void
{
foreach ($xpath->query('/md:EntityDescriptor/md:SPSSODescriptor/md:AttributeConsumingService/md:ServiceName') as $attribute) {
if (empty($attribute->nodeValue)) {
$this->error .= 'ServiceName attribute is empty please fill the attribute. ';

public function checkAttributeForContentExistence (mixed $attributes):void{

foreach ($attributes as $attribute) {
if(empty($attribute->nodeValue)){
$this->error .= " $attribute->localName attribute is empty please fill the attribute. ";
break;
}
}

}

public function checkServiceNameAttributeForContentExistence(object $xpath): void
{
$this->checkAttributeForContentExistence($xpath->query('/md:EntityDescriptor/md:SPSSODescriptor/md:AttributeConsumingService/md:ServiceName'));
}
public function checkServiceDescriptionAttributeForContentExistence(object $xpath): void
{
$this->checkAttributeForContentExistence($xpath->query('/md:EntityDescriptor/md:SPSSODescriptor/md:AttributeConsumingService/md:ServiceDescription'));
}



public function generateResult(): void
{
if (empty($this->error)) {
Expand Down Expand Up @@ -807,6 +820,7 @@ public function validateMetadata(string $metadata): string
$this->checkOneEntityAttributesElementPerExtensions($xpath);
$this->checkServiceProviderRequestedAttributeNameValueDuplicity($xpath);
$this->checkServiceNameAttributeForContentExistence($xpath);
$this->checkServiceDescriptionAttributeForContentExistence($xpath);

$this->generateResult();
}
Expand Down

0 comments on commit b757207

Please sign in to comment.