mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
docs/guide-ja/security reviewed [ci skip]
This commit is contained in:
@ -20,10 +20,10 @@ class User extends ActiveRecord implements IdentityInterface
|
||||
// ...
|
||||
|
||||
/**
|
||||
* 与えられた ID によって識別子を探す
|
||||
* 与えられた ID によってユーザ識別情報を探す
|
||||
*
|
||||
* @param string|integer $id 探すための ID
|
||||
* @return IdentityInterface|null 与えられた ID に合致する識別子オブジェクト
|
||||
* @return IdentityInterface|null 与えられた ID に合致する Identity オブジェクト
|
||||
*/
|
||||
public static function findIdentity($id)
|
||||
{
|
||||
@ -31,10 +31,10 @@ class User extends ActiveRecord implements IdentityInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* 与えられたトークンによって識別子を探す
|
||||
* 与えられたトークンによってユーザ識別情報を探す
|
||||
*
|
||||
* @param string $token 探すためのトークン
|
||||
* @return IdentityInterface|null 与えられたトークンに合致する識別子オブジェクト
|
||||
* @return IdentityInterface|null 与えられたトークンに合致する Identity オブジェクト
|
||||
*/
|
||||
public static function findIdentityByAccessToken($token, $type = null)
|
||||
{
|
||||
@ -74,7 +74,7 @@ class User extends ActiveRecord implements IdentityInterface
|
||||
その他のメソッドのうち、二つのもの - `getAuthKey` と `validateAuthKey` - は、「次回から自動ログイン ("remember me")」のクッキーに対して追加のセキュリティを提供するために使われます。
|
||||
`getAuthKey` メソッドは全てのユーザに対してユニークな文字列を返さなければなりません。
|
||||
`Yii::$app->getSecurity()->generateRandomString()` を使うと、信頼性の高い方法でユニークな文字列を生成することが出来ます。
|
||||
これをユーザのレコードの一部として保存しておくのが良いアイデアです。
|
||||
これをユーザのレコードの一部として保存しておくのは良いアイデアです。
|
||||
|
||||
```php
|
||||
public function beforeSave($insert)
|
||||
|
Reference in New Issue
Block a user