File tree Expand file tree Collapse file tree 11 files changed +194
-658
lines changed Expand file tree Collapse file tree 11 files changed +194
-658
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 9
9
"time"
10
10
11
11
"github.com/gofiber/fiber/v3"
12
+ "github.com/gofiber/fiber/v3/extractors"
12
13
"github.com/gofiber/fiber/v3/middleware/session"
13
14
utils "github.com/gofiber/utils/v2"
14
15
"github.com/stretchr/testify/require"
@@ -76,7 +77,7 @@ func Test_CSRF_WithSession(t *testing.T) {
76
77
77
78
// session store
78
79
store := session .NewStore (session.Config {
79
- Extractor : session .FromCookie ("_session" ),
80
+ Extractor : extractors .FromCookie ("_session" ),
80
81
})
81
82
82
83
// fiber instance
@@ -274,7 +275,7 @@ func Test_CSRF_ExpiredToken_WithSession(t *testing.T) {
274
275
275
276
// session store
276
277
store := session .NewStore (session.Config {
277
- Extractor : session .FromCookie ("_session" ),
278
+ Extractor : extractors .FromCookie ("_session" ),
278
279
})
279
280
280
281
// fiber instance
@@ -1112,7 +1113,7 @@ func Test_CSRF_DeleteToken_WithSession(t *testing.T) {
1112
1113
1113
1114
// session store
1114
1115
store := session .NewStore (session.Config {
1115
- Extractor : session .FromCookie ("_session" ),
1116
+ Extractor : extractors .FromCookie ("_session" ),
1116
1117
})
1117
1118
1118
1119
// fiber instance
Original file line number Diff line number Diff line change 4
4
"time"
5
5
6
6
"github.com/gofiber/fiber/v3"
7
+ "github.com/gofiber/fiber/v3/extractors"
7
8
"github.com/gofiber/fiber/v3/log"
8
9
utils "github.com/gofiber/utils/v2"
9
10
)
@@ -50,9 +51,10 @@ type Config struct {
50
51
CookieSameSite string
51
52
52
53
// Extractor is used to extract the session ID from the request.
54
+ // See: https://docs.gofiber.io/guide/extractors
53
55
//
54
- // Optional. Default: FromCookie("session_id")
55
- Extractor Extractor
56
+ // Optional. Default: extractors. FromCookie("session_id")
57
+ Extractor extractors. Extractor
56
58
57
59
// IdleTimeout defines the maximum duration of inactivity before the session expires.
58
60
//
@@ -91,7 +93,7 @@ type Config struct {
91
93
var ConfigDefault = Config {
92
94
IdleTimeout : 30 * time .Minute ,
93
95
KeyGenerator : utils .UUIDv4 ,
94
- Extractor : FromCookie ("session_id" ),
96
+ Extractor : extractors . FromCookie ("session_id" ),
95
97
CookieSameSite : "Lax" ,
96
98
}
97
99
Original file line number Diff line number Diff line change 5
5
"time"
6
6
7
7
"github.com/gofiber/fiber/v3"
8
+ "github.com/gofiber/fiber/v3/extractors"
8
9
"github.com/stretchr/testify/require"
9
10
"github.com/valyala/fasthttp"
10
11
)
@@ -23,7 +24,7 @@ func TestConfigDefaultWithCustomConfig(t *testing.T) {
23
24
// Test custom config
24
25
customConfig := Config {
25
26
IdleTimeout : 48 * time .Hour ,
26
- Extractor : FromHeader ("X-Custom-Session" ),
27
+ Extractor : extractors . FromHeader ("X-Custom-Session" ),
27
28
KeyGenerator : func () string { return "custom_key" },
28
29
}
29
30
cfg := configDefault (customConfig )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments