@@ -42,6 +42,12 @@ session data that is sent to the client, and verified when the session token is
4242## Example
4343
4444```` 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+
4551val sessionConfig = SessionConfig .default(" some_very_long_secret_and_random_string_some_very_long_secret_and_random_string" )
4652implicit val sessionManager = new SessionManager [Long ](sessionConfig)
4753
@@ -129,6 +135,8 @@ convenient to use a `MultiValueSessionSerializer[T]` which should convert the in
129135Here we are creating a manager where the session content will be a single ` Long ` number:
130136
131137```` scala
138+ import com .softwaremill .session .{SessionConfig , SessionManager }
139+
132140val sessionConfig = SessionConfig .default(" some_very_long_secret_and_random_string_some_very_long_secret_and_random_string" )
133141implicit val sessionManager = new SessionManager [Long ](sessionConfig)
134142````
@@ -137,6 +145,11 @@ The basic directives enable you to set, read and invalidate the session. To crea
137145and set a new session cookie), you need to use the ` setSession ` directive:
138146
139147```` scala
148+ import akka .http .scaladsl .server .Directives ._
149+
150+ import com .softwaremill .session .SessionDirectives ._
151+ import com .softwaremill .session .SessionOptions ._
152+
140153path(" login" ) {
141154 post {
142155 entity(as[String ]) { body =>
@@ -265,6 +278,11 @@ These can be customized in the config.
265278Example usage:
266279
267280```` scala
281+ import akka .http .scaladsl .server .Directives ._
282+
283+ import com .softwaremill .session .CsrfDirectives ._
284+ import com .softwaremill .session .CsrfOptions ._
285+
268286randomTokenCsrfProtection(checkHeader) {
269287 get(" site" ) {
270288 // read from disk
0 commit comments