当前位置: 首页>>代码示例>>PHP>>正文


PHP Encrypter::decrypt方法代码示例

本文整理汇总了PHP中Illuminate\Contracts\Encryption\Encrypter::decrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Encrypter::decrypt方法的具体用法?PHP Encrypter::decrypt怎么用?PHP Encrypter::decrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Contracts\Encryption\Encrypter的用法示例。


在下文中一共展示了Encrypter::decrypt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: tokensMatch

 /**
  * Determine if the session and input CSRF tokens match.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return bool
  */
 protected function tokensMatch($request)
 {
     $token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN');
     if (!$token && ($header = $request->header('X-XSRF-TOKEN'))) {
         $token = $this->encrypter->decrypt($header);
     }
     return Str::equals($request->session()->token(), $token);
 }
开发者ID:alvarobfdev,项目名称:LaravelCore,代码行数:14,代码来源:VerifyCsrfToken.php

示例2: decryptArray

 /**
  * Decrypt an array based cookie.
  *
  * @param  array  $cookie
  * @return array
  */
 protected function decryptArray(array $cookie)
 {
     $decrypted = array();
     foreach ($cookie as $key => $value) {
         $decrypted[$key] = $this->encrypter->decrypt($value);
     }
     return $decrypted;
 }
开发者ID:GeorgeShazkho,项目名称:micros-de-conce,代码行数:14,代码来源:EncryptCookies.php

