conjur-api 4.1.1 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -0
- data/conjur-api.gemspec +5 -0
- data/lib/conjur-api/version.rb +1 -1
- data/lib/conjur/acts_as_asset.rb +17 -0
- data/lib/conjur/acts_as_resource.rb +12 -0
- data/lib/conjur/acts_as_role.rb +12 -0
- data/lib/conjur/acts_as_user.rb +8 -0
- data/lib/conjur/api.rb +1 -0
- data/lib/conjur/api/audit.rb +53 -0
- data/lib/conjur/audit-api.rb +42 -0
- data/lib/conjur/base.rb +16 -2
- data/lib/conjur/group.rb +8 -0
- data/lib/conjur/resource.rb +14 -2
- data/lib/conjur/variable.rb +3 -0
- data/spec/lib/asset_spec.rb +80 -0
- data/spec/lib/audit_spec.rb +102 -0
- data/spec/spec_helper.rb +11 -0
- metadata +43 -7
data/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
require "bundler/gem_tasks"
|
3
|
+
require "yard"
|
3
4
|
|
4
5
|
begin
|
5
6
|
require 'rspec/core/rake_task'
|
@@ -10,6 +11,8 @@ rescue LoadError
|
|
10
11
|
$stderr.puts "RSpec Rake tasks not available in environment #{ENV['RACK_ENV']}"
|
11
12
|
end
|
12
13
|
|
14
|
+
YARD::Rake::YardocTask.new(:yard)
|
15
|
+
|
13
16
|
task :jenkins do
|
14
17
|
if ENV['BUILD_NUMBER']
|
15
18
|
File.write('build_number', ENV['BUILD_NUMBER'])
|
@@ -17,6 +20,7 @@ task :jenkins do
|
|
17
20
|
require 'ci/reporter/rake/rspec'
|
18
21
|
Rake::Task["ci:setup:rspec"].invoke
|
19
22
|
Rake::Task["spec"].invoke
|
23
|
+
Rake::Task["yard"].invoke
|
20
24
|
end
|
21
25
|
|
22
26
|
task default: :spec
|
data/conjur-api.gemspec
CHANGED
@@ -15,6 +15,9 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.name = "conjur-api"
|
16
16
|
gem.require_paths = ["lib"]
|
17
17
|
gem.version = Conjur::API::VERSION
|
18
|
+
|
19
|
+
gem.required_ruby_version = '>= 1.9'
|
20
|
+
|
18
21
|
|
19
22
|
gem.add_dependency 'rest-client'
|
20
23
|
gem.add_dependency 'activesupport'
|
@@ -26,4 +29,6 @@ Gem::Specification.new do |gem|
|
|
26
29
|
gem.add_development_dependency 'ci_reporter'
|
27
30
|
gem.add_development_dependency 'simplecov'
|
28
31
|
gem.add_development_dependency 'io-grab'
|
32
|
+
gem.add_development_dependency 'yard'
|
33
|
+
gem.add_development_dependency 'redcarpet'
|
29
34
|
end
|
data/lib/conjur-api/version.rb
CHANGED
data/lib/conjur/acts_as_asset.rb
CHANGED
@@ -29,5 +29,22 @@ module Conjur
|
|
29
29
|
include HasAttributes
|
30
30
|
end
|
31
31
|
end
|
32
|
+
|
33
|
+
def add_member(role_name, member, options = {})
|
34
|
+
owned_role(role_name).grant_to member, options
|
35
|
+
end
|
36
|
+
|
37
|
+
def remove_member(role_name, member)
|
38
|
+
owned_role(role_name).revoke_from member
|
39
|
+
end
|
40
|
+
|
41
|
+
protected
|
42
|
+
|
43
|
+
def owned_role(role_name)
|
44
|
+
tokens = [ resource_kind, resource_id, role_name ]
|
45
|
+
grant_role = [ core_conjur_account, '@', tokens.join('/') ].join(':')
|
46
|
+
require 'conjur/role'
|
47
|
+
Conjur::Role.new(Conjur::Authz::API.host, self.options)[Conjur::API.parse_role_id(grant_role).join('/')]
|
48
|
+
end
|
32
49
|
end
|
33
50
|
end
|
@@ -26,6 +26,10 @@ module Conjur
|
|
26
26
|
Conjur::Resource.new(Conjur::Authz::API.host, self.options)[[ core_conjur_account, 'resources', path_escape(resource_kind), path_escape(resource_id) ].join('/')]
|
27
27
|
end
|
28
28
|
|
29
|
+
def resourceid
|
30
|
+
[ core_conjur_account, resource_kind, resource_id ].join(':')
|
31
|
+
end
|
32
|
+
|
29
33
|
def resource_kind
|
30
34
|
require 'active_support/core_ext'
|
31
35
|
self.class.name.split("::")[-1].underscore.split('/').join('-')
|
@@ -39,5 +43,13 @@ module Conjur
|
|
39
43
|
resource.delete
|
40
44
|
super
|
41
45
|
end
|
46
|
+
|
47
|
+
def permit(privilege, role, options = {})
|
48
|
+
resource.permit privilege, role, options
|
49
|
+
end
|
50
|
+
|
51
|
+
def deny(privilege, role)
|
52
|
+
resource.deny privilege, role
|
53
|
+
end
|
42
54
|
end
|
43
55
|
end
|
data/lib/conjur/acts_as_role.rb
CHANGED
@@ -34,5 +34,17 @@ module Conjur
|
|
34
34
|
require 'conjur/role'
|
35
35
|
Conjur::Role.new(Conjur::Authz::API.host, self.options)[Conjur::API.parse_role_id(self.roleid).join('/')]
|
36
36
|
end
|
37
|
+
|
38
|
+
# Permit this role to perform a privileged action.
|
39
|
+
def can(privilege, resource, options = {})
|
40
|
+
require 'conjur/resource'
|
41
|
+
Conjur::Resource.new(Conjur::Authz::API.host, self.options)[Conjur::API.parse_resource_id(resource).join('/')].permit privilege, self.roleid, options
|
42
|
+
end
|
43
|
+
|
44
|
+
# Deny this role from performing perform a privileged action.
|
45
|
+
def cannot(privilege, resource, options = {})
|
46
|
+
require 'conjur/resource'
|
47
|
+
Conjur::Resource.new(Conjur::Authz::API.host, self.options)[Conjur::API.parse_resource_id(resource).join('/')].deny privilege, self.roleid
|
48
|
+
end
|
37
49
|
end
|
38
50
|
end
|
data/lib/conjur/acts_as_user.rb
CHANGED
@@ -25,5 +25,13 @@ module Conjur
|
|
25
25
|
include ActsAsRole
|
26
26
|
end
|
27
27
|
end
|
28
|
+
|
29
|
+
def api_key
|
30
|
+
attributes['api_key'] or raise "api_key is only available on a newly created #{self.class.name.downcase}"
|
31
|
+
end
|
32
|
+
|
33
|
+
def api
|
34
|
+
Conjur::API.new_from_key login, api_key
|
35
|
+
end
|
28
36
|
end
|
29
37
|
end
|
data/lib/conjur/api.rb
CHANGED
@@ -0,0 +1,53 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2013 Conjur Inc
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
|
+
# this software and associated documentation files (the "Software"), to deal in
|
6
|
+
# the Software without restriction, including without limitation the rights to
|
7
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
+
# subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
12
|
+
# copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
module Conjur
|
21
|
+
class API
|
22
|
+
# Return audit events related to the given role_id. Identitical to audit_events
|
23
|
+
# except that a String may be given instead of a Role object.
|
24
|
+
# @param role_id [String] the role for which events should be returned.
|
25
|
+
def audit_role role, options={}
|
26
|
+
audit_event_feed 'role', (role.roleid rescue role), options
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
# Return audit events related to the current authenticated role.
|
31
|
+
def audit_current_role options={}
|
32
|
+
audit_event_feed 'role', nil, options
|
33
|
+
end
|
34
|
+
|
35
|
+
# Return audit events related to the given resource
|
36
|
+
def audit_resource resource, options={}
|
37
|
+
audit_event_feed 'resource', (resource.resourceid rescue resource), options
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
def audit_event_feed kind, identifier=nil, options={}
|
42
|
+
path = "feeds/#{kind}"
|
43
|
+
path << "/#{CGI.escape identifier}" if identifier
|
44
|
+
query = options.slice(:limit, :offset)
|
45
|
+
path << "?#{query.to_param}" unless query.empty?
|
46
|
+
parse_response RestClient::Resource.new(Conjur::Audit::API.host, credentials)[path].get
|
47
|
+
end
|
48
|
+
|
49
|
+
def parse_response response
|
50
|
+
JSON.parse response
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2013 Conjur Inc
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
|
+
# this software and associated documentation files (the "Software"), to deal in
|
6
|
+
# the Software without restriction, including without limitation the rights to
|
7
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
8
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
9
|
+
# subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
12
|
+
# copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
16
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
17
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
18
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
19
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
#
|
21
|
+
|
22
|
+
module Conjur
|
23
|
+
module Audit
|
24
|
+
class API < Conjur::API
|
25
|
+
class << self
|
26
|
+
def host
|
27
|
+
ENV['CONJUR_AUDIT_URL'] || default_host
|
28
|
+
end
|
29
|
+
|
30
|
+
def default_host
|
31
|
+
case Conjur.env
|
32
|
+
when 'test', 'development'
|
33
|
+
"http://localhost:#{Conjur.service_base_port + 300}"
|
34
|
+
else
|
35
|
+
"https://audit-#{Conjur.stack}-conjur.herokuapp.com"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
require 'conjur/api/audit'
|
data/lib/conjur/base.rb
CHANGED
@@ -40,12 +40,26 @@ module Conjur
|
|
40
40
|
class << self
|
41
41
|
# Parse a role id into [ account, 'roles', kind, id ]
|
42
42
|
def parse_role_id(id)
|
43
|
-
|
43
|
+
id = id.role if id.respond_to?(:role)
|
44
|
+
if id.is_a?(Role)
|
45
|
+
[ id.account, 'roles', id.kind, id.identifier ]
|
46
|
+
elsif id.respond_to?(:role_kind)
|
47
|
+
[ Conjur::Core::API.conjur_account, 'roles', id.role_kind, id.identifier ]
|
48
|
+
else
|
49
|
+
parse_id id, 'roles'
|
50
|
+
end
|
44
51
|
end
|
45
52
|
|
46
53
|
# Parse a resource id into [ account, 'resources', kind, id ]
|
47
54
|
def parse_resource_id(id)
|
48
|
-
|
55
|
+
id = id.resource if id.respond_to?(:resource)
|
56
|
+
if id.is_a?(Resource)
|
57
|
+
[ id.account, 'resources', id.kind, id.identifier ]
|
58
|
+
elsif id.respond_to?(:resource_kind)
|
59
|
+
[ Conjur::Core::API.conjur_account, 'resources', id.resource_kind, id.resource_id ]
|
60
|
+
else
|
61
|
+
parse_id id, 'resources'
|
62
|
+
end
|
49
63
|
end
|
50
64
|
|
51
65
|
# Converts flat id into path components, with mixed-in "super-kind"
|
data/lib/conjur/group.rb
CHANGED
@@ -22,5 +22,13 @@ module Conjur
|
|
22
22
|
class Group < RestClient::Resource
|
23
23
|
include ActsAsAsset
|
24
24
|
include ActsAsRole
|
25
|
+
|
26
|
+
def add_member(member, options = {})
|
27
|
+
role.grant_to member, options
|
28
|
+
end
|
29
|
+
|
30
|
+
def remove_member(member)
|
31
|
+
role.revoke_from member
|
32
|
+
end
|
25
33
|
end
|
26
34
|
end
|
data/lib/conjur/resource.rb
CHANGED
@@ -28,6 +28,13 @@ module Conjur
|
|
28
28
|
match_path(3..-1)
|
29
29
|
end
|
30
30
|
|
31
|
+
# Name convention according to Role#roleid.
|
32
|
+
def resourceid
|
33
|
+
[account, kind, identifier].join ':'
|
34
|
+
end
|
35
|
+
|
36
|
+
alias :resource_id :resourceid
|
37
|
+
|
31
38
|
def create(options = {})
|
32
39
|
log do |logger|
|
33
40
|
logger << "Creating resource #{kind}:#{identifier}"
|
@@ -67,7 +74,12 @@ module Conjur
|
|
67
74
|
end
|
68
75
|
end
|
69
76
|
|
70
|
-
|
77
|
+
begin
|
78
|
+
self["?permit&privilege=#{query_escape p}&role=#{query_escape role}"].post(options)
|
79
|
+
rescue RestClient::Forbidden
|
80
|
+
# TODO: Remove once permit is idempotent
|
81
|
+
raise $! unless $!.http_body == "Privilege already granted."
|
82
|
+
end
|
71
83
|
end
|
72
84
|
end
|
73
85
|
|
@@ -98,4 +110,4 @@ module Conjur
|
|
98
110
|
item.respond_to?(:each) ? item : [ item ]
|
99
111
|
end
|
100
112
|
end
|
101
|
-
end
|
113
|
+
end
|
data/lib/conjur/variable.rb
CHANGED
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Conjur::ActsAsAsset do
|
4
|
+
let(:asset) { Object.new }
|
5
|
+
before {
|
6
|
+
class << asset
|
7
|
+
include Conjur::ActsAsAsset
|
8
|
+
|
9
|
+
def options
|
10
|
+
OPTIONS
|
11
|
+
end
|
12
|
+
end
|
13
|
+
}
|
14
|
+
let(:invoke) {
|
15
|
+
send action
|
16
|
+
}
|
17
|
+
let(:add_member) {
|
18
|
+
asset.add_member ROLE, MEMBER, OPTIONS
|
19
|
+
}
|
20
|
+
let(:remove_member) {
|
21
|
+
asset.remove_member ROLE, MEMBER
|
22
|
+
}
|
23
|
+
|
24
|
+
shared_context "asset with role" do
|
25
|
+
before(:each) {
|
26
|
+
asset.stub(:core_conjur_account).and_return(ACCOUNT)
|
27
|
+
asset.stub(:resource_kind).and_return(KIND)
|
28
|
+
asset.stub(:resource_id).and_return(ID)
|
29
|
+
Conjur::Role.stub(:new).and_return(role_base)
|
30
|
+
}
|
31
|
+
let(:role_base) {
|
32
|
+
double(:"[]" => role_instance)
|
33
|
+
}
|
34
|
+
let(:role_instance) {
|
35
|
+
double(grant_to: true, revoke_from: true)
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
shared_examples_for "it obtains role via asset" do
|
40
|
+
it "account=asset.core_conjur_account" do
|
41
|
+
asset.should_receive(:core_conjur_account)
|
42
|
+
invoke
|
43
|
+
end
|
44
|
+
it "kind=asset.resource_kind" do
|
45
|
+
asset.should_receive(:resource_kind)
|
46
|
+
invoke
|
47
|
+
end
|
48
|
+
it "id=asset.resource_id" do
|
49
|
+
asset.should_receive(:resource_id)
|
50
|
+
invoke
|
51
|
+
end
|
52
|
+
|
53
|
+
it "obtains role as #{ACCOUNT}:@:#{KIND}/#{ID}/#{ROLE}" do
|
54
|
+
Conjur::Role.should_receive(:new).with("http://localhost:5100", {}).and_return role_base
|
55
|
+
role_base.should_receive(:[]).with("#{CGI.escape ACCOUNT}/roles/@/#{KIND}/#{ID}/#{CGI.escape ROLE}").and_return role_instance
|
56
|
+
|
57
|
+
invoke
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "#add_member" do
|
62
|
+
let(:action) { :add_member }
|
63
|
+
include_context "asset with role"
|
64
|
+
it_behaves_like "it obtains role via asset"
|
65
|
+
it 'calls role.grant_to(member,...)' do
|
66
|
+
role_instance.should_receive(:grant_to).with(MEMBER, anything)
|
67
|
+
invoke
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "#remove_member" do
|
72
|
+
let(:action) { :remove_member }
|
73
|
+
include_context "asset with role"
|
74
|
+
it_behaves_like "it obtains role via asset"
|
75
|
+
it 'calls role.revoke_from(member)' do
|
76
|
+
role_instance.should_receive(:revoke_from).with(MEMBER)
|
77
|
+
invoke
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Conjur::API, api: :dummy do
|
4
|
+
describe "audit API methods" do
|
5
|
+
|
6
|
+
let(:options){ {limit:20, offset: 51, some_unwanted_option: 'heloo!'} }
|
7
|
+
let(:expected_options){ options.slice(:limit, :offset) }
|
8
|
+
let(:response){ ['some event'] }
|
9
|
+
let(:include_options){ false }
|
10
|
+
let(:query){ include_options ? '?' + expected_options.to_query : '' }
|
11
|
+
let(:expected_path){ nil }
|
12
|
+
let(:expected_url){ "#{Conjur::Audit::API.host}/#{expected_path}#{query}" }
|
13
|
+
|
14
|
+
def expect_request
|
15
|
+
RestClient::Request.should_receive(:execute).with(
|
16
|
+
user: credentials,
|
17
|
+
password: nil,
|
18
|
+
headers: {},
|
19
|
+
url: expected_url,
|
20
|
+
method: :get
|
21
|
+
).and_return response.to_json
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
describe "#audit_role" do
|
26
|
+
let(:role_id){ 'acct:user:foobar' }
|
27
|
+
let(:role){ double('role', roleid: role_id) }
|
28
|
+
let(:expected_path){ "feeds/role/#{CGI.escape role_id}" }
|
29
|
+
let(:args){ [role_id] }
|
30
|
+
let(:full_args){ include_options ? args + [options] : args }
|
31
|
+
shared_examples_for "gets roles feed" do
|
32
|
+
it "GETs feeds/role/:role_id" do
|
33
|
+
expect_request
|
34
|
+
api.audit_role(*full_args).should == response
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "when called with a role id" do
|
39
|
+
let(:args){ [role_id] }
|
40
|
+
it_behaves_like "gets roles feed"
|
41
|
+
end
|
42
|
+
|
43
|
+
context "when called with a role instance" do
|
44
|
+
let(:audit_role_args){ [role] }
|
45
|
+
it_behaves_like "gets roles feed"
|
46
|
+
end
|
47
|
+
|
48
|
+
context "when called with pagination options" do
|
49
|
+
let(:include_options){ true }
|
50
|
+
let(:args){ [ role_id ] }
|
51
|
+
it_behaves_like "gets roles feed"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "#audit_current_role" do
|
56
|
+
let(:expected_path){ "feeds/role" }
|
57
|
+
let(:args){ include_options ? [options] : [] }
|
58
|
+
shared_examples_for "gets current role feed" do
|
59
|
+
it "GETS feeds/role" do
|
60
|
+
expect_request
|
61
|
+
api.audit_current_role(*args).should == response
|
62
|
+
end
|
63
|
+
end
|
64
|
+
context "when called with no args" do
|
65
|
+
it_behaves_like "gets current role feed"
|
66
|
+
end
|
67
|
+
context "when called with pagination options" do
|
68
|
+
let(:include_options){ true }
|
69
|
+
it_behaves_like "gets current role feed"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "#audit_resource" do
|
74
|
+
let(:resource_id){ 'acct:food:bacon' }
|
75
|
+
let(:resource){ double('resource', resourceid: resource_id) }
|
76
|
+
let(:expected_path){ "feeds/resource/#{CGI.escape resource_id}" }
|
77
|
+
let(:args){[resource_id]}
|
78
|
+
let(:full_args){ include_options ? args + [options] : args }
|
79
|
+
shared_examples_for "gets the resource feed" do
|
80
|
+
it "GETS feeds/resource/:resource_id" do
|
81
|
+
expect_request
|
82
|
+
api.audit_resource(*full_args).should == response
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context "when called with resource id" do
|
87
|
+
let(:args){ [resource_id] }
|
88
|
+
it_behaves_like "gets the resource feed"
|
89
|
+
end
|
90
|
+
|
91
|
+
context "when called with resource instance" do
|
92
|
+
let(:args){ [resource] }
|
93
|
+
it_behaves_like "gets the resource feed"
|
94
|
+
end
|
95
|
+
|
96
|
+
context "when called with pagination options" do
|
97
|
+
let(:include_options) { true }
|
98
|
+
it_behaves_like "gets the resource feed"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -82,10 +82,20 @@ end
|
|
82
82
|
|
83
83
|
require 'conjur/api'
|
84
84
|
|
85
|
+
KIND="asset_kind"
|
86
|
+
ID="unique_id"
|
87
|
+
ROLE='<role>'
|
88
|
+
MEMBER='<member>'
|
89
|
+
PRIVILEGE='<privilege>'
|
90
|
+
OWNER='<owner/userid>'
|
91
|
+
ACCOUNT='<core_account>'
|
92
|
+
OPTIONS={}
|
93
|
+
|
85
94
|
shared_context api: :dummy do
|
86
95
|
let(:username) { "user" }
|
87
96
|
let(:api){ Conjur::API.new_from_key username, 'key' }
|
88
97
|
let(:authz_host) { 'http://authz.example.com' }
|
98
|
+
let(:audit_host) { 'http://audit.example.com' }
|
89
99
|
let(:credentials) { double "fake credentials" }
|
90
100
|
let(:core_host) { 'http://core.example.com' }
|
91
101
|
let(:account) { 'the-account' }
|
@@ -94,6 +104,7 @@ shared_context api: :dummy do
|
|
94
104
|
Conjur::Authz::API.stub host: authz_host
|
95
105
|
Conjur::Core::API.stub host: core_host
|
96
106
|
Conjur::Core::API.stub conjur_account: account
|
107
|
+
Conjur::Audit::API.stub host:audit_host
|
97
108
|
api.stub credentials: credentials
|
98
109
|
end
|
99
110
|
end
|
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.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-11-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|
@@ -156,6 +156,38 @@ dependencies:
|
|
156
156
|
- - ! '>='
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: yard
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
none: false
|
163
|
+
requirements:
|
164
|
+
- - ! '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
type: :development
|
168
|
+
prerelease: false
|
169
|
+
version_requirements: !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - ! '>='
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
- !ruby/object:Gem::Dependency
|
176
|
+
name: redcarpet
|
177
|
+
requirement: !ruby/object:Gem::Requirement
|
178
|
+
none: false
|
179
|
+
requirements:
|
180
|
+
- - ! '>='
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
183
|
+
type: :development
|
184
|
+
prerelease: false
|
185
|
+
version_requirements: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
159
191
|
description: Conjur API
|
160
192
|
email:
|
161
193
|
- divided.mind@gmail.com
|
@@ -183,6 +215,7 @@ files:
|
|
183
215
|
- lib/conjur/acts_as_role.rb
|
184
216
|
- lib/conjur/acts_as_user.rb
|
185
217
|
- lib/conjur/api.rb
|
218
|
+
- lib/conjur/api/audit.rb
|
186
219
|
- lib/conjur/api/authn.rb
|
187
220
|
- lib/conjur/api/groups.rb
|
188
221
|
- lib/conjur/api/hosts.rb
|
@@ -191,6 +224,7 @@ files:
|
|
191
224
|
- lib/conjur/api/secrets.rb
|
192
225
|
- lib/conjur/api/users.rb
|
193
226
|
- lib/conjur/api/variables.rb
|
227
|
+
- lib/conjur/audit-api.rb
|
194
228
|
- lib/conjur/authn-api.rb
|
195
229
|
- lib/conjur/authz-api.rb
|
196
230
|
- lib/conjur/base.rb
|
@@ -225,6 +259,8 @@ files:
|
|
225
259
|
- spec/api/variables_spec.rb
|
226
260
|
- spec/cas_rest_client.rb
|
227
261
|
- spec/lib/api_spec.rb
|
262
|
+
- spec/lib/asset_spec.rb
|
263
|
+
- spec/lib/audit_spec.rb
|
228
264
|
- spec/lib/build_from_response_spec.rb
|
229
265
|
- spec/lib/exists_spec.rb
|
230
266
|
- spec/lib/host_spec.rb
|
@@ -254,10 +290,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
254
290
|
requirements:
|
255
291
|
- - ! '>='
|
256
292
|
- !ruby/object:Gem::Version
|
257
|
-
version: '
|
258
|
-
segments:
|
259
|
-
- 0
|
260
|
-
hash: 2013228503366139163
|
293
|
+
version: '1.9'
|
261
294
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
262
295
|
none: false
|
263
296
|
requirements:
|
@@ -266,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
299
|
version: '0'
|
267
300
|
segments:
|
268
301
|
- 0
|
269
|
-
hash:
|
302
|
+
hash: 1370688255515528538
|
270
303
|
requirements: []
|
271
304
|
rubyforge_project:
|
272
305
|
rubygems_version: 1.8.25
|
@@ -288,6 +321,8 @@ test_files:
|
|
288
321
|
- spec/api/variables_spec.rb
|
289
322
|
- spec/cas_rest_client.rb
|
290
323
|
- spec/lib/api_spec.rb
|
324
|
+
- spec/lib/asset_spec.rb
|
325
|
+
- spec/lib/audit_spec.rb
|
291
326
|
- spec/lib/build_from_response_spec.rb
|
292
327
|
- spec/lib/exists_spec.rb
|
293
328
|
- spec/lib/host_spec.rb
|
@@ -305,3 +340,4 @@ test_files:
|
|
305
340
|
- spec/vcr_cassettes/Conjur_Resource/_create/with_path-like_identifier.yml
|
306
341
|
- spec/vcr_cassettes/Conjur_Resource/_create/with_un-encoded_path-like_identifier.yml
|
307
342
|
- spec/vcr_cassettes/Conjur_Resource/_create/with_uuid_identifier.yml
|
343
|
+
has_rdoc:
|