struct

KemalIdentity::Sessions::CookieConfig

Inherits Struct < Value < Object

How the session cookie is named and attributed.

Validated at construction, which means an incoherent configuration is a startup crash rather than a cookie the browser silently discards in production (docs/01-architecture.md).

Constants

DEFAULT_NAME = "__Host-kemal_identity"

Default name, and the reason for most of the validation below.

The __Host- consequence, which is not a footnote

The prefix forbids a Domain attribute, so the cookie is scoped to exactly one host: app.example.com and api.example.com cannot share a session. That is the right default — it stops a compromised sibling subdomain from setting a session cookie for the parent — but it is a wall people hit without understanding why. An application spanning subdomains must set a non-prefixed name together with an explicit domain, deliberately (docs/02-security-model.md).

HOST_PREFIX = "__Host-"
SECURE_PREFIX = "__Secure-"

Constructors

Instance methods

domain
Source
extract(cookies : HTTP::Cookies) : String | Nil

Reads the raw token out of a request's cookies, or nil if it is not there.

Takes HTTP::Cookies rather than a server context: nothing outside the Kemal layer is allowed to know that HTTP::Server::Context exists (docs/01-architecture.md).

Source
host_prefixed?
Source
http_only?
Source
name
Source
path
Source
secure?
Source