1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/rackspace/authentication.rb

36 lines
No EOL
851 B
Ruby

module Fog
module Rackspace
module Authentication
private
def authentication_method
if @rackspace_auth_url && @rackspace_auth_url =~ /v1(\.\d)?\w*$/
:authenticate_v1
else
:authenticate_v2
end
end
def v1_authentication?
@identity_service.nil?
end
def v2_authentication?
@identity_service != nil
end
def authenticate_v2(options)
h = {
:rackspace_api_key => options[:rackspace_api_key],
:rackspace_username => options[:rackspace_username],
:rackspace_auth_url => options[:rackspace_auth_url]
}
@identity_service = Fog::Rackspace::Identity.new(h)
@auth_token = @identity_service.auth_token
endpoint_uri
end
end
end
end