Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Automatically disable the keystore generate_auth_token action if Sess…
Browse files Browse the repository at this point in the history
…ion Set Credentials is set in config. This will force systematic basic_auth.
  • Loading branch information
cdujeu committed Apr 7, 2015
1 parent 5037672 commit 43b1592
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ function authTokenActions($action, $httpVars, $fileVars){
switch($action){
case "keystore_generate_auth_token":

if(ConfService::getCoreConf("SESSION_SET_CREDENTIALS", "auth")){
$this->logDebug("Keystore Generate Tokens", "Session Credentials set: returning empty tokens to force basic authentication");
HTMLWriter::charsetHeader("text/plain");
echo "";
break;
}

$token = AJXP_Utils::generateRandomString();
$private = AJXP_Utils::generateRandomString();
$data = array("USER_ID" => $user, "PRIVATE" => $private);
Expand All @@ -124,7 +131,7 @@ function authTokenActions($action, $httpVars, $fileVars){
$data["DEVICE_UA"] = $_SERVER['HTTP_USER_AGENT'];
$data["DEVICE_IP"] = $_SERVER['REMOTE_ADDR'];
$this->storage->simpleStoreSet("keystore", $token, $data, "serial");
header("Content-type: application/json;");
HTMLWriter::charsetHeader("application/json");
echo(json_encode(array(
"t" => $token,
"p" => $private)
Expand Down

0 comments on commit 43b1592

Please sign in to comment.