Arikaim CMS

JwtAuthProvider extends AuthProvider
in package
implements AuthProviderInterface

JWT auth provider.

Table of Contents

Interfaces

AuthProviderInterface
Auth provider interface

Properties

$params  : array<string|int, mixed>
Provider params
$user  : array<string|int, mixed>|null
Current auth user
$userProvider  : UserProviderInterface
User provider
$jwtKey  : string
Jwt key
$token  : object|null
JWT token

Methods

__construct()  : mixed
Constructor
authenticate()  : bool
Auth user
clearToken()  : void
Remove token.
createToken()  : string
Create auth token.
decodeToken()  : bool
Decode and save token data.
getId()  : null|int
Get auth id
getLoginAttempts()  : int|null
Get login attempts
getParam()  : mixed|null
Get param
getProvider()  : UserProviderInterface
Return user provider
getToken()  : object|null
Return token array data
getTokenParam()  : mixed|null
Return token param from decoded token
getUser()  : array<string|int, mixed>|null
Get current auth user
isLogged()  : bool
Check if user is logged
isValidToken()  : bool
Return true if token is valid
logout()  : void
Logout
readAuthHeader()  : string|null
Get token from request header
setProvider()  : void
Set user provider
init()  : void
Init provider

Properties

$params

Provider params

protected array<string|int, mixed> $params

$user

Current auth user

protected array<string|int, mixed>|null $user

Methods

__construct()

Constructor

public __construct([array<string|int, mixed> $params = [] ]) : mixed
Parameters
$params : array<string|int, mixed> = []

authenticate()

Auth user

public authenticate(array<string|int, mixed> $credentials[, ServerRequestInterface|null $request = null ]) : bool
Parameters
$credentials : array<string|int, mixed>
$request : ServerRequestInterface|null = null
Return values
bool

createToken()

Create auth token.

public createToken(mixed $id[, int|null $expire = null ][, string|null $key = null ]) : string
Parameters
$id : mixed

Auth id

$expire : int|null = null
$key : string|null = null
Return values
string

decodeToken()

Decode and save token data.

public decodeToken(string $token[, string|null $key = null ]) : bool
Parameters
$token : string
$key : string|null = null
Return values
bool

getId()

Get auth id

public getId() : null|int
Return values
null|int

getLoginAttempts()

Get login attempts

public getLoginAttempts() : int|null
Return values
int|null

getParam()

Get param

public getParam(string $name[, mixed $default = null ]) : mixed|null
Parameters
$name : string
$default : mixed = null
Return values
mixed|null

getToken()

Return token array data

public getToken() : object|null
Return values
object|null

getTokenParam()

Return token param from decoded token

public getTokenParam(string $name) : mixed|null
Parameters
$name : string
Return values
mixed|null

getUser()

Get current auth user

public getUser() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

isLogged()

Check if user is logged

public isLogged() : bool
Return values
bool

isValidToken()

Return true if token is valid

public isValidToken() : bool
Return values
bool

readAuthHeader()

Get token from request header

public static readAuthHeader(RequestInterface $request[, bool $bearer = true ]) : string|null
Parameters
$request : RequestInterface
$bearer : bool = true
Return values
string|null

Api token


        
On this page

Search results