JWT Authentication Adapter.
This class provides a JWT authentication adapter for the Hazaar framework.
public string $passphrase
public string $privateKey
private bool $writeCookie
private bool $clearCookie
public __construct(array $config = []): void
Parameter | Type | Description |
---|
$config | array | |
Authorises the JWT token.
public write(array $data): void
Parameter | Type | Description |
---|
$data | array | |
public has(string $key): bool
Parameter | Type | Description |
---|
$key | string | |
public get(string $key): mixed
Parameter | Type | Description |
---|
$key | string | |
public set(string $key, mixed $value): void
Parameter | Type | Description |
---|
$key | string | |
$value | mixed | |
public (string $key): void
Parameter | Type | Description |
---|
$key | string | |
public writeToken(): void
Refreshes the JWT token.
private refresh(string $refreshToken, ?array $JWTRefreshBody): bool
Parameter | Type | Description |
---|
$refreshToken | string | |
$JWTRefreshBody | array | |
Validates the JWT token.
private validateToken(string $token, ?array $JWTBody, ?string $passphrase): bool
Parameter | Type | Description |
---|
$token | string | the JWT token |
$JWTBody | array | |
$passphrase | string | the passphrase |
private checkToken(): bool
Builds a JWT token with the given JWT body and passphrase.
private buildToken(array $JWTBody, ?string $passphrase): string
Parameter | Type | Description |
---|
$JWTBody | array | the body of the JWT token |
$passphrase | string | The passphrase to sign the JWT token. Defaults to null. |
private buildRefreshTokenKey(string $passphrase): string
Parameter | Type | Description |
---|
$passphrase | string | |
Signs the JWT token.
private sign(array $JWTHeader, array $JWTBody, ?string $passphrase): string
Parameter | Type | Description |
---|
$JWTHeader | array | the header of the JWT token |
$JWTBody | array | the body of the JWT token |
$passphrase | string | |
Generated by Hazaar API Doc Generator