Enable secure
for JWT-cookie
This commit is contained in:
parent
3b43538f90
commit
c0ffd0a7ba
@ -106,7 +106,7 @@ function storeToken (string $secureToken, string $qualifiedUsername, string $htt
|
||||
// This might seem backwards, but relying on $_SERVER directly allows spoofed values with potential security risks
|
||||
return (strlen($value) > strlen($httpHost)) ? false : (0 === substr_compare($httpHost, $value, -strlen($value)));
|
||||
}))[0];
|
||||
if ($cookieDomain && setcookie('JWT', $secureToken, (time() + $settings->Session['Duration']), '/', '.' . $cookieDomain)) {
|
||||
if ($cookieDomain && setcookie('JWT', $secureToken, (time() + $settings->Session['Duration']), '/', '.' . $cookieDomain, TRUE)) {
|
||||
return ['status' => 'Success'];
|
||||
} else {
|
||||
return ['status' => 'Fail', 'reason' => 'Unable to store cookie(s)'];
|
||||
|
@ -10,7 +10,16 @@
|
||||
if ($validateTokenResult['status'] === "Success") {
|
||||
switch ($_REQUEST['do']) {
|
||||
case 'mutateusers':
|
||||
if (isset($_REQUEST['new']) && isset($_REQUEST['removed'])) {
|
||||
// Do magic!
|
||||
}
|
||||
else {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode([
|
||||
"Result" => "Failure",
|
||||
"Reason" => "Incomplete request data"
|
||||
]);
|
||||
}
|
||||
break;
|
||||
case 'retrievesessions':
|
||||
$storedTokens = [];
|
||||
|
Loading…
Reference in New Issue
Block a user