-
Notifications
You must be signed in to change notification settings - Fork 0
/
session.js
122 lines (110 loc) · 3.54 KB
/
session.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
'use strict'
const Env = use('Env')
module.exports = {
/*
|--------------------------------------------------------------------------
| Session Driver
|--------------------------------------------------------------------------
|
| Cookie driver will save session on cookies, but make sure to setup
| APP_KEY inside .env file to keep cookies encrypted and signed.
|
| Available Options are :-
| cookie, file, redis
*/
driver: Env.get('SESSION_DRIVER', 'cookie'),
/*
|--------------------------------------------------------------------------
| Cookie Name
|--------------------------------------------------------------------------
|
| Cookie name defines the name of key to used for saving session cookie.
| Cookie name is required even if you are not using cookie driver.
|
*/
cookie: 'adonis-session',
/*
|--------------------------------------------------------------------------
| Session Age
|--------------------------------------------------------------------------
|
| Define session life in minutes. Session will be destroyed after defined
| minutes of inactivity.
|
*/
age: 120,
/*
|--------------------------------------------------------------------------
| Clear on browser close
|--------------------------------------------------------------------------
|
| You can make your sessions to be removed once browser has been closed/killed
| by setting below value to true. Also it will disregard age parameter.
|
*/
clearWithBrowser: false,
/*
|--------------------------------------------------------------------------
| Http Only Cookie
|--------------------------------------------------------------------------
|
| Keep cookie http only, which means javascript cannot access the cookie
| by document.cookie.
|
*/
httpOnly: true,
/*
|--------------------------------------------------------------------------
| Same site only
|--------------------------------------------------------------------------
|
| Keep cookie accessible from the same domain. Available values are
| true, false, lax and strict.
| https://tools.ietf.org/html/draft-west-first-party-cookies-07
|
*/
sameSite: true,
/*
|--------------------------------------------------------------------------
| Domain
|--------------------------------------------------------------------------
|
| Set domain for session cookie. If not defined it will be set to current
| domain. For single and subdomains use. ".adonisjs.com"
|
*/
domain: null,
/*
|--------------------------------------------------------------------------
| Path
|--------------------------------------------------------------------------
|
| Path defines where the session will be available. If you want to access
| it anywhere on your website. Set it to /
|
*/
path: '/',
/*
|--------------------------------------------------------------------------
| Secure
|--------------------------------------------------------------------------
|
| Define whether to keep session cookie secure or not. Secured cookies
| are only served over HTTPS.
|
*/
secure: false,
/*
|--------------------------------------------------------------------------
| File Driver Config
|--------------------------------------------------------------------------
|
| Here we define settings for file driver. For now we define directory
| in which we want to store our sessions. Defined directory will be
| created inside storage directory.
|
*/
file: {
directory: 'sessions'
}
}