onelogin 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/git-secrets-public.yml +55 -0
- data/README.md +60 -2
- data/examples/Gemfile.lock +10 -6
- data/examples/another-get-all-login-events-of-last-day-to-csv.rb +141 -0
- data/examples/events-to-csv.rb +3 -3
- data/examples/get-all-login-events-of-last-day-to-csv.rb +88 -0
- data/examples/rails-custom-login-page/Gemfile +2 -2
- data/examples/rails-custom-login-page/Gemfile.lock +20 -16
- data/examples/rails-custom-login-page/README.md +32 -0
- data/examples/rails-custom-login-page/app/controllers/home_controller.rb +1 -0
- data/examples/rails-custom-login-page/app/views/dashboard/index.html.erb +2 -9
- data/examples/rails-custom-login-page/app/views/home/index.html.erb +71 -8
- data/examples/rails-custom-login-page/config/initializers/onelogin.rb +3 -1
- data/examples/rails-custom-login-page/config/secrets.yml.sample +2 -0
- data/lib/onelogin/api/client.rb +608 -16
- data/lib/onelogin/api/cursor.rb +4 -3
- data/lib/onelogin/api/models/connector_basic.rb +20 -0
- data/lib/onelogin/api/models/event.rb +1 -1
- data/lib/onelogin/api/models/onelogin_app.rb +46 -6
- data/lib/onelogin/api/models/onelogin_app_basic.rb +51 -0
- data/lib/onelogin/api/models/onelogin_app_v1.rb +22 -0
- data/lib/onelogin/api/models/user.rb +1 -1
- data/lib/onelogin/api/models.rb +3 -0
- data/lib/onelogin/api/util/constants.rb +15 -1
- data/lib/onelogin/version.rb +1 -1
- data/onelogin.gemspec +2 -2
- metadata +13 -7
data/lib/onelogin/api/cursor.rb
CHANGED
@@ -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, &
|
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']
|
@@ -4,17 +4,57 @@ module OneLogin
|
|
4
4
|
|
5
5
|
class OneLoginApp
|
6
6
|
|
7
|
-
attr_accessor :
|
8
|
-
|
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
|
9
14
|
|
10
15
|
def initialize(data)
|
11
|
-
@id = data['id']
|
12
|
-
@connector_id = data['connector_id']
|
13
16
|
@name = data['name']
|
14
|
-
@extension = data['extension']
|
15
|
-
@icon = data['icon']
|
16
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']
|
17
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
|
18
58
|
end
|
19
59
|
end
|
20
60
|
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
|
data/lib/onelogin/api/models.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
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'
|
@@ -7,7 +8,9 @@ require 'onelogin/api/models/factor_enrollment_response'
|
|
7
8
|
require 'onelogin/api/models/group'
|
8
9
|
require 'onelogin/api/models/mfa'
|
9
10
|
require 'onelogin/api/models/mfa_token'
|
11
|
+
require 'onelogin/api/models/onelogin_app_v1'
|
10
12
|
require 'onelogin/api/models/onelogin_app'
|
13
|
+
require 'onelogin/api/models/onelogin_app_basic'
|
11
14
|
require 'onelogin/api/models/onelogin_token'
|
12
15
|
require 'onelogin/api/models/otp_device'
|
13
16
|
require 'onelogin/api/models/privilege'
|
@@ -34,8 +34,22 @@ module OneLogin
|
|
34
34
|
LOCK_USER_URL = "https://api.%s.onelogin.com/api/1/users/%s/lock_user"
|
35
35
|
GENERATE_MFA_TOKEN_URL = "https://api.%s.onelogin.com/api/1/users/%s/mfa_token"
|
36
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
|
+
|
37
41
|
# Apps URL
|
38
|
-
|
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"
|
39
53
|
|
40
54
|
# Role URLs
|
41
55
|
GET_ROLES_URL = "https://api.%s.onelogin.com/api/1/roles"
|
data/lib/onelogin/version.rb
CHANGED
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"
|
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.
|
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:
|
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: '
|
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: '
|
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
|
@@ -220,6 +223,7 @@ files:
|
|
220
223
|
- lib/onelogin/api/models.rb
|
221
224
|
- lib/onelogin/api/models/app.rb
|
222
225
|
- lib/onelogin/api/models/auth_factor.rb
|
226
|
+
- lib/onelogin/api/models/connector_basic.rb
|
223
227
|
- lib/onelogin/api/models/device.rb
|
224
228
|
- lib/onelogin/api/models/embed_app.rb
|
225
229
|
- lib/onelogin/api/models/event.rb
|
@@ -229,6 +233,8 @@ files:
|
|
229
233
|
- lib/onelogin/api/models/mfa.rb
|
230
234
|
- lib/onelogin/api/models/mfa_token.rb
|
231
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
|
232
238
|
- lib/onelogin/api/models/onelogin_token.rb
|
233
239
|
- lib/onelogin/api/models/otp_device.rb
|
234
240
|
- lib/onelogin/api/models/privilege.rb
|
@@ -268,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
268
274
|
version: '0'
|
269
275
|
requirements: []
|
270
276
|
rubyforge_project: http://www.rubygems.org/gems/onelogin-ruby-sdk
|
271
|
-
rubygems_version: 2.
|
277
|
+
rubygems_version: 2.5.2.1
|
272
278
|
signing_key:
|
273
279
|
specification_version: 4
|
274
280
|
summary: OneLogin's Ruby SDK.
|