CUserIdentity
鍖 | system.web.auth |
---|---|
缁ф壙 | class CUserIdentity » CBaseUserIdentity » CComponent |
瀹炵幇 | IUserIdentity |
婧愯嚜 | 1.0 |
鐗堟湰 | $Id: CUserIdentity.php 3426 2011-10-25 00:01:09Z alexander.makarow $ |
婧愮爜 | framework/web/auth/CUserIdentity.php |
CUserIdentity鏄竴涓熀浜庣敤鎴峰悕楠岃瘉鐨勮韩浠藉拰瀵嗙爜鐨勫熀绫
娲剧敓绫诲簲璇ヤ娇鐢ㄥ疄闄呯殑楠岃瘉鏈哄埗鏉ュ疄鐜authenticate锛 锛堟瘮濡傝锛屽鐓ф暟鎹〃鏉ユ鏌ョ敤鎴峰悕鍜屽瘑鐮侊級銆
榛樿鏄紝CUserIdentity璁や负username鏄敮涓鐨勮瘑鍒紝 鍥犱负鎶婂畠褰撲綔ID鏉ユ鏌ャ
娲剧敓绫诲簲璇ヤ娇鐢ㄥ疄闄呯殑楠岃瘉鏈哄埗鏉ュ疄鐜authenticate锛 锛堟瘮濡傝锛屽鐓ф暟鎹〃鏉ユ鏌ョ敤鎴峰悕鍜屽瘑鐮侊級銆
榛樿鏄紝CUserIdentity璁や负username鏄敮涓鐨勮瘑鍒紝 鍥犱负鎶婂畠褰撲綔ID鏉ユ鏌ャ
鍏叡灞炴
灞炴 | 绫诲瀷 | 鎻忚堪 | 瀹氫箟鍦 |
---|---|---|---|
errorCode | integer | 楠岃瘉閿欒浠g爜銆傚鏋滄槸鏈夐敊璇彂鐢燂紝閭d箞閿欒浠g爜涓嶄細涓0銆 榛樿鏄100锛屾剰鍛崇潃鏈煡鐨勮韩浠姐傝皟鐢authenticate鍙互鏀瑰彉杩欎釜鍊笺 | CBaseUserIdentity |
errorMessage | string | 楠岃瘉閿欒淇℃伅銆傞粯璁や负绌恒 | CBaseUserIdentity |
id | string | 杩斿洖鍞竴鐨勮韩浠芥爣璇嗐 | CUserIdentity |
isAuthenticated | 楠岃瘉鏄惁鎴愬姛銆 | 杩斿洖鍊艰鏄庤韩浠芥槸鍚﹂氳繃楠岃瘉銆 | CBaseUserIdentity |
name | string | 杩斿洖韬唤鐨勬樉绀哄悕瀛椼 | CUserIdentity |
password | string | 瀵嗙爜 | CUserIdentity |
persistentStates | array | 杩斿洖闇瑕佹寔涔呭寲鐨勮韩浠界姸鎬併 | CBaseUserIdentity |
username | string | 鐢ㄦ埛鍚 | CUserIdentity |
鍏叡鏂规硶
灞炴ц缁
id
灞炴
鍙
public string getId()
杩斿洖鍞竴鐨勮韩浠芥爣璇嗐 榛樿瀹炵幇浼氳繑鍥username銆 姝ゆ柟娉曚负鎺ュ彛IUserIdentity寮哄埗瑕佹眰瀹炵幇銆
name
灞炴
鍙
public string getName()
杩斿洖韬唤鐨勬樉绀哄悕瀛椼 榛樿瀹炵幇杩斿洖username銆 姝ゆ柟娉曚负鎺ュ彛IUserIdentity寮哄埗瑕佹眰瀹炵幇銆
password
灞炴
public string $password;
瀵嗙爜
username
灞炴
public string $username;
鐢ㄦ埛鍚
鏂规硶璇︾粏
__construct()
鏂规硶
public void __construct(string $username, string $password)
| ||
$username | string | 鐢ㄦ埛鍚 |
$password | string | 瀵嗙爜 |
婧愮爜锛 framework/web/auth/CUserIdentity.php#44 (鏄剧ず)
public function __construct($username,$password)
{
$this->username=$username;
$this->password=$password;
}
鏋勯犳柟娉
authenticate()
鏂规硶
public boolean authenticate()
| ||
{return} | boolean | 鏄惁楠岃瘉鎴愬姛銆 |
婧愮爜锛 framework/web/auth/CUserIdentity.php#56 (鏄剧ず)
public function authenticate()
{
throw new CException(Yii::t('yii','{class}::authenticate() must be implemented.',array('{class}'=>get_class($this))));
}
鍩轰簬username鍜password瀵圭敤鎴疯繘琛岄獙璇併 娲剧敓绫诲簲璇ラ噸鍐欒繖涓柟娉曪紝鍚﹀垯灏变細鎶涘嚭寮傚父銆 姝ゆ柟娉曚负鎺ュ彛IUserIdentity寮哄埗瑕佹眰瀹炵幇銆
getId()
鏂规硶
public string getId()
| ||
{return} | string | the unique identifier for the identity. |
婧愮爜锛 framework/web/auth/CUserIdentity.php#67 (鏄剧ず)
public function getId()
{
return $this->username;
}
杩斿洖鍞竴鐨勮韩浠芥爣璇嗐 榛樿瀹炵幇浼氳繑鍥username銆 姝ゆ柟娉曚负鎺ュ彛IUserIdentity寮哄埗瑕佹眰瀹炵幇銆
getName()
鏂规硶
public string getName()
| ||
{return} | string | 鏍囪瘑鐨勬樉绀哄悕瀛椼 |
婧愮爜锛 framework/web/auth/CUserIdentity.php#78 (鏄剧ず)
public function getName()
{
return $this->username;
}
杩斿洖韬唤鐨勬樉绀哄悕瀛椼 榛樿瀹炵幇杩斿洖username銆 姝ゆ柟娉曚负鎺ュ彛IUserIdentity寮哄埗瑕佹眰瀹炵幇銆