Class: Legion::Extensions::Identity::Entra::Delegated::Actor::AuthValidator

Inherits:
Actors::Once
  • Object
show all
Defined in:
lib/legion/extensions/identity/entra/delegated/actors/auth_validator.rb

Instance Method Summary collapse

Instance Method Details

#check_subtask?Boolean

Returns:

  • (Boolean)


13
# File 'lib/legion/extensions/identity/entra/delegated/actors/auth_validator.rb', line 13

def check_subtask?  = false

#delayObject



16
17
18
# File 'lib/legion/extensions/identity/entra/delegated/actors/auth_validator.rb', line 16

def delay
  9.0
end

#enabled?Boolean

rubocop:disable Legion/Extension/ActorEnabledSideEffects

Returns:

  • (Boolean)


20
21
22
# File 'lib/legion/extensions/identity/entra/delegated/actors/auth_validator.rb', line 20

def enabled? # rubocop:disable Legion/Extension/ActorEnabledSideEffects
  true
end

#generate_task?Boolean

Returns:

  • (Boolean)


14
# File 'lib/legion/extensions/identity/entra/delegated/actors/auth_validator.rb', line 14

def generate_task?  = false

#manualObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/legion/extensions/identity/entra/delegated/actors/auth_validator.rb', line 24

def manual
  log.info('Entra Delegated AuthValidator starting')
  client = Legion::Extensions::Identity::Entra::Client.instance(pattern: :delegated)

  if Legion::Extensions::Identity::Entra::Helpers::TokenManager.authenticated?(:delegated)
    token = client.access_token
    if token
      log.info('Entra delegated auth valid')
      upgrade_identity
    elsif auto_authenticate?
      log.info('Entra delegated token expired, attempting browser re-auth')
      attempt_browser_reauth
    end
  elsif previously_authenticated?
    if Legion::Extensions::Identity::Entra::Helpers::TokenManager.scope_fingerprint_stale?(:delegated)
      log.info('Entra delegated scope fingerprint changed, re-authenticating to acquire updated scopes')
    else
      log.info('Entra delegated token file found but expired, attempting re-auth')
    end
    attempt_browser_reauth
  elsif auto_authenticate?
    log.info('auto_authenticate enabled, opening browser for initial auth')
    attempt_browser_reauth
  else
    log.debug('No Entra delegated auth configured, skipping')
  end
  log.info('Entra Delegated AuthValidator complete')
rescue StandardError => e
  log.error("AuthValidator: #{e.message}")
end

#runner_classObject



10
# File 'lib/legion/extensions/identity/entra/delegated/actors/auth_validator.rb', line 10

def runner_class    = self.class

#runner_functionObject



11
# File 'lib/legion/extensions/identity/entra/delegated/actors/auth_validator.rb', line 11

def runner_function = 'manual'

#use_runner?Boolean

Returns:

  • (Boolean)


12
# File 'lib/legion/extensions/identity/entra/delegated/actors/auth_validator.rb', line 12

def use_runner?     = false