onelogin 1.2.2 → 1.2.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8069da07a08e3fe1e504af1a9fc63291976e91c0
4
- data.tar.gz: f042c302a74c09a7fd1b4b7ddc7e06de2b5d3220
3
+ metadata.gz: 35fa6e59d712be2d32a0f0226cb26748c38c5aef
4
+ data.tar.gz: 4bf1cd249892f17c680acc337ea57168582d9e90
5
5
  SHA512:
6
- metadata.gz: e57dbe81b5aed13dcac3a3eeef4fcc44daaccac3383d4e90703792100dff2e8010448e3b19b5e4b92c7c65bca0f15a68307d1a3715aa277d8cafeafb75b62f72
7
- data.tar.gz: 57ce0509e3f806865283cbd8ca091a316cb8a16cf69d34bd25249a1d60ec5f06ec61eb17f655184251682c49ecae42259ca0d88e50089bd8c804d1a70c9a88be
6
+ metadata.gz: edf073e14e440e6939e24088ca13876fa2724a9a7a4c277ed7c5d731ab913285a238beac455010fe7afeb8b7570b748d677e1db8ac74cb77d23ba3a213933025
7
+ data.tar.gz: d63150971c087549b2cd679c527475fcbb9e47c7b5b845da299d79afef349e44c4f5caaee7f01a2de0973488fd41ff89f8249c9c56fcc1759ce74e1bdf80e65c
@@ -353,11 +353,10 @@ module OneLogin
353
353
  model: OneLogin::Api::Models::User,
354
354
  headers: authorized_headers,
355
355
  max_results: @max_results,
356
- params: params,
357
- client: self.class
356
+ params: params
358
357
  }
359
358
 
360
- return Cursor.new(url_for(GET_USERS_URL), options)
359
+ return Cursor.new(self.class, url_for(GET_USERS_URL), options)
361
360
 
362
361
  rescue Exception => e
363
362
  @error = '500'
@@ -422,7 +421,7 @@ module OneLogin
422
421
  max_results: @max_results
423
422
  }
424
423
 
425
- return Cursor.new(url_for(GET_APPS_FOR_USER_URL, user_id), options)
424
+ return Cursor.new(self.class, url_for(GET_APPS_FOR_USER_URL, user_id), options)
426
425
 
427
426
  rescue Exception => e
428
427
  @error = '500'
@@ -979,9 +978,14 @@ module OneLogin
979
978
  raise "username_or_email, password and subdomain are required parameters"
980
979
  end
981
980
 
981
+ headers = authorized_headers
982
+ if allowed_origin
983
+ headers = headers.merge({ 'Custom-Allowed-Origin-Header-1' => allowed_origin })
984
+ end
985
+
982
986
  response = self.class.post(
983
987
  url,
984
- headers: authorized_headers.merge({ 'Custom-Allowed-Origin-Header-1' => allowed_origin }),
988
+ headers: headers,
985
989
  body: query_params.to_json
986
990
  )
987
991
 
@@ -1004,11 +1008,13 @@ module OneLogin
1004
1008
  # @param device_id [String] Provide the MFA device_id you are submitting for verification.
1005
1009
  # @param state_token [String] Provide the state_token associated with the MFA device_id you are submitting for verification.
1006
1010
  # @param otp_token [String] (Optional) Provide the OTP value for the MFA factor you are submitting for verification.
1011
+ # @param allowed_origin [String] (Optional) Required for CORS requests only. Set to the Origin URI from which you are allowed to send a request using CORS.
1012
+ # @param do_not_notify [String] (Optional) When verifying MFA via Protect Push, set this to true to stop additional push notifications being sent to the OneLogin Protect device.
1007
1013
  #
1008
1014
  # @return [SessionTokenInfo] if the action succeed
1009
1015
  #
1010
1016
  # @see {https://developers.onelogin.com/api-docs/1/users/verify-factor Verify Factor documentation}
1011
- def get_session_token_verified(device_id, state_token, otp_token=nil, allowed_origin='')
1017
+ def get_session_token_verified(device_id, state_token, otp_token=nil, allowed_origin='', do_not_notify=false)
1012
1018
  clean_error
1013
1019
  prepare_token
1014
1020
 
@@ -1017,16 +1023,22 @@ module OneLogin
1017
1023
 
1018
1024
  data = {
1019
1025
  'device_id'=> device_id.to_s,
1020
- 'state_token'=> state_token
1026
+ 'state_token'=> state_token,
1027
+ 'do_not_notify'=> do_not_notify
1021
1028
  }
1022
1029
 
1023
1030
  unless otp_token.nil? || otp_token.empty?
1024
1031
  data['otp_token'] = otp_token
1025
1032
  end
1026
1033
 
