Module: Verikloak::Audience::RailtieWarnings
- Included in:
- RailtieHelpers
- Defined in:
- lib/verikloak/audience/railtie.rb
Overview
Warning messages for Railtie.
Constant Summary collapse
- WARNING_MESSAGE =
<<~MSG [verikloak-audience] Skipping automatic middleware insertion because ::Verikloak::Middleware is not present in the Rails middleware stack. To enable verikloak-audience, first ensure that the core Verikloak middleware (`Verikloak::Middleware`) is added to your Rails middleware stack. Once the core middleware is present, you can run `rails g verikloak:audience:install` to generate the initializer for the audience middleware, or manually add: config.middleware.insert_after Verikloak::Middleware, Verikloak::Audience::Middleware This warning will disappear once the core middleware is properly configured and the audience middleware is inserted. MSG
- CORE_NOT_CONFIGURED_WARNING =
<<~MSG [verikloak-audience] Skipping automatic middleware insertion because verikloak-rails is not fully configured (discovery_url is not set). The audience middleware requires the core Verikloak middleware to be present in the stack. Please configure verikloak-rails first by setting the discovery_url in your initializer. MSG
- UNCONFIGURED_WARNING =
<<~MSG [verikloak-audience] Skipping configuration validation because required_aud is not configured. To use verikloak-audience, you must configure at least one required audience. Run `rails g verikloak:audience:install` to generate the initializer, or add: Verikloak::Audience.configure do |config| config.required_aud = ['your-audience'] end WARNING: Without this configuration, ALL requests will be rejected with 403. MSG
Instance Method Summary collapse
- #log_warning(message) ⇒ Object
- #warn_core_not_configured ⇒ Object
- #warn_missing_core_middleware ⇒ Object
- #warn_unconfigured ⇒ Object
Instance Method Details
#log_warning(message) ⇒ Object
45 46 47 48 |
# File 'lib/verikloak/audience/railtie.rb', line 45 def log_warning() logger = (::Rails.logger if defined?(::Rails) && ::Rails.respond_to?(:logger)) logger ? logger.warn() : Kernel.warn() end |
#warn_core_not_configured ⇒ Object
50 |
# File 'lib/verikloak/audience/railtie.rb', line 50 def warn_core_not_configured = log_warning(CORE_NOT_CONFIGURED_WARNING) |
#warn_missing_core_middleware ⇒ Object
51 |
# File 'lib/verikloak/audience/railtie.rb', line 51 def warn_missing_core_middleware = log_warning(WARNING_MESSAGE) |
#warn_unconfigured ⇒ Object
52 |
# File 'lib/verikloak/audience/railtie.rb', line 52 def warn_unconfigured = log_warning(UNCONFIGURED_WARNING) |