aptible-auth 1.0.1 → 1.1.0

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
- SHA1:
3
- metadata.gz: 94d1b488bb7c6678d569bcc055c0acaa32c758a5
4
- data.tar.gz: cf72ce8c232de3f076b18594bfc0b3ee51ca64d2
2
+ SHA256:
3
+ metadata.gz: '00328550f86b01c32a92affe4e03732823568896937d4789151bd458ef60d119'
4
+ data.tar.gz: 762c0481e463f560f9ac56ef4228d985a01f79c343c341e6cc16dca442c77d41
5
5
  SHA512:
6
- metadata.gz: a09300c9a4335c2b2c4ae53a709f8d68b1c006611237d884a8073e7faf1b24de085cf0f3c872398344ccbce13e1b1885d107b656b2955bbcd9d55de467ac8eb2
7
- data.tar.gz: 883e9d720e15d2dff7e24ce6cb091e235392970a9958a7077197671ef5e02d5089c61189566cd4fd6c867d5d55200981bc908170de6559e46ccc4155412b56fc
6
+ metadata.gz: 0a970d42b7b94aa7d1995b1c4f7e72ba880339efc402fb3e77e8e8e3a18bcb2174dfeea3cb8707270eac99877ef809f6793f3b3f8b94b28087b27e655f020e3a
7
+ data.tar.gz: 598365febae878bdb08df3ecaf00f7e894d85ce914664e797c1a8d838091a7f6820575de2e128b84d4e3e20325679a2a58f0fcb99420a04d3672b12170278088
@@ -0,0 +1 @@
1
+ * @dawenster
@@ -1,7 +1,7 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - "2.0"
5
- - "2.1"
6
4
  - "2.2"
7
- - jruby-9.0.5.0
5
+ - "2.3"
6
+ - "2.5"
7
+ - "2.6"
data/README.md CHANGED
@@ -60,7 +60,5 @@ end
60
60
 
61
61
  MIT License, see [LICENSE](LICENSE.md) for details.
62
62
 