1034
+ headers = authorized_headers
1035
+ if allowed_origin
1036
+ headers = headers.merge({ 'Custom-Allowed-Origin-Header-1' => allowed_origin })
1037
+ end
1038
+
1027
1039
  response = self.class.post(
1028
1040
  url,
1029
- headers: authorized_headers.merge({ 'Custom-Allowed-Origin-Header-1' => allowed_origin }),
1041
+ headers: headers,
1030
1042
  body: data.to_json
1031
1043
  )
1032
1044
 
@@ -1068,7 +1080,7 @@ module OneLogin
1068
1080
  params: params
1069
1081
  }
1070
1082
 
1071
- return Cursor.new(url_for(GET_ROLES_URL), options)
1083
+ return Cursor.new(self.class, url_for(GET_ROLES_URL), options)
1072
1084
 
1073
1085
  rescue Exception => e
1074
1086
  @error = '500'
@@ -1134,7 +1146,7 @@ module OneLogin
1134
1146
  max_results: @max_results
1135
1147
  }
1136
1148
 
1137
- return Cursor.new(url_for(GET_EVENT_TYPES_URL), options)
1149
+ return Cursor.new(self.class, url_for(GET_EVENT_TYPES_URL), options)
1138
1150
 
1139
1151
  rescue Exception => e
1140
1152
  @error = '500'
@@ -1163,7 +1175,7 @@ module OneLogin
1163
1175
  params: params
1164
1176
  }
1165
1177
 
1166
- return Cursor.new(url_for(GET_EVENTS_URL), options)
1178
+ return Cursor.new(self.class, url_for(GET_EVENTS_URL), options)
1167
1179
 
1168
1180
  rescue Exception => e
1169
1181
  @error = '500'
@@ -1271,7 +1283,7 @@ module OneLogin
1271
1283
  params: params
1272
1284
  }
1273
1285
 
1274
- return Cursor.new(url_for(GET_GROUPS_URL), options)
1286
+ return Cursor.new(self.class, url_for(GET_GROUPS_URL), options)
1275
1287
 
1276
1288
  rescue Exception => e
1277
1289
  @error = '500'
@@ -1377,11 +1389,12 @@ module OneLogin
1377
1389
  # @param state_token [String] Provide the state_token associated with the MFA device_id you are submitting for verification.
1378
1390
  # @param otp_token [String] (Optional) Provide the OTP value for the MFA factor you are submitting for verification.
1379
1391
  # @param url_endpoint [String] (Optional) Specify an url where return the response.
1392
+ # @param do_not_notify [String] (Optional) When verifying MFA via Protect Push, set this to true to stop additional push notifications being sent to the OneLogin Protect device
1380
1393
  #
1381
1394
  # @return [SAMLEndpointResponse] object with an encoded SAMLResponse
1382
1395
  #
1383
1396
  # @see {https://developers.onelogin.com/api-docs/1/saml-assertions/verify-factor Verify Factor documentation}
1384
- def get_saml_assertion_verifying(app_id, device_id, state_token, otp_token=nil, url_endpoint=nil)
1397
+ def get_saml_assertion_verifying(app_id, device_id, state_token, otp_token=nil, url_endpoint=nil, do_not_notify=false)
1385
1398
  clean_error
1386
1399
  prepare_token
1387
1400
 
@@ -1396,7 +1409,8 @@ module OneLogin
1396
1409
  data = {
1397
1410
  'app_id'=> app_id,
1398
1411
  'device_id'=> device_id.to_s,
1399
- 'state_token'=> state_token
1412
+ 'state_token'=> state_token,
1413
+ 'do_not_notify'=> do_not_notify
1400
1414
  }
1401
1415
 
1402
1416
  unless otp_token.nil? || otp_token.empty?
@@ -11,7 +11,8 @@ class Cursor
11
11
  # @param url [String] The url of the API endpoint
12
12
  # @param options [Hash] Configuation options
13
13
  #
14
- def initialize(url, options = {})
14
+ def initialize(client, url, options = {})
15
+ @client = client
15
16
  @url = url
16
17
  @options = options
17
18
 
@@ -19,7 +20,6 @@ class Cursor
19
20
  @headers = options[:headers] || {}
20
21
  @params = options[:params] || {}
21
22
  @max_results = options[:max_results]
22
- @client = options[:client]
23
23
 
24
24
  @collection = []
25
25
  @after_cursor = options.fetch(:after_cursor, nil)
@@ -57,6 +57,7 @@ class Cursor
57
57
  )
58
58
 
59
59
  json = response.parsed_response
60
+
60
61
  results = json['data'].flatten
61
62
 
62
63
  @collection += if results_remaining < results.size
@@ -1,3 +1,3 @@
1
1
  module OneLogin
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
  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.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - OneLogin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-23 00:00:00.000000000 Z
11
+ date: 2018-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty