class

Kemal::Session::Config

Inherits Reference < Object

Configuration singleton. Mirrors the kemal-session config surface where it makes sense for a client-side (cookie) store, plus a few Rails-specific knobs (salt, iterations). engine / gc_interval from kemal-session have no analogue here: the cookie is the storage.

Constants

INSTANCE = new

Instance methods

csrf_base_url

CSRF: base URL the Origin header is compared against, e.g. "https://app.example.com". Derived from X-Forwarded-Proto/Host when nil; set it explicitly when running behind a proxy that doesn't forward the original scheme.

Source
csrf_base_url=(csrf_base_url : String | Nil)

CSRF: base URL the Origin header is compared against, e.g. "https://app.example.com". Derived from X-Forwarded-Proto/Host when nil; set it explicitly when running behind a proxy that doesn't forward the original scheme.

Source
csrf_origin_check

CSRF: whether the Origin header is checked against the request's base URL (Rails' config.action_controller.forgery_protection_origin_check).

Source
csrf_origin_check=(csrf_origin_check : Bool)

CSRF: whether the Origin header is checked against the request's base URL (Rails' config.action_controller.forgery_protection_origin_check).

Source
csrf_param_name

CSRF: the request parameter carrying the token (Rails' config.action_controller.request_forgery_protection_token).

Source
csrf_param_name=(csrf_param_name : String)

CSRF: the request parameter carrying the token (Rails' config.action_controller.request_forgery_protection_token).

Source
csrf_per_form_tokens

CSRF: whether per-form tokens are issued and accepted. Must match the Rails app's config.action_controller.per_form_csrf_tokens, which is true under load_defaults 5.2 or later.

Source
csrf_per_form_tokens=(csrf_per_form_tokens : Bool)

CSRF: whether per-form tokens are issued and accepted. Must match the Rails app's config.action_controller.per_form_csrf_tokens, which is true under load_defaults 5.2 or later.

Source
csrf_trust_forwarded_headers

CSRF: whether X-Forwarded-Proto / X-Forwarded-Host are believed when deriving the base URL the Origin header is compared against. true matches Rails' request.base_url, and is safe behind a proxy that overwrites those headers; set it to false when anything can reach the app directly, so a spoofed forwarded host can't satisfy the check. Ignored when csrf_base_url is set.

Source
csrf_trust_forwarded_headers=(csrf_trust_forwarded_headers : Bool)

CSRF: whether X-Forwarded-Proto / X-Forwarded-Host are believed when deriving the base URL the Origin header is compared against. true matches Rails' request.base_url, and is safe behind a proxy that overwrites those headers; set it to false when anything can reach the app directly, so a spoofed forwarded host can't satisfy the check. Ignored when csrf_base_url is set.

Source
domain
Source
domain=(domain : String | Nil)
Source
encryptor

A cached MessageEncryptor, rebuilt when the secret/salt/iterations change.

Source
http_only
Source
http_only=(http_only : Bool)
Source
iterations

PBKDF2 iteration count. Rails uses 1000 for its application key generator.

Source
iterations=(iterations : Int32)

PBKDF2 iteration count. Rails uses 1000 for its application key generator.

Source
path
Source
path=(path : String)
Source
purpose

The message purpose Rails embeds/checks for this cookie.

Source
salt

Key-derivation salt. Defaults to Rails' authenticated-encrypted-cookie salt.

Source
salt=(salt : String)

Key-derivation salt. Defaults to Rails' authenticated-encrypted-cookie salt.

Source
secret

The Rails secret_key_base. Required; cryptographic operations raise SecretRequiredException while this is empty.

Source
secret=(secret : String)

The Rails secret_key_base. Required; cryptographic operations raise SecretRequiredException while this is empty.

Source
secret_key_base

Rails-friendly alias for secret.

Source
secret_key_base=(value : String) : String
Source
secure

false is Rails' default too (it leans on force_ssl). Set it to true for any app served over HTTPS, or the cookie also travels over plain HTTP.

Source
secure=(secure : Bool)

false is Rails' default too (it leans on force_ssl). Set it to true for any app served over HTTPS, or the cookie also travels over plain HTTP.

Source
timeout

Optional cookie lifetime. nil (default) emits a session cookie with a null metadata expiry, matching a default Rails session. When set, the cookie gets an Expires and the metadata envelope an exp.

Source
timeout=(timeout : Time::Span | Nil)

Optional cookie lifetime. nil (default) emits a session cookie with a null metadata expiry, matching a default Rails session. When set, the cookie gets an Expires and the metadata envelope an exp.

Source