make session lifetime configurable
This commit is contained in:
parent
c0a39cb2a1
commit
2391415969
|
@ -345,6 +345,9 @@ return [
|
|||
|
||||
// Cookie name
|
||||
'name' => env('SESSION_NAME', 'session'),
|
||||
|
||||
// Lifetime in days
|
||||
'lifetime' => env('SESSION_LIFETIME', 30)
|
||||
],
|
||||
|
||||
// IP addresses of reverse proxies that are trusted, can be an array or a comma separated list
|
||||
|
|
|
@ -62,6 +62,7 @@ class SessionServiceProvider extends ServiceProvider
|
|||
'options' => [
|
||||
'cookie_httponly' => true,
|
||||
'name' => $sessionConfig['name'],
|
||||
'cookie_lifetime' => (int)($sessionConfig['lifetime'] * 24 * 60 * 60),
|
||||
],
|
||||
'handler' => $handler,
|
||||
]);
|
||||
|
|
|
@ -53,13 +53,19 @@ class SessionServiceProviderTest extends ServiceProviderTest
|
|||
[Session::class],
|
||||
[
|
||||
NativeSessionStorage::class,
|
||||
['options' => ['cookie_httponly' => true, 'name' => 'session'], 'handler' => null],
|
||||
[
|
||||
'options' => ['cookie_httponly' => true, 'name' => 'session', 'cookie_lifetime' => 172800],
|
||||
'handler' => null
|
||||
],
|
||||
],
|
||||
[Session::class],
|
||||
[DatabaseHandler::class],
|
||||
[
|
||||
NativeSessionStorage::class,
|
||||
['options' => ['cookie_httponly' => true, 'name' => 'foobar'], 'handler' => $databaseHandler],
|
||||
[
|
||||
'options' => ['cookie_httponly' => true, 'name' => 'foobar', 'cookie_lifetime' => 432000],
|
||||
'handler' => $databaseHandler
|
||||
],
|
||||
],
|
||||
[Session::class]
|
||||
)
|
||||
|
@ -101,8 +107,8 @@ class SessionServiceProviderTest extends ServiceProviderTest
|
|||
->method('get')
|
||||
->with('session')
|
||||
->willReturnOnConsecutiveCalls(
|
||||
['driver' => 'native', 'name' => 'session'],
|
||||
['driver' => 'pdo', 'name' => 'foobar']
|
||||
['driver' => 'native', 'name' => 'session', 'lifetime' => 2],
|
||||
['driver' => 'pdo', 'name' => 'foobar', 'lifetime' => 5]
|
||||
);
|
||||
|
||||
$app->expects($this->atLeastOnce())
|
||||
|
|
Loading…
Reference in New Issue