UserPasswordAuthentication
in package
implements
IAuthentication
Login/pass authentication
Table of Contents
Interfaces
- IAuthentication
- Authentication method interface.
Properties
- $error : string
- The last authentication error
- $mustThrowError : string
- Indicates if the error MUST be returned to the user
- $password : string
- The password in clear text
- $user_id : int
- The user_id matching the username
- $username : string
- The username
Methods
- __construct() : mixed
- Initializes a new instance of the UserPasswordAuthentication class
- canTryNextAuthenticationMethod() : bool
- Determines if the next authentication method could be tried if this one failed.
- getError() : string
- Gets the last authentication error
- getPasswordHash() : string
- Gets the hash of the password
- getUserID() : int
- Gets the user_id matching the username You first need to validate the username, calling the isValid method.
- isValid() : bool
- Determines if the login/pass is valid
Properties
$error
The last authentication error
private
string
$error
$mustThrowError
Indicates if the error MUST be returned to the user
private
string
$mustThrowError
= \false
$password
The password in clear text
private
string
$password
$user_id
The user_id matching the username
private
int
$user_id
$username
The username
private
string
$username
Methods
__construct()
Initializes a new instance of the UserPasswordAuthentication class
public
__construct(string $username, mixed $password) : mixed
Parameters
- $username : string
-
The username
- $password : mixed
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
getError()
Gets the last authentication error
public
getError() : string
Return values
string —The last error
getPasswordHash()
Gets the hash of the password
public
getPasswordHash(string $password) : string
Parameters
- $password : string
-
The password in clear text
Return values
string —The hashed password
getUserID()
Gets the user_id matching the username You first need to validate the username, calling the isValid method.
public
getUserID() : int
Return values
int —The user ID
isValid()
Determines if the login/pass is valid
public
isValid() : bool
Return values
bool —true if the login/pass is valid; otherwise, false.