Module: AdminSuite::Auth

Defined in:
lib/admin_suite/auth.rb,
lib/admin_suite/auth/strategy.rb,
lib/admin_suite/auth/host_hook.rb,
lib/admin_suite/auth/host_user.rb,
lib/admin_suite/auth/http_basic.rb

Overview

Registry of named authentication strategies.

Defined Under Namespace

Classes: HostHook, HostUser, HttpBasic, Strategy, UnknownStrategyError

Class Method Summary collapse

Class Method Details

.lookup(name) ⇒ Object



17
18
19
20
21
22
# File 'lib/admin_suite/auth.rb', line 17

def lookup(name)
  @registry.fetch(name.to_sym) do
    raise UnknownStrategyError,
      "Unknown AdminSuite auth strategy #{name.inspect}. Registered: #{@registry.keys.sort.inspect}"
  end
end

.normalize_actor(value) ⇒ Object

One definition of "is this a usable actor?", shared by every surface.

Legacy HostHook returns true to mean "authenticated, but I could not name anybody". That is an answer to a different question than authorization asks, so it is not an actor. Lives here rather than in a controller so the MCP surface -- which has no controller -- cannot drift from the web UI's interpretation.



35
36
37
38
39
# File 'lib/admin_suite/auth.rb', line 35

def normalize_actor(value)
  return nil if value.nil? || value.equal?(true) || value.equal?(false)

  value
end

.register(name, klass) ⇒ Object



13
14
15
# File 'lib/admin_suite/auth.rb', line 13

def register(name, klass)
  @registry[name.to_sym] = klass
end

.registered ⇒ Object



24
25
26
# File 'lib/admin_suite/auth.rb', line 24

def registered
  @registry.keys
end