Level51\JWTUtils\JWTUtils
Utility Class for handling JWTs.
Synopsis
class JWTUtils
{
- // members
- private static integer $lifetime_in_days = 7;
- private static integer $renew_threshold_in_minutes = 60;
- private static JWTUtils $instance = NULL;
- // methods
- public static JWTUtils inst()
- public static void tearDown()
- private void __construct()
- private void __clone()
- private bool hasValidSecret()
- private int calcExpirationClaim()
- public array getClaims()
- public array byBasicAuth()
- public string renew()
- public bool check()
Tasks
Line | Task |
---|---|
159 | Check if script reaches this point if exp claim is in past |
Members
private
- $instance — Level51\JWTUtils\JWTUtils
- $lifetime_in_days — int
- $renew_threshold_in_minutes — int
Methods
private
- __construct() — JWTUtils constructor.
- __clone() — Disables the magic clone method
- calcExpirationClaim()
- hasValidSecret() — Checks for a valid "secret" config
public
- byBasicAuth() — Creates a new token from Basic Auth member data
- check() — Checks if token is valid and non-expired
- getClaims() — Generates a fresh set of default claims.
- inst()
- renew() — Checks if the given token is valid and needs to be renewed
- tearDown() — Clears the singleton instance. Helps with PHPUnit testing.