<?php

namespace Cadoles\CoreBundle\Service;

use LightSaml\Model\Protocol\Response;

class samlAttributeMapperService
{
    public function getAttributesFromResponse(Response $response): array
    {
        $attributes = [];

        foreach ($response->getFirstAssertion()->getFirstAttributeStatement()->getAllAttributes() as $attribute) {
            $attributes[$attribute->getFriendlyName()] = $attribute->getFirstAttributeValue();
        }
        return $attributes;
    }
}
