aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/auth_bytemark.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mauve/auth_bytemark.rb')
-rw-r--r--lib/mauve/auth_bytemark.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/mauve/auth_bytemark.rb b/lib/mauve/auth_bytemark.rb
index 7419d10..9e0a6d1 100644
--- a/lib/mauve/auth_bytemark.rb
+++ b/lib/mauve/auth_bytemark.rb
@@ -3,7 +3,7 @@ require 'sha1'
require 'xmlrpc/client'
require 'timeout'
-class AuthSourceBytemark
+class AuthBytemark
def initialize (srv='auth.bytemark.co.uk', port=443)
raise ArgumentError.new("Server must be a String, not a #{srv.class}") if String != srv.class
@@ -11,6 +11,7 @@ class AuthSourceBytemark
@srv = srv
@port = port
@timeout = 7
+ @logger = Log4r::Logger.new(self.class.to_s)
end
## Not really needed.
@@ -33,15 +34,16 @@ class AuthSourceBytemark
raise ArgumentError.new("Login must be a string, not a #{login.class}") if String != login.class
raise ArgumentError.new("Password must be a string, not a #{password.class}") if String != password.class
raise ArgumentError.new("Login or/and password is/are empty.") if login.empty? || password.empty?
+
client = XMLRPC::Client.new(@srv,"/",@port,nil,nil,nil,nil,true,@timeout).proxy("bytemark.auth")
+
begin
challenge = client.getChallengeForUser(login)
response = Digest::SHA1.new.update(challenge).update(password).hexdigest
client.login(login, response)
- rescue XMLRPC::FaultException => fault
- return "Fault code is #{fault.faultCode} stating #{fault.faultString}"
+ rescue Exception => ex
+ return false
end
- return true
end
end