1 Star 0 Fork 94

苹果/jwt-auth

forked from Thans/jwt-auth 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Payload.php 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
Thans 提交于 2020-11-26 03:39 . Apply fixes from StyleCI
<?php
namespace thans\jwt;
use thans\jwt\claim\Factory;
use thans\jwt\claim\Issuer;
use thans\jwt\claim\Audience;
use thans\jwt\claim\Expiration;
use thans\jwt\claim\IssuedAt;
use thans\jwt\claim\JwtId;
use thans\jwt\claim\NotBefore;
use thans\jwt\claim\Subject;
class Payload
{
protected $factory;
protected $classMap
= [
'aud' => Audience::class,
'exp' => Expiration::class,
'iat' => IssuedAt::class,
'iss' => Issuer::class,
'jti' => JwtId::class,
'nbf' => NotBefore::class,
'sub' => Subject::class,
];
protected $claims;
public function __construct(Factory $factory)
{
$this->factory = $factory;
}
public function customer(array $claim = [])
{
foreach ($claim as $key => $value) {
$this->factory->customer(
$key,
is_object($value) ? $value->getValue() : $value
);
}
return $this;
}
public function get()
{
$claim = $this->factory->builder()->getClaims();
return $claim;
}
public function check($refresh = false)
{
$this->factory->validate($refresh);
return $this;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/ypwl/jwt-auth.git
[email protected]:ypwl/jwt-auth.git
ypwl
jwt-auth
jwt-auth
master

搜索帮助