summaryrefslogtreecommitdiff
path: root/users/lib/warden/strategies
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-02-06 16:16:34 +0100
committerAzul <azul@leap.se>2013-02-06 16:16:34 +0100
commit1bf82535b25cb17c58a196fdaab639040f48e769 (patch)
tree0cc213966150991f13b8858144bffae85fc91163 /users/lib/warden/strategies
parent70e05a181ce3b79a6ea9b5c76eab5102e94860ca (diff)
using ruby-srp 0.1.5 SRP::Client to wrap user in session
Diffstat (limited to 'users/lib/warden/strategies')
-rw-r--r--users/lib/warden/strategies/secure_remote_password.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/users/lib/warden/strategies/secure_remote_password.rb b/users/lib/warden/strategies/secure_remote_password.rb
index 594e27e..483336d 100644
--- a/users/lib/warden/strategies/secure_remote_password.rb
+++ b/users/lib/warden/strategies/secure_remote_password.rb
@@ -25,13 +25,18 @@ module Warden
end
def validate!
- user = session[:handshake].authenticate(params['client_auth'].hex)
- user ? success!(user) : fail!(:password => "wrong_password")
+ client = session[:handshake].authenticate(params['client_auth'].hex)
+ client ?
+ success!(User.find_by_login(client.username)) :
+ fail!(:password => "wrong_password")
end
def initialize!
if user = User.find_by_login(id)
- session[:handshake] = user.initialize_auth(params['A'].hex)
+ client = SRP::Client.new user.username,
+ :verifier => user.verifier,
+ :salt => user.salt
+ session[:handshake] = SRP::Session.new(client, params['A'].hex)
custom! json_response(session[:handshake])
else
fail! :login => "user_not_found"