Exemplo n.º 1
0
function getARP($params)
{
    if (!isset($params['aid'])) {
        return false;
    }
    $arp = new sspmod_janus_ARP();
    $arp->setAid((int) $params['aid']);
    $arp->load();
    $attributes = $arp->getAttributes();
    if (empty($attributes)) {
        $attributes = array();
    }
    ksort($attributes);
    return array('aid' => $arp->getAid(), 'name' => $arp->getName(), 'description' => $arp->getDescription(), 'is_default' => $arp->isDefault(), 'attributes' => $attributes);
}
echo '<h1>SAML20 SP</h1>';
include 'saml20-sp-remote.php';
foreach ($metadata as $key => $val) {
    $msg = $mcontrol->createNewEntity($key, 'saml20-sp');
    echo "Id: " . $msg . '<br />';
    if (is_int($msg)) {
        $econtroller = new sspmod_janus_EntityController($janus_config);
        $econtroller->setEntity((string) $msg);
        $econtroller->loadEntity();
        foreach ($val as $k => $v) {
            if ($k == 'attributes') {
                $arp = new sspmod_janus_ARP();
                $arp->setName($key);
                $arp->setAttributes($v);
                $arp->save();
                $econtroller->setArp($arp->getAid());
            }
            if ($k == 'name') {
                $k = 'entity:name';
            }
            if ($k == 'description') {
                $k = 'entity:description';
            }
            echo '<br>Key: ' . $k . '<br>';
            if (is_string($v)) {
                echo '<br/>Insert ' . $v . '<br/>';
                if (!$econtroller->addMetadata($k, $v)) {
                    $econtroller->updateMetadata($k, $v);
                    echo 'Updated<br>';
                } else {
                    echo 'Added<br>';