Module: ActionDispatch::ContentSecurityPolicy::Request
- Included in:
- Request
- Defined in:
- lib/action_dispatch/http/content_security_policy.rb
Constant Summary collapse
- POLICY =
"action_dispatch.content_security_policy".freeze
- POLICY_REPORT_ONLY =
"action_dispatch.content_security_policy_report_only".freeze
- NONCE_GENERATOR =
"action_dispatch.content_security_policy_nonce_generator".freeze
- NONCE =
"action_dispatch.content_security_policy_nonce".freeze
Instance Method Summary collapse
- #content_security_policy ⇒ Object
- #content_security_policy=(policy) ⇒ Object
- #content_security_policy_nonce ⇒ Object
- #content_security_policy_nonce_generator ⇒ Object
- #content_security_policy_nonce_generator=(generator) ⇒ Object
- #content_security_policy_report_only ⇒ Object
- #content_security_policy_report_only=(value) ⇒ Object
Instance Method Details
#content_security_policy ⇒ Object
51 52 53 |
# File 'lib/action_dispatch/http/content_security_policy.rb', line 51 def content_security_policy get_header(POLICY) end |
#content_security_policy=(policy) ⇒ Object
55 56 57 |
# File 'lib/action_dispatch/http/content_security_policy.rb', line 55 def content_security_policy=(policy) set_header(POLICY, policy) end |
#content_security_policy_nonce ⇒ Object
75 76 77 78 79 80 81 82 83 |
# File 'lib/action_dispatch/http/content_security_policy.rb', line 75 def content_security_policy_nonce if content_security_policy_nonce_generator if nonce = get_header(NONCE) nonce else set_header(NONCE, generate_content_security_policy_nonce) end end end |
#content_security_policy_nonce_generator ⇒ Object
67 68 69 |
# File 'lib/action_dispatch/http/content_security_policy.rb', line 67 def content_security_policy_nonce_generator get_header(NONCE_GENERATOR) end |
#content_security_policy_nonce_generator=(generator) ⇒ Object
71 72 73 |
# File 'lib/action_dispatch/http/content_security_policy.rb', line 71 def content_security_policy_nonce_generator=(generator) set_header(NONCE_GENERATOR, generator) end |
#content_security_policy_report_only ⇒ Object
59 60 61 |
# File 'lib/action_dispatch/http/content_security_policy.rb', line 59 def content_security_policy_report_only get_header(POLICY_REPORT_ONLY) end |
#content_security_policy_report_only=(value) ⇒ Object
63 64 65 |
# File 'lib/action_dispatch/http/content_security_policy.rb', line 63 def content_security_policy_report_only=(value) set_header(POLICY_REPORT_ONLY, value) end |