first commit

This commit is contained in:
dev-chiefworks
2022-05-31 16:21:53 -04:00
commit f76abffdcd
5978 changed files with 1078901 additions and 0 deletions
@@ -0,0 +1,24 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class AUTHORIZATION
{
public static function validateTimestamp($token)
{
$CI = &get_instance();
$token = self::validateToken($token);
if ($token != false && (now() - $token->timestamp < ($CI->config->item('token_timeout') * 60))) {
return $token;
}
return false;
}
public static function validateToken($token)
{
$CI = &get_instance();
return JWT::decode($token, $CI->config->item('jwt_key'));
}
public static function generateToken($data)
{
$CI = &get_instance();
return JWT::encode($data, $CI->config->item('jwt_key'));
}
}