occi-api 4.3.3 → 4.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b31a4ef31f01497fb6bc37b720e2bc129dfb8e1c
4
- data.tar.gz: 34839545df78237a7667522561c6c1dce2a201c3
3
+ metadata.gz: 615c238e6d6852e6dd7291fae45fedb4c454a233
4
+ data.tar.gz: 158844cef470a5e5eabe0839c57932629522f67f
5
5
  SHA512:
6
- metadata.gz: 98b21d80f28f2dc681e61e466e9100cefc2ee23b5989ffd2c2f9acefdbc80538b81bc3555c4c6c0c02fb530cbdf21f51fb232e3852ae350b55baa6a14c327552
7
- data.tar.gz: 88f422c97daed701da92242e1a311d9011ce868d6b58ec9a6db96d245a6957e0383d30e167550696407f1bd70fe9cece40d6324ad8ac6eb706ee9c23017f4517
6
+ metadata.gz: 47554b26fcaf8fb1b39bfec2bed82b529cea387b2a00714c1d08053f2b3bcdfc930fb2c26a41174683fe8100640a7b4348e102e1754ec286d0f93bb28a4fda48
7
+ data.tar.gz: e47ff7daa781b85849b46cf5cc6a1718dcf3b4d833c51d9cca9b49ec0c905f4815ed48a245b6650926cca5c6a8519babc4de172158fed97636ce5bc59e20f497
@@ -0,0 +1,18 @@
1
+ module Occi::Api::Client
2
+ module Http
3
+ module AuthnPlugins
4
+
5
+ class Token < Base
6
+
7
+ def setup(options = {})
8
+ # set up token auth
9
+ raise ArgumentError, "Missing required option 'token' for token auth!" if @options[:token].blank?
10
+ raise ArgumentError, "Token cannot be a multi-line string!" if @options[:token].strip.lines.count > 1
11
+ @env_ref.class.headers['X-Auth-Token'] = @options[:token].strip
12
+ end
13
+
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -20,21 +20,22 @@ module Occi::Api::Client
20
20
  # @see Occi::Api::Client::ClientBase
21
21
  def get_auth(auth_options, fallback = false)
22
22
  # select appropriate authN type
23
- case auth_options[:type]
24
- when "basic"
25
- @authn_plugin = Http::AuthnPlugins::Basic.new self, auth_options
26
- when "digest"
27
- @authn_plugin = Http::AuthnPlugins::Digest.new self, auth_options
28
- when "x509"
29
- @authn_plugin = Http::AuthnPlugins::X509.new self, auth_options
30
- when "keystone"
31
- raise ::Occi::Api::Client::Errors::AuthnError, "This authN method is for fallback only!" unless fallback
32
- @authn_plugin = Http::AuthnPlugins::Keystone.new self, auth_options
33
- when "none", nil
34
- @authn_plugin = Http::AuthnPlugins::Dummy.new self
35
- else
36
- raise ::Occi::Api::Client::Errors::AuthnError, "Unknown authN method [#{@auth_options[:type]}]!"
37
- end
23
+ @authn_plugin = case auth_options[:type]
24
+ when "basic", "digest", "x509", "token"
25
+ Http::AuthnPlugins.const_get(auth_options[:type].capitalize).new(
26
+ self,
27
+ auth_options
28
+ )
29
+ when "keystone"
30
+ raise ::Occi::Api::Client::Errors::AuthnError,
31
+ "This authN method is for fallback only!" unless fallback
32
+ Http::AuthnPlugins::Keystone.new self, auth_options
33
+ when "none", nil
34
+ Http::AuthnPlugins::Dummy.new self
35
+ else
36
+ raise ::Occi::Api::Client::Errors::AuthnError,
37
+ "Unknown authN method [#{@auth_options[:type]}]!"
38
+ end
38
39
 
39
40
  @authn_plugin.setup
40
41
 
@@ -100,4 +101,4 @@ module Occi::Api::Client
100
101
  end
101
102
 
102
103
  end
103
- end
104
+ end
@@ -1,5 +1,5 @@
1
1
  module Occi
2
2
  module Api
3
- VERSION = "4.3.3" unless defined?(::Occi::Api::VERSION)
3
+ VERSION = "4.3.4" unless defined?(::Occi::Api::VERSION)
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occi-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.3
4
+ version: 4.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Feldhaus
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-11-26 00:00:00.000000000 Z
13
+ date: 2015-12-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: occi-core
@@ -118,6 +118,7 @@ files:
118
118
  - lib/occi/api/client/http/authn_plugins/digest.rb
119
119
  - lib/occi/api/client/http/authn_plugins/dummy.rb
120
120
  - lib/occi/api/client/http/authn_plugins/keystone.rb
121
+ - lib/occi/api/client/http/authn_plugins/token.rb
121
122
  - lib/occi/api/client/http/authn_plugins/x509.rb
122
123
  - lib/occi/api/client/http/code_helpers.rb
123
124
  - lib/occi/api/client/http/helpers.rb