Skip to content

Commit

Permalink
leeway support
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleferguson committed Oct 2, 2015
1 parent c1cb1d2 commit 703ee9a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ for the available config options and their defaults.
| ------------ | ------- | ---------------------------------------------------------------- |
| `JWT_SECRET` | *null* | The secret key that will be used for sigining/validating tokens. |
| `JWT_ALGO` | *HS256* | The algorithm to use for sigining tokens. |
| `JWT_LEEWAY` | *0* | Seconds of leeway for validating timestamps to account for time differences between systems |
| `JWT_INPUT` | *token* | By default we will look for the token in the `Authorization` header. If it's not found there, then this value will be used to search the sent input from the request to find the token. |

If you're using the `JwtExceptionHandler` to handle exceptions, these environment variables can be set to customize the error messages.
Expand Down
9 changes: 9 additions & 0 deletions src/Drivers/FirebaseDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
class FirebaseDriver implements JwtDriverInterface
{

/**
* @param int $leeway for checking timestamps
*/
public function __construct($leeway = null)
{
$leeway = $leeway ?: getenv('JWT_LEEWAY');
JWT::$leeway = $leeway ?: 0;
}

/**
* Validate that the provided token
*
Expand Down

0 comments on commit 703ee9a

Please sign in to comment.