app/controllers/concerns/blacklight/token_based_user.rb in blacklight-7.40.0 vs app/controllers/concerns/blacklight/token_based_user.rb in blacklight-8.0.0.beta1

- old
+ new

@@ -1,6 +1,7 @@ # frozen_string_literal: true + module Blacklight::TokenBasedUser extend ActiveSupport::Concern included do if respond_to? :helper_method @@ -46,10 +47,21 @@ def export_secret_token secret_key_generator.generate_key('encrypted user session key')[0..(key_len - 1)] end def secret_key_generator - @secret_key_generator ||= ActiveSupport::KeyGenerator.new(Rails.application.secret_key_base) + @secret_key_generator ||= begin + app = Rails.application + + secret_key_base = if app.respond_to?(:credentials) + # Rails 5.2+ + app.credentials.secret_key_base + else + # Rails <= 5.1 + app.secrets.secret_key_base + end + ActiveSupport::KeyGenerator.new(secret_key_base) + end end def message_encryptor ActiveSupport::MessageEncryptor.new(export_secret_token) end