Skip to content

Commit 16140cf

Browse files
committed
Removed encryptor for cookies, by default Laravel encrypts the cookie anyway.
1 parent d2c3f0b commit 16140cf

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

src/AuthManager.php

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use BoxedCode\Laravel\Auth\Device\Contracts\AuthManager as ManagerContract;
66
use BoxedCode\Laravel\Auth\Device\Contracts\Fingerprinter;
7-
use Illuminate\Contracts\Encryption\Encrypter;
87
use Illuminate\Contracts\Session\Session;
98
use Illuminate\Cookie\CookieJar;
109
use Illuminate\Http\Request;
@@ -34,28 +33,17 @@ class AuthManager implements ManagerContract
3433
*/
3534
protected $session;
3635

37-
/**
38-
* The encrypter instance.
39-
*
40-
* @var \Illuminate\Contracts\Encryption\Encrypter
41-
*/
42-
protected $encrypter;
43-
4436
/**
4537
* Create a new manager instance.
46-
*
47-
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
38+
*
4839
* @param \Illuminate\Contracts\Session\Session $session
4940
* @param \BoxedCode\Laravel\Auth\Device\Contracts\Fingerprinter $fingerprinter
5041
* @param array $config
5142
*/
52-
public function __construct(Encrypter $encrypter,
53-
Session $session,
43+
public function __construct(Session $session,
5444
Fingerprinter $fingerprinter,
5545
array $config = []
5646
) {
57-
$this->encrypter = $encrypter;
58-
5947
$this->session = $session;
6048

6149
$this->fingerprinter = $fingerprinter;
@@ -133,14 +121,12 @@ public function revokeAuthorizationRequest()
133121
*/
134122
public function setDeviceTokenCookie(Response $response, $token)
135123
{
136-
$enrypted = $this->encrypter->encrypt($token);
137-
138124
$lifetime = $this->config['lifetimes']['authorization'] ?: 2628000;
139125

140126
$response->headers->setCookie(
141127
(new CookieJar)->make(
142128
'_la_dat',
143-
$enrypted,
129+
$token,//$enrypted,
144130
$lifetime
145131
)
146132
);
@@ -157,7 +143,7 @@ public function setDeviceTokenCookie(Response $response, $token)
157143
public function getDeviceTokenCookie(Request $request)
158144
{
159145
if ($token = $request->cookies->get('_la_dat')) {
160-
return $this->encrypter->decrypt($token);
146+
return $token;
161147
}
162148
}
163149

0 commit comments

Comments
 (0)