Class app\models\User

Inheritanceapp\models\User » yii\base\BaseObject
Implementsyii\base\Configurable, yii\web\IdentityInterface

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. yii\base\BaseObject
__construct() Constructor. yii\base\BaseObject
__get() Returns the value of an object property. yii\base\BaseObject
__isset() Checks if a property is set, i.e. defined and not null. yii\base\BaseObject
__set() Sets value of an object property. yii\base\BaseObject
__unset() Sets an object property to null. yii\base\BaseObject
canGetProperty() Returns a value indicating whether a property can be read. yii\base\BaseObject
canSetProperty() Returns a value indicating whether a property can be set. yii\base\BaseObject
className() Returns the fully qualified name of this class. yii\base\BaseObject
findByUsername() Finds user by username app\models\User
findIdentity() Finds an identity by the given ID. app\models\User
findIdentityByAccessToken() Finds an identity by the given token. app\models\User
getAuthKey() Returns a key that can be used to check the validity of a given identity ID. app\models\User
getId() Returns an ID that can uniquely identify a user identity. app\models\User
hasMethod() Returns a value indicating whether a method is defined. yii\base\BaseObject
hasProperty() Returns a value indicating whether a property is defined. yii\base\BaseObject
init() Initializes the object. yii\base\BaseObject
validateAuthKey() Validates the given auth key. app\models\User
validatePassword() Validates password app\models\User

Property Details

$accessToken public property
public $accessToken null
$authKey public property
public $authKey null
$id public property
public $id null
$password public property
public $password null
$username public property
public $username null

Method Details

findByUsername() public static method

Finds user by username

public static static|null findByUsername ( $username )
$username string
findIdentity() public static method

Finds an identity by the given ID.

public static yii\web\IdentityInterface|null findIdentity ( $id )
$id string|integer

The ID to be looked for

return yii\web\IdentityInterface|null

The identity object that matches the given ID. Null should be returned if such an identity cannot be found or the identity is not in an active state (disabled, deleted, etc.)

findIdentityByAccessToken() public static method

Finds an identity by the given token.

public static yii\web\IdentityInterface|null findIdentityByAccessToken ( $token, $type null )
$token mixed

The token to be looked for

$type mixed

The type of the token. The value of this parameter depends on the implementation. For example, yii\filters\auth\HttpBearerAuth will set this parameter to be yii\filters\auth\HttpBearerAuth.

return yii\web\IdentityInterface|null

The identity object that matches the given token. Null should be returned if such an identity cannot be found or the identity is not in an active state (disabled, deleted, etc.)

getAuthKey() public method

Returns a key that can be used to check the validity of a given identity ID.

The key should be unique for each individual user, and should be persistent so that it can be used to check the validity of the user identity.

The space of such keys should be big enough to defeat potential identity attacks.

The returned key is used to validate session and auto-login (if yii\web\User::$enableAutoLogin is enabled).

Make sure to invalidate earlier issued authKeys when you implement force user logout, password change and other scenarios, that require forceful access revocation for old sessions.

public string|null getAuthKey ( )
return string|null

A key that is used to check the validity of a given identity ID.

getId() public method

Returns an ID that can uniquely identify a user identity.

public string|integer getId ( )
return string|integer

An ID that uniquely identifies a user identity.

validateAuthKey() public method

Validates the given auth key.

public boolean|null validateAuthKey ( $authKey )
$authKey string

The given auth key

return boolean|null

Whether the given auth key is valid.

validatePassword() public method

Validates password

public boolean validatePassword ( $password )
$password string

Password to validate

return boolean

If password provided is valid for current user