Class ApiAuthComponent
REST API auth component 'access_token' used for authentication is a JSON Web Token (JWT)
- Object
- ApiAuthComponent implements ApiAuthInterface
See: https://tools.ietf.org/html/rfc7519 (for full specs)
Located at controllers/components/api_auth.php
Methods summary
public
|
|
public
|
|
public
array|boolean
|
|
public
boolean
|
#
authenticate( string $username, string $password, array $authGroupName = array() )
Authenticate user starting from username and password |
public
string|null
|
|
public
string|boolean
|
#
renewToken( string $refreshToken )
Renew a JWT using a refresh token If it fails to renew JWT then return false |
protected
|
|
public
string|boolean
|
#
generateRefreshToken( )
Generate a refresh token to use for renew JWT The refresh token is saved in hash_jobs table If user is not identified then return false |
protected
string
|
|
public
boolean
|
|
public
array
|
|
public
string|boolean
|
|
public
integer
|
|
protected
array|boolean
|
|
public
string
|
|
public
array
|
#
getUserSession( )
Return the user data it replaces BeAuthComponent::getUserSession() in API context |
public
array
|
Properties summary
protected
Controller
|
$controller
The Controller |
|
protected
array|boolean
|
$user
The authenticate user It's false if user is not authenticated |
#
false
|
protected
string
|
$token
The JWT generated or read from request |
#
null
|
protected
array
|
$payload
The payload used for token generation |
#
array()
|
public
array
|
$config
Configuration used to customize token generation.
- |
#
array(
'JWT' => array(
'expiresIn' => 600, // in seconds (10 minutes)
'alg' => 'HS256',
),
'refreshTokenExpiresIn' => '1 month',
)
|