Example #1
0
 */
require_once 'vendor/autoload.php';
try {
    if (!isset($argv[1])) {
        echo "Please specify entityId" . PHP_EOL;
        die;
    }
    $spEntityId = $argv[1];
    $configFile = __DIR__ . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "config.ini";
    $config = \fkooman\Config\Config::fromIniFile($configFile);
    // data directory
    $exportDir = $config->s('output')->l('exportDir', true);
    // REQ
    $timezone = $config->l('timezone', false, "Europe/Amsterdam");
    date_default_timezone_set($timezone);
    $inputFile = $exportDir . DIRECTORY_SEPARATOR . "export.json";
    $exportData = @file_get_contents($inputFile);
    if (false === $exportData) {
        throw new Exception(sprintf("unable to read JSON file '%s' from disk", $inputFile));
    }
    $entities = json_decode($exportData, true);
    $aclResolve = new \SURFnet\janus\acl\Resolve($entities);
    $allowedIdps = $aclResolve->aclAllowedIdps($spEntityId, true);
    echo $spEntityId . PHP_EOL;
    foreach ($allowedIdps as $allowedIdp) {
        echo "    " . $allowedIdp . PHP_EOL;
    }
} catch (Exception $e) {
    echo sprintf("ERROR: %s", $e->getMessage());
    die(PHP_EOL);
}
Example #2
0
 * limitations under the License.
 */
require_once 'vendor/autoload.php';
echo date("Y-m-d H:i:s") . " :: starting Janus entity aclDump\n";
try {
    $configFile = __DIR__ . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "config.ini";
    $config = \fkooman\Config\Config::fromIniFile($configFile);
    // data directory
    $exportDir = $config->s('output')->l('exportDir', true);
    // REQ
    $aclDir = $config->s('output')->l('aclDir', true);
    // REQ
    $timezone = $config->l('timezone', false, "Europe/Amsterdam");
    date_default_timezone_set($timezone);
    $inputFile = $exportDir . DIRECTORY_SEPARATOR . "export.json";
    $exportData = @file_get_contents($inputFile);
    if (false === $exportData) {
        throw new Exception(sprintf("unable to read JSON file '%s' from disk", $inputFile));
    }
    $entities = json_decode($exportData, true);
    $aclResolve = new SURFnet\janus\acl\Resolve($entities);
    $aclDump = array("saml20-idp" => $aclResolve->idpAclDump(true), "saml20-sp" => $aclResolve->spAclDump(true));
    $outputFile = $aclDir . DIRECTORY_SEPARATOR . "acl.json";
    if (false === @file_put_contents($outputFile, json_encode($aclDump))) {
        throw new Exception(sprintf("unable to write JSON file '%s' to disk", $outputFile));
    }
} catch (Exception $e) {
    echo sprintf("ERROR: %s", $e->getMessage());
    die(PHP_EOL);
}
echo date("Y-m-d H:i:s") . " :: entity aclDump done\n";
Example #3
0
 */
require_once 'vendor/autoload.php';
try {
    if (!isset($argv[1])) {
        echo "Please specify entityId" . PHP_EOL;
        die;
    }
    $idpEntityId = $argv[1];
    $configFile = __DIR__ . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "config.ini";
    $config = \fkooman\Config\Config::fromIniFile($configFile);
    // data directory
    $exportDir = $config->s('output')->l('exportDir', true);
    // REQ
    $timezone = $config->l('timezone', false, "Europe/Amsterdam");
    date_default_timezone_set($timezone);
    $inputFile = $exportDir . DIRECTORY_SEPARATOR . "export.json";
    $exportData = @file_get_contents($inputFile);
    if (false === $exportData) {
        throw new Exception(sprintf("unable to read JSON file '%s' from disk", $inputFile));
    }
    $entities = json_decode($exportData, true);
    $aclResolve = new \SURFnet\janus\acl\Resolve($entities);
    $allowedSps = $aclResolve->aclAllowedSps($idpEntityId, true);
    echo $idpEntityId . PHP_EOL;
    foreach ($allowedSps as $allowedSp) {
        echo "    " . $allowedSp . PHP_EOL;
    }
} catch (Exception $e) {
    echo sprintf("ERROR: %s", $e->getMessage());
    die(PHP_EOL);
}