module SwiftStorage::Auth::V1_0
Attributes
auth_path[RW]
Public Instance Methods
authenticate!()
click to toggle source
# File lib/swift_storage/auth/v1_0.rb, line 6 def authenticate! headers = { Headers::AUTH_USER => "#{tenant}:#{username}", Headers::AUTH_KEY => password } res = request(auth_url, headers: headers) h = res.header self.storage_url = h[Headers::STORAGE_URL] @auth_token = h[Headers::AUTH_TOKEN] @storage_token = h[Headers::STORAGE_TOKEN] @auth_at = Time.now end
authenticated?()
click to toggle source
# File lib/swift_storage/auth/v1_0.rb, line 20 def authenticated? !!(self.storage_url && auth_token) end
Private Instance Methods
auth_url()
click to toggle source
# File lib/swift_storage/auth/v1_0.rb, line 26 def auth_url File.join(endpoint, @auth_path || 'auth/v1.0') end