jwt initial
This commit is contained in:
22
interfaceServices/jwttest2.php
Normal file
22
interfaceServices/jwttest2.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require '../vendor/autoload.php';
|
||||||
|
|
||||||
|
use Lcobucci\JWT\Builder;
|
||||||
|
use Lcobucci\JWT\Signer\Hmac\Sha256;
|
||||||
|
|
||||||
|
$signer = new Sha256();
|
||||||
|
|
||||||
|
$token = (new Builder())->setIssuer("http://pugludos.com")
|
||||||
|
->setIssuedAt(time())
|
||||||
|
->setExpiration(time() + 3600)
|
||||||
|
->set("userName", "ckoch")
|
||||||
|
->sign($signer, "testing")
|
||||||
|
->getToken();
|
||||||
|
|
||||||
|
echo( $token );
|
||||||
|
|
||||||
|
/* used to verify token */
|
||||||
|
var_dump($token->verify($signer, 'testing'));
|
||||||
|
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user