Example #1
0
    $portal_urn = '';
    // FIXMEFIXME
    $candidate_tools = ma_list_clients($ma_url, $km_signer);
    foreach ($candidate_tools as $toolname => $toolurn) {
        if ($toolname == 'portal') {
            $portal_urn = $toolurn;
            break;
        }
    }
    if ($portal_urn == '') {
        error_log("KM: Error authorizing portal for {$username}: Couldn't find portal in list of KM clients");
        $_SESSION['lastmessage'] = 'Your GENI account is active.';
        $_SESSION['lasterror'] = 'GENI Portal not authorized: Could not find portal in list of available clients';
        relative_redirect($authorize_portal_page);
    }
    $result = ma_authorize_client($ma_url, $km_signer, $member_id, $portal_urn, true);
    //  error_log("auth res = " . print_r($result, true));
    if ($result[RESPONSE_ARGUMENT::CODE] == RESPONSE_ERROR::NONE) {
        relative_redirect('home.php');
    } else {
        $auth_error = $result[RESPONSE_ARGUMENT::OUTPUT];
        error_log("KM: Error authorizing portal for {$username}: " . $auth_error);
        $_SESSION['lastmessage'] = 'Your GENI account is active.';
        $_SESSION['lasterror'] = 'GENI Portal not authorized: error authorizing: $auth_error';
        relative_redirect($authorize_portal_page);
    }
} else {
    // portal not authorized
    $_SESSION['lastmessage'] = 'Your GENI account is active.';
    if (!$speaks_for_enabled) {
        $_SESSION['lasterror'] = 'GENI Portal not authorized.';
Example #2
0
if (array_key_exists("authorize_sense", $_GET)) {
    $sense = $_GET["authorize_sense"];
}
$sense_text = "authorized";
if ($sense == false) {
    $sense_text = "deauthorized";
}
$toolurn_auth = "";
if (array_key_exists("authorize_toolurn", $_GET)) {
    $toolurn_auth = $_GET["authorize_toolurn"];
}
// error_log("REDIRECT = " . $redirect_address);
$auth_success = false;
$auth_error = "";
if (array_key_exists("authorize_toolname", $_GET)) {
    $result = ma_authorize_client($ma_url, $km_signer, $member_id, $toolurn_auth, $sense);
    //  error_log("auth res = " . print_r($result, true));
    if ($result[RESPONSE_ARGUMENT::CODE] == RESPONSE_ERROR::NONE) {
        $auth_success = true;
    } else {
        $auth_error = $result[RESPONSE_ARGUMENT::OUTPUT];
        error_log("KM: Error changing authorization for {$toolname_auth} for {$username} to {$sense}: " . $result[RESPONSE_ARGUMENT::OUTPUT]);
    }
}
if (isset($member_id)) {
    $authorized_tools_for_user = ma_list_authorized_clients($ma_url, $km_signer, $member_id);
    //error_log("auth list: " . print_r($authorized_tools_for_user, true));
}
include 'kmheader.php';
print "<h2>GENI Key Management Tool</h2><br>\n";
include "tool-showmessage.php";