Class: Occi::Api::Client::Http::AuthnPlugins::Token

Inherits:
Base
  • Object
show all
Defined in:
lib/occi/api/client/http/authn_plugins/token.rb

Instance Attribute Summary

Attributes inherited from Base

#env_ref, #fallbacks, #options

Instance Method Summary collapse

Methods inherited from Base

#authenticate, #initialize

Constructor Details

This class inherits a constructor from Occi::Api::Client::Http::AuthnPlugins::Base

Instance Method Details

#setup(options = {}) ⇒ Object

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
14
15
# File 'lib/occi/api/client/http/authn_plugins/token.rb', line 7

def setup(options = {})
  # set up token auth
  raise ArgumentError, "Missing required option 'token' for token auth!" if @options[:token].blank?
  raise ArgumentError, "Token cannot be a multi-line string!" if @options[:token].strip.lines.count > 1
  @env_ref.class.headers['X-Auth-Token'] = @options[:token].strip

  @env_ref.class.ssl_ca_path @options[:ca_path] if @options[:ca_path]
  @env_ref.class.ssl_ca_file @options[:ca_file] if @options[:ca_file]
end