@@ -42,6 +42,12 @@ session data that is sent to the client, and verified when the session token is
42
42
## Example
43
43
44
44
```` scala
45
+ import akka .http .scaladsl .server .Directives ._
46
+
47
+ import com .softwaremill .session .{SessionConfig , SessionManager }
48
+ import com .softwaremill .session .SessionDirectives ._
49
+ import com .softwaremill .session .SessionOptions ._
50
+
45
51
val sessionConfig = SessionConfig .default(" some_very_long_secret_and_random_string_some_very_long_secret_and_random_string" )
46
52
implicit val sessionManager = new SessionManager [Long ](sessionConfig)
47
53
@@ -129,6 +135,8 @@ convenient to use a `MultiValueSessionSerializer[T]` which should convert the in
129
135
Here we are creating a manager where the session content will be a single ` Long ` number:
130
136
131
137
```` scala
138
+ import com .softwaremill .session .{SessionConfig , SessionManager }
139
+
132
140
val sessionConfig = SessionConfig .default(" some_very_long_secret_and_random_string_some_very_long_secret_and_random_string" )
133
141
implicit val sessionManager = new SessionManager [Long ](sessionConfig)
134
142
````
@@ -137,6 +145,11 @@ The basic directives enable you to set, read and invalidate the session. To crea
137
145
and set a new session cookie), you need to use the ` setSession ` directive:
138
146
139
147
```` scala
148
+ import akka .http .scaladsl .server .Directives ._
149
+
150
+ import com .softwaremill .session .SessionDirectives ._
151
+ import com .softwaremill .session .SessionOptions ._
152
+
140
153
path(" login" ) {
141
154
post {
142
155
entity(as[String ]) { body =>
@@ -265,6 +278,11 @@ These can be customized in the config.
265
278
Example usage:
266
279
267
280
```` scala
281
+ import akka .http .scaladsl .server .Directives ._
282
+
283
+ import com .softwaremill .session .CsrfDirectives ._
284
+ import com .softwaremill .session .CsrfOptions ._
285
+
268
286
randomTokenCsrfProtection(checkHeader) {
269
287
get(" site" ) {
270
288
// read from disk
0 commit comments