cookie

inline fun <S : Any> SessionsConfig.cookie(name: String, storage: SessionStorage)

Configures Sessions to pass a session identifier in cookies using the name Set-Cookie attribute and store the serialized session's data in the server storage.


inline fun <S : Any> SessionsConfig.cookie(name: String, storage: SessionStorage, block: CookieIdSessionBuilder<S>.() -> Unit)

Configures Sessions to pass a session identifier in cookies using the name Set-Cookie attribute and store the serialized session's data in the server storage. The block parameter allows you to configure additional cookie settings, for example:

  • add other cookie attributes;

  • sign and encrypt session data.


inline fun <S : Any> SessionsConfig.cookie(name: String)

Configures Sessions to pass the serialized session's data in cookies using the name Set-Cookie attribute.


inline fun <S : Any> SessionsConfig.cookie(name: String, block: CookieSessionBuilder<S>.() -> Unit)

Configures Sessions to pass the serialized session's data in cookies using the name Set-Cookie attribute. The block parameter allows you to configure additional cookie settings, for example:

  • add other cookie attributes;

  • sign and encrypt session data.

For example, the code snippet below shows how to specify a cookie's path and expiration time:

install(Sessions) {
cookie<UserSession>("user_session") {
cookie.path = "/"
cookie.maxAgeInSeconds = 10
}
}

fun <S : Any> SessionsConfig.cookie(name: String, sessionType: KClass<S>, storage: SessionStorage)

Deprecated (with error)

Use reified types instead.

Configures Sessions to pass a session identifier in cookies using the name Set-Cookie attribute and store the serialized session's data in the server storage.


inline fun <S : Any> SessionsConfig.cookie(name: String, sessionType: KClass<S>, storage: SessionStorage, block: CookieIdSessionBuilder<S>.() -> Unit)

Deprecated (with error)

Use reified types instead.

Configures Sessions to pass a session identifier in cookies using the name Set-Cookie attribute and store the serialized session's data in the server storage. The block parameter allows you to configure additional cookie settings, for example:

  • add other cookie attributes;

  • sign and encrypt session data.


fun <S : Any> SessionsConfig.cookie(name: String, sessionType: KClass<S>)

Deprecated (with error)

Use reified type parameter instead.

Configures Sessions to pass the serialized session's data in cookies using the name Set-Cookie attribute.


inline fun <S : Any> SessionsConfig.cookie(name: String, sessionType: KClass<S>, block: CookieSessionBuilder<S>.() -> Unit)

Deprecated (with error)

Use reified type instead.

Configures Sessions to pass the serialized session's data in cookies using the name Set-Cookie attribute. The block parameter allows you to configure additional cookie settings, for example:

  • add other cookie attributes;

  • sign and encrypt session data.