occi-api 4.3.3 → 4.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/occi/api/client/http/authn_plugins/token.rb +18 -0
- data/lib/occi/api/client/http/helpers.rb +17 -16
- data/lib/occi/api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 615c238e6d6852e6dd7291fae45fedb4c454a233
|
4
|
+
data.tar.gz: 158844cef470a5e5eabe0839c57932629522f67f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
data/lib/occi/api/version.rb
CHANGED
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.
|
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-
|
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
|