onelogin 1.2.0 → 1.2.1

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
2
  SHA1:
3
- metadata.gz: 891448f2f234475b2f392acef115af5b20424599
4
- data.tar.gz: 7ebc413eef700591b78c3654d194595994e5d5a6
3
+ metadata.gz: d58de3abd209ce7e6de060541a04cb2ccc403645
4
+ data.tar.gz: 01491005b2597087ba28e3cae0d4466129b4e453
5
5
  SHA512:
6
- metadata.gz: 01f1f2c8dae4fcfc8606ae68bd8c18d8d1a664fc857da76af5fe7a5f04eb2a7e46c25cab9b1643016d893dbf5bae065c0c1e7a2348e7eb72f818ef3a1d2d63d6
7
- data.tar.gz: b3fd44cb52795b239704b1879dd3d6695880705e52d32d6e7c52c2a9f37a260e3ede5ba36975d5d182ba57d8fccff72ce9edb65447a9aaaa3bfc50e4043a0b77
6
+ metadata.gz: b484d5d34ac1b711ce41d32c217ddaeefd19e2c8b55d057e02b560bf0146171a6a6956cbd1f0301ce215ef4bd3a7183535c30a11b8fd82e18715e1df358c8085
7
+ data.tar.gz: 326e7dc9c1485f2ba5322432038498e3bd8973f9b58e0847c612ad14a882a8cadbb74a58e2ff7cb7a42f8c318872a901a8466bc0f3418300ed4f02de5f199dce
data/README.md CHANGED
@@ -293,9 +293,6 @@ session_login_token_params = {
293
293
  }
294
294
  session_token_data = client.create_session_login_token(session_login_token_params)
295
295
 
296
- # Create Session Via API Token
297
- cookie = client..create_session_via_token(session_token_data.session_token)
298
-
299
296
  # Create Session Login Token MFA , after verify
