Beispiel #1
0
function tokenGet($params)
{
    $username =& $params[0];
    $password =& $params[1];
    $clientname =& $params[2];
    $tokenNumber = false;
    /* $command should be a script to check authentication. */
    /* JLO2 Local */
    //$command = "/home/jlodom00/public_html/pwdev/backend/pubcookie_test/pubmycook.sh {$username} {$password}";
    /* NOTE Pubcookie  */
    $command = "/home/jlodom00/public_html/pwdev/backend/pubcookie_test/pubmycook.sh {$username} {$password}";
    $command = escapeshellcmd($command);
    $validLogin = false;
    passthru($command, $validLogin);
    if ($validLogin == 1) {
        $newToken = new NodeToken();
        $tokenNumber = $newToken->createToken($username, $clientname);
        $tokenNumber = $newToken->tokenNumber;
        /* It is possible for user authentication to succeed but
        		for the user to be invalid for the planworld node.
        		Token check to make sure that the user was found to be
        		valid in the planworld node itself. */
        if (!$newToken->valid) {
            $tokenNumber = false;
            statusCode(401);
        } else {
            statusCode(200);
        }
    } else {
        statusCode(401);
        $tokenNumber = false;
    }
    return $tokenNumber;
}
Beispiel #2
0
function xmlrpc_getToken($method_name, $params)
{
    $username =& $params[0];
    $password =& $params[1];
    $tokenNumber = false;
    /* $command should be a script to check authentication. The one below is specific to JLO2's install.*/
    $command = "/Users/jlodom/Sites/code01/pubcookie_test/alwaystrue.sh {$username}";
    /* Command Below is for NOTE authentication in JLO2 test environment.
    	$command = "/Users/jlodom/Sites/izzy/pubcookie_test/pubmycook.sh {$username} {$password}";
    	*/
    /* Command Below always returns true for testing.
    	$command = "/PATHTOPLANWORLD/development/tokenauth/alwaystrue.sh {$username}";
    	*/
    /* Command Below is a template for Pubcookie. The directory it is in must be writable.
    	   In a production environment, this script should never be in the web server path.
    	$command = "/PATHTOPLANWORLD/development/tokenauth/pubcookieexample.sh {$username} {$password}";
    	*/
    $command = escapeshellcmd($command);
    $validLogin = false;
    passthru($command, $validLogin);
    if ($validLogin) {
        $newToken = new NodeToken();
        $tokenNumber = $newToken->createToken($username);
        $tokenNumber = $newToken->tokenNumber;
    } else {
        $tokenNumber = false;
    }
    return $tokenNumber;
}