Class: Fog::Brightbox::Storage::AuthenticationRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/brightbox/storage/authentication_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ AuthenticationRequest

Returns a new instance of AuthenticationRequest.



8
9
10
# File 'lib/fog/brightbox/storage/authentication_request.rb', line 8

def initialize(config)
  @config = config
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



5
6
7
# File 'lib/fog/brightbox/storage/authentication_request.rb', line 5

def access_token
  @access_token
end

#management_urlObject

Returns the value of attribute management_url.



5
6
7
# File 'lib/fog/brightbox/storage/authentication_request.rb', line 5

def management_url
  @management_url
end

#tenantObject

Returns the value of attribute tenant.



6
7
8
# File 'lib/fog/brightbox/storage/authentication_request.rb', line 6

def tenant
  @tenant
end

#userObject

Returns the value of attribute user.



6
7
8
# File 'lib/fog/brightbox/storage/authentication_request.rb', line 6

def user
  @user
end

Instance Method Details

#authenticateObject



12
13
14
15
16
17
18
19
20
# File 'lib/fog/brightbox/storage/authentication_request.rb', line 12

def authenticate
  response = authentication_request

  self.access_token = response.headers["X-Auth-Token"]
  self.management_url = response.headers["X-Server-Management-Url"] || response.headers["X-Storage-Url"]
  self
rescue Excon::Errors::Unauthorized => error
  raise Fog::Brightbox::Storage::AuthenticationRequired.slurp(error)
end