Skip to content

Instantly share code, notes, and snippets.

@oreoshake
Last active April 23, 2020 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oreoshake/cfcbd21ad1115f636b2fffca8734bbe0 to your computer and use it in GitHub Desktop.
Save oreoshake/cfcbd21ad1115f636b2fffca8734bbe0 to your computer and use it in GitHub Desktop.
if current_user&.samesite_lax_enabled?
SecureHeaders.use_secure_headers_override(request, :samesite_lax)
end
SecureHeaders::Configuration.default do |config|
config.cookies = {
samesite: {
none: { only: ["saml_csrf_token", "saml_return_to"] },
}
}
end
SecureHeaders::Configuration.override(:samesite_lax) do |config|
config.cookies = {
samesite: {
lax: { except: ["saml_csrf_token", "saml_return_to", "saml_csrf_token_legacy", "saml_return_to_legacy"] },
none: { only: ["saml_csrf_token", "saml_return_to"] }
}
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment