Sha256: c426d57174e35ada47f0c770f40f1130616b8d75a57ec4eedf912e35cb00cd30

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

module Grape
  module Jwt
    module Authentication
      module Extensions
        # Root-level handling of dependencies.
        module Dependencies
          # Specifies which configuration keys are shared between keyless
          # and grape-jwt-authentication, so that we can easily pass through
          # our configuration to keyless.
          KEYLESS_CONFIGURATION = %i[
            authenticator rsa_public_key_url rsa_public_key_caching
            rsa_public_key_expiration jwt_issuer jwt_beholder jwt_options
            jwt_verification_key
          ].freeze

          # (Re)configure our gem dependencies. We take care of setting up
          # +Keyless+, which has been extracted from this gem.
          def configure_dependencies
            configure_keyless
          end

          # Configure the +Keyless+ gem with our configuration.
          def configure_keyless
            configuration = Grape::Jwt::Authentication.configuration

            Keyless.configure do |keyless|
              KEYLESS_CONFIGURATION.each do |option|
                keyless.send("#{option}=", configuration.send(option))
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grape-jwt-authentication-2.8.0 lib/grape/jwt/authentication/extensions/dependencies.rb
grape-jwt-authentication-2.7.1 lib/grape/jwt/authentication/extensions/dependencies.rb
grape-jwt-authentication-2.7.0 lib/grape/jwt/authentication/extensions/dependencies.rb