class

Marten::Conf::GlobalSettings::CSRF

Inherits Reference / Object

Defines configuration options related to Cross Site Request Forgery protection.

Instance methods

protection_enabled

Returns a boolean indicating if CSRF protection is enabled globally (defaults to true).

Source
protection_enabled=(protection_enabled : Bool)

Allows to set whether or not CSRF protection is enabled globally.

Source
protection_enabled?

Returns a boolean indicating if CSRF protection is enabled globally (defaults to true).

Source
session_key

Returns the session key to use for the CSRF token (defaults to "csrftoken").

Source
session_key=(name : String | Symbol)

Allows to set session key to use for the CSRF token.

Source
trusted_origins

Returns the array of CSRF-trusted origins.

Source
trusted_origins=(origins : Array(String))

Allows to define an array of trusted origins.

These origins will be trusted for CSRF-protected requests (such as POST requests) and they will be used to check either the Origin or the Referer header depending on the request scheme. This is done to ensure that a specific subdomain such as sub1.example.com cannot issue a POST request to sub2.example.com. In order to enable CSRF-protected requests over different origins, it's possible to add trusted origins to this array. For example https://sub1.example.com can be configured as a trusted domain that way, but it's possible to allow CSRF-protected requests for all the subdomains of a specific domain by using https://*.example.com.

Source
use_session

Returns a boolean indicating if the CSRF token is stored inside the session.

Source
use_session=(use_session : Bool)

Allows to set whether or not the CSRF token should be stored inside the session.

Source
use_session?

Returns a boolean indicating if the CSRF token is stored inside the session.

Source