login_radius 11.0.0 → 11.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +21 -21
- data/README.md +58 -58
- data/lib/login_radius/api/account/account_api.rb +581 -581
- data/lib/login_radius/api/account/role_api.rb +330 -330
- data/lib/login_radius/api/account/sott_api.rb +47 -47
- data/lib/login_radius/api/advanced/configuration_api.rb +57 -57
- data/lib/login_radius/api/advanced/consent_management_api.rb +161 -161
- data/lib/login_radius/api/advanced/custom_object_api.rb +316 -316
- data/lib/login_radius/api/advanced/custom_registration_data_api.rb +195 -195
- data/lib/login_radius/api/advanced/multi_factor_authentication_api.rb +942 -606
- data/lib/login_radius/api/advanced/re_authentication_api.rb +317 -243
- data/lib/login_radius/api/advanced/web_hook_api.rb +101 -101
- data/lib/login_radius/api/authentication/authentication_api.rb +1036 -989
- data/lib/login_radius/api/authentication/one_touch_login_api.rb +160 -160
- data/lib/login_radius/api/authentication/password_less_login_api.rb +202 -158
- data/lib/login_radius/api/authentication/phone_authentication_api.rb +329 -329
- data/lib/login_radius/api/authentication/pin_authentication_api.rb +316 -316
- data/lib/login_radius/api/authentication/risk_based_authentication_api.rb +286 -286
- data/lib/login_radius/api/authentication/smart_login_api.rb +146 -146
- data/lib/login_radius/api/social/native_social_api.rb +255 -255
- data/lib/login_radius/api/social/social_api.rb +784 -806
- data/lib/login_radius/error.rb +7 -7
- data/lib/login_radius/request_client.rb +311 -295
- data/lib/login_radius/response.rb +18 -12
- data/lib/login_radius/version.rb +2 -2
- data/lib/login_radius.rb +30 -30
- data/login_radius.gemspec +25 -28
- metadata +7 -7
@@ -1,581 +1,581 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Created by LoginRadius Development Team
|
4
|
-
# Copyright 2019 LoginRadius Inc. All rights reserved.
|
5
|
-
require_relative '../../request_client'
|
6
|
-
|
7
|
-
module LoginRadius
|
8
|
-
# AccountApi module
|
9
|
-
class AccountApi
|
10
|
-
include RequestClient
|
11
|
-
|
12
|
-
attr_accessor :site_name, :api_key, :api_secret
|
13
|
-
|
14
|
-
# Initializes a LoginRadius Account object with an apikey and secret
|
15
|
-
# Takes in a hash containing site_name(required), api_key(required), api_secret(required)
|
16
|
-
def initialize
|
17
|
-
@site_name = ENV['SITE_NAME']
|
18
|
-
@api_key = ENV['API_KEY']
|
19
|
-
@api_secret = ENV['API_SECRET']
|
20
|
-
raise LoginRadius::Error.new, "'site_name' is a required option for Account class initialization." \
|
21
|
-
unless @site_name != '' && @site_name != nil
|
22
|
-
raise LoginRadius::Error.new, "'api_key' is a required option for Account class initialization." \
|
23
|
-
unless @api_key != '' && @api_key != nil
|
24
|
-
raise LoginRadius::Error.new, "'api_secret is a required option for Account class initialization." \
|
25
|
-
unless @api_secret != '' && @api_secret != nil
|
26
|
-
end
|
27
|
-
|
28
|
-
# This API is used to retrieve all of the accepted Policies by the user, associated with their UID.
|
29
|
-
#
|
30
|
-
# @param uid - UID, the unified identifier for each user account
|
31
|
-
#
|
32
|
-
# @return Complete Policy History data
|
33
|
-
# 15.1.1
|
34
|
-
def get_privacy_policy_history_by_uid(uid)
|
35
|
-
if isNullOrWhiteSpace(uid)
|
36
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
37
|
-
end
|
38
|
-
|
39
|
-
query_parameters = {}
|
40
|
-
query_parameters['apiKey'] = @api_key
|
41
|
-
query_parameters['apiSecret'] = @api_secret
|
42
|
-
|
43
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/privacypolicy/history'
|
44
|
-
get_request(resource_path, query_parameters,
|
45
|
-
end
|
46
|
-
|
47
|
-
# This API is used to create an account in Cloud Storage. This API bypass the normal email verification process and manually creates the user. <br><br>In order to use this API, you need to format a JSON request body with all of the mandatory fields
|
48
|
-
#
|
49
|
-
# @param account_create_model - Model Class containing Definition of payload for Account Create API
|
50
|
-
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
51
|
-
#
|
52
|
-
# @return Response containing Definition for Complete profile data
|
53
|
-
# 18.1
|
54
|
-
def create_account(account_create_model, fields = '')
|
55
|
-
if account_create_model.blank?
|
56
|
-
raise LoginRadius::Error.new, getValidationMessage('account_create_model')
|
57
|
-
end
|
58
|
-
|
59
|
-
query_parameters = {}
|
60
|
-
query_parameters['apiKey'] = @api_key
|
61
|
-
query_parameters['apiSecret'] = @api_secret
|
62
|
-
unless isNullOrWhiteSpace(fields)
|
63
|
-
query_parameters['fields'] = fields
|
64
|
-
end
|
65
|
-
|
66
|
-
resource_path = 'identity/v2/manage/account'
|
67
|
-
post_request(resource_path, query_parameters, account_create_model)
|
68
|
-
end
|
69
|
-
|
70
|
-
# This API is used to retrieve all of the profile data, associated with the specified account by email in Cloud Storage.
|
71
|
-
#
|
72
|
-
# @param email - Email of the user
|
73
|
-
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
74
|
-
#
|
75
|
-
# @return Response containing Definition for Complete profile data
|
76
|
-
# 18.2
|
77
|
-
def get_account_profile_by_email(email, fields = '')
|
78
|
-
if isNullOrWhiteSpace(email)
|
79
|
-
raise LoginRadius::Error.new, getValidationMessage('email')
|
80
|
-
end
|
81
|
-
|
82
|
-
query_parameters = {}
|
83
|
-
query_parameters['apiKey'] = @api_key
|
84
|
-
query_parameters['apiSecret'] = @api_secret
|
85
|
-
query_parameters['email'] = email
|
86
|
-
unless isNullOrWhiteSpace(fields)
|
87
|
-
query_parameters['fields'] = fields
|
88
|
-
end
|
89
|
-
|
90
|
-
resource_path = 'identity/v2/manage/account'
|
91
|
-
get_request(resource_path, query_parameters,
|
92
|
-
end
|
93
|
-
|
94
|
-
# This API is used to retrieve all of the profile data associated with the specified account by user name in Cloud Storage.
|
95
|
-
#
|
96
|
-
# @param user_name - UserName of the user
|
97
|
-
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
98
|
-
#
|
99
|
-
# @return Response containing Definition for Complete profile data
|
100
|
-
# 18.3
|
101
|
-
def get_account_profile_by_user_name(user_name, fields = '')
|
102
|
-
if isNullOrWhiteSpace(user_name)
|
103
|
-
raise LoginRadius::Error.new, getValidationMessage('user_name')
|
104
|
-
end
|
105
|
-
|
106
|
-
query_parameters = {}
|
107
|
-
query_parameters['apiKey'] = @api_key
|
108
|
-
query_parameters['apiSecret'] = @api_secret
|
109
|
-
query_parameters['userName'] = user_name
|
110
|
-
unless isNullOrWhiteSpace(fields)
|
111
|
-
query_parameters['fields'] = fields
|
112
|
-
end
|
113
|
-
|
114
|
-
resource_path = 'identity/v2/manage/account'
|
115
|
-
get_request(resource_path, query_parameters,
|
116
|
-
end
|
117
|
-
|
118
|
-
# This API is used to retrieve all of the profile data, associated with the account by phone number in Cloud Storage.
|
119
|
-
#
|
120
|
-
# @param phone - The Registered Phone Number
|
121
|
-
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
122
|
-
#
|
123
|
-
# @return Response containing Definition for Complete profile data
|
124
|
-
# 18.4
|
125
|
-
def get_account_profile_by_phone(phone, fields = '')
|
126
|
-
if isNullOrWhiteSpace(phone)
|
127
|
-
raise LoginRadius::Error.new, getValidationMessage('phone')
|
128
|
-
end
|
129
|
-
|
130
|
-
query_parameters = {}
|
131
|
-
query_parameters['apiKey'] = @api_key
|
132
|
-
query_parameters['apiSecret'] = @api_secret
|
133
|
-
query_parameters['phone'] = phone
|
134
|
-
unless isNullOrWhiteSpace(fields)
|
135
|
-
query_parameters['fields'] = fields
|
136
|
-
end
|
137
|
-
|
138
|
-
resource_path = 'identity/v2/manage/account'
|
139
|
-
get_request(resource_path, query_parameters,
|
140
|
-
end
|
141
|
-
|
142
|
-
# This API is used to retrieve all of the profile data, associated with the account by uid in Cloud Storage.
|
143
|
-
#
|
144
|
-
# @param uid - UID, the unified identifier for each user account
|
145
|
-
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
146
|
-
#
|
147
|
-
# @return Response containing Definition for Complete profile data
|
148
|
-
# 18.5
|
149
|
-
def get_account_profile_by_uid(uid, fields = '')
|
150
|
-
if isNullOrWhiteSpace(uid)
|
151
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
152
|
-
end
|
153
|
-
|
154
|
-
query_parameters = {}
|
155
|
-
query_parameters['apiKey'] = @api_key
|
156
|
-
query_parameters['apiSecret'] = @api_secret
|
157
|
-
unless isNullOrWhiteSpace(fields)
|
158
|
-
query_parameters['fields'] = fields
|
159
|
-
end
|
160
|
-
|
161
|
-
resource_path = 'identity/v2/manage/account/' + uid
|
162
|
-
get_request(resource_path, query_parameters,
|
163
|
-
end
|
164
|
-
|
165
|
-
# This API is used to update the information of existing accounts in your Cloud Storage. See our Advanced API Usage section <a href='https://www.loginradius.com/docs/api/v2/customer-identity-api/advanced-api-usage/'>Here</a> for more capabilities.
|
166
|
-
#
|
167
|
-
# @param account_user_profile_update_model - Model Class containing Definition of payload for Account Update API
|
168
|
-
# @param uid - UID, the unified identifier for each user account
|
169
|
-
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
170
|
-
# @param null_support - Boolean, pass true if you wish to update any user profile field with a NULL value, You can get the details
|
171
|
-
#
|
172
|
-
# @return Response containing Definition for Complete profile data
|
173
|
-
# 18.15
|
174
|
-
def update_account_by_uid(account_user_profile_update_model, uid, fields = '', null_support = false)
|
175
|
-
if account_user_profile_update_model.blank?
|
176
|
-
raise LoginRadius::Error.new, getValidationMessage('account_user_profile_update_model')
|
177
|
-
end
|
178
|
-
if isNullOrWhiteSpace(uid)
|
179
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
180
|
-
end
|
181
|
-
|
182
|
-
query_parameters = {}
|
183
|
-
query_parameters['apiKey'] = @api_key
|
184
|
-
query_parameters['apiSecret'] = @api_secret
|
185
|
-
unless isNullOrWhiteSpace(fields)
|
186
|
-
query_parameters['fields'] = fields
|
187
|
-
end
|
188
|
-
unless null_support == false
|
189
|
-
query_parameters['nullSupport'] = null_support
|
190
|
-
end
|
191
|
-
|
192
|
-
resource_path = 'identity/v2/manage/account/' + uid
|
193
|
-
put_request(resource_path, query_parameters, account_user_profile_update_model)
|
194
|
-
end
|
195
|
-
|
196
|
-
# This API is used to update the PhoneId by using the Uid's. Admin can update the PhoneId's for both the verified and unverified profiles. It will directly replace the PhoneId and bypass the OTP verification process.
|
197
|
-
#
|
198
|
-
# @param phone - Phone number
|
199
|
-
# @param uid - UID, the unified identifier for each user account
|
200
|
-
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
201
|
-
#
|
202
|
-
# @return Response containing Definition for Complete profile data
|
203
|
-
# 18.16
|
204
|
-
def update_phone_id_by_uid(phone, uid, fields = '')
|
205
|
-
if isNullOrWhiteSpace(phone)
|
206
|
-
raise LoginRadius::Error.new, getValidationMessage('phone')
|
207
|
-
end
|
208
|
-
if isNullOrWhiteSpace(uid)
|
209
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
210
|
-
end
|
211
|
-
|
212
|
-
query_parameters = {}
|
213
|
-
query_parameters['apiKey'] = @api_key
|
214
|
-
query_parameters['apiSecret'] = @api_secret
|
215
|
-
unless isNullOrWhiteSpace(fields)
|
216
|
-
query_parameters['fields'] = fields
|
217
|
-
end
|
218
|
-
|
219
|
-
body_parameters = {}
|
220
|
-
body_parameters['phone'] = phone
|
221
|
-
|
222
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/phoneid'
|
223
|
-
put_request(resource_path, query_parameters, body_parameters)
|
224
|
-
end
|
225
|
-
|
226
|
-
# This API use to retrive the hashed password of a specified account in Cloud Storage.
|
227
|
-
#
|
228
|
-
# @param uid - UID, the unified identifier for each user account
|
229
|
-
#
|
230
|
-
# @return Response containing Definition for Complete PasswordHash data
|
231
|
-
# 18.17
|
232
|
-
def get_account_password_hash_by_uid(uid)
|
233
|
-
if isNullOrWhiteSpace(uid)
|
234
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
235
|
-
end
|
236
|
-
|
237
|
-
query_parameters = {}
|
238
|
-
query_parameters['apiKey'] = @api_key
|
239
|
-
query_parameters['apiSecret'] = @api_secret
|
240
|
-
|
241
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/password'
|
242
|
-
get_request(resource_path, query_parameters,
|
243
|
-
end
|
244
|
-
|
245
|
-
# This API is used to set the password of an account in Cloud Storage.
|
246
|
-
#
|
247
|
-
# @param password - New password
|
248
|
-
# @param uid - UID, the unified identifier for each user account
|
249
|
-
#
|
250
|
-
# @return Response containing Definition for Complete PasswordHash data
|
251
|
-
# 18.18
|
252
|
-
def set_account_password_by_uid(password, uid)
|
253
|
-
if isNullOrWhiteSpace(password)
|
254
|
-
raise LoginRadius::Error.new, getValidationMessage('password')
|
255
|
-
end
|
256
|
-
if isNullOrWhiteSpace(uid)
|
257
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
258
|
-
end
|
259
|
-
|
260
|
-
query_parameters = {}
|
261
|
-
query_parameters['apiKey'] = @api_key
|
262
|
-
query_parameters['apiSecret'] = @api_secret
|
263
|
-
|
264
|
-
body_parameters = {}
|
265
|
-
body_parameters['password'] = password
|
266
|
-
|
267
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/password'
|
268
|
-
put_request(resource_path, query_parameters, body_parameters)
|
269
|
-
end
|
270
|
-
|
271
|
-
# This API deletes the Users account and allows them to re-register for a new account.
|
272
|
-
#
|
273
|
-
# @param uid - UID, the unified identifier for each user account
|
274
|
-
#
|
275
|
-
# @return Response containing Definition of Delete Request
|
276
|
-
# 18.19
|
277
|
-
def delete_account_by_uid(uid)
|
278
|
-
if isNullOrWhiteSpace(uid)
|
279
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
280
|
-
end
|
281
|
-
|
282
|
-
query_parameters = {}
|
283
|
-
query_parameters['apiKey'] = @api_key
|
284
|
-
query_parameters['apiSecret'] = @api_secret
|
285
|
-
|
286
|
-
resource_path = 'identity/v2/manage/account/' + uid
|
287
|
-
delete_request(resource_path, query_parameters,
|
288
|
-
end
|
289
|
-
|
290
|
-
# This API is used to invalidate the Email Verification status on an account.
|
291
|
-
#
|
292
|
-
# @param uid - UID, the unified identifier for each user account
|
293
|
-
# @param email_template - Email template name
|
294
|
-
# @param verification_url - Email verification url
|
295
|
-
#
|
296
|
-
# @return Response containing Definition of Complete Validation data
|
297
|
-
# 18.20
|
298
|
-
def invalidate_account_email_verification(uid, email_template = '', verification_url = '')
|
299
|
-
if isNullOrWhiteSpace(uid)
|
300
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
301
|
-
end
|
302
|
-
|
303
|
-
query_parameters = {}
|
304
|
-
query_parameters['apiKey'] = @api_key
|
305
|
-
query_parameters['apiSecret'] = @api_secret
|
306
|
-
unless isNullOrWhiteSpace(email_template)
|
307
|
-
query_parameters['emailTemplate'] = email_template
|
308
|
-
end
|
309
|
-
unless isNullOrWhiteSpace(verification_url)
|
310
|
-
query_parameters['verificationUrl'] = verification_url
|
311
|
-
end
|
312
|
-
|
313
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/invalidateemail'
|
314
|
-
put_request(resource_path, query_parameters,
|
315
|
-
end
|
316
|
-
|
317
|
-
# This API Returns a Forgot Password Token it can also be used to send a Forgot Password email to the customer. Note: If you have the UserName workflow enabled, you may replace the 'email' parameter with 'username' in the body.
|
318
|
-
#
|
319
|
-
# @param email - user's email
|
320
|
-
# @param email_template - Email template name
|
321
|
-
# @param reset_password_url - Url to which user should get re-directed to for resetting the password
|
322
|
-
# @param send_email - If set to true, the API will also send a Forgot Password email to the customer, bypassing any Bot Protection challenges that they are faced with.
|
323
|
-
#
|
324
|
-
# @return Response containing Definition of Complete Forgot Password data
|
325
|
-
# 18.22
|
326
|
-
def get_forgot_password_token(email, email_template = '', reset_password_url = '', send_email = false)
|
327
|
-
if isNullOrWhiteSpace(email)
|
328
|
-
raise LoginRadius::Error.new, getValidationMessage('email')
|
329
|
-
end
|
330
|
-
|
331
|
-
query_parameters = {}
|
332
|
-
query_parameters['apiKey'] = @api_key
|
333
|
-
query_parameters['apiSecret'] = @api_secret
|
334
|
-
unless isNullOrWhiteSpace(email_template)
|
335
|
-
query_parameters['emailTemplate'] = email_template
|
336
|
-
end
|
337
|
-
unless isNullOrWhiteSpace(reset_password_url)
|
338
|
-
query_parameters['resetPasswordUrl'] = reset_password_url
|
339
|
-
end
|
340
|
-
unless send_email == false
|
341
|
-
query_parameters['sendEmail'] = send_email
|
342
|
-
end
|
343
|
-
|
344
|
-
body_parameters = {}
|
345
|
-
body_parameters['email'] = email
|
346
|
-
|
347
|
-
resource_path = 'identity/v2/manage/account/forgot/token'
|
348
|
-
post_request(resource_path, query_parameters, body_parameters)
|
349
|
-
end
|
350
|
-
|
351
|
-
# This API Returns an Email Verification token.
|
352
|
-
#
|
353
|
-
# @param email - user's email
|
354
|
-
#
|
355
|
-
# @return Response containing Definition of Complete Verification data
|
356
|
-
# 18.23
|
357
|
-
def get_email_verification_token(email)
|
358
|
-
if isNullOrWhiteSpace(email)
|
359
|
-
raise LoginRadius::Error.new, getValidationMessage('email')
|
360
|
-
end
|
361
|
-
|
362
|
-
query_parameters = {}
|
363
|
-
query_parameters['apiKey'] = @api_key
|
364
|
-
query_parameters['apiSecret'] = @api_secret
|
365
|
-
|
366
|
-
body_parameters = {}
|
367
|
-
body_parameters['email'] = email
|
368
|
-
|
369
|
-
resource_path = 'identity/v2/manage/account/verify/token'
|
370
|
-
post_request(resource_path, query_parameters, body_parameters)
|
371
|
-
end
|
372
|
-
|
373
|
-
# The API is used to get LoginRadius access token based on UID.
|
374
|
-
#
|
375
|
-
# @param uid - UID, the unified identifier for each user account
|
376
|
-
#
|
377
|
-
# @return Response containing Definition of Complete Token data
|
378
|
-
# 18.24
|
379
|
-
def get_access_token_by_uid(uid)
|
380
|
-
if isNullOrWhiteSpace(uid)
|
381
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
382
|
-
end
|
383
|
-
|
384
|
-
query_parameters = {}
|
385
|
-
query_parameters['apiKey'] = @api_key
|
386
|
-
query_parameters['apiSecret'] = @api_secret
|
387
|
-
query_parameters['uid'] = uid
|
388
|
-
|
389
|
-
resource_path = 'identity/v2/manage/account/access_token'
|
390
|
-
get_request(resource_path, query_parameters,
|
391
|
-
end
|
392
|
-
|
393
|
-
# This API Allows you to reset the phone no verification of an end user’s account.
|
394
|
-
#
|
395
|
-
# @param uid - UID, the unified identifier for each user account
|
396
|
-
# @param sms_template - SMS Template name
|
397
|
-
#
|
398
|
-
# @return Response containing Definition of Complete Validation data
|
399
|
-
# 18.27
|
400
|
-
def reset_phone_id_verification_by_uid(uid, sms_template = '')
|
401
|
-
if isNullOrWhiteSpace(uid)
|
402
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
403
|
-
end
|
404
|
-
|
405
|
-
query_parameters = {}
|
406
|
-
query_parameters['apiKey'] = @api_key
|
407
|
-
query_parameters['apiSecret'] = @api_secret
|
408
|
-
unless isNullOrWhiteSpace(sms_template)
|
409
|
-
query_parameters['smsTemplate'] = sms_template
|
410
|
-
end
|
411
|
-
|
412
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/invalidatephone'
|
413
|
-
put_request(resource_path, query_parameters,
|
414
|
-
end
|
415
|
-
|
416
|
-
# This API is used to add/upsert another emails in account profile by different-different email types. If the email type is same then it will simply update the existing email, otherwise it will add a new email in Email array.
|
417
|
-
#
|
418
|
-
# @param upsert_email_model - Model Class containing Definition of payload for UpsertEmail Property
|
419
|
-
# @param uid - UID, the unified identifier for each user account
|
420
|
-
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
421
|
-
#
|
422
|
-
# @return Response containing Definition for Complete profile data
|
423
|
-
# 18.29
|
424
|
-
def upsert_email(upsert_email_model, uid, fields = '')
|
425
|
-
if upsert_email_model.blank?
|
426
|
-
raise LoginRadius::Error.new, getValidationMessage('upsert_email_model')
|
427
|
-
end
|
428
|
-
if isNullOrWhiteSpace(uid)
|
429
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
430
|
-
end
|
431
|
-
|
432
|
-
query_parameters = {}
|
433
|
-
query_parameters['apiKey'] = @api_key
|
434
|
-
query_parameters['apiSecret'] = @api_secret
|
435
|
-
unless isNullOrWhiteSpace(fields)
|
436
|
-
query_parameters['fields'] = fields
|
437
|
-
end
|
438
|
-
|
439
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/email'
|
440
|
-
put_request(resource_path, query_parameters, upsert_email_model)
|
441
|
-
end
|
442
|
-
|
443
|
-
# Use this API to Remove emails from a user Account
|
444
|
-
#
|
445
|
-
# @param email - user's email
|
446
|
-
# @param uid - UID, the unified identifier for each user account
|
447
|
-
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
448
|
-
#
|
449
|
-
# @return Response containing Definition for Complete profile data
|
450
|
-
# 18.30
|
451
|
-
def remove_email(email, uid, fields = '')
|
452
|
-
if isNullOrWhiteSpace(email)
|
453
|
-
raise LoginRadius::Error.new, getValidationMessage('email')
|
454
|
-
end
|
455
|
-
if isNullOrWhiteSpace(uid)
|
456
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
457
|
-
end
|
458
|
-
|
459
|
-
query_parameters = {}
|
460
|
-
query_parameters['apiKey'] = @api_key
|
461
|
-
query_parameters['apiSecret'] = @api_secret
|
462
|
-
unless isNullOrWhiteSpace(fields)
|
463
|
-
query_parameters['fields'] = fields
|
464
|
-
end
|
465
|
-
|
466
|
-
body_parameters = {}
|
467
|
-
body_parameters['email'] = email
|
468
|
-
|
469
|
-
resource_path = 'identity/v2/manage/account/' + uid + '/email'
|
470
|
-
delete_request(resource_path, query_parameters, body_parameters)
|
471
|
-
end
|
472
|
-
|
473
|
-
# This API is used to refresh an access token via it's associated refresh token.
|
474
|
-
#
|
475
|
-
# @param refresh__token - LoginRadius refresh token
|
476
|
-
#
|
477
|
-
# @return Response containing Definition of Complete Token data
|
478
|
-
# 18.31
|
479
|
-
def refresh_access_token_by_refresh_token(refresh__token)
|
480
|
-
if isNullOrWhiteSpace(refresh__token)
|
481
|
-
raise LoginRadius::Error.new, getValidationMessage('refresh__token')
|
482
|
-
end
|
483
|
-
|
484
|
-
query_parameters = {}
|
485
|
-
query_parameters['apiKey'] = @api_key
|
486
|
-
query_parameters['apiSecret'] = @api_secret
|
487
|
-
query_parameters['refresh_Token'] = refresh__token
|
488
|
-
|
489
|
-
resource_path = 'identity/v2/manage/account/access_token/refresh'
|
490
|
-
get_request(resource_path, query_parameters,
|
491
|
-
end
|
492
|
-
|
493
|
-
# The Revoke Refresh Access Token API is used to revoke a refresh token or the Provider Access Token, revoking an existing refresh token will invalidate the refresh token but the associated access token will work until the expiry.
|
494
|
-
#
|
495
|
-
# @param refresh__token - LoginRadius refresh token
|
496
|
-
#
|
497
|
-
# @return Response containing Definition of Delete Request
|
498
|
-
# 18.32
|
499
|
-
def revoke_refresh_token(refresh__token)
|
500
|
-
if isNullOrWhiteSpace(refresh__token)
|
501
|
-
raise LoginRadius::Error.new, getValidationMessage('refresh__token')
|
502
|
-
end
|
503
|
-
|
504
|
-
query_parameters = {}
|
505
|
-
query_parameters['apiKey'] = @api_key
|
506
|
-
query_parameters['apiSecret'] = @api_secret
|
507
|
-
query_parameters['refresh_Token'] = refresh__token
|
508
|
-
|
509
|
-
resource_path = 'identity/v2/manage/account/access_token/refresh/revoke'
|
510
|
-
get_request(resource_path, query_parameters,
|
511
|
-
end
|
512
|
-
|
513
|
-
# Note: This is intended for specific workflows where an email may be associated to multiple UIDs. This API is used to retrieve all of the identities (UID and Profiles), associated with a specified email in Cloud Storage.
|
514
|
-
#
|
515
|
-
# @param email - Email of the user
|
516
|
-
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
517
|
-
#
|
518
|
-
# @return Complete user Identity data
|
519
|
-
# 18.35
|
520
|
-
def get_account_identities_by_email(email, fields = '')
|
521
|
-
if isNullOrWhiteSpace(email)
|
522
|
-
raise LoginRadius::Error.new, getValidationMessage('email')
|
523
|
-
end
|
524
|
-
|
525
|
-
query_parameters = {}
|
526
|
-
query_parameters['apiKey'] = @api_key
|
527
|
-
query_parameters['apiSecret'] = @api_secret
|
528
|
-
query_parameters['email'] = email
|
529
|
-
unless isNullOrWhiteSpace(fields)
|
530
|
-
query_parameters['fields'] = fields
|
531
|
-
end
|
532
|
-
|
533
|
-
resource_path = 'identity/v2/manage/account/identities'
|
534
|
-
get_request(resource_path, query_parameters,
|
535
|
-
end
|
536
|
-
|
537
|
-
# This API is used to delete all user profiles associated with an Email.
|
538
|
-
#
|
539
|
-
# @param email - Email of the user
|
540
|
-
#
|
541
|
-
# @return Response containing Definition of Delete Request
|
542
|
-
# 18.36
|
543
|
-
def account_delete_by_email(email)
|
544
|
-
if isNullOrWhiteSpace(email)
|
545
|
-
raise LoginRadius::Error.new, getValidationMessage('email')
|
546
|
-
end
|
547
|
-
|
548
|
-
query_parameters = {}
|
549
|
-
query_parameters['apiKey'] = @api_key
|
550
|
-
query_parameters['apiSecret'] = @api_secret
|
551
|
-
query_parameters['email'] = email
|
552
|
-
|
553
|
-
resource_path = 'identity/v2/manage/account'
|
554
|
-
delete_request(resource_path, query_parameters,
|
555
|
-
end
|
556
|
-
|
557
|
-
# This API is used to update a user's Uid. It will update all profiles, custom objects and consent management logs associated with the Uid.
|
558
|
-
#
|
559
|
-
# @param update_uid_model - Payload containing Update UID
|
560
|
-
# @param uid - UID, the unified identifier for each user account
|
561
|
-
#
|
562
|
-
# @return Response containing Definition of Complete Validation data
|
563
|
-
# 18.41
|
564
|
-
def account_update_uid(update_uid_model, uid)
|
565
|
-
if update_uid_model.blank?
|
566
|
-
raise LoginRadius::Error.new, getValidationMessage('update_uid_model')
|
567
|
-
end
|
568
|
-
if isNullOrWhiteSpace(uid)
|
569
|
-
raise LoginRadius::Error.new, getValidationMessage('uid')
|
570
|
-
end
|
571
|
-
|
572
|
-
query_parameters = {}
|
573
|
-
query_parameters['apiKey'] = @api_key
|
574
|
-
query_parameters['apiSecret'] = @api_secret
|
575
|
-
query_parameters['uid'] = uid
|
576
|
-
|
577
|
-
resource_path = 'identity/v2/manage/account/uid'
|
578
|
-
put_request(resource_path, query_parameters, update_uid_model)
|
579
|
-
end
|
580
|
-
end
|
581
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Created by LoginRadius Development Team
|
4
|
+
# Copyright 2019 LoginRadius Inc. All rights reserved.
|
5
|
+
require_relative '../../request_client'
|
6
|
+
|
7
|
+
module LoginRadius
|
8
|
+
# AccountApi module
|
9
|
+
class AccountApi
|
10
|
+
include RequestClient
|
11
|
+
|
12
|
+
attr_accessor :site_name, :api_key, :api_secret
|
13
|
+
|
14
|
+
# Initializes a LoginRadius Account object with an apikey and secret
|
15
|
+
# Takes in a hash containing site_name(required), api_key(required), api_secret(required)
|
16
|
+
def initialize
|
17
|
+
@site_name = ENV['SITE_NAME']
|
18
|
+
@api_key = ENV['API_KEY']
|
19
|
+
@api_secret = ENV['API_SECRET']
|
20
|
+
raise LoginRadius::Error.new, "'site_name' is a required option for Account class initialization." \
|
21
|
+
unless @site_name != '' && @site_name != nil
|
22
|
+
raise LoginRadius::Error.new, "'api_key' is a required option for Account class initialization." \
|
23
|
+
unless @api_key != '' && @api_key != nil
|
24
|
+
raise LoginRadius::Error.new, "'api_secret is a required option for Account class initialization." \
|
25
|
+
unless @api_secret != '' && @api_secret != nil
|
26
|
+
end
|
27
|
+
|
28
|
+
# This API is used to retrieve all of the accepted Policies by the user, associated with their UID.
|
29
|
+
#
|
30
|
+
# @param uid - UID, the unified identifier for each user account
|
31
|
+
#
|
32
|
+
# @return Complete Policy History data
|
33
|
+
# 15.1.1
|
34
|
+
def get_privacy_policy_history_by_uid(uid)
|
35
|
+
if isNullOrWhiteSpace(uid)
|
36
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
37
|
+
end
|
38
|
+
|
39
|
+
query_parameters = {}
|
40
|
+
query_parameters['apiKey'] = @api_key
|
41
|
+
query_parameters['apiSecret'] = @api_secret
|
42
|
+
|
43
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/privacypolicy/history'
|
44
|
+
get_request(resource_path, query_parameters, {})
|
45
|
+
end
|
46
|
+
|
47
|
+
# This API is used to create an account in Cloud Storage. This API bypass the normal email verification process and manually creates the user. <br><br>In order to use this API, you need to format a JSON request body with all of the mandatory fields
|
48
|
+
#
|
49
|
+
# @param account_create_model - Model Class containing Definition of payload for Account Create API
|
50
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
51
|
+
#
|
52
|
+
# @return Response containing Definition for Complete profile data
|
53
|
+
# 18.1
|
54
|
+
def create_account(account_create_model, fields = '')
|
55
|
+
if account_create_model.blank?
|
56
|
+
raise LoginRadius::Error.new, getValidationMessage('account_create_model')
|
57
|
+
end
|
58
|
+
|
59
|
+
query_parameters = {}
|
60
|
+
query_parameters['apiKey'] = @api_key
|
61
|
+
query_parameters['apiSecret'] = @api_secret
|
62
|
+
unless isNullOrWhiteSpace(fields)
|
63
|
+
query_parameters['fields'] = fields
|
64
|
+
end
|
65
|
+
|
66
|
+
resource_path = 'identity/v2/manage/account'
|
67
|
+
post_request(resource_path, query_parameters, account_create_model)
|
68
|
+
end
|
69
|
+
|
70
|
+
# This API is used to retrieve all of the profile data, associated with the specified account by email in Cloud Storage.
|
71
|
+
#
|
72
|
+
# @param email - Email of the user
|
73
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
74
|
+
#
|
75
|
+
# @return Response containing Definition for Complete profile data
|
76
|
+
# 18.2
|
77
|
+
def get_account_profile_by_email(email, fields = '')
|
78
|
+
if isNullOrWhiteSpace(email)
|
79
|
+
raise LoginRadius::Error.new, getValidationMessage('email')
|
80
|
+
end
|
81
|
+
|
82
|
+
query_parameters = {}
|
83
|
+
query_parameters['apiKey'] = @api_key
|
84
|
+
query_parameters['apiSecret'] = @api_secret
|
85
|
+
query_parameters['email'] = email
|
86
|
+
unless isNullOrWhiteSpace(fields)
|
87
|
+
query_parameters['fields'] = fields
|
88
|
+
end
|
89
|
+
|
90
|
+
resource_path = 'identity/v2/manage/account'
|
91
|
+
get_request(resource_path, query_parameters, {})
|
92
|
+
end
|
93
|
+
|
94
|
+
# This API is used to retrieve all of the profile data associated with the specified account by user name in Cloud Storage.
|
95
|
+
#
|
96
|
+
# @param user_name - UserName of the user
|
97
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
98
|
+
#
|
99
|
+
# @return Response containing Definition for Complete profile data
|
100
|
+
# 18.3
|
101
|
+
def get_account_profile_by_user_name(user_name, fields = '')
|
102
|
+
if isNullOrWhiteSpace(user_name)
|
103
|
+
raise LoginRadius::Error.new, getValidationMessage('user_name')
|
104
|
+
end
|
105
|
+
|
106
|
+
query_parameters = {}
|
107
|
+
query_parameters['apiKey'] = @api_key
|
108
|
+
query_parameters['apiSecret'] = @api_secret
|
109
|
+
query_parameters['userName'] = user_name
|
110
|
+
unless isNullOrWhiteSpace(fields)
|
111
|
+
query_parameters['fields'] = fields
|
112
|
+
end
|
113
|
+
|
114
|
+
resource_path = 'identity/v2/manage/account'
|
115
|
+
get_request(resource_path, query_parameters, {})
|
116
|
+
end
|
117
|
+
|
118
|
+
# This API is used to retrieve all of the profile data, associated with the account by phone number in Cloud Storage.
|
119
|
+
#
|
120
|
+
# @param phone - The Registered Phone Number
|
121
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
122
|
+
#
|
123
|
+
# @return Response containing Definition for Complete profile data
|
124
|
+
# 18.4
|
125
|
+
def get_account_profile_by_phone(phone, fields = '')
|
126
|
+
if isNullOrWhiteSpace(phone)
|
127
|
+
raise LoginRadius::Error.new, getValidationMessage('phone')
|
128
|
+
end
|
129
|
+
|
130
|
+
query_parameters = {}
|
131
|
+
query_parameters['apiKey'] = @api_key
|
132
|
+
query_parameters['apiSecret'] = @api_secret
|
133
|
+
query_parameters['phone'] = phone
|
134
|
+
unless isNullOrWhiteSpace(fields)
|
135
|
+
query_parameters['fields'] = fields
|
136
|
+
end
|
137
|
+
|
138
|
+
resource_path = 'identity/v2/manage/account'
|
139
|
+
get_request(resource_path, query_parameters, {})
|
140
|
+
end
|
141
|
+
|
142
|
+
# This API is used to retrieve all of the profile data, associated with the account by uid in Cloud Storage.
|
143
|
+
#
|
144
|
+
# @param uid - UID, the unified identifier for each user account
|
145
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
146
|
+
#
|
147
|
+
# @return Response containing Definition for Complete profile data
|
148
|
+
# 18.5
|
149
|
+
def get_account_profile_by_uid(uid, fields = '')
|
150
|
+
if isNullOrWhiteSpace(uid)
|
151
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
152
|
+
end
|
153
|
+
|
154
|
+
query_parameters = {}
|
155
|
+
query_parameters['apiKey'] = @api_key
|
156
|
+
query_parameters['apiSecret'] = @api_secret
|
157
|
+
unless isNullOrWhiteSpace(fields)
|
158
|
+
query_parameters['fields'] = fields
|
159
|
+
end
|
160
|
+
|
161
|
+
resource_path = 'identity/v2/manage/account/' + uid
|
162
|
+
get_request(resource_path, query_parameters, {})
|
163
|
+
end
|
164
|
+
|
165
|
+
# This API is used to update the information of existing accounts in your Cloud Storage. See our Advanced API Usage section <a href='https://www.loginradius.com/docs/api/v2/customer-identity-api/advanced-api-usage/'>Here</a> for more capabilities.
|
166
|
+
#
|
167
|
+
# @param account_user_profile_update_model - Model Class containing Definition of payload for Account Update API
|
168
|
+
# @param uid - UID, the unified identifier for each user account
|
169
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
170
|
+
# @param null_support - Boolean, pass true if you wish to update any user profile field with a NULL value, You can get the details
|
171
|
+
#
|
172
|
+
# @return Response containing Definition for Complete profile data
|
173
|
+
# 18.15
|
174
|
+
def update_account_by_uid(account_user_profile_update_model, uid, fields = '', null_support = false)
|
175
|
+
if account_user_profile_update_model.blank?
|
176
|
+
raise LoginRadius::Error.new, getValidationMessage('account_user_profile_update_model')
|
177
|
+
end
|
178
|
+
if isNullOrWhiteSpace(uid)
|
179
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
180
|
+
end
|
181
|
+
|
182
|
+
query_parameters = {}
|
183
|
+
query_parameters['apiKey'] = @api_key
|
184
|
+
query_parameters['apiSecret'] = @api_secret
|
185
|
+
unless isNullOrWhiteSpace(fields)
|
186
|
+
query_parameters['fields'] = fields
|
187
|
+
end
|
188
|
+
unless null_support == false
|
189
|
+
query_parameters['nullSupport'] = null_support
|
190
|
+
end
|
191
|
+
|
192
|
+
resource_path = 'identity/v2/manage/account/' + uid
|
193
|
+
put_request(resource_path, query_parameters, account_user_profile_update_model)
|
194
|
+
end
|
195
|
+
|
196
|
+
# This API is used to update the PhoneId by using the Uid's. Admin can update the PhoneId's for both the verified and unverified profiles. It will directly replace the PhoneId and bypass the OTP verification process.
|
197
|
+
#
|
198
|
+
# @param phone - Phone number
|
199
|
+
# @param uid - UID, the unified identifier for each user account
|
200
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
201
|
+
#
|
202
|
+
# @return Response containing Definition for Complete profile data
|
203
|
+
# 18.16
|
204
|
+
def update_phone_id_by_uid(phone, uid, fields = '')
|
205
|
+
if isNullOrWhiteSpace(phone)
|
206
|
+
raise LoginRadius::Error.new, getValidationMessage('phone')
|
207
|
+
end
|
208
|
+
if isNullOrWhiteSpace(uid)
|
209
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
210
|
+
end
|
211
|
+
|
212
|
+
query_parameters = {}
|
213
|
+
query_parameters['apiKey'] = @api_key
|
214
|
+
query_parameters['apiSecret'] = @api_secret
|
215
|
+
unless isNullOrWhiteSpace(fields)
|
216
|
+
query_parameters['fields'] = fields
|
217
|
+
end
|
218
|
+
|
219
|
+
body_parameters = {}
|
220
|
+
body_parameters['phone'] = phone
|
221
|
+
|
222
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/phoneid'
|
223
|
+
put_request(resource_path, query_parameters, body_parameters)
|
224
|
+
end
|
225
|
+
|
226
|
+
# This API use to retrive the hashed password of a specified account in Cloud Storage.
|
227
|
+
#
|
228
|
+
# @param uid - UID, the unified identifier for each user account
|
229
|
+
#
|
230
|
+
# @return Response containing Definition for Complete PasswordHash data
|
231
|
+
# 18.17
|
232
|
+
def get_account_password_hash_by_uid(uid)
|
233
|
+
if isNullOrWhiteSpace(uid)
|
234
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
235
|
+
end
|
236
|
+
|
237
|
+
query_parameters = {}
|
238
|
+
query_parameters['apiKey'] = @api_key
|
239
|
+
query_parameters['apiSecret'] = @api_secret
|
240
|
+
|
241
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/password'
|
242
|
+
get_request(resource_path, query_parameters, {})
|
243
|
+
end
|
244
|
+
|
245
|
+
# This API is used to set the password of an account in Cloud Storage.
|
246
|
+
#
|
247
|
+
# @param password - New password
|
248
|
+
# @param uid - UID, the unified identifier for each user account
|
249
|
+
#
|
250
|
+
# @return Response containing Definition for Complete PasswordHash data
|
251
|
+
# 18.18
|
252
|
+
def set_account_password_by_uid(password, uid)
|
253
|
+
if isNullOrWhiteSpace(password)
|
254
|
+
raise LoginRadius::Error.new, getValidationMessage('password')
|
255
|
+
end
|
256
|
+
if isNullOrWhiteSpace(uid)
|
257
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
258
|
+
end
|
259
|
+
|
260
|
+
query_parameters = {}
|
261
|
+
query_parameters['apiKey'] = @api_key
|
262
|
+
query_parameters['apiSecret'] = @api_secret
|
263
|
+
|
264
|
+
body_parameters = {}
|
265
|
+
body_parameters['password'] = password
|
266
|
+
|
267
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/password'
|
268
|
+
put_request(resource_path, query_parameters, body_parameters)
|
269
|
+
end
|
270
|
+
|
271
|
+
# This API deletes the Users account and allows them to re-register for a new account.
|
272
|
+
#
|
273
|
+
# @param uid - UID, the unified identifier for each user account
|
274
|
+
#
|
275
|
+
# @return Response containing Definition of Delete Request
|
276
|
+
# 18.19
|
277
|
+
def delete_account_by_uid(uid)
|
278
|
+
if isNullOrWhiteSpace(uid)
|
279
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
280
|
+
end
|
281
|
+
|
282
|
+
query_parameters = {}
|
283
|
+
query_parameters['apiKey'] = @api_key
|
284
|
+
query_parameters['apiSecret'] = @api_secret
|
285
|
+
|
286
|
+
resource_path = 'identity/v2/manage/account/' + uid
|
287
|
+
delete_request(resource_path, query_parameters, {})
|
288
|
+
end
|
289
|
+
|
290
|
+
# This API is used to invalidate the Email Verification status on an account.
|
291
|
+
#
|
292
|
+
# @param uid - UID, the unified identifier for each user account
|
293
|
+
# @param email_template - Email template name
|
294
|
+
# @param verification_url - Email verification url
|
295
|
+
#
|
296
|
+
# @return Response containing Definition of Complete Validation data
|
297
|
+
# 18.20
|
298
|
+
def invalidate_account_email_verification(uid, email_template = '', verification_url = '')
|
299
|
+
if isNullOrWhiteSpace(uid)
|
300
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
301
|
+
end
|
302
|
+
|
303
|
+
query_parameters = {}
|
304
|
+
query_parameters['apiKey'] = @api_key
|
305
|
+
query_parameters['apiSecret'] = @api_secret
|
306
|
+
unless isNullOrWhiteSpace(email_template)
|
307
|
+
query_parameters['emailTemplate'] = email_template
|
308
|
+
end
|
309
|
+
unless isNullOrWhiteSpace(verification_url)
|
310
|
+
query_parameters['verificationUrl'] = verification_url
|
311
|
+
end
|
312
|
+
|
313
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/invalidateemail'
|
314
|
+
put_request(resource_path, query_parameters, {})
|
315
|
+
end
|
316
|
+
|
317
|
+
# This API Returns a Forgot Password Token it can also be used to send a Forgot Password email to the customer. Note: If you have the UserName workflow enabled, you may replace the 'email' parameter with 'username' in the body.
|
318
|
+
#
|
319
|
+
# @param email - user's email
|
320
|
+
# @param email_template - Email template name
|
321
|
+
# @param reset_password_url - Url to which user should get re-directed to for resetting the password
|
322
|
+
# @param send_email - If set to true, the API will also send a Forgot Password email to the customer, bypassing any Bot Protection challenges that they are faced with.
|
323
|
+
#
|
324
|
+
# @return Response containing Definition of Complete Forgot Password data
|
325
|
+
# 18.22
|
326
|
+
def get_forgot_password_token(email, email_template = '', reset_password_url = '', send_email = false)
|
327
|
+
if isNullOrWhiteSpace(email)
|
328
|
+
raise LoginRadius::Error.new, getValidationMessage('email')
|
329
|
+
end
|
330
|
+
|
331
|
+
query_parameters = {}
|
332
|
+
query_parameters['apiKey'] = @api_key
|
333
|
+
query_parameters['apiSecret'] = @api_secret
|
334
|
+
unless isNullOrWhiteSpace(email_template)
|
335
|
+
query_parameters['emailTemplate'] = email_template
|
336
|
+
end
|
337
|
+
unless isNullOrWhiteSpace(reset_password_url)
|
338
|
+
query_parameters['resetPasswordUrl'] = reset_password_url
|
339
|
+
end
|
340
|
+
unless send_email == false
|
341
|
+
query_parameters['sendEmail'] = send_email
|
342
|
+
end
|
343
|
+
|
344
|
+
body_parameters = {}
|
345
|
+
body_parameters['email'] = email
|
346
|
+
|
347
|
+
resource_path = 'identity/v2/manage/account/forgot/token'
|
348
|
+
post_request(resource_path, query_parameters, body_parameters)
|
349
|
+
end
|
350
|
+
|
351
|
+
# This API Returns an Email Verification token.
|
352
|
+
#
|
353
|
+
# @param email - user's email
|
354
|
+
#
|
355
|
+
# @return Response containing Definition of Complete Verification data
|
356
|
+
# 18.23
|
357
|
+
def get_email_verification_token(email)
|
358
|
+
if isNullOrWhiteSpace(email)
|
359
|
+
raise LoginRadius::Error.new, getValidationMessage('email')
|
360
|
+
end
|
361
|
+
|
362
|
+
query_parameters = {}
|
363
|
+
query_parameters['apiKey'] = @api_key
|
364
|
+
query_parameters['apiSecret'] = @api_secret
|
365
|
+
|
366
|
+
body_parameters = {}
|
367
|
+
body_parameters['email'] = email
|
368
|
+
|
369
|
+
resource_path = 'identity/v2/manage/account/verify/token'
|
370
|
+
post_request(resource_path, query_parameters, body_parameters)
|
371
|
+
end
|
372
|
+
|
373
|
+
# The API is used to get LoginRadius access token based on UID.
|
374
|
+
#
|
375
|
+
# @param uid - UID, the unified identifier for each user account
|
376
|
+
#
|
377
|
+
# @return Response containing Definition of Complete Token data
|
378
|
+
# 18.24
|
379
|
+
def get_access_token_by_uid(uid)
|
380
|
+
if isNullOrWhiteSpace(uid)
|
381
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
382
|
+
end
|
383
|
+
|
384
|
+
query_parameters = {}
|
385
|
+
query_parameters['apiKey'] = @api_key
|
386
|
+
query_parameters['apiSecret'] = @api_secret
|
387
|
+
query_parameters['uid'] = uid
|
388
|
+
|
389
|
+
resource_path = 'identity/v2/manage/account/access_token'
|
390
|
+
get_request(resource_path, query_parameters, {})
|
391
|
+
end
|
392
|
+
|
393
|
+
# This API Allows you to reset the phone no verification of an end user’s account.
|
394
|
+
#
|
395
|
+
# @param uid - UID, the unified identifier for each user account
|
396
|
+
# @param sms_template - SMS Template name
|
397
|
+
#
|
398
|
+
# @return Response containing Definition of Complete Validation data
|
399
|
+
# 18.27
|
400
|
+
def reset_phone_id_verification_by_uid(uid, sms_template = '')
|
401
|
+
if isNullOrWhiteSpace(uid)
|
402
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
403
|
+
end
|
404
|
+
|
405
|
+
query_parameters = {}
|
406
|
+
query_parameters['apiKey'] = @api_key
|
407
|
+
query_parameters['apiSecret'] = @api_secret
|
408
|
+
unless isNullOrWhiteSpace(sms_template)
|
409
|
+
query_parameters['smsTemplate'] = sms_template
|
410
|
+
end
|
411
|
+
|
412
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/invalidatephone'
|
413
|
+
put_request(resource_path, query_parameters, {})
|
414
|
+
end
|
415
|
+
|
416
|
+
# This API is used to add/upsert another emails in account profile by different-different email types. If the email type is same then it will simply update the existing email, otherwise it will add a new email in Email array.
|
417
|
+
#
|
418
|
+
# @param upsert_email_model - Model Class containing Definition of payload for UpsertEmail Property
|
419
|
+
# @param uid - UID, the unified identifier for each user account
|
420
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
421
|
+
#
|
422
|
+
# @return Response containing Definition for Complete profile data
|
423
|
+
# 18.29
|
424
|
+
def upsert_email(upsert_email_model, uid, fields = '')
|
425
|
+
if upsert_email_model.blank?
|
426
|
+
raise LoginRadius::Error.new, getValidationMessage('upsert_email_model')
|
427
|
+
end
|
428
|
+
if isNullOrWhiteSpace(uid)
|
429
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
430
|
+
end
|
431
|
+
|
432
|
+
query_parameters = {}
|
433
|
+
query_parameters['apiKey'] = @api_key
|
434
|
+
query_parameters['apiSecret'] = @api_secret
|
435
|
+
unless isNullOrWhiteSpace(fields)
|
436
|
+
query_parameters['fields'] = fields
|
437
|
+
end
|
438
|
+
|
439
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/email'
|
440
|
+
put_request(resource_path, query_parameters, upsert_email_model)
|
441
|
+
end
|
442
|
+
|
443
|
+
# Use this API to Remove emails from a user Account
|
444
|
+
#
|
445
|
+
# @param email - user's email
|
446
|
+
# @param uid - UID, the unified identifier for each user account
|
447
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
448
|
+
#
|
449
|
+
# @return Response containing Definition for Complete profile data
|
450
|
+
# 18.30
|
451
|
+
def remove_email(email, uid, fields = '')
|
452
|
+
if isNullOrWhiteSpace(email)
|
453
|
+
raise LoginRadius::Error.new, getValidationMessage('email')
|
454
|
+
end
|
455
|
+
if isNullOrWhiteSpace(uid)
|
456
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
457
|
+
end
|
458
|
+
|
459
|
+
query_parameters = {}
|
460
|
+
query_parameters['apiKey'] = @api_key
|
461
|
+
query_parameters['apiSecret'] = @api_secret
|
462
|
+
unless isNullOrWhiteSpace(fields)
|
463
|
+
query_parameters['fields'] = fields
|
464
|
+
end
|
465
|
+
|
466
|
+
body_parameters = {}
|
467
|
+
body_parameters['email'] = email
|
468
|
+
|
469
|
+
resource_path = 'identity/v2/manage/account/' + uid + '/email'
|
470
|
+
delete_request(resource_path, query_parameters, body_parameters)
|
471
|
+
end
|
472
|
+
|
473
|
+
# This API is used to refresh an access token via it's associated refresh token.
|
474
|
+
#
|
475
|
+
# @param refresh__token - LoginRadius refresh token
|
476
|
+
#
|
477
|
+
# @return Response containing Definition of Complete Token data
|
478
|
+
# 18.31
|
479
|
+
def refresh_access_token_by_refresh_token(refresh__token)
|
480
|
+
if isNullOrWhiteSpace(refresh__token)
|
481
|
+
raise LoginRadius::Error.new, getValidationMessage('refresh__token')
|
482
|
+
end
|
483
|
+
|
484
|
+
query_parameters = {}
|
485
|
+
query_parameters['apiKey'] = @api_key
|
486
|
+
query_parameters['apiSecret'] = @api_secret
|
487
|
+
query_parameters['refresh_Token'] = refresh__token
|
488
|
+
|
489
|
+
resource_path = 'identity/v2/manage/account/access_token/refresh'
|
490
|
+
get_request(resource_path, query_parameters, {})
|
491
|
+
end
|
492
|
+
|
493
|
+
# The Revoke Refresh Access Token API is used to revoke a refresh token or the Provider Access Token, revoking an existing refresh token will invalidate the refresh token but the associated access token will work until the expiry.
|
494
|
+
#
|
495
|
+
# @param refresh__token - LoginRadius refresh token
|
496
|
+
#
|
497
|
+
# @return Response containing Definition of Delete Request
|
498
|
+
# 18.32
|
499
|
+
def revoke_refresh_token(refresh__token)
|
500
|
+
if isNullOrWhiteSpace(refresh__token)
|
501
|
+
raise LoginRadius::Error.new, getValidationMessage('refresh__token')
|
502
|
+
end
|
503
|
+
|
504
|
+
query_parameters = {}
|
505
|
+
query_parameters['apiKey'] = @api_key
|
506
|
+
query_parameters['apiSecret'] = @api_secret
|
507
|
+
query_parameters['refresh_Token'] = refresh__token
|
508
|
+
|
509
|
+
resource_path = 'identity/v2/manage/account/access_token/refresh/revoke'
|
510
|
+
get_request(resource_path, query_parameters, {})
|
511
|
+
end
|
512
|
+
|
513
|
+
# Note: This is intended for specific workflows where an email may be associated to multiple UIDs. This API is used to retrieve all of the identities (UID and Profiles), associated with a specified email in Cloud Storage.
|
514
|
+
#
|
515
|
+
# @param email - Email of the user
|
516
|
+
# @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
|
517
|
+
#
|
518
|
+
# @return Complete user Identity data
|
519
|
+
# 18.35
|
520
|
+
def get_account_identities_by_email(email, fields = '')
|
521
|
+
if isNullOrWhiteSpace(email)
|
522
|
+
raise LoginRadius::Error.new, getValidationMessage('email')
|
523
|
+
end
|
524
|
+
|
525
|
+
query_parameters = {}
|
526
|
+
query_parameters['apiKey'] = @api_key
|
527
|
+
query_parameters['apiSecret'] = @api_secret
|
528
|
+
query_parameters['email'] = email
|
529
|
+
unless isNullOrWhiteSpace(fields)
|
530
|
+
query_parameters['fields'] = fields
|
531
|
+
end
|
532
|
+
|
533
|
+
resource_path = 'identity/v2/manage/account/identities'
|
534
|
+
get_request(resource_path, query_parameters, {})
|
535
|
+
end
|
536
|
+
|
537
|
+
# This API is used to delete all user profiles associated with an Email.
|
538
|
+
#
|
539
|
+
# @param email - Email of the user
|
540
|
+
#
|
541
|
+
# @return Response containing Definition of Delete Request
|
542
|
+
# 18.36
|
543
|
+
def account_delete_by_email(email)
|
544
|
+
if isNullOrWhiteSpace(email)
|
545
|
+
raise LoginRadius::Error.new, getValidationMessage('email')
|
546
|
+
end
|
547
|
+
|
548
|
+
query_parameters = {}
|
549
|
+
query_parameters['apiKey'] = @api_key
|
550
|
+
query_parameters['apiSecret'] = @api_secret
|
551
|
+
query_parameters['email'] = email
|
552
|
+
|
553
|
+
resource_path = 'identity/v2/manage/account'
|
554
|
+
delete_request(resource_path, query_parameters, {})
|
555
|
+
end
|
556
|
+
|
557
|
+
# This API is used to update a user's Uid. It will update all profiles, custom objects and consent management logs associated with the Uid.
|
558
|
+
#
|
559
|
+
# @param update_uid_model - Payload containing Update UID
|
560
|
+
# @param uid - UID, the unified identifier for each user account
|
561
|
+
#
|
562
|
+
# @return Response containing Definition of Complete Validation data
|
563
|
+
# 18.41
|
564
|
+
def account_update_uid(update_uid_model, uid)
|
565
|
+
if update_uid_model.blank?
|
566
|
+
raise LoginRadius::Error.new, getValidationMessage('update_uid_model')
|
567
|
+
end
|
568
|
+
if isNullOrWhiteSpace(uid)
|
569
|
+
raise LoginRadius::Error.new, getValidationMessage('uid')
|
570
|
+
end
|
571
|
+
|
572
|
+
query_parameters = {}
|
573
|
+
query_parameters['apiKey'] = @api_key
|
574
|
+
query_parameters['apiSecret'] = @api_secret
|
575
|
+
query_parameters['uid'] = uid
|
576
|
+
|
577
|
+
resource_path = 'identity/v2/manage/account/uid'
|
578
|
+
put_request(resource_path, query_parameters, update_uid_model)
|
579
|
+
end
|
580
|
+
end
|
581
|
+
end
|