Jwt
Issue, parse and validate JSON Web Tokens (JWT) as described in RFC 7519.
Builder (Phalcon\Encryption\Security\JWT\Builder) Parser (Phalcon\Encryption\Security\JWT\Token\Parser) Validator (Phalcon\Encryption\Security\JWT\Validator)
- Full name:
\Zemit\Provider\Jwt\Jwt
Properties
options
public array $options
builder
public \Phalcon\Encryption\Security\JWT\Builder $builder
parser
public \Phalcon\Encryption\Security\JWT\Token\Parser $parser
validator
public \Phalcon\Encryption\Security\JWT\Validator $validator
signer
public \Phalcon\Encryption\Security\JWT\Signer\AbstractSigner $signer
token
public \Phalcon\Encryption\Security\JWT\Token\Token $token
Methods
__construct
public __construct(array $defaultOptions = []): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$defaultOptions | array |
signer
Initialize JWT Signer
public signer(string $signer = null, string $algo = null): \Phalcon\Encryption\Security\JWT\Signer\AbstractSigner
Parameters:
Parameter | Type | Description |
---|---|---|
$signer | string | |
$algo | string |
builder
Initialize JWT Builder and validate it
public builder(array $options = []): \Phalcon\Encryption\Security\JWT\Builder
Parameters:
Parameter | Type | Description |
---|---|---|
$options | array |
Throws:
parser
Initialize JWT Parser
public parser(): \Phalcon\Encryption\Security\JWT\Token\Parser
validator
Initialize JWT Validator
public validator(\Phalcon\Encryption\Security\JWT\Token\Token $token = null, int $timeShift): \Phalcon\Encryption\Security\JWT\Validator
Parameters:
Parameter | Type | Description |
---|---|---|
$token | \Phalcon\Encryption\Security\JWT\Token\Token | |
$timeShift | int |
buildToken
Build a token and validate it
public buildToken(\Phalcon\Encryption\Security\JWT\Builder $builder = null): \Phalcon\Encryption\Security\JWT\Token\Token
Parameters:
Parameter | Type | Description |
---|---|---|
$builder | \Phalcon\Encryption\Security\JWT\Builder |
Throws:
parseToken
Parse a jwt token and return the Token object
public parseToken(string $token): \Phalcon\Encryption\Security\JWT\Token\Token
Parameters:
Parameter | Type | Description |
---|---|---|
$token | string |
validateToken
Validate the token
public validateToken(\Phalcon\Encryption\Security\JWT\Token\Token $token = null, int $timeShift, array $options = [], \Phalcon\Encryption\Security\JWT\Signer\AbstractSigner $signer = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$token | \Phalcon\Encryption\Security\JWT\Token\Token | |
$timeShift | int | |
$options | array | |
$signer | \Phalcon\Encryption\Security\JWT\Signer\AbstractSigner |
Throws:
getDefaultOptions
Get default JWT Builder Options
public getDefaultOptions(array $options = []): array
Parameters:
Parameter | Type | Description |
---|---|---|
$options | array |