File tree 11 files changed +56
-10
lines changed
11 files changed +56
-10
lines changed Original file line number Diff line number Diff line change 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"
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
@@ -23,11 +24,11 @@ Gem::Specification.new do |spec|
23
24
spec . add_dependency 'gem_config'
24
25
spec . add_dependency 'oauth2-aptible' , '~> 0.10.0'
25
26
27
+ spec . add_development_dependency 'aptible-tasks' , '>= 0.6.0'
26
28
spec . add_development_dependency 'bundler' , '~> 1.3'
27
- spec . add_development_dependency 'aptible-tasks' , '>= 0.2.0 '
29
+ spec . add_development_dependency 'pry '
28
30
spec . add_development_dependency 'rake'
29
31
spec . add_development_dependency 'rspec' , '~> 3.0'
30
32
spec . add_development_dependency 'rspec-its'
31
- spec . add_development_dependency 'pry'
32
33
spec . add_development_dependency 'timecop' , '~> 0.8.1'
33
34
end
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ class Organization < Resource
4
4
has_many :roles
5
5
has_many :users
6
6
has_many :invitations
7
+ has_many :whitelist_memberships
7
8
belongs_to :security_officer
8
9
9
10
field :id
@@ -20,20 +21,34 @@ class Organization < Resource
20
21
field :security_alert_email
21
22
field :ops_alert_email
22
23
field :security_officer_id
24
+ field :enterprise
25
+ field :sso_enforced
23
26
24
27
def privileged_roles
25
28
roles . select ( &:privileged? )
26
29
end
27
30
28
31
def accounts
29
32
return @accounts if @accounts
33
+
30
34
require 'aptible/api'
31
35
32
36
accounts = Aptible ::Api ::Account . all ( token : token , headers : headers )
33
37
@accounts = accounts . select do |account |
34
38
( link = account . links [ :organization ] ) && link . href == href
35
39
end
36
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
37
52
end
38
53
end
39
54
end
Original file line number Diff line number Diff line change @@ -23,3 +23,5 @@ def root_url
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'
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ def signing_params_from_secret(secret)
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
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ module Auth
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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change 82
82
end
83
83
84
84
describe '#authenticate_user' do
85
- let ( :args ) { %w( [email protected] foobar ) }
85
+ let ( :args ) { %w[ [email protected] foobar ] }
86
86
87
87
before { oauth . stub_chain ( :password , :get_token ) { response } }
88
88
116
116
end
117
117
118
118
describe '#authenticate_client' do
119
- let ( :args ) { %w( id secret [email protected] ) }
119
+ let ( :args ) { %w[ id secret [email protected] ] }
120
120
121
121
before do
122
122
subject . stub ( :signing_params_from_secret ) { { algorithm : 'foobar' } }
You can’t perform that action at this time.
0 commit comments