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

Commit 43b1592

Browse files
committed
Automatically disable the keystore generate_auth_token action if Session Set Credentials is set in config. This will force systematic basic_auth.
1 parent 5037672 commit 43b1592

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

core/src/plugins/authfront.keystore/class.KeystoreAuthFrontend.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ function authTokenActions($action, $httpVars, $fileVars){
108108
switch($action){
109109
case "keystore_generate_auth_token":
110110

111+
if(ConfService::getCoreConf("SESSION_SET_CREDENTIALS", "auth")){
112+
$this->logDebug("Keystore Generate Tokens", "Session Credentials set: returning empty tokens to force basic authentication");
113+
HTMLWriter::charsetHeader("text/plain");
114+
echo "";
115+
break;
116+
}
117+
111118
$token = AJXP_Utils::generateRandomString();
112119
$private = AJXP_Utils::generateRandomString();
113120
$data = array("USER_ID" => $user, "PRIVATE" => $private);
@@ -124,7 +131,7 @@ function authTokenActions($action, $httpVars, $fileVars){
124131
$data["DEVICE_UA"] = $_SERVER['HTTP_USER_AGENT'];
125132
$data["DEVICE_IP"] = $_SERVER['REMOTE_ADDR'];
126133
$this->storage->simpleStoreSet("keystore", $token, $data, "serial");
127-
header("Content-type: application/json;");
134+
HTMLWriter::charsetHeader("application/json");
128135
echo(json_encode(array(
129136
"t" => $token,
130137
"p" => $private)

0 commit comments

Comments
 (0)