11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/angular_rails_csrf/concern.rb', line 11
def set_xsrf_token_cookie
return unless defined?(protect_against_forgery?) && protect_against_forgery? && !respond_to?(:__exclude_xsrf_token_cookie?)
config = Rails.application.config
same_site = same_site_from config
secure = secure_from config
cookie_options = {
value: form_authenticity_token,
domain: domain_from(config),
same_site: same_site,
secure: same_site.eql?(:none) || secure
}
cookie_name = cookie_name_from config
cookies[cookie_name] = cookie_options
end
|