conjur-api 4.16.0 → 4.19.0
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/CHANGELOG.md +14 -0
- data/README.md +4 -4
- data/lib/conjur-api/version.rb +1 -1
- data/lib/conjur/api.rb +14 -1
- data/lib/conjur/api/resources.rb +21 -3
- data/lib/conjur/base.rb +51 -12
- data/lib/conjur/configuration.rb +7 -0
- data/spec/lib/api_spec.rb +55 -3
- data/spec/lib/configuration_spec.rb +27 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d286220bf5ce8e32e9fa3ecbba374906d40739a8
|
4
|
+
data.tar.gz: d38f3fd537e81c44c537327642cc4ef6b6407537
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1c6e64c7cc31108c7c9f2fc7dde41c10d4b57006c8963f0be3288b49e365f5fb5fbf97b58e744e9fcf9493feafc8070a6571a26d65b6c7b0b13298dffef209e
|
7
|
+
data.tar.gz: b64f23a2614041ec2f186d9f563ace280ea3cb1f791663c26d780b41911cc5b057e37161cb1d1b9588162cf7393c8290dff26cd2a7d45136bbdd35463f20d361
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
# v4.19.0
|
2
|
+
|
3
|
+
* Rename `sudo` to `elevate` throughout the spec and docstrings. This is an incompatible change, but it
|
4
|
+
occurs before the Conjur 4.5 server that implements `elevate` is released.
|
5
|
+
|
6
|
+
# v4.18.0
|
7
|
+
|
8
|
+
* Add method `global_privilege_permitted?` to facilitate working with Conjur 4.5 global privileges.
|
9
|
+
|
10
|
+
# v4.17.0
|
11
|
+
|
12
|
+
* Add handling for `X-Forwarded-For` and `X-Conjur-Privilege` ("conjur sudo")
|
13
|
+
* Transform embedded whitespace in certificate string into newlines
|
14
|
+
|
1
15
|
# v4.16.0
|
2
16
|
* Add ssl_certificate option to allow certs to be provided as strings (helpful in heroku)
|
3
17
|
* Add `Conjur::Configuration#apply_cert_config!` method to add certs from `#cert_file` and `#ssl_certificate`
|
data/README.md
CHANGED
@@ -49,7 +49,7 @@ gemset or bundle.
|
|
49
49
|
|
50
50
|
Once Conjur is configured, the connection can be established like this:
|
51
51
|
|
52
|
-
```
|
52
|
+
```
|
53
53
|
conjur = Conjur::Authn.connect nil, noask: true
|
54
54
|
```
|
55
55
|
|
@@ -71,7 +71,7 @@ object.
|
|
71
71
|
|
72
72
|
For example, specify the `account` and `appliance_url` (both of which are required) like this:
|
73
73
|
|
74
|
-
```
|
74
|
+
```
|
75
75
|
Conjur.configuration.account = 'my-account'
|
76
76
|
Conjur.configuration.appliance_url = 'https://conjur.mydomain.com/api'
|
77
77
|
```
|
@@ -82,13 +82,13 @@ configuration variable. For example, `appliance_url` is `CONJUR_APPLIANCE_URL`,
|
|
82
82
|
|
83
83
|
In either case, you will also need to configure certificate trust. For example:
|
84
84
|
|
85
|
-
```
|
85
|
+
```
|
86
86
|
OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE.add_file "/etc/conjur-yourorg.pem"
|
87
87
|
```
|
88
88
|
|
89
89
|
Once Conjur is configured, you can create a new API client by providing a `login` and `api_key`:
|
90
90
|
|
91
|
-
```
|
91
|
+
```
|
92
92
|
Conjur::API.new_from_key login, api_key
|
93
93
|
```
|
94
94
|
|
data/lib/conjur-api/version.rb
CHANGED
data/lib/conjur/api.rb
CHANGED
@@ -85,7 +85,12 @@ class RestClient::Resource
|
|
85
85
|
#
|
86
86
|
# @return {Conjur::API} the new api
|
87
87
|
def conjur_api
|
88
|
-
Conjur::API.new_from_token token
|
88
|
+
api = Conjur::API.new_from_token token, remote_ip
|
89
|
+
if conjur_privilege
|
90
|
+
api.with_privilege conjur_privilege
|
91
|
+
else
|
92
|
+
api
|
93
|
+
end
|
89
94
|
end
|
90
95
|
|
91
96
|
# Get an authentication token from the clients Authorization header.
|
@@ -104,6 +109,14 @@ class RestClient::Resource
|
|
104
109
|
raise AuthorizationError.new("Authorization missing")
|
105
110
|
end
|
106
111
|
end
|
112
|
+
|
113
|
+
def remote_ip
|
114
|
+
options[:headers][:x_forwarded_for]
|
115
|
+
end
|
116
|
+
|
117
|
+
def conjur_privilege
|
118
|
+
options[:headers][:x_conjur_privilege]
|
119
|
+
end
|
107
120
|
|
108
121
|
# The username this resource authenticates as.
|
109
122
|
#
|
data/lib/conjur/api/resources.rb
CHANGED
@@ -22,7 +22,6 @@ require 'conjur/resource'
|
|
22
22
|
|
23
23
|
module Conjur
|
24
24
|
class API
|
25
|
-
|
26
25
|
#@!group Authorization: Resources
|
27
26
|
|
28
27
|
# Create a {http://developer.conjur.net/reference/services/authorization/resource Conjur Resource}.
|
@@ -60,7 +59,7 @@ module Conjur
|
|
60
59
|
r.create(options)
|
61
60
|
end
|
62
61
|
end
|
63
|
-
|
62
|
+
|
64
63
|
# Find a resource by it's id. The id given to this method must be qualified by a kind, but the account is
|
65
64
|
# optional.
|
66
65
|
#
|
@@ -84,7 +83,7 @@ module Conjur
|
|
84
83
|
#
|
85
84
|
# @param identifier [String] a qualified resource identifier, optionally including an account
|
86
85
|
# @return [Conjur::Resource] the resource, which may or may not exist
|
87
|
-
|
86
|
+
def resource identifier
|
88
87
|
Resource.new(Conjur::Authz::API.host, credentials)[self.class.parse_resource_id(identifier).join('/')]
|
89
88
|
end
|
90
89
|
|
@@ -148,5 +147,24 @@ module Conjur
|
|
148
147
|
end
|
149
148
|
end
|
150
149
|
end
|
150
|
+
|
151
|
+
# The resource which grants global privileges to Conjur.
|
152
|
+
# Privileges given on this resource apply to any record in the system.
|
153
|
+
# There are two defined global privileges:
|
154
|
+
#
|
155
|
+
# * **elevate** permission is granted for any action.
|
156
|
+
# * **reveal** methods which list records will always return every matching
|
157
|
+
# record, regardless of whether the user has any privileges on these records or not.
|
158
|
+
# Services can also choose to attach additional semantics to *reveal*, such as allowing
|
159
|
+
# the user to show non-sensitive attributes of any record.
|
160
|
+
#
|
161
|
+
# Global privileges are available in Conjur 4.5 and later.
|
162
|
+
GLOBAL_PRIVILEGE_RESOURCE = "!:!:conjur"
|
163
|
+
|
164
|
+
# Checks whether the client has a particular global privilege.
|
165
|
+
# The global privileges are *elevate* and *reveal*.
|
166
|
+
def global_privilege_permitted? privilege
|
167
|
+
resource(GLOBAL_PRIVILEGE_RESOURCE).permitted? privilege
|
168
|
+
end
|
151
169
|
end
|
152
170
|
end
|
data/lib/conjur/base.rb
CHANGED
@@ -100,10 +100,11 @@ module Conjur
|
|
100
100
|
# api.user 'foo' # raises a 401 error
|
101
101
|
#
|
102
102
|
# @param [String] username the username to use when making authenticated requests.
|
103
|
-
# @param [
|
103
|
+
# @param [String] api_key the api key or password for `username`
|
104
|
+
# @param [String] remote_ip the optional IP address to be recorded in the audit record.
|
104
105
|
# @return [Conjur::API] an api that will authenticate with the given username and api key.
|
105
|
-
def new_from_key(username, api_key)
|
106
|
-
self.new username, api_key, nil
|
106
|
+
def new_from_key(username, api_key, remote_ip = nil)
|
107
|
+
self.new username, api_key, nil, remote_ip
|
107
108
|
end
|
108
109
|
|
109
110
|
|
@@ -135,9 +136,10 @@ module Conjur
|
|
135
136
|
# end
|
136
137
|
#
|
137
138
|
# @param [Hash] token the authentication token as parsed JSON to use when making authenticated requests
|
139
|
+
# @param [String] remote_ip the optional IP address to be recorded in the audit record.
|
138
140
|
# @return [Conjur::API] an api that will authenticate with the token
|
139
|
-
def new_from_token(token)
|
140
|
-
self.new nil, nil, token
|
141
|
+
def new_from_token(token, remote_ip = nil)
|
142
|
+
self.new nil, nil, token, remote_ip
|
141
143
|
end
|
142
144
|
end
|
143
145
|
|
@@ -151,12 +153,14 @@ module Conjur
|
|
151
153
|
# @param [String] username the username to authenticate as
|
152
154
|
# @param [String] api_key the api key or password to use when authenticating
|
153
155
|
# @param [Hash] token the token to use when making authenticated requuests.
|
156
|
+
# @param [String] remote_ip the optional IP address to be recorded in the audit record.
|
154
157
|
#
|
155
158
|
# @api internal
|
156
|
-
def initialize username, api_key, token
|
159
|
+
def initialize username, api_key, token, remote_ip = nil
|
157
160
|
@username = username
|
158
161
|
@api_key = api_key
|
159
162
|
@token = token
|
163
|
+
@remote_ip = remote_ip
|
160
164
|
|
161
165
|
raise "Expecting ( username and api_key ) or token" unless ( username && api_key ) || token
|
162
166
|
end
|
@@ -166,6 +170,14 @@ module Conjur
|
|
166
170
|
#
|
167
171
|
# @return [String] the api key, or nil if this instance was created from a token.
|
168
172
|
attr_reader :api_key
|
173
|
+
|
174
|
+
#@!attribute [r] remote_ip
|
175
|
+
# An optional IP address to be recorded in the audit record for any actions performed by this API instance.
|
176
|
+
attr_reader :remote_ip
|
177
|
+
|
178
|
+
#@!attribute [r] privilege
|
179
|
+
# The optional global privilege (e.g. 'elevate' or 'reveal') which should be attempted on the request.
|
180
|
+
attr_accessor :privilege
|
169
181
|
|
170
182
|
# The name of the user as which this api instance is authenticated. This is available whether the api
|
171
183
|
# instance was created from credentials or an authentication token.
|
@@ -196,7 +208,7 @@ module Conjur
|
|
196
208
|
|
197
209
|
@token ||= Conjur::API.authenticate(@username, @api_key)
|
198
210
|
|
199
|
-
|
211
|
+
validate_token
|
200
212
|
|
201
213
|
return @token
|
202
214
|
end
|
@@ -208,20 +220,47 @@ module Conjur
|
|
208
220
|
# @raise [RestClient::Unauthorized] if fetching the token fails.
|
209
221
|
# @see {#token}
|
210
222
|
def credentials
|
211
|
-
|
223
|
+
headers = {}.tap do |h|
|
224
|
+
h[:authorization] = "Token token=\"#{Base64.strict_encode64 token.to_json}\""
|
225
|
+
h[:x_conjur_privilege] = @privilege if @privilege
|
226
|
+
h[:x_forwarded_for] = @remote_ip if @remote_ip
|
227
|
+
end
|
228
|
+
{ headers: headers, username: username }
|
212
229
|
end
|
213
230
|
|
231
|
+
# Return a new API object with the specified X-Conjur-Privilege.
|
232
|
+
#
|
233
|
+
# @return The API instance.
|
234
|
+
def with_privilege privilege
|
235
|
+
self.class.new(username, api_key, token, remote_ip).tap do |api|
|
236
|
+
api.privilege = privilege
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
214
240
|
private
|
215
241
|
|
242
|
+
def token_valid?
|
243
|
+
begin
|
244
|
+
validate_token
|
245
|
+
return true
|
246
|
+
rescue Exception
|
247
|
+
return false
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
216
251
|
# Check to see if @token is defined, and whether it's expired
|
217
252
|
#
|
218
|
-
# @
|
219
|
-
def
|
220
|
-
|
253
|
+
# @raise [Exception] if the token is invalid
|
254
|
+
def validate_token
|
255
|
+
fail "token not present" unless @token
|
221
256
|
|
222
257
|
# Actual token expiration is 8 minutes, but why cut it so close
|
223
258
|
expiration = 5.minutes
|
224
|
-
Time.now - Time.parse(@token['timestamp'])
|
259
|
+
lag = Time.now - Time.parse(@token['timestamp'])
|
260
|
+
unless lag < expiration
|
261
|
+
fail "obtained token is invalid: "\
|
262
|
+
"token timestamp is #{@token['timestamp']}, #{lag} seconds ago"
|
263
|
+
end
|
225
264
|
end
|
226
265
|
end
|
227
266
|
end
|
data/lib/conjur/configuration.rb
CHANGED
@@ -421,7 +421,14 @@ module Conjur
|
|
421
421
|
private
|
422
422
|
|
423
423
|
def add_cert_string store, str
|
424
|
+
str = str.gsub(/\s+/, "\n")
|
425
|
+
str.gsub!("-----BEGIN\n", "-----BEGIN ")
|
426
|
+
str.gsub!("-----END\n", "-----END ")
|
424
427
|
store.add_cert OpenSSL::X509::Certificate.new str
|
428
|
+
rescue OpenSSL::X509::CertificateError => ex
|
429
|
+
$stderr.puts "Invalid certificate:"
|
430
|
+
$stderr.puts str
|
431
|
+
raise ex
|
425
432
|
rescue OpenSSL::X509::StoreError => ex
|
426
433
|
raise ex unless ex.message == 'cert already in hash table'
|
427
434
|
end
|
data/spec/lib/api_spec.rb
CHANGED
@@ -226,7 +226,9 @@ describe Conjur::API do
|
|
226
226
|
let(:login) { "bob" }
|
227
227
|
let(:token) { { 'data' => login, 'timestamp' => Time.now.to_s } }
|
228
228
|
subject { api }
|
229
|
-
let(:
|
229
|
+
let(:remote_ip) { nil }
|
230
|
+
let(:api_args) { [ token, remote_ip ].compact }
|
231
|
+
let(:api) { Conjur::API.new_from_token(*api_args) }
|
230
232
|
let(:account) { 'some-account' }
|
231
233
|
before { allow(Conjur::Core::API).to receive_messages conjur_account: account }
|
232
234
|
end
|
@@ -242,11 +244,28 @@ describe Conjur::API do
|
|
242
244
|
subject { super().credentials }
|
243
245
|
it { is_expected.to eq({ headers: { authorization: "Token token=\"#{Base64.strict_encode64(token.to_json)}\"" }, username: login }) }
|
244
246
|
end
|
247
|
+
|
248
|
+
describe "privileged" do
|
249
|
+
describe '#credentials' do
|
250
|
+
subject { super().with_privilege('elevate').credentials }
|
251
|
+
it { is_expected.to eq({ headers: { authorization: "Token token=\"#{Base64.strict_encode64(token.to_json)}\"", :x_conjur_privilege=>"elevate" }, username: login }) }
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
context "with remote_ip" do
|
256
|
+
let(:remote_ip) { "66.0.0.1" }
|
257
|
+
describe '#credentials' do
|
258
|
+
subject { super().credentials }
|
259
|
+
it { is_expected.to eq({ headers: { authorization: "Token token=\"#{Base64.strict_encode64(token.to_json)}\"", :x_forwarded_for=>"66.0.0.1" }, username: login }) }
|
260
|
+
end
|
261
|
+
end
|
245
262
|
end
|
246
263
|
|
247
264
|
context "from api key", logged_in: true do
|
248
265
|
let(:api_key) { "theapikey" }
|
249
|
-
let(:
|
266
|
+
let(:api_args) { [ login, api_key, remote_ip ].compact }
|
267
|
+
let(:api) { Conjur::API.new_from_key(*api_args) }
|
268
|
+
let(:remote_ip) { nil }
|
250
269
|
subject { api }
|
251
270
|
|
252
271
|
it("should authenticate to get a token") do
|
@@ -257,6 +276,14 @@ describe Conjur::API do
|
|
257
276
|
expect(api.credentials).to eq({ headers: { authorization: "Token token=\"#{Base64.strict_encode64(token.to_json)}\"" }, username: login })
|
258
277
|
end
|
259
278
|
|
279
|
+
it("checks if the token is fresh") do
|
280
|
+
expired_token = token.merge 'timestamp' => 10.minutes.ago.to_s
|
281
|
+
expect(Conjur::API).to receive(:authenticate).with(login, api_key).and_return expired_token
|
282
|
+
|
283
|
+
expect(api.instance_variable_get("@token")).to eq(nil)
|
284
|
+
expect { api.token }.to raise_error /obtained token is invalid/
|
285
|
+
end
|
286
|
+
|
260
287
|
context "with an expired token" do
|
261
288
|
it "fetches a new one" do
|
262
289
|
allow(Conjur::API).to receive(:authenticate).with(login, api_key).and_return token
|
@@ -273,12 +300,37 @@ describe Conjur::API do
|
|
273
300
|
|
274
301
|
context "from logged-in RestClient::Resource" do
|
275
302
|
let(:token_encoded) { Base64.strict_encode64(token.to_json) }
|
276
|
-
let(:
|
303
|
+
let(:headers) { { authorization: "Token token=\"#{token_encoded}\"" } }
|
304
|
+
let(:resource) { RestClient::Resource.new("http://example.com", { headers: headers })}
|
277
305
|
it "can construct a new API instance" do
|
278
306
|
api = resource.conjur_api
|
279
307
|
expect(api.credentials[:headers][:authorization]).to eq("Token token=\"#{token_encoded}\"")
|
308
|
+
expect(api.credentials[:headers][:x_conjur_privilege]).to be_nil
|
309
|
+
expect(api.credentials[:headers][:x_forwarded_for]).to be_nil
|
280
310
|
expect(api.credentials[:username]).to eq("bob")
|
281
311
|
end
|
312
|
+
|
313
|
+
context "privileged" do
|
314
|
+
let(:headers) { { authorization: "Token token=\"#{token_encoded}\"", x_conjur_privilege: "elevate" } }
|
315
|
+
it "can clone itself" do
|
316
|
+
api = resource.conjur_api
|
317
|
+
expect(api.credentials[:headers][:authorization]).to eq("Token token=\"#{token_encoded}\"")
|
318
|
+
expect(api.credentials[:headers][:x_conjur_privilege]).to eq("elevate")
|
319
|
+
expect(api.credentials[:headers][:x_forwarded_for]).to be_nil
|
320
|
+
expect(api.credentials[:username]).to eq("bob")
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
context "privileged" do
|
325
|
+
let(:headers) { { authorization: "Token token=\"#{token_encoded}\"", x_forwarded_for: "66.0.0.1" } }
|
326
|
+
it "can clone itself" do
|
327
|
+
api = resource.conjur_api
|
328
|
+
expect(api.credentials[:headers][:authorization]).to eq("Token token=\"#{token_encoded}\"")
|
329
|
+
expect(api.credentials[:headers][:x_conjur_privilege]).to be_nil
|
330
|
+
expect(api.credentials[:headers][:x_forwarded_for]).to eq("66.0.0.1")
|
331
|
+
expect(api.credentials[:username]).to eq("bob")
|
332
|
+
end
|
333
|
+
end
|
282
334
|
end
|
283
335
|
end
|
284
336
|
|
@@ -219,12 +219,10 @@ describe Conjur::Configuration do
|
|
219
219
|
|
220
220
|
let(:store){ double('default store') }
|
221
221
|
|
222
|
-
|
223
222
|
before do
|
224
223
|
stub_const 'OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE', store
|
225
224
|
allow_any_instance_of(Conjur::Configuration).to receive(:ssl_certificate).and_return ssl_certificate
|
226
225
|
allow_any_instance_of(Conjur::Configuration).to receive(:cert_file).and_return cert_file
|
227
|
-
|
228
226
|
end
|
229
227
|
|
230
228
|
context "when neither cert_file or ssl_certificate is present" do
|
@@ -240,7 +238,7 @@ describe Conjur::Configuration do
|
|
240
238
|
|
241
239
|
context 'when both are given' do
|
242
240
|
let(:cert_file){ '/path/to/cert.pem' }
|
243
|
-
let(:ssl_certificate){ 'certificate
|
241
|
+
let(:ssl_certificate){ 'certificate-contents' }
|
244
242
|
let(:cert){ double('certificate') }
|
245
243
|
it 'calls store.add_cert with a certificate created from ssl_certificate' do
|
246
244
|
expect(OpenSSL::X509::Certificate).to receive(:new).with(ssl_certificate).once.and_return cert
|
@@ -260,11 +258,35 @@ describe Conjur::Configuration do
|
|
260
258
|
|
261
259
|
context 'when ssl_certificate is given' do
|
262
260
|
let(:cert_file){ nil }
|
263
|
-
let(:ssl_certificate){
|
261
|
+
let(:ssl_certificate){ "-----BEGIN CERTIFICATE----- MIIDUTCCAjmgAwIBAgIJAO4Lf1Rf2cciMA0GCSqGSIb3DQEBBQUAMDMxMTAvBgNV BAMTKGVjMi01NC05MS0yNDYtODQuY29tcHV0ZS0xLmFtYXpvbmF3cy5jb20wHhcN MTQxMDA4MjEwNTA5WhcNMjQxMDA1MjEwNTA5WjAzMTEwLwYDVQQDEyhlYzItNTQt OTEtMjQ2LTg0LmNvbXB1dGUtMS5hbWF6b25hd3MuY29tMIIBIjANBgkqhkiG9w0B AQEFAAOCAQ8AMIIBCgKCAQEAx+OFANXNEYNsMR3Uvg4/72VG3LZO8yxrYaYzc3FZ NN3NpIOCZvRTC5S+OawsdEljHwfhdVoXdWNKgVJakSxsAnnaj11fA6XpfN60o6Fk i4q/BqwqgeNJjKAlElFsNz2scWFWRe49NHlj9qaq/yWZ8Cn0IeHy8j8F+jMek4zt dCSxVEayVG/k8RFmYCcluQc/1LuCjPiFwJU43AGkO+yvmOuYGivsNKY+54yuEZqF VDsjAjMsYXxgLx9y1F7Rq3CfeqY6IajR7pmmRup8/D9NyyyQuIML83mjTSvo0UYu rkdXPObd/m6gumscvXMl6SoJ5IPItvTA42MZqTaNzimF0QIDAQABo2gwZjBkBgNV HREEXTBbgglsb2NhbGhvc3SCBmNvbmp1coIcY29uanVyLW1hc3Rlci5pdHAuY29u anVyLm5ldIIoZWMyLTU0LTkxLTI0Ni04NC5jb21wdXRlLTEuYW1hem9uYXdzLmNv bTANBgkqhkiG9w0BAQUFAAOCAQEANk7P3ZEZHLgiTrLG13VAkm33FAvFzRG6akx1 jgNeRDgSaxRtrfJq3mnhsmD6hdvv+e6prPCFOjeEDheyCZyQDESdVEJBwytHVjnH dbvgMRaPm6OO8CyRyNjg3YcC36T//oQKOdAXXEcrtd0QbelBDYlKA7smJtznfhAb XypVdeS/6I4qvJi3Ckp5sQ1GszYhVXAvEeWeY59WwsTWYHLkzss9QShnigPyo3LY ZA5JVXofYi9DJ6VexP7sJNhCMrY2WnMpPcAOB9T7a6lcoXj6mWxvFys0xDIEOnc6 NGb+d47blphUKRZMAUZgYgFfMfmlyu1IXj03J8AuKtIMEwkXAA== -----END CERTIFICATE----- " }
|
262
|
+
let(:actual_certificate) {
|
263
|
+
<<-CERT
|
264
|
+
-----BEGIN CERTIFICATE-----
|
265
|
+
MIIDUTCCAjmgAwIBAgIJAO4Lf1Rf2cciMA0GCSqGSIb3DQEBBQUAMDMxMTAvBgNV
|
266
|
+
BAMTKGVjMi01NC05MS0yNDYtODQuY29tcHV0ZS0xLmFtYXpvbmF3cy5jb20wHhcN
|
267
|
+
MTQxMDA4MjEwNTA5WhcNMjQxMDA1MjEwNTA5WjAzMTEwLwYDVQQDEyhlYzItNTQt
|
268
|
+
OTEtMjQ2LTg0LmNvbXB1dGUtMS5hbWF6b25hd3MuY29tMIIBIjANBgkqhkiG9w0B
|
269
|
+
AQEFAAOCAQ8AMIIBCgKCAQEAx+OFANXNEYNsMR3Uvg4/72VG3LZO8yxrYaYzc3FZ
|
270
|
+
NN3NpIOCZvRTC5S+OawsdEljHwfhdVoXdWNKgVJakSxsAnnaj11fA6XpfN60o6Fk
|
271
|
+
i4q/BqwqgeNJjKAlElFsNz2scWFWRe49NHlj9qaq/yWZ8Cn0IeHy8j8F+jMek4zt
|
272
|
+
dCSxVEayVG/k8RFmYCcluQc/1LuCjPiFwJU43AGkO+yvmOuYGivsNKY+54yuEZqF
|
273
|
+
VDsjAjMsYXxgLx9y1F7Rq3CfeqY6IajR7pmmRup8/D9NyyyQuIML83mjTSvo0UYu
|
274
|
+
rkdXPObd/m6gumscvXMl6SoJ5IPItvTA42MZqTaNzimF0QIDAQABo2gwZjBkBgNV
|
275
|
+
HREEXTBbgglsb2NhbGhvc3SCBmNvbmp1coIcY29uanVyLW1hc3Rlci5pdHAuY29u
|
276
|
+
anVyLm5ldIIoZWMyLTU0LTkxLTI0Ni04NC5jb21wdXRlLTEuYW1hem9uYXdzLmNv
|
277
|
+
bTANBgkqhkiG9w0BAQUFAAOCAQEANk7P3ZEZHLgiTrLG13VAkm33FAvFzRG6akx1
|
278
|
+
jgNeRDgSaxRtrfJq3mnhsmD6hdvv+e6prPCFOjeEDheyCZyQDESdVEJBwytHVjnH
|
279
|
+
dbvgMRaPm6OO8CyRyNjg3YcC36T//oQKOdAXXEcrtd0QbelBDYlKA7smJtznfhAb
|
280
|
+
XypVdeS/6I4qvJi3Ckp5sQ1GszYhVXAvEeWeY59WwsTWYHLkzss9QShnigPyo3LY
|
281
|
+
ZA5JVXofYi9DJ6VexP7sJNhCMrY2WnMpPcAOB9T7a6lcoXj6mWxvFys0xDIEOnc6
|
282
|
+
NGb+d47blphUKRZMAUZgYgFfMfmlyu1IXj03J8AuKtIMEwkXAA==
|
283
|
+
-----END CERTIFICATE-----
|
284
|
+
CERT
|
285
|
+
}
|
264
286
|
let(:cert){ double('cert') }
|
265
287
|
|
266
288
|
before do
|
267
|
-
expect(OpenSSL::X509::Certificate).to receive(:new).with(
|
289
|
+
expect(OpenSSL::X509::Certificate).to receive(:new).with(actual_certificate).at_least(:once).and_return cert
|
268
290
|
end
|
269
291
|
|
270
292
|
it 'calls store.add_cert with a certificate created from ssl_certificate' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conjur-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafal Rzepecki
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|