Class: Yauth::Strategy
- Inherits:
-
Warden::Strategies::Base
- Object
- Warden::Strategies::Base
- Yauth::Strategy
- Defined in:
- lib/yauth/strategy.rb
Instance Attribute Summary collapse
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
Class Method Summary collapse
Instance Method Summary collapse
- #authenticate! ⇒ Object
-
#initialize(*args) ⇒ Strategy
constructor
A new instance of Strategy.
Constructor Details
Instance Attribute Details
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
4 5 6 |
# File 'lib/yauth/strategy.rb', line 4 def manager @manager end |
Class Method Details
.install! ⇒ Object
21 22 23 |
# File 'lib/yauth/strategy.rb', line 21 def self.install! Warden::Strategies.add(:yauth_users, self) end |
Instance Method Details
#authenticate! ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/yauth/strategy.rb', line 11 def authenticate! auth = Rack::Auth::Basic::Request.new(env) credentials = auth.provided? && auth.basic? && auth.credentials if not credentials or not user = manager.authenticate(*credentials) fail!("Could not log in") else success!(user) end end |