Class: Devise::JWT::DefaultsGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/devise/jwt/defaults_generator.rb

Overview

Generate defaults to be used in the configuration for the Devise installation in a Rails app

See Also:

  • Warden::JWTAuth

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDefaultsGenerator

Returns a new instance of DefaultsGenerator.



16
17
18
19
20
21
22
23
24
# File 'lib/devise/jwt/defaults_generator.rb', line 16

def initialize
  @devise_mappings = Devise.mappings
  @defaults = {
    mappings: {},
    revocation_strategies: {},
    dispatch_requests: [],
    revocation_requests: []
  }
end

Instance Attribute Details

#defaultsObject (readonly)

Returns the value of attribute defaults.



10
11
12
# File 'lib/devise/jwt/defaults_generator.rb', line 10

def defaults
  @defaults
end

#devise_mappingsObject (readonly)

Returns the value of attribute devise_mappings.



10
11
12
# File 'lib/devise/jwt/defaults_generator.rb', line 10

def devise_mappings
  @devise_mappings
end

Class Method Details

.callObject



12
13
14
# File 'lib/devise/jwt/defaults_generator.rb', line 12

def self.call
  new.call
end

Instance Method Details

#callObject



26
27
28
29
30
31
32
33
# File 'lib/devise/jwt/defaults_generator.rb', line 26

def call
  devise_mappings.each_key do |scope|
    inspector = MappingInspector.new(scope)
    next unless inspector.jwt?
    add_defaults(inspector)
  end
  defaults
end