Class: Authlogic::ControllerAdapters::AbstractAdapter
- Inherits:
-
Object
- Object
- Authlogic::ControllerAdapters::AbstractAdapter
show all
- Defined in:
- lib/novelys_authlogic/controller_adapters/abstract_adapter.rb
Overview
Allows you to use Authlogic in any framework you want, not just rails. See the RailsAdapter or MerbAdapter for an example of how to adapt Authlogic to work with your framework.
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of AbstractAdapter.
8
9
10
|
# File 'lib/novelys_authlogic/controller_adapters/abstract_adapter.rb', line 8
def initialize(controller)
self.controller = controller
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(id, *args, &block) ⇒ Object
62
63
64
|
# File 'lib/novelys_authlogic/controller_adapters/abstract_adapter.rb', line 62
def method_missing(id, *args, &block)
controller.send(id, *args, &block)
end
|
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
6
7
8
|
# File 'lib/novelys_authlogic/controller_adapters/abstract_adapter.rb', line 6
def controller
@controller
end
|
Instance Method Details
#authenticate_with_http_basic(&block) ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/novelys_authlogic/controller_adapters/abstract_adapter.rb', line 12
def authenticate_with_http_basic(&block)
@auth = Rack::Auth::Basic::Request.new(controller.request.env)
if @auth.provided? and @auth.basic?
block.call(*@auth.credentials)
else
false
end
end
|
#cookie_domain ⇒ Object
25
26
27
|
# File 'lib/novelys_authlogic/controller_adapters/abstract_adapter.rb', line 25
def cookie_domain
raise NotImplementedError.new("The cookie_domain method has not been implemented by the controller adapter")
end
|
#cookies ⇒ Object
21
22
23
|
# File 'lib/novelys_authlogic/controller_adapters/abstract_adapter.rb', line 21
def cookies
controller.cookies
end
|
#last_request_update_allowed? ⇒ Boolean
57
58
59
|
# File 'lib/novelys_authlogic/controller_adapters/abstract_adapter.rb', line 57
def last_request_update_allowed?
controller.send(:last_request_update_allowed?)
end
|
#params ⇒ Object
29
30
31
|
# File 'lib/novelys_authlogic/controller_adapters/abstract_adapter.rb', line 29
def params
controller.params
end
|
#request ⇒ Object
33
34
35
|
# File 'lib/novelys_authlogic/controller_adapters/abstract_adapter.rb', line 33
def request
controller.request
end
|
#request_content_type ⇒ Object
37
38
39
|
# File 'lib/novelys_authlogic/controller_adapters/abstract_adapter.rb', line 37
def request_content_type
request.content_type
end
|
#responds_to_last_request_update_allowed? ⇒ Boolean
53
54
55
|
# File 'lib/novelys_authlogic/controller_adapters/abstract_adapter.rb', line 53
def responds_to_last_request_update_allowed?
controller.respond_to?(:last_request_update_allowed?, true)
end
|
#responds_to_single_access_allowed? ⇒ Boolean
45
46
47
|
# File 'lib/novelys_authlogic/controller_adapters/abstract_adapter.rb', line 45
def responds_to_single_access_allowed?
controller.respond_to?(:single_access_allowed?, true)
end
|
#session ⇒ Object
41
42
43
|
# File 'lib/novelys_authlogic/controller_adapters/abstract_adapter.rb', line 41
def session
controller.session
end
|
#single_access_allowed? ⇒ Boolean
49
50
51
|
# File 'lib/novelys_authlogic/controller_adapters/abstract_adapter.rb', line 49
def single_access_allowed?
controller.send(:single_access_allowed?)
end
|