jwt initial

This commit is contained in:
2018-05-06 16:00:00 -04:00
parent 59d8cfe020
commit ca630dda67

View 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'));
?>