feature-754: pass one_auth token as provided if it has more than two tokens

This commit is contained in:
Ruben S. Montero committed 2011-07-28 03:51:25 +02:00
1 parent f725fe9667
commit dfba42fa38
1 file changed
+6 -11
+6 -11
View File
@@ -96,19 +96,14 @@ module OpenNebula
raise "ONE_AUTH file not present"
end
if !one_secret.match(".+:.+")
raise "Authorization file malformed"
end
tokens = one_secret.split(':')
one_secret=~/^(.+?):(.+)$/
user=$1
password=$2
if password.match(/^plain:/)
@one_auth = "#{user}:#{password.split(':').last}"
if tokens.length > 2
@one_auth = one_secret
elsif secret_tokens == 2
@one_auth = "#{tokens[0]}:#{Digest::SHA1.hexdigest(tokens[1])}"
else
@one_auth = "#{user}:#{Digest::SHA1.hexdigest(password)}"
raise "Authorization file malformed"
end
if endpoint