Sha256: aae2967014f0951c847408bb3ec07ddc5d5ceb17723385d007bbb89c4a646eb3

Contents?: true

Size: 509 Bytes

Versions: 2

Compression:

Stored size: 509 Bytes

Contents

# frozen_string_literal: true

Warden::Manager.after_authentication do |record, warden, options|
  clean_up_for_winning_strategy = !warden.winning_strategy.respond_to?(:clean_up_csrf?) ||
    warden.winning_strategy.clean_up_csrf?
  if Kingsman.clean_up_csrf_token_on_authentication && clean_up_for_winning_strategy
    if warden.request.respond_to?(:reset_csrf_token)
      # Rails 7.1+
      warden.request.reset_csrf_token
    else
      warden.request.session.try(:delete, :_csrf_token)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kingsman-0.1.1 lib/kingsman/hooks/csrf_cleaner.rb
kingsman-0.1.0 lib/kingsman/hooks/csrf_cleaner.rb