Class: RailsAiContext::Introspectors::AuthIntrospector

Inherits:
Object
  • Object
show all
Extended by:
StaticTier
Defined in:
lib/rails_ai_context/introspectors/auth_introspector.rb

Overview

Discovers authentication and authorization setup: Devise, Rails 8 auth, Pundit, CanCanCan, CORS, CSP.

Constant Summary collapse

SYMBOL_DEVISE_SETTINGS =

Settings reported as a bare word rather than as their literal value, matching how Devise's own docs name the strategies.

%i[lock_strategy unlock_strategy].freeze
DEVISE_SETTINGS =
(%i[timeout_in maximum_attempts password_length] + SYMBOL_DEVISE_SETTINGS).freeze

Constants included from StaticTier

StaticTier::ALTERNATE_SOURCE, StaticTier::FILES_ONLY, StaticTier::KINDS, StaticTier::RUNTIME_ONLY

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from StaticTier

answers_statically?, static_tier, static_tier_declared?, unavailable_reason, validate_static_tier!

Constructor Details

#initialize(app) ⇒ AuthIntrospector

Returns a new instance of AuthIntrospector.



18
19
20
# File 'lib/rails_ai_context/introspectors/auth_introspector.rb', line 18

def initialize(app)
  @app = app
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



16
17
18
# File 'lib/rails_ai_context/introspectors/auth_introspector.rb', line 16

def app
  @app
end

Instance Method Details

#callObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rails_ai_context/introspectors/auth_introspector.rb', line 22

def call
  {
    authentication: detect_authentication,
    authorization: detect_authorization,
    security: detect_security,
    devise_modules_per_model: detect_devise_modules_per_model,
    token_auth: detect_token_auth
  }
rescue => e
  { error: e.message }
end