Module: SwiftStorage::Auth::V1_0

Defined in:
lib/swift_storage/auth/v1_0.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#auth_pathObject

Returns the value of attribute auth_path.



4
5
6
# File 'lib/swift_storage/auth/v1_0.rb', line 4

def auth_path
  @auth_path
end

Instance Method Details

#authenticate!Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# 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?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/swift_storage/auth/v1_0.rb', line 20

def authenticated?
  !!(self.storage_url && auth_token)
end