63
- Copyright (c) 2014 [Aptible](https://www.aptible.com) and contributors.
64
-
65
- [<img src="https://s.gravatar.com/avatar/9b58236204e844e3181e43e05ddb0809?s=60" style="border-radius: 50%;" alt="@sandersonet" />](https://github.com/sandersonet)
63
+ Copyright (c) 2019 [Aptible](https://www.aptible.com) and contributors.
66
64
 
data/Rakefile CHANGED
@@ -4,5 +4,5 @@ begin
4
4
  require 'aptible/tasks'
5
5
  Aptible::Tasks.load_tasks
6
6
  rescue LoadError
7
- $stderr.puts 'Skipping Aptible::Tasks initialization...'
7
+ warn 'Skipping Aptible::Tasks initialization...'
8
8
  end
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
 
@@ -19,16 +20,15 @@ Gem::Specification.new do |spec|
19
20
  spec.test_files = spec.files.grep(%r{^spec/})
20
21
  spec.require_paths = ['lib']
21
22
 
22
- spec.add_dependency 'aptible-billing', '~> 1.0'
23
23
  spec.add_dependency 'aptible-resource', '~> 1.0'
24
24
  spec.add_dependency 'gem_config'
25
25
  spec.add_dependency 'oauth2-aptible', '~> 0.10.0'
26
26
 
27
+ spec.add_development_dependency 'aptible-tasks', '>= 0.6.0'
27
28
  spec.add_development_dependency 'bundler', '~> 1.3'
28
- spec.add_development_dependency 'aptible-tasks', '>= 0.2.0'
29
+ spec.add_development_dependency 'pry'
29
30
  spec.add_development_dependency 'rake'
30
- spec.add_development_dependency 'rspec', '~> 2.0'
31
+ spec.add_development_dependency 'rspec', '~> 3.0'
31
32
  spec.add_development_dependency 'rspec-its'
32
- spec.add_development_dependency 'pry'
33
33
  spec.add_development_dependency 'timecop', '~> 0.8.1'
34
34
  end
@@ -1,11 +1,10 @@
1
- require 'aptible/billing'
2
-
3
1
  module Aptible
4
2
  module Auth
5
3
  class Organization < Resource
6
4
  has_many :roles
7
5
  has_many :users
8
6
  has_many :invitations
7
+ has_many :whitelist_memberships
9
8
  belongs_to :security_officer
10
9
 
11
10
  field :id
@@ -22,17 +21,8 @@ module Aptible
22
21
  field :security_alert_email
23
22
  field :ops_alert_email
24
23
  field :security_officer_id
25
-
26
- def billing_detail
27
- @billing_detail ||= Aptible::Billing::BillingDetail.find(
28
- id, token: token, headers: headers
29
- )
30
- end
31
-
32
- def can_manage_compliance?
33
- return false unless billing_detail
34
- %w(production pilot).include?(billing_detail.plan)
35
- end
24
+ field :enterprise
25
+ field :sso_enforced
36
26
 
37
27
  def privileged_roles
38
28
  roles.select(&:privileged?)
@@ -40,6 +30,7 @@ module Aptible
40
30
 
41
31
  def accounts
42
32
  return @accounts if @accounts
33
+
43
34
  require 'aptible/api'
44
35
 
45
36
  accounts = Aptible::Api::Account.all(token: token, headers: headers)
@@ -47,6 +38,17 @@ module Aptible
47
38
  (link = account.links[:organization]) && link.href == href
48
39
  end
49
40
  end
41
+
42
+ # SamlConfiguration is a dependent object that does not
43
+ # have a link until created. So, we create the link for it
44
+ # to allow HyperResource to successfully create the object.
45
+ # Afterwords, we can directly manage the SamlConfiguration
46
+ def create_saml_configuration!(params)
47
+ HyperResource::Link.new(
48
+ self,
49
+ 'href' => "#{href}/saml_configurations"
50
+ ).post(self.class.normalize_params(params))
51
+ end
50
52
  end
51
53
  end
52
54
  end
@@ -23,3 +23,5 @@ require 'aptible/auth/session'
23
23
  require 'aptible/auth/token'
24
24
  require 'aptible/auth/user'
25
25
  require 'aptible/auth/ssh_key'
26
+ require 'aptible/auth/saml_configuration'
27
+ require 'aptible/auth/whitelist_membership'
@@ -0,0 +1,16 @@
1
+ module Aptible
2
+ module Auth
3
+ class SamlConfiguration < Resource
4
+ belongs_to :organization
5
+
6
+ field :id
7
+ field :entity_id
8
+ field :sign_in_url
9
+ field :name_format
10
+ field :certificate
11
+ field :handle
12
+ field :created_at, type: Time
13
+ field :updated_at, type: Time
14
+ end
15
+ end
16
+ end
@@ -144,7 +144,7 @@ module Aptible
144
144
  private_key = parse_private_key(secret)
145
145
  {
146
146
  private_key: private_key,
147
- algorithm: "RS#{key_length(private_key) / 2}"
147
+ algorithm: "RS#{key_length(private_key) / 2}"
148
148
  }
149
149
  end
150
150
 
@@ -3,6 +3,7 @@ module Aptible
3
3
  class User < Resource
4
4
  has_many :roles
5
5
  has_many :ssh_keys
6
+ has_many :whitelist_memberhips
6
7
 
7
8
  field :id
8
9
  field :name
@@ -1,5 +1,5 @@
1
1
  module Aptible
2
2
  module Auth
3
- VERSION = '1.0.1'.freeze
3
+ VERSION = '1.1.0'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,11 @@
1
+ module Aptible
2
+ module Auth
3
+ class WhitelistMembership < Resource
4
+ belongs_to :organization
5
+ embeds_one :user
6
+
7
+ field :id
8
+ field :created_at, type: Time
9
+ end
10
+ end
11
+ end
@@ -1,36 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Aptible::Auth::Organization do
4
- describe '#can_manage_compliance?' do
5
- before { subject.stub(:billing_detail) { billing_detail } }
6
-
7
- context 'without a billing detail' do
8
- let(:billing_detail) { nil }
9
- it 'should return false' do
10
- expect(subject.can_manage_compliance?).to eq false
11
- end
12
- end
13
-
14
- context 'with a billing detail' do
15
- let(:billing_detail) { double Aptible::Billing::BillingDetail }
16
-
17
- it 'should return true with production plan' do
18
- billing_detail.stub(:plan) { 'production' }
19
- expect(subject.can_manage_compliance?).to eq true
20
- end
21
-
22
- it 'should return false with development plan' do
23
- billing_detail.stub(:plan) { 'development' }
24
- expect(subject.can_manage_compliance?).to eq false
25
- end
26
-
27
- it 'should return false with platform plan' do
28
- billing_detail.stub(:plan) { 'platform' }
29
- expect(subject.can_manage_compliance?).to eq false
30
- end
31
- end
32
- end
33
-
34
4
  describe '#security_officer' do
35
5
  let(:user) { double 'Aptible::Auth::User' }
36
6
 
@@ -82,7 +82,7 @@ describe Aptible::Auth::Token do
82
82
  end
83
83
 
84
84
  describe '#authenticate_user' do
85
- let(:args) { %w(user@example.com foobar) }
85
+ let(:args) { %w[user@example.com foobar] }
86
86
 
87
87
  before { oauth.stub_chain(:password, :get_token) { response } }
88
88
 
@@ -116,7 +116,7 @@ describe Aptible::Auth::Token do
116
116
  end
117
117
 
118
118
  describe '#authenticate_client' do
119
- let(:args) { %w(id secret user@example.com) }
119
+ let(:args) { %w[id secret user@example.com] }
120
120
 
121
121
  before do
122
122
  subject.stub(:signing_params_from_secret) { { algorithm: 'foobar' } }
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptible-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Macreery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-27 00:00:00.000000000 Z
11
+ date: 2020-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: aptible-billing
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: aptible-resource
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +52,20 @@ dependencies:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
54
  version: 0.10.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: aptible-tasks
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.6.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.6.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -81,19 +81,19 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.3'
83
83
  - !ruby/object:Gem::Dependency
84
- name: aptible-tasks
84
+ name: pry
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 0.2.0
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 0.2.0
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '2.0'
117
+ version: '3.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '2.0'
124
+ version: '3.0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rspec-its
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -136,20 +136,6 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: pry
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: timecop
155
141
  requirement: !ruby/object:Gem::Requirement
@@ -171,6 +157,7 @@ executables: []
171
157
  extensions: []
172
158
  extra_rdoc_files: []
173
159
  files:
160
+ - ".github/CODEOWNERS"
174
161
  - ".gitignore"
175
162
  - ".rspec"
176
163
  - ".travis.yml"
@@ -188,11 +175,13 @@ files:
188
175
  - lib/aptible/auth/organization.rb
189
176
  - lib/aptible/auth/resource.rb
190
177
  - lib/aptible/auth/role.rb
178
+ - lib/aptible/auth/saml_configuration.rb
191
179
  - lib/aptible/auth/session.rb
192
180
  - lib/aptible/auth/ssh_key.rb
193
181
  - lib/aptible/auth/token.rb
194
182
  - lib/aptible/auth/user.rb
195
183
  - lib/aptible/auth/version.rb
184
+ - lib/aptible/auth/whitelist_membership.rb
196
185
  - spec/aptible/auth/agent_spec.rb
197
186
  - spec/aptible/auth/organization_spec.rb
198
187
  - spec/aptible/auth/resource_spec.rb
@@ -221,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
210
  version: '0'
222
211
  requirements: []
223
212
  rubyforge_project:
224
- rubygems_version: 2.6.13
213
+ rubygems_version: 2.7.6.2
225
214
  signing_key:
226
215
  specification_version: 4
227
216
  summary: Ruby client for auth.aptible.com