first commit
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user