300
297
  session_login_token_mfa_params = {
301
298
  username_or_email: "usermfa@example.com",
@@ -24,6 +24,12 @@ OptionParser.new do |opts|
24
24
  options[:since] = s.iso8601
25
25
  end
26
26
 
27
+ opts.on("-lLAST", "--LAST=LAST", Time, "Events since this many days ago") do |d|
28
+ now = Date.today
29
+ days_ago = (now - d)
30
+ options[:since] = days_ago.iso8601
31
+ end
32
+
27
33
  opts.on("-uUNTIL", "--UNTIL=UNTIL", Time, "Events before this date") do |u|
28
34
  options[:until] = u.iso8601
29
35
  end
@@ -35,18 +41,27 @@ OptionParser.new do |opts|
35
41
  opts.on("-tTYPE", "--type=TYPE", Integer, "Filter by event type id") do |t|
36
42
  options[:event_type_id] = t
37
43
  end
44
+
45
+ opts.on("-uTYPE", "--user=TYPE", Integer, "Filter by user id") do |u|
46
+ options[:user_id] = u
47
+ end
48
+
49
+ # Sort direction is done by adding a + or - before the field name that you want to sort on
50
+ opts.on("-zTYPE", "--sort=TYPE", String, "Sort by this field") do |s|
51
+ options[:sort] = s
52
+ end
38
53
  end.parse!
39
54
 
40
55
  # Fetch the events
41
56
  client = OneLogin::Api::Client.new(
42
- client_id: 'ONELOGIN_CLIENT_ID',
43
- client_secret: 'ONELOGIN_CLIENT_SECRET',
44
- region: 'us'
57
+ client_id: 'ONELOGIN_CLIENT_ID_GOES_HERE',
58
+ client_secret: 'ONELOGIN_CLIENT_SECRET_GOES_HERE',
59
+ region: 'us'
45
60
  )
46
61
 
47
62
  attribute_names = ['id', 'created_at', 'account_id', 'user_id', 'user_name', 'event_type_id',
48
63
  'notes', 'ipaddr', 'actor_user_id', 'actor_user_name', 'assuming_acting_user_id',
49
- 'role_id', 'role_name', 'app_id', 'group_id', 'group_name', 'otp_device_id',
64
+ 'role_id', 'role_name', 'app_id', 'app_name', 'group_id', 'group_name', 'otp_device_id',
50
65
  'otp_device_name', 'policy_id', 'policy_name', 'actor_system', 'custom_message',
51
66
  'operation_name', 'directory_sync_run_id', 'directory_id', 'resolution', 'client_id',
52
67
  'resource_type_id', 'error_description']
@@ -68,6 +83,7 @@ CSV.open('events.csv', 'wb') do |csv|
68
83
  # fetch the events
69
84
  client.get_events(options).take(limit).each do |event|
70
85
  csv << attribute_names.map { |attribute_name| event.send(attribute_name) }
86
+ counter += 1
71
87
  end
72
88
  end
73
89
 
@@ -1006,44 +1006,6 @@ module OneLogin
1006
1006
  nil
1007
1007
  end
1008
1008
 
1009
- # Post a session token to this API endpoint to start a session and set a cookie to log a user into an app.
1010
- #
1011
- # @param session_token [String] The session token
1012
- #
1013
- # @return [String] return the 'Set-Cookie' value of the HTTP Header if any
1014
- #
1015
- # @see {https://developers.onelogin.com/api-docs/1/login-page/create-session-via-token Create Session Via API Token documentation}
1016
- def create_session_via_token(session_token)
1017
- clean_error
1018
-
1019
- begin
1020
- url = url_for(SESSION_API_TOKEN_URL)
1021
-
1022
- data = {
1023
- 'session_token'=> session_token
1024
- }
1025
-
1026
- response = HTTParty.post(
1027
- url,
1028
- headers: headers,
1029
- body: data.to_json
1030
- )
1031
-
1032
- if response.code == 200
1033
- if response.headers.key?('Set-Cookie')
1034
- return response.headers['Set-Cookie']
1035
- end
1036
- else
1037
- @error = response.code.to_s
1038
- @error_description = extract_error_message_from_response(response)
1039
- end
1040
- rescue Exception => e
1041
- @error = '500'
1042
- @error_description = e.message
1043
- end
1044
-
1045
- nil
1046
- end
1047
1009
 
1048
1010
  ################
1049
1011
  # Role Methods #
@@ -6,7 +6,7 @@ module OneLogin
6
6
 
7
7
  attr_accessor :id, :created_at, :account_id, :user_id, :user_name, :event_type_id,
8
8
  :notes, :ipaddr, :actor_user_id, :actor_user_name, :assuming_acting_user_id,
9
- :role_id, :role_name, :app_id, :group_id, :group_name, :otp_device_id,
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
12
  :resource_type_id, :error_description
@@ -26,6 +26,7 @@ module OneLogin
26
26
  @role_id = data['role_id']
27
27
  @role_name = data['role_name'].to_s
28
28
  @app_id = data['app_id']
29
+ @app_name = data['app_name'].to_s
29
30
  @group_id = data['group_id']
30
31
  @group_name = data['group_name'].to_s
31
32
  @otp_device_id = data['otp_device_id']
@@ -38,6 +38,7 @@ module OneLogin
38
38
  @trusted_idp_id = data['trusted_idp_id']
39
39
  @activated_at = data['activated_at']? Time.iso8601(data['activated_at']) : nil
40
40
  @created_at = data['created_at']? Time.iso8601(data['created_at']) : nil
41
+ @updated_at = data['updated_at']? Time.iso8601(data['updated_at']) : nil
41
42
  @password_changed_at = data['password_changed_at']? Time.iso8601(data['password_changed_at']) : nil
42
43
  @invitation_sent_at = data['invitation_sent_at']? Time.iso8601(data['invitation_sent_at']) : nil
43
44
  @invalid_login_attempts = data['invalid_login_attempts']
@@ -22,7 +22,6 @@ module OneLogin
22
22
  CREATE_USER_URL = "https://api.%s.onelogin.com/api/1/users"
23
23
  SESSION_LOGIN_TOKEN_URL = "https://api.%s.onelogin.com/api/1/login/auth"
24
24
  GET_TOKEN_VERIFY_FACTOR = "https://api.%s.onelogin.com/api/1/login/verify_factor"
25
- SESSION_API_TOKEN_URL = "https://admin.%s.onelogin.com/session_via_api_token"
26
25
  UPDATE_USER_URL = "https://api.%s.onelogin.com/api/1/users/%s"
27
26
  DELETE_USER_URL = "https://api.%s.onelogin.com/api/1/users/%s"
28
27
  ADD_ROLE_TO_USER_URL = "https://api.%s.onelogin.com/api/1/users/%s/add_roles"
@@ -1,3 +1,3 @@
1
1
  module OneLogin
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
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.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OneLogin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-07 00:00:00.000000000 Z
11
+ date: 2018-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -260,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
260
  version: '0'
261
261
  requirements: []
262
262
  rubyforge_project: http://www.rubygems.org/gems/onelogin-ruby-sdk
263
- rubygems_version: 2.4.8
263
+ rubygems_version: 2.2.2
264
264
  signing_key:
265
265
  specification_version: 4
266
266
  summary: OneLogin's Ruby SDK.