YubiCloudAuthentication
in package
implements
IAuthentication
YubiCloudAuthentication class
Authenticates a user through YubiCloud
Table of Contents
Interfaces
- IAuthentication
- Authentication method interface.
Properties
- $error : string
- The last validation error
- $key : string
- The key
- $mustThrowError : string
- Indicates if the error MUST be returned to the user
- $user_id : int
- The user_id
- $username : string
- The username who should match the key
Methods
- __construct() : mixed
- Initializes a new instance of the key
- canTryNextAuthenticationMethod() : bool
- Determines if the next authentication method could be tried if this one failed.
- computeUserID() : mixed
- Gets the user_id matching the username
- getError() : string
- Gets the last authentication error
- getPublicIdentity() : string
- Gets public identity
- getUserID() : int
- Gets the user_id matching the key
- isValid() : bool
- Validates an OTP key against the YubiCloud servers
- looksValidOTP() : bool
- Validates the specified key's characters to determine if it looks like an OTP
Properties
$error
The last validation error
public
string
$error
$key
The key
private
string
$key
$mustThrowError
Indicates if the error MUST be returned to the user
private
string
$mustThrowError
= \false
$user_id
The user_id
private
int
$user_id
$username
The username who should match the key
private
string
$username
Methods
__construct()
Initializes a new instance of the key
public
__construct(string $key[, mixed $username = null ]) : mixed
Parameters
- $key : string
-
The key
- $username : mixed = null
canTryNextAuthenticationMethod()
Determines if the next authentication method could be tried if this one failed.
public
canTryNextAuthenticationMethod() : bool
Return values
bool —true if authentication can go on to the next method; otherwise, false
computeUserID()
Gets the user_id matching the username
public
computeUserID() : mixed
You first need to validate the username, calling the isValid method.
getError()
Gets the last authentication error
public
getError() : string
Return values
string —The last authentication error
getPublicIdentity()
Gets public identity
public
getPublicIdentity() : string
Return values
string —Public identity
getUserID()
Gets the user_id matching the key
public
getUserID() : int
You first need to query the authentication table, calling the computeUserID method. This is automatically done by IsValid, as we need to validate key matches someone.
Return values
int —the user ID
isValid()
Validates an OTP key against the YubiCloud servers
public
isValid() : bool
Return values
bool —true if the input is a valid OTP key; otherwise, false.
looksValidOTP()
Validates the specified key's characters to determine if it looks like an OTP
public
looksValidOTP() : bool
Return values
bool —true if the input seems an OTP key; otherwise, false.