@@ -64,15 +64,18 @@ class User extends ActiveRecord implements IdentityInterface
...
@@ -64,15 +64,18 @@ class User extends ActiveRecord implements IdentityInterface
}
}
```
```
Two of the outlined methods are simple: `findIdentity` is provided with an ID value and returns a model instance associated with that ID. The `getId` method returns the ID itself.
Two of the outlined methods are simple: `findIdentity` is provided with an ID value and returns a model instance
Two of the other methods--`getAuthKey` and `validateAuthKey`--are used to provide extra security to the "remember me" cookie. The `getAuthKey` method should return a string that is unique for each user. You can create reliably create a unique string using `Yii::$app->getSecurity()->generateRandomKey()`. It's a good idea to also save this as part of the user's record:
associated with that ID. The `getId` method returns the ID itself. Two of the other methods – `getAuthKey` and
`validateAuthKey` – are used to provide extra security to the "remember me" cookie. The `getAuthKey` method should
return a string that is unique for each user. You can reliably create a unique string using
`Yii::$app->getSecurity()->generateRandomString()`. It's a good idea to also save this as part of the user's record:
- Enh #4080: Added proper handling and support of the symlinked directories in `FileHelper`, added $options parameter in `FileHelper::removeDirectory()` (resurtm)
- Enh #4080: Added proper handling and support of the symlinked directories in `FileHelper`, added $options parameter in `FileHelper::removeDirectory()` (resurtm)
- Enh #4086: changedAttributes of afterSave Event now contain old values (dizews)
- Enh #4086: changedAttributes of afterSave Event now contain old values (dizews)
thrownewInvalidConfigException('Security::$deriveKeyStrategy is set to "pbkdf2", which requires PHP >= 5.5.0. Either upgrade your run-time environment or use another strategy.');
thrownewInvalidParamException('Invalid parameters to hash_pbkdf2()');
}
}
return$outputKey;
}
}
/**
// todo: is there a nice way to reduce the code repetition in hkdf() and pbkdf2()?
* Derives a key from the given password using HMAC.
$test=@hash_hmac($algo,'','',true);
* @param string $password the source password
if(!$test){
* @param string $salt the random salt
thrownewInvalidParamException('Failed to generate HMAC with hash algorithm: '.$algo);
@@ -401,12 +511,13 @@ class Security extends Component
...
@@ -401,12 +511,13 @@ class Security extends Component
if(!function_exists('password_hash')){
if(!function_exists('password_hash')){
thrownewInvalidConfigException('Password hash key strategy "password_hash" requires PHP >= 5.5.0, either upgrade your environment or use another strategy.');
thrownewInvalidConfigException('Password hash key strategy "password_hash" requires PHP >= 5.5.0, either upgrade your environment or use another strategy.');