function pugpig_subs_cds_sign_in($url_base, $urn, $surname, $proxy_server = null, $proxy_port = null, $comments = array(), $api_type = PUGPIG_CDS_DEFAULT_API_TYPE, $originator = null)
{
    $comments[] = "URN: {$urn} SURNAME: {$surname}";
    $token = _pugpig_subs_cds_get_verified_token($url_base, $urn, $surname, $comments, $proxy_server, $proxy_port, $api_type, $originator);
    _pugpig_subs_sign_in_response($token, $comments);
}
Esempio n. 2
0
*/
include_once "auth_test_inc.php";
// Take the first param that isn't one of the special set
$params = $_REQUEST;
unset($params["product_id"]);
unset($params["issue_prefix"]);
unset($params["issue_start"]);
unset($params["issue_end"]);
$cred = array_shift($params);
$cred = strtolower($cred);
$comments = array();
if (patcf_is_status_coder($cred)) {
    patcf_return_status_code($cred, 0);
    $comments[] = "User follows special pattern";
    $token = strrev($cred);
} else {
    if ($cred == "badtoken") {
        $comments[] = "This token is no good. Simulate expired or cancelled";
        $token = "badbad";
    } else {
        if (in_array($cred, $all_users)) {
            $comments[] = "User is in the predefined list";
            $token = strrev($cred);
        } else {
            $comments[] = "User not in the predefined list";
            $token = null;
        }
    }
}
_pugpig_subs_sign_in_response($token, $comments);
}
$orig = $token;
$user = "";
if ($token == $longtoken) {
    $user = "******";
} else {
    $token = preg_replace('/X/', '', $token);
    // Remove the X
    $user = strrev($token);
}
$comments = array();
if ($token == "") {
    $token = null;
    $comments[] = "No token supplied";
} elseif (in_array(strrev($token), array("blockedtoken"))) {
    $comments[] = "Your token is no longer valid";
    $token = null;
} elseif (in_array(strrev($token), array("expiredtoken"))) {
    $comments[] = "Your token has been renewed";
    $token = strrev("activeall");
} elseif (in_array(strrev($token), array("alwaysstaletoken"))) {
    $comments[] = "Have another stale token. Sorry.";
    $token = $orig . "X";
}
$secret = null;
if (endsWith($user, "global")) {
    $comments[] = "Using a Global Auth Token";
    $secret = empty($pugpigCredsSecret) ? null : $pugpigCredsSecret;
}
_pugpig_subs_sign_in_response($token, $comments, 'notrecognised', 'Invalid credentials', $secret);