/**
  * Constructor
  *
  * You must pass the OpenStack's options for the authentication
  *
  * @param  array $options
  * @param  HttpClient $httpClient
  * @throws Exception\InvalidArgumentException
  */
 public function __construct(array $options, HttpClient $httpClient = null)
 {
     $this->setOptions($options);
     $this->api = new Api($httpClient);
     $this->api->setApiPath(__DIR__ . '/api/identity');
     $this->api->setQueryParams(array('format' => 'json'));
     $this->api->setUrl($this->options['url']);
     $username = isset($options['user']) ? $options['user'] : $options['username'];
     if (isset($options['password'])) {
         if (!$this->auth($username, $options['password'])) {
             throw new Exception\RuntimeException('Authentication failed, please check the username and password provided');
         }
     } else {
         if (!$this->auth($username, null, $options['key'])) {
             throw new Exception\RuntimeException('Authentication failed, please check the username and the API\'s key provided');
         }
     }
     $this->api->resetLastResponse();
 }