Skip to content

Commit 4a9d6ae

Browse files
author
mauli
committed
Move JWT token into metadir dokuwiki#4239
Moving JWT token store away from cache directory, to have long-lived authentication files properly stored. Using sha256 on the files instead of md5, to help mitigate potential hash collision as filenames are based on username.
1 parent df2dbbd commit 4a9d6ae

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

inc/JWT.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ public function getIssued()
179179
*/
180180
public static function getStorageFile($user)
181181
{
182-
return getCacheName($user, '.token');
182+
global $conf;
183+
$hash = hash('sha256', $user);
184+
$file = $conf['metadir'] . '/jwt/' . $hash[0] . '/' . $hash . '.token';
185+
io_makeFileDir($file);
186+
return $file;
183187
}
184188
}

0 commit comments

Comments
 (0)