Class: AdminSuite::Auth::Strategy

Inherits:
Object
  • Object
show all
Defined in:
lib/admin_suite/auth/strategy.rb

Overview

Base class for authentication strategies.

A strategy authenticates the current request. It must either:

  • return a truthy actor object (request allowed), or
  • deny: render/redirect on the controller itself (halts the chain), or return nil/false (the engine responds 403).

Direct Known Subclasses

HostHook, HttpBasic

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Strategy

Returns a new instance of Strategy.



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

def initialize(options = {})
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#authenticate!(controller) ⇒ Object?

Returns the authenticated actor, or nil when denied.

Parameters:

  • controller (ActionController::Base)

Returns:

  • (Object, nil)

    the authenticated actor, or nil when denied

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/admin_suite/auth/strategy.rb', line 20

def authenticate!(controller)
  raise NotImplementedError, "#{self.class.name} must implement #authenticate!(controller)"
end