Class: Authentication::Logic::ControllerAdapters::RailsAdapter

Inherits:
AbstractAdapter
  • Object
show all
Defined in:
lib/auth/logic/controller_adapters/rails_adapter.rb

Overview

Adapts auth-logic to work with rails. The point is to close the gap between what auth-logic expects and what the rails controller object provides. Similar to how ActiveRecord has an adapter for MySQL, PostgreSQL, SQLite, etc.

Defined Under Namespace

Modules: RailsImplementation

Constant Summary

Constants inherited from AbstractAdapter

AbstractAdapter::ENV_SESSION_OPTIONS, AbstractAdapter::E_COOKIE_DOMAIN_ADAPTER

Instance Attribute Summary

Attributes inherited from AbstractAdapter

#controller

Instance Method Summary collapse

Methods inherited from AbstractAdapter

#initialize, #last_request_update_allowed?, #params, #renew_session_id, #request, #respond_to_missing?, #responds_to_single_access_allowed?, #session, #single_access_allowed?

Constructor Details

This class inherits a constructor from Authentication::Logic::ControllerAdapters::AbstractAdapter

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Authentication::Logic::ControllerAdapters::AbstractAdapter

Instance Method Details

#authenticate_with_http_basic(&block) ⇒ Object



11
12
13
# File 'lib/auth/logic/controller_adapters/rails_adapter.rb', line 11

def authenticate_with_http_basic(&block)
  controller.authenticate_with_http_basic(&block)
end


21
22
23
# File 'lib/auth/logic/controller_adapters/rails_adapter.rb', line 21

def cookie_domain
  controller.request.session_options[:domain]
end

#cookiesObject

Returns a ‘ActionDispatch::Cookies::CookieJar`. See the AC guide guides.rubyonrails.org/action_controller_overview.html#cookies



17
18
19
# File 'lib/auth/logic/controller_adapters/rails_adapter.rb', line 17

def cookies
  controller.respond_to?(:cookies, true) ? controller.send(:cookies) : nil
end

#request_content_typeObject



25
26
27
# File 'lib/auth/logic/controller_adapters/rails_adapter.rb', line 25

def request_content_type
  request.format.to_s
end