Package io.ktor.server.sessions
Types
A configuration used to specify cookie attributes for Sessions.
A configuration that allows you to configure additional cookie settings for Sessions, for example:
A configuration that allows you to configure additional cookie settings for Sessions.
A container for all session instances.
A configuration that allows you to configure header settings for Sessions.
A configuration that allows you to configure header settings for Sessions.
Thrown when a session is asked too early before the Sessions plugin had chance to configure it. For example, in a phase before ApplicationCallPipeline.Plugins or in a plugin installed before Sessions into the same phase.
A configuration for the Sessions plugin.
Serializes a session data from and to String.
A default reflection-based session serializer. A serialized format is textual and optimized for size as it could be transferred via HTTP headers or cookies.
A storage that provides the ability to write, read, and invalidate session data.
A storage that keeps session data in memory.
SessionTracker provides ability to track and extract session from the call context.
SessionTracker that transfers a Session Id generated by a sessionIdProvider in HTTP Headers/Cookies. It uses a storage and a serializer to store/load serialized/deserialized session content of a specific type.
SessionTracker that stores the contents of the session as part of HTTP Cookies/Headers. It uses a specific serializer to serialize and deserialize objects of type type.
A session transport used to receive, send, or clear a session from/to an ApplicationCall.
A session transport that adds the Set-Cookie
header and reads the Cookie
header for the specified cookie name, and a specific cookie configuration after applying/un-applying the specified transforms defined by transformers.
A session transport that sets or gets the specific header name, applying/un-applying the specified transforms defined by transformers.
A transformer used to sign and encrypt session data.
A transformer used to sign and encrypt/decrypt session data. This transformer works as follows:
Thrown when an HTTP response has already been sent but an attempt to modify the session is made.
Functions
Creates the default SessionSerializer for the type T.
Creates the default SessionSerializer for the class type.
Configures Sessions to pass the serialized session's data in cookies using the nameSet-Cookie
attribute.
Configures Sessions to pass a session identifier in cookies using the nameSet-Cookie
attribute and store the serialized session's data in the server storage.
Configures Sessions to pass the serialized session's data in cookies using the nameSet-Cookie
attribute. The block parameter allows you to configure additional cookie settings, for example:
Creates the default SessionSerializer for the type T.
Creates the default SessionSerializer by typeInfo.
Creates a storage that serializes a session's data to a file under the rootDir directory.
Generates a secure random session ID
Configures Sessions to pass a session identifier in a name HTTP header and store the serialized session's data in the server storage.
Configures Sessions to pass the serialized session's data in a name HTTP header. The block parameter allows you to configure additional settings, for example, sign and encrypt session data.
Returns the corresponding session ID for the type SessionType or null
if no session provided. It will crash if no session provider for type SessionType installed or no Sessions plugin installed.
Un-applies a list of session transformations to a cookieValue representing a transformed session string. If any of the unapplication of transformations fail returning a null, this function also returns null.
Applies a list of session transformations to a value representing session data.
Properties
Gets a current session or fails if the Sessions plugin is not installed.
A plugin that provides a mechanism to persist data between different HTTP requests. Typical use cases include storing a logged-in user's ID, the contents of a shopping basket, or keeping user preferences on the client. In Ktor, you can implement sessions by using cookies or custom headers, choose whether to store session data on the server or pass it to the client, sign and encrypt session data and more.