onelogin 1.3.1 → 1.6.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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/git-secrets-public.yml +55 -0
  3. data/README.md +64 -0
  4. data/examples/Gemfile.lock +10 -6
  5. data/examples/another-get-all-login-events-of-last-day-to-csv.rb +141 -0
  6. data/examples/events-to-csv.rb +3 -3
  7. data/examples/get-all-login-events-of-last-day-to-csv.rb +88 -0
  8. data/examples/rails-custom-login-page/Gemfile +2 -2
  9. data/examples/rails-custom-login-page/Gemfile.lock +20 -16
  10. data/examples/rails-custom-login-page/README.md +35 -2
  11. data/examples/rails-custom-login-page/app/assets/stylesheets/application.css +1 -61
  12. data/examples/rails-custom-login-page/app/controllers/home_controller.rb +1 -0
  13. data/examples/rails-custom-login-page/app/controllers/sessions_controller.rb +4 -4
  14. data/examples/rails-custom-login-page/app/controllers/users_controller.rb +48 -14
  15. data/examples/rails-custom-login-page/app/helpers/sessions_helper.rb +1 -1
  16. data/examples/rails-custom-login-page/app/helpers/users_helper.rb +1 -0
  17. data/examples/rails-custom-login-page/app/views/dashboard/index.html.erb +2 -9
  18. data/examples/rails-custom-login-page/app/views/home/index.html.erb +84 -18
  19. data/examples/rails-custom-login-page/app/views/layouts/application.html.erb +13 -1
  20. data/examples/rails-custom-login-page/app/views/users/edit.html.erb +30 -24
  21. data/examples/rails-custom-login-page/app/views/users/index.html.erb +30 -27
  22. data/examples/rails-custom-login-page/app/views/users/new.html.erb +58 -3
  23. data/examples/rails-custom-login-page/app/views/users/onboard.html.erb +54 -0
  24. data/examples/rails-custom-login-page/app/views/users/show.html.erb +16 -13
  25. data/examples/rails-custom-login-page/config/initializers/onelogin.rb +3 -1
  26. data/examples/rails-custom-login-page/config/routes.rb +4 -0
  27. data/examples/rails-custom-login-page/config/secrets.yml.sample +2 -0
  28. data/lib/onelogin/api/client.rb +682 -10
  29. data/lib/onelogin/api/cursor.rb +4 -3
  30. data/lib/onelogin/api/models/connector_basic.rb +20 -0
  31. data/lib/onelogin/api/models/event.rb +6 -1
  32. data/lib/onelogin/api/models/event_type.rb +2 -2
  33. data/lib/onelogin/api/models/mfa_token.rb +18 -0
  34. data/lib/onelogin/api/models/onelogin_app.rb +62 -0
  35. data/lib/onelogin/api/models/onelogin_app_basic.rb +51 -0
  36. data/lib/onelogin/api/models/onelogin_app_v1.rb +22 -0
  37. data/lib/onelogin/api/models/user.rb +1 -1
  38. data/lib/onelogin/api/models.rb +5 -0
  39. data/lib/onelogin/api/util/constants.rb +18 -0
  40. data/lib/onelogin/version.rb +1 -1
  41. data/onelogin.gemspec +2 -2
  42. metadata +16 -7
@@ -30,7 +30,7 @@ class Cursor
30
30
  @after_cursor = options.fetch(:after_cursor, nil)
31
31
  end
32
32
 
33
- def each(start = 0)
33
+ def each(start = 0, &proc)
34
34
  return to_enum(:each, start) unless block_given?
35
35
 
36
36
  Array(@collection[start..-1]).each do |item|
@@ -46,7 +46,7 @@ class Cursor
46
46
 
47
47
  fetch_next_page
48
48
 
49
- each(start, &Proc.new)
49
+ each(start, &proc)
50
50
  end
51
51
  end
52
52
 
@@ -54,8 +54,9 @@ class Cursor
54
54
 
55
55
  def fetch_next_page
56
56
  @params = @params.merge(after_cursor: @after_cursor) if @after_cursor
57
+ @client.prepare_token
57
58
 
