Skip to content

Commit

Permalink
Enable use of unencrypted cookies (#335)
Browse files Browse the repository at this point in the history
Enables the use of the `cookie.unencryptedCookies` config item to specify cookies that should not be passed through the cookie encryption middleware. Cookie configuration file added in octobercms/october@ab9dcaf, documented in octobercms/docs#3644. Credit to @pikanji
  • Loading branch information
pikanji authored and Luke Towers committed Jul 20, 2018
1 parent 95112ec commit 7846ec0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/Cookie/Middleware/EncryptCookies.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php namespace October\Rain\Cookie\Middleware;

use Config;
use Illuminate\Contracts\Encryption\Encrypter as EncrypterContract;

class EncryptCookies extends \Illuminate\Cookie\Middleware\EncryptCookies
{
public function __construct(EncrypterContract $encrypter)
{
parent::__construct($encrypter);
$except = Config::get('cookie.unencryptedCookies', []);
$this->disableFor($except);
}
}
2 changes: 1 addition & 1 deletion src/Foundation/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Kernel extends HttpKernel
*/
protected $middlewareGroups = [
'web' => [
\Illuminate\Cookie\Middleware\EncryptCookies::class,
\October\Rain\Cookie\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
Expand Down

0 comments on commit 7846ec0

Please sign in to comment.