You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to configure OmniAuth::AuthenticityTokenProtection for Hanami #1074
How can I configure the OmniAuth::AuthenticityTokenProtection to pass options to Rack::Protection::AuthenticityToken. I'm using Hanami 1.3 which already handle CSRF protection, but I would like to configure OmniAuth to use the right session key (key: :_csrf_token) and the right HTTP param (authenticity_param: :_csrf_token).
# Since Hanami does not encode/decode the CSRF token in base64 we need to set a custom allow/deny logic.OmniAuth::AuthenticityTokenProtection.default_options(allow_if: lambdado |env|
token_key=Hanami::Action::CSRFProtection::CSRF_TOKEN.to_srequest_token=Rack::Request.new(env).params[token_key]session_token=env['rack.session'][token_key]
!Hanami::Utils::Blank.blank?(request_token) && Rack::Utils.secure_compare(request_token,session_token)end)
changed the title [-]How to configure OmniAuth::AuthenticityTokenProtection[/-][+]How to configure OmniAuth::AuthenticityTokenProtection for Hanami[/+]on Jun 10, 2022
Activity
masterT commentedon Jun 10, 2022
Got my answer from #1070.
[-]How to configure OmniAuth::AuthenticityTokenProtection[/-][+]How to configure OmniAuth::AuthenticityTokenProtection for Hanami[/+]