| @@ 225-239 (lines=15) @@ | ||
| 222 | * @throws \Application\Exception |
|
| 223 | * @return string |
|
| 224 | */ |
|
| 225 | protected function callHashFunction($password) |
|
| 226 | { |
|
| 227 | /** @var \Bluz\Auth\Auth $auth */ |
|
| 228 | $auth = Auth::getInstance(); |
|
| 229 | $options = $auth->getOption(self::PROVIDER_EQUALS); |
|
| 230 | ||
| 231 | if (!isset($options['hash']) or |
|
| 232 | !is_callable($options['hash']) |
|
| 233 | ) { |
|
| 234 | throw new Exception("Hash function for 'equals' adapter is not callable"); |
|
| 235 | } |
|
| 236 | ||
| 237 | // encrypt password with secret |
|
| 238 | return call_user_func($options['hash'], $password); |
|
| 239 | } |
|
| 240 | ||
| 241 | /** |
|
| 242 | * Call Verify Function |
|
| @@ 249-263 (lines=15) @@ | ||
| 246 | * @throws \Application\Exception |
|
| 247 | * @return string |
|
| 248 | */ |
|
| 249 | protected function callVerifyFunction($password, $hash) |
|
| 250 | { |
|
| 251 | /** @var \Bluz\Auth\Auth $auth */ |
|
| 252 | $auth = Auth::getInstance(); |
|
| 253 | $options = $auth->getOption(self::PROVIDER_EQUALS); |
|
| 254 | ||
| 255 | if (!isset($options['verify']) or |
|
| 256 | !is_callable($options['verify']) |
|
| 257 | ) { |
|
| 258 | throw new Exception("Verify function for 'equals' adapter is not callable"); |
|
| 259 | } |
|
| 260 | ||
| 261 | // verify password with hash |
|
| 262 | return call_user_func($options['verify'], $password, $hash); |
|
| 263 | } |
|
| 264 | ||
| 265 | /** |
|
| 266 | * authenticate user by token |
|