Module: Datadog::AppSec::Contrib::Devise::Patcher

Includes:
Patcher
Defined in:
lib/datadog/appsec/contrib/devise/patcher.rb,
lib/datadog/appsec/contrib/devise/patcher/authenticatable_patch.rb,
lib/datadog/appsec/contrib/devise/patcher/registration_controller_patch.rb

Overview

Patcher for AppSec on Devise

Defined Under Namespace

Modules: AuthenticatablePatch, RegistrationControllerPatch

Class Method Summary collapse

Class Method Details

.patchObject



25
26
27
28
29
30
# File 'lib/datadog/appsec/contrib/devise/patcher.rb', line 25

def patch
  patch_authenticable_strategy
  patch_registration_controller

  Patcher.instance_variable_set(:@patched, true)
end

.patch_authenticable_strategyObject



32
33
34
# File 'lib/datadog/appsec/contrib/devise/patcher.rb', line 32

def patch_authenticable_strategy
  ::Devise::Strategies::Authenticatable.prepend(AuthenticatablePatch)
end

.patch_registration_controllerObject



36
37
38
39
40
# File 'lib/datadog/appsec/contrib/devise/patcher.rb', line 36

def patch_registration_controller
  ::ActiveSupport.on_load(:after_initialize) do
    ::Devise::RegistrationsController.prepend(RegistrationControllerPatch)
  end
end

.patched?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/datadog/appsec/contrib/devise/patcher.rb', line 17

def patched?
  Patcher.instance_variable_get(:@patched)
end

.target_versionObject



21
22
23
# File 'lib/datadog/appsec/contrib/devise/patcher.rb', line 21

def target_version
  Integration.version
end