示例3: prepareForUnserialize

 /**
  * Prepare the raw string data from the session for unserialization.
  *
  * @param  string  $data
  * @return string
  */
 protected function prepareForUnserialize($data)
 {
     try {
         return $this->encrypter->decrypt($data);
     } catch (DecryptException $e) {
         return json_encode([]);
     }
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:14,代码来源:EncryptedStore.php

示例4: onReady

 /**
  * Fired just before building.
  *
  * @param Encrypter $encrypter
  * @param Request   $request
  */
 public function onReady(Encrypter $encrypter, Request $request)
 {
     if ($code = $request->get('code')) {
         array_set($this->parameters, 'code', $encrypter->decrypt($code));
     }
     if ($email = $request->get('email')) {
         array_set($this->parameters, 'email', $encrypter->decrypt($email));
     }
 }
开发者ID:jacksun101,项目名称:users-module,代码行数:15,代码来源:ResetPasswordFormCriteria.php

示例5: tokensMatch

 /**
  * Determine if the session and input CSRF tokens match.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return bool
  */
 protected function tokensMatch($request)
 {
     // Get tokens from session and the request
     $sessionToken = $request->session()->token();
     $token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN');
     if (!$token && ($header = $request->header('X-XSRF-TOKEN'))) {
         $token = $this->encrypter->decrypt($header);
     }
     if (!is_string($sessionToken) || !is_string($token)) {
         return false;
     }
     // Validate them
     return hash_equals((string) $request->session()->token(), (string) $token);
 }
开发者ID:influendo,项目名称:laravel-survivor,代码行数:20,代码来源:SurvivorController.php

示例6: handle

 /**
  * Handle the command.
  *
  * @param UserRepositoryInterface $users
  * @param UserActivator           $activator
  * @param Encrypter               $encrypter
  * @param Request                 $request
  * @return bool
  */
 public function handle(UserRepositoryInterface $users, UserActivator $activator, Encrypter $encrypter, Request $request)
 {
     $code = $request->get('code');
     $email = $request->get('email');
     if (!$code || !$email) {
         return false;
     }
     $code = $encrypter->decrypt($code);
     $email = $encrypter->decrypt($email);
     if (!($user = $users->findByEmail($email))) {
         return false;
     }
     return $activator->activate($user, $code);
 }
开发者ID:jacksun101,项目名称:users-module,代码行数:23,代码来源:HandleActivateRequest.php

示例7: date

 function it_fails_with_string(Encrypter $encrypter, Request $request)
 {
     $time = date("Y-m-d H:i:s", strtotime("30 seconds ago"));
     $request->get('_guard_opened')->willReturn($time);
     $encrypter->decrypt($time)->willReturn($time);
     $this->validate($request)->shouldReturn(false);
 }
开发者ID:ryanwinchester,项目名称:laravel-spamguard,代码行数:7,代码来源:SpamTimerValidatorSpec.php

示例8: validate

 /**
  * Validate the request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  array $params
  * @return bool
  */
 public function validate($request, $params = [])
 {
     $this->params = $params;
     try {
         $timeOpened = $this->encrypter->decrypt($request->get('_guard_opened'));
     } catch (DecryptException $e) {
         return false;
     }
     if (!is_numeric($timeOpened)) {
         return false;
     }
     $timeElapsed = time() - $timeOpened;
     $tooFast = $timeElapsed < $this->getMinTime();
     $tooSlow = $timeElapsed > $this->getMaxTime();
     return !$tooFast && !$tooSlow;
 }
开发者ID:ryanwinchester,项目名称:laravel-spamguard,代码行数:23,代码来源:SpamTimerValidator.php

示例9: decryptPayload

 /**
  * Attempt to decrypt payload.
  */
 protected function decryptPayload()
 {
     try {
         $decrypted = $this->encrypter->decrypt($this->encryptedValue);
         $this->decryptedValue = json_decode($decrypted);
     } catch (\Exception $e) {
         throw new Exceptions\InvalidEncryptionFormat($e->getMessage());
     }
 }
开发者ID:classid,项目名称:core-payload,代码行数:12,代码来源:Broker.php

示例10: get

 /**
  * Retrieve an item from the cache by key.
  *
  * @param  string  $key
  * @return mixed
  */
 public function get($key)
 {
     $prefixed = $this->prefix . $key;
     $cache = $this->table()->where('key', '=', $prefixed)->first();
     // If we have a cache record we will check the expiration time against current
     // time on the system and see if the record has expired. If it has, we will
     // remove the records from the database table so it isn't returned again.
     if (!is_null($cache)) {
         if (is_array($cache)) {
             $cache = (object) $cache;
         }
         if (time() >= $cache->expiration) {
             $this->forget($key);
             return;
         }
         return $this->encrypter->decrypt($cache->value);
     }
 }
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:24,代码来源:DatabaseStore.php

示例11: decryptArray

 /**
  * Decrypt an array based cookie.
  *
  * @param  array  $cookie
  * @return array
  */
 protected function decryptArray(array $cookie)
 {
     $decrypted = [];
     foreach ($cookie as $key => $value) {
         if (is_string($value)) {
             $decrypted[$key] = $this->encrypter->decrypt($value);
         }
     }
     return $decrypted;
 }
开发者ID:focuslife,项目名称:v0.1,代码行数:16,代码来源:EncryptCookies.php

示例12: incrementOrDecrement

 /**
  * Increment or decrement an item in the cache.
  *
  * @param  string  $key
  * @param  mixed  $value
  * @param  \Closure  $callback
  * @return void
  */
 protected function incrementOrDecrement($key, $value, Closure $callback)
 {
     $prefixed = $this->prefix . $key;
     $cache = $this->table()->where('key', $prefixed)->lockForUpdate()->first();
     if (!is_null($cache)) {
         $current = $this->encrypter->decrypt($cache->value);
         if (is_numeric($current)) {
             $this->table()->where('key', $prefixed)->update(['value' => $this->encrypter->encrypt($callback($current))]);
         }
     }
 }
开发者ID:manhvu1212,项目名称:videoplatform,代码行数:19,代码来源:DatabaseStore.php

示例13: tokensMatch

 /**
  * @param \Illuminate\Http\Request $request
  *
  * @return bool
  */
 protected function tokensMatch($request)
 {
     $sessionToken = $request->session()->token();
     $token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN');
     if (!$token && ($header = $request->header('X-XSRF-TOKEN'))) {
         $token = $this->encrypter->decrypt($header);
     }
     if (!is_string($sessionToken) || !is_string($token)) {
         return false;
     }
     return hash_equals($sessionToken, $token);
 }
开发者ID:notadd,项目名称:framework,代码行数:17,代码来源:VerifyCsrfToken.php

示例14: getActivate

 /**
  * Activate a user by token
  * @param  string  $token
  * @param  Request $request
  * @param  Events  $events
  * @return Illuminate\Http\Response
  */
 public function getActivate(Encrypter $encrypter, Request $request, Events $events, $token)
 {
     try {
         $data = json_decode($encrypter->decrypt($token));
         if (is_object($data) && isset($data->id) && is_numeric($data->id) && isset($data->expires) && with(new Carbon(date('Y-m-d H:i:s', $data->expires)))->gt(Carbon::now())) {
             $user = $this->activateUser($data->id);
             $events->fire(new UserActivated($user));
             return $this->userWasActivated($data->id);
         } else {
             throw new Exception("Invalid token");
         }
     } catch (Exception $e) {
         return $this->userWasNotActivated();
     }
 }
开发者ID:ruysu,项目名称:laravel-core,代码行数:22,代码来源:ActivatesUsers.php

示例15: incrementOrDecrement

 /**
  * Increment or decrement an item in the cache.
  *
  * @param string $key        	
  * @param mixed $value        	
  * @param \Closure $callback        	
  * @return int|bool
  */
 protected function incrementOrDecrement($key, $value, Closure $callback)
 {
     return $this->connection->transaction(function () use($key, $value, $callback) {
         $prefixed = $this->prefix . $key;
         $cache = $this->table()->where('key', $prefixed)->lockForUpdate()->first();
         if (is_null($cache)) {
             return false;
         }
         $current = $this->encrypter->decrypt($cache->value);
         $new = $callback($current, $value);
         if (!is_numeric($current)) {
             return false;
         }
         $this->table()->where('key', $prefixed)->update(['value' => $this->encrypter->encrypt($new)]);
         return $new;
     });
 }
开发者ID:sapwoo,项目名称:portfolio,代码行数:25,代码来源:DatabaseStore.php


注:本文中的Illuminate\Contracts\Encryption\Encrypter::decrypt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。