CBaseUserIdentity
CBaseUserIdentity is a base class implementing
IUserIdentity.
CBaseUserIdentity implements the scheme for representing identity
information that needs to be persisted. It also provides the way
to represent the authentication errors.
Derived classes should implement
IUserIdentity::authenticate
and
IUserIdentity::getId that are required by the
IUserIdentity
interface.
Public Properties
Hide inherited properties
| Property | Type | Description | Defined By |
| errorCode |
integer |
the authentication error code. |
CBaseUserIdentity |
| errorMessage |
string |
the authentication error message. |
CBaseUserIdentity |
| id |
mixed |
Returns a value that uniquely represents the identity. |
CBaseUserIdentity |
| isAuthenticated |
whether |
Returns a value indicating whether the identity is authenticated. |
CBaseUserIdentity |
| name |
string |
Returns the display name for the identity (e.g. username). |
CBaseUserIdentity |
| persistentStates |
array |
Returns the identity states that should be persisted. |
CBaseUserIdentity |
Property Details
public integer $errorCode;
the authentication error code. If there is an error, the error code will be non-zero.
Defaults to 100, meaning unknown identity. Calling authenticate will change this value.
public string $errorMessage;
the authentication error message. Defaults to empty.
Returns a value that uniquely represents the identity.
Returns a value indicating whether the identity is authenticated.
This method is required by IUserIdentity.
Returns the display name for the identity (e.g. username).
Returns the identity states that should be persisted.
This method is required by IUserIdentity.
Method Details
|
public void clearState(string $name)
|
| $name |
string |
the name of the state |
Removes the specified state.
|
public mixed getId()
|
| {return} |
mixed |
a value that uniquely represents the identity (e.g. primary key value).
The default implementation simply returns name. |
Returns a value that uniquely represents the identity.
|
public whether getIsAuthenticated()
|
| {return} |
whether |
the authentication is successful. |
Returns a value indicating whether the identity is authenticated.
This method is required by IUserIdentity.
|
public string getName()
|
| {return} |
string |
the display name for the identity.
The default implementation simply returns empty string. |
Returns the display name for the identity (e.g. username).
|
public array getPersistentStates()
|
| {return} |
array |
the identity states that should be persisted. |
Returns the identity states that should be persisted.
This method is required by IUserIdentity.
|
public mixed getState(string $name, mixed $defaultValue=NULL)
|
| $name |
string |
the name of the state |
| $defaultValue |
mixed |
the default value to be returned if the named state does not exist |
| {return} |
mixed |
the value of the named state |
Gets the persisted state by the specified name.
|
public void setPersistentStates($states $states)
|
| $states |
$states |
array the identity states that should be persisted. |
Sets an array of presistent states.
|
public void setState(string $name, mixed $value)
|
| $name |
string |
the name of the state |
| $value |
mixed |
the value of the named state |
Sets the named state with a given value.