58
- response = @client.get(
59
+ response = @client.class.get(
59
60
  @url,
60
61
  headers: @headers,
61
62
  query: @params
@@ -0,0 +1,20 @@
1
+ module OneLogin
2
+ module Api
3
+ module Models
4
+
5
+ class ConnectorBasic
6
+
7
+ attr_accessor :id, :name, :auth_method
8
+ attr_accessor :icon_url, :allows_new_parameters
9
+
10
+ def initialize(data)
11
+ @id = data['id']
12
+ @name = data['name']
13
+ @icon_url = data['icon_url']
14
+ @auth_method = data['auth_method']
15
+ @allows_new_parameters = data['allows_new_parameters']
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -9,7 +9,7 @@ module OneLogin
9
9
  :role_id, :role_name, :app_id, :app_name, :group_id, :group_name, :otp_device_id,
10
10
  :otp_device_name, :policy_id, :policy_name, :actor_system, :custom_message,
11
11
  :operation_name, :directory_sync_run_id, :directory_id, :resolution, :client_id,
12
- :resource_type_id, :error_description
12
+ :resource_type_id, :error_description, :risk_score, :risk_reasons, :risk_cookie_id, :browser_fingerprint
13
13
 
14
14
  def initialize(data)
15
15
  @id = data['id']
@@ -42,6 +42,11 @@ module OneLogin
42
42
  @client_id = data['client_id']
43
43
  @resource_type_id = data['resource_type_id']
44
44
  @error_description = data['error_description'].to_s
45
+ @proxy_ip = data['proxy_ip'].to_s
46
+ @risk_score = data['risk_score']
47
+ @risk_reasons = data['risk_reasons'].to_s
48
+ @risk_cookie_id = data['risk_cookie_id']
49
+ @browser_fingerprint = data['browser_fingerprint']
45
50
  end
46
51
  end
47
52
  end
@@ -4,12 +4,12 @@ module OneLogin
4
4
 
5
5
  class EventType
6
6
 
7
- attr_accessor :id, :name, :reference
7
+ attr_accessor :id, :name, :description
8
8
 
9
9
  def initialize(data)
10
10
  @id = data['id']
11
11
  @name = data['name'].to_s
12
- @reference = data['reference'].to_s
12
+ @description = data['description'].to_s
13
13
  end
14
14
  end
15
15
  end
@@ -0,0 +1,18 @@
1
+ module OneLogin
2
+ module Api
3
+ module Models
4
+
5
+ class MFAToken
6
+
7
+ attr_accessor :value, :expires_at, :reusable
8
+
9
+ def initialize(data)
10
+ @value = data['mfa_token']
11
+ @expires_at = data['expires_at']
12
+ @reusable = data['reusable']
13
+ end
14
+ end
15
+
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,62 @@
1
+ module OneLogin
2
+ module Api
3
+ module Models
4
+
5
+ class OneLoginApp
6
+
7
+ attr_accessor :name, :visible, :policy_id, :is_available,
8
+ :parameters, :allow_assumed_signin,
9
+ :configuration, :notes, :description
10
+
11
+
12
+ attr_reader :created_at, :updated_at, :icon, :provisioning,
13
+ :connector_id, :sso, :auth_method, :id, :tab_id
14
+
15
+ def initialize(data)
16
+ @name = data['name']
17
+ @visible = data['visible']
18
+ @policy_id = data['policy_id']? data['policy_id'].to_i : nil
19
+ @parameters = data['parameters']
20
+ @allow_assumed_signin = data['allow_assumed_signin']
21
+ @configuration = data['configuration']
22
+ @notes = data['notes']
23
+ @description = data['description']
24
+
25
+ @created_at = data['created_at']
26
+ @updated_at = data['updated_at']
27
+ @icon = data['icon_url']
28
+ @provisioning = data['provisioning']
29
+ @connector_id = data['connector_id']? data['connector_id'].to_i : nil
30
+ @sso = data['sso']
31
+ @auth_method = data['auth_method']
32
+ @tab_id = data['tab_id']? data['tab_id'].to_i : nil
33
+ @id = data['id']? data['id'].to_i : nil
34
+ end
35
+
36
+ def get_auth_method_name
37
+ auth_method_name = nil
38
+ case @auth_method
39
+ when 0
40
+ auth_method_name = "PASSWORD"
41
+ when 1
42
+ auth_method_name = "OPENID"
43
+ when 2
44
+ auth_method_name = "SAML"
45
+ when 3
46
+ auth_method_name = "API"
47
+ when 4
48
+ auth_method_name = "GOOGLE"
49
+ when 6
50
+ auth_method_name = "BASIC_AUTH"
51
+ when 7
52
+ auth_method_name = "WSFED"
53
+ when 8
54
+ auth_method_name = "OIDC"
55
+ end
56
+
57
+ auth_method_name
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,51 @@
1
+ module OneLogin
2
+ module Api
3
+ module Models
4
+
5
+ class OneLoginAppBasic
6
+
7
+ attr_accessor :name, :visible,
8
+ :description
9
+
10
+ attr_reader :created_at, :updated_at,
11
+ :connector_id, :auth_method, :id
12
+
13
+ def initialize(data)
14
+ @id = data['id']? data['id'].to_i : nil
15
+ @name = data['name']
16
+ @description = data['description']
17
+ @auth_method = data['auth_method']
18
+ @connector_id = data['connector_id']? data['connector_id'].to_i : nil
19
+ @visible = data['visible']
20
+ @created_at = data['created_at']
21
+ @updated_at = data['updated_at']
22
+
23
+ end
24
+
25
+ def get_auth_method_name
26
+ auth_method_name = nil
27
+ case @auth_method
28
+ when 0
29
+ auth_method_name = "PASSWORD"
30
+ when 1
31
+ auth_method_name = "OPENID"
32
+ when 2
33
+ auth_method_name = "SAML"
34
+ when 3
35
+ auth_method_name = "API"
36
+ when 4
37
+ auth_method_name = "GOOGLE"
38
+ when 6
39
+ auth_method_name = "BASIC_AUTH"
40
+ when 7
41
+ auth_method_name = "WSFED"
42
+ when 8
43
+ auth_method_name = "OIDC"
44
+ end
45
+
46
+ auth_method_name
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,22 @@
1
+ module OneLogin
2
+ module Api
3
+ module Models
4
+
5
+ class OneLoginApp
6
+
7
+ attr_accessor :id, :connector_id, :name, :extension
8
+ attr_accessor :icon, :visible, :provisioning
9
+
10
+ def initialize(data)
11
+ @id = data['id']
12
+ @connector_id = data['connector_id']
13
+ @name = data['name']
14
+ @extension = data['extension']
15
+ @icon = data['icon']
16
+ @visible = data['visible']
17
+ @provisioning = data['provisioning']
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -51,7 +51,7 @@ module OneLogin
51
51
  @role_ids
52
52
  end
53
53
 
54
- def get_role_ids
54
+ def get_group_id
55
55
  @group_id
56
56
  end
57
57
 
@@ -1,11 +1,16 @@
1
1
  require 'onelogin/api/models/app'
2
2
  require 'onelogin/api/models/auth_factor'
3
+ require 'onelogin/api/models/connector_basic'
3
4
  require 'onelogin/api/models/device'
4
5
  require 'onelogin/api/models/event'
5
6
  require 'onelogin/api/models/event_type'
6
7
  require 'onelogin/api/models/factor_enrollment_response'
7
8
  require 'onelogin/api/models/group'
8
9
  require 'onelogin/api/models/mfa'
10
+ require 'onelogin/api/models/mfa_token'
11
+ require 'onelogin/api/models/onelogin_app_v1'
12
+ require 'onelogin/api/models/onelogin_app'
13
+ require 'onelogin/api/models/onelogin_app_basic'
9
14
  require 'onelogin/api/models/onelogin_token'
10
15
  require 'onelogin/api/models/otp_device'
11
16
  require 'onelogin/api/models/privilege'
@@ -32,6 +32,24 @@ module OneLogin
32
32
  SET_USER_STATE_URL = "https://api.%s.onelogin.com/api/1/users/%s/set_state"
33
33
  LOG_USER_OUT_URL = "https://api.%s.onelogin.com/api/1/users/%s/logout"
34
34
  LOCK_USER_URL = "https://api.%s.onelogin.com/api/1/users/%s/lock_user"
35
+ GENERATE_MFA_TOKEN_URL = "https://api.%s.onelogin.com/api/1/users/%s/mfa_token"
36
+
37
+ # Connectors URL
38
+ GET_CONNECTORS_URL = "https://api.%s.onelogin.com/api/2/connectors"
39
+ #GET_CONNECTOR_URL = "https://api.%s.onelogin.com/api/2/connectors/%s"
40
+
41
+ # Apps URL
42
+
43
+ # V1
44
+ GET_APPS_URL_V1 = "https://api.%s.onelogin.com/api/1/apps"
45
+
46
+ # V2
47
+ GET_APPS_URL = "https://api.%s.onelogin.com/api/2/apps"
48
+ CREATE_APP_URL = "https://api.%s.onelogin.com/api/2/apps"
49
+ GET_APP_URL = "https://api.%s.onelogin.com/api/2/apps/%s"
50
+ UPDATE_APP_URL = "https://api.%s.onelogin.com/api/2/apps/%s"
51
+ DELETE_APP_URL = "https://api.%s.onelogin.com/api/2/apps/%s"
52
+ DELETE_APP_PARAMETER_URL = "https://api.%s.onelogin.com/api/2/apps/%s/parameters/%s"
35
53
 
36
54
  # Role URLs
37
55
  GET_ROLES_URL = "https://api.%s.onelogin.com/api/1/roles"
@@ -1,3 +1,3 @@
1
1
  module OneLogin
2
- VERSION = "1.3.1"
2
+ VERSION = "1.6.0"
3
3
  end
data/onelogin.gemspec CHANGED
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
39
39
  spec.add_runtime_dependency('httparty', '>=0.13.7')
40
40
  spec.add_runtime_dependency('nokogiri', '>=1.6.3.1')
41
41
 
42
- spec.add_development_dependency "bundler", "~> 1.15"
42
+ spec.add_development_dependency "bundler"
43
43
  spec.add_development_dependency "rake", "~> 10.0"
44
44
  spec.add_development_dependency "rspec", "~> 3.0"
45
- end
45
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onelogin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OneLogin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-29 00:00:00.000000000 Z
11
+ date: 2022-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.15'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.15'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -90,6 +90,7 @@ extra_rdoc_files:
90
90
  - LICENSE
91
91
  - README.md
92
92
  files:
93
+ - ".github/workflows/git-secrets-public.yml"
93
94
  - ".gitignore"
94
95
  - ".travis.yml"
95
96
  - CODE_OF_CONDUCT.md
@@ -103,8 +104,10 @@ files:
103
104
  - examples/Gemfile.lock
104
105
  - examples/README.md
105
106
  - examples/all-users-to-csv.rb
107
+ - examples/another-get-all-login-events-of-last-day-to-csv.rb
106
108
  - examples/create-user.rb
107
109
  - examples/events-to-csv.rb
110
+ - examples/get-all-login-events-of-last-day-to-csv.rb
108
111
  - examples/last-app-user-login-to-csv.rb
109
112
  - examples/list-users.rb
110
113
  - examples/rails-custom-login-page/.gitignore
@@ -153,6 +156,7 @@ files:
153
156
  - examples/rails-custom-login-page/app/views/users/index.html.erb
154
157
  - examples/rails-custom-login-page/app/views/users/index.json.jbuilder
155
158
  - examples/rails-custom-login-page/app/views/users/new.html.erb
159
+ - examples/rails-custom-login-page/app/views/users/onboard.html.erb
156
160
  - examples/rails-custom-login-page/app/views/users/show.html.erb
157
161
  - examples/rails-custom-login-page/app/views/users/show.json.jbuilder
158
162
  - examples/rails-custom-login-page/bin/bundle
@@ -219,6 +223,7 @@ files:
219
223
  - lib/onelogin/api/models.rb
220
224
  - lib/onelogin/api/models/app.rb
221
225
  - lib/onelogin/api/models/auth_factor.rb
226
+ - lib/onelogin/api/models/connector_basic.rb
222
227
  - lib/onelogin/api/models/device.rb
223
228
  - lib/onelogin/api/models/embed_app.rb
224
229
  - lib/onelogin/api/models/event.rb
@@ -226,6 +231,10 @@ files:
226
231
  - lib/onelogin/api/models/factor_enrollment_response.rb
227
232
  - lib/onelogin/api/models/group.rb
228
233
  - lib/onelogin/api/models/mfa.rb
234
+ - lib/onelogin/api/models/mfa_token.rb
235
+ - lib/onelogin/api/models/onelogin_app.rb
236
+ - lib/onelogin/api/models/onelogin_app_basic.rb
237
+ - lib/onelogin/api/models/onelogin_app_v1.rb
229
238
  - lib/onelogin/api/models/onelogin_token.rb
230
239
  - lib/onelogin/api/models/otp_device.rb
231
240
  - lib/onelogin/api/models/privilege.rb
@@ -265,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
274
  version: '0'
266
275
  requirements: []
267
276
  rubyforge_project: http://www.rubygems.org/gems/onelogin-ruby-sdk
268
- rubygems_version: 2.2.2
277
+ rubygems_version: 2.5.2.1
269
278
  signing_key:
270
279
  specification_version: 4
271
280
  summary: OneLogin's Ruby SDK.