Module: Grape::Jwt::Authentication
- Extended by:
- ActiveSupport::Concern
- Includes:
- DSL::API
- Defined in:
- lib/grape/jwt/authentication.rb,
lib/grape/jwt/authentication/version.rb,
lib/grape/jwt/authentication/jwt_handler.rb,
lib/grape/jwt/authentication/dependencies.rb,
lib/grape/jwt/authentication/configuration.rb
Overview
The Grape JWT authentication concern.
Defined Under Namespace
Classes: Configuration, JwtHandler
Constant Summary collapse
- VERSION =
The version of the
grape-jwt-authentication
gem '2.5.0'
- KEYLESS_CONFIGURATION =
Specifies which configuration keys are shared between keyless and grape-jwt-authentication, so that we can easily pass through our configuration to keyless.
%i[ authenticator rsa_public_key_url rsa_public_key_caching rsa_public_key_expiration jwt_issuer jwt_beholder jwt_options jwt_verification_key ].freeze
Class Attribute Summary collapse
-
.configuration ⇒ Configuration
Retrieve the current configuration object.
Class Method Summary collapse
-
.configure {|configuration| ... } ⇒ Object
Configure the concern by providing a block which takes care of this task.
-
.configure_dependencies ⇒ Object
(Re)configure our gem dependencies.
-
.configure_keyless ⇒ Object
Configure the
Keyless
gem with our configuration. -
.gem_version ⇒ Gem::Version
Returns the version of the gem as a
Gem::Version
. -
.reset_configuration! ⇒ Object
Reset the current configuration with the default one.
-
.version ⇒ String
Returns the version of gem as a string.
Class Attribute Details
.configuration ⇒ Configuration
Retrieve the current configuration object.
32 33 34 |
# File 'lib/grape/jwt/authentication.rb', line 32 def self.configuration @configuration ||= Configuration.new end |
Class Method Details
.configure {|configuration| ... } ⇒ Object
Configure the concern by providing a block which takes care of this task. Example:
Grape::Jwt::Authentication.configure do |conf|
# conf.xyz = [..]
end
42 43 44 45 |
# File 'lib/grape/jwt/authentication.rb', line 42 def self.configure yield(configuration) configure_dependencies end |
.configure_dependencies ⇒ Object
(Re)configure our gem dependencies. We take care of setting up Keyless
, which has been extracted from this gem.
18 19 20 |
# File 'lib/grape/jwt/authentication/dependencies.rb', line 18 def self.configure_dependencies configure_keyless end |
.configure_keyless ⇒ Object
Configure the Keyless
gem with our configuration.
23 24 25 26 27 28 29 30 31 |
# File 'lib/grape/jwt/authentication/dependencies.rb', line 23 def self.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 |
.gem_version ⇒ Gem::Version
Returns the version of the gem as a Gem::Version
.
21 22 23 |
# File 'lib/grape/jwt/authentication/version.rb', line 21 def gem_version Gem::Version.new VERSION end |
.reset_configuration! ⇒ Object
Reset the current configuration with the default one.
48 49 50 51 |
# File 'lib/grape/jwt/authentication.rb', line 48 def self.reset_configuration! self.configuration = Configuration.new configure_dependencies end |
.version ⇒ String
Returns the version of gem as a string.
14 15 16 |
# File 'lib/grape/jwt/authentication/version.rb', line 14 def version VERSION end |