Class: Occi::Api::Client::Http::AuthnPlugins::Base

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

Direct Known Subclasses

Basic, Digest, Dummy, Keystone, X509

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env_ref, options = {}) ⇒ Base

Returns a new instance of Base


10
11
12
13
14
# File 'lib/occi/api/client/http/authn_plugins/base.rb', line 10

def initialize(env_ref, options = {})
  @options = options
  @env_ref = env_ref
  @fallbacks = []
end

Instance Attribute Details

#env_refObject (readonly)

Returns the value of attribute env_ref


6
7
8
# File 'lib/occi/api/client/http/authn_plugins/base.rb', line 6

def env_ref
  @env_ref
end

#fallbacksObject (readonly)

Returns the value of attribute fallbacks


8
9
10
# File 'lib/occi/api/client/http/authn_plugins/base.rb', line 8

def fallbacks
  @fallbacks
end

#optionsObject (readonly)

Returns the value of attribute options


7
8
9
# File 'lib/occi/api/client/http/authn_plugins/base.rb', line 7

def options
  @options
end

Instance Method Details

#authenticate(options = {}) ⇒ Object


18
19
20
21
# File 'lib/occi/api/client/http/authn_plugins/base.rb', line 18

def authenticate(options = {})
  response = @env_ref.class.head("#{@env_ref.endpoint.to_s}/-/")
  raise ::Occi::Api::Client::Errors::AuthnError, "Authentication failed with code #{response.code.to_s}!" unless response.success?
end

#setup(options = {}) ⇒ Object


16
# File 'lib/occi/api/client/http/authn_plugins/base.rb', line 16

def setup(options = {}); end