Skip to content
Snippets Groups Projects
Verified Commit 739a681c authored by Damien's avatar Damien
Browse files

FEAT #10954 TIME 0:10 Get refreshed token response

parent af116b78
No related branches found
No related tags found
No related merge requests found
...@@ -154,6 +154,8 @@ class AuthenticationController ...@@ -154,6 +154,8 @@ class AuthenticationController
'where' => ['id = ?'], 'where' => ['id = ?'],
'data' => [$user['id']] 'data' => [$user['id']]
]); ]);
$response = $response->withHeader('Token', AuthenticationController::getJWT());
$response = $response->withHeader('Refresh-Token', $refreshToken);
HistoryController::add([ HistoryController::add([
'code' => 'OK', 'code' => 'OK',
...@@ -163,9 +165,6 @@ class AuthenticationController ...@@ -163,9 +165,6 @@ class AuthenticationController
'message' => '{userLogIn}' 'message' => '{userLogIn}'
]); ]);
$response = $response->withHeader('Token', AuthenticationController::getJWT());
$response = $response->withHeader('Refresh-Token', $refreshToken);
return $response->withStatus(204); return $response->withStatus(204);
} }
...@@ -195,9 +194,7 @@ class AuthenticationController ...@@ -195,9 +194,7 @@ class AuthenticationController
$GLOBALS['id'] = $user['id']; $GLOBALS['id'] = $user['id'];
$response = $response->withHeader('Token', AuthenticationController::getJWT()); return $response->withJson(['token' => AuthenticationController::getJWT()]);
return $response->withStatus(204);
} }
public static function getJWT() public static function getJWT()
...@@ -226,9 +223,9 @@ class AuthenticationController ...@@ -226,9 +223,9 @@ class AuthenticationController
return $jwt; return $jwt;
} }
private static function getRefreshJWT() public static function getRefreshJWT()
{ {
$sessionTime = 1; $sessionTime = AuthenticationController::MAX_DURATION_TOKEN;
$loadedXml = CoreConfigModel::getConfig(); $loadedXml = CoreConfigModel::getConfig();
if ($loadedXml) { if ($loadedXml) {
...@@ -248,4 +245,18 @@ class AuthenticationController ...@@ -248,4 +245,18 @@ class AuthenticationController
return $jwt; return $jwt;
} }
public static function getResetJWT()
{
$token = [
'exp' => time() + 3600,
'user' => [
'id' => $GLOBALS['id']
]
];
$jwt = JWT::encode($token, CoreConfigModel::getEncryptKey());
return $jwt;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment