Class: Verikloak::Pundit::Railtie
- Inherits:
-
Rails::Railtie
- Object
- Rails::Railtie
- Verikloak::Pundit::Railtie
- Defined in:
- lib/verikloak/pundit/railtie.rb
Overview
Railtie to auto-include Controller helpers in Rails.
Class Method Summary collapse
-
.sync_with_verikloak_rails ⇒ void
Sync env_claims_key with verikloak-rails configuration.
Class Method Details
.sync_with_verikloak_rails ⇒ void
This method returns an undefined value.
Sync env_claims_key with verikloak-rails configuration. Only applies if env_claims_key has not been explicitly set.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/verikloak/pundit/railtie.rb', line 30 def sync_with_verikloak_rails return unless Verikloak::Rails.respond_to?(:config) rails_config = Verikloak::Rails.config return unless rails_config.respond_to?(:user_env_key) && rails_config.user_env_key current_key = Verikloak::Pundit.config.env_claims_key return unless current_key == 'verikloak.user' # Use configure to properly update frozen config Verikloak::Pundit.configure do |c| c.env_claims_key = rails_config.user_env_key end rescue StandardError => e warn "[verikloak-pundit] Failed to sync with verikloak-rails: #{e.}" end |