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,316 +1,316 @@
|
|
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
|
-
# PINAuthenticationApi module
|
9
|
-
class PINAuthenticationApi
|
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 login a user by pin and session token.
|
29
|
-
#
|
30
|
-
# @param login_by_pin_model - Model Class containing Definition of payload for LoginByPin API
|
31
|
-
# @param session_token - Session Token of user
|
32
|
-
#
|
33
|
-
# @return Response containing User Profile Data and access token
|
34
|
-
# 9.22
|
35
|
-
def pin_login(login_by_pin_model, session_token)
|
36
|
-
if login_by_pin_model.blank?
|
37
|
-
raise LoginRadius::Error.new, getValidationMessage('login_by_pin_model')
|
38
|
-
end
|
39
|
-
if isNullOrWhiteSpace(session_token)
|
40
|
-
raise LoginRadius::Error.new, getValidationMessage('session_token')
|
41
|
-
end
|
42
|
-
|
43
|
-
query_parameters = {}
|
44
|
-
query_parameters['apiKey'] = @api_key
|
45
|
-
query_parameters['session_token'] = session_token
|
46
|
-
|
47
|
-
resource_path = 'identity/v2/auth/login/pin'
|
48
|
-
post_request(resource_path, query_parameters, login_by_pin_model)
|
49
|
-
end
|
50
|
-
|
51
|
-
# This API sends the reset pin email to specified email address.
|
52
|
-
#
|
53
|
-
# @param forgot_pin_link_by_email_model - Model Class containing Definition for Forgot Pin Link By Email API
|
54
|
-
# @param email_template - Email template name
|
55
|
-
# @param reset_pin_url - Reset PIN Url
|
56
|
-
#
|
57
|
-
# @return Response containing Definition of Complete Validation data
|
58
|
-
# 42.1
|
59
|
-
def send_forgot_pin_email_by_email(forgot_pin_link_by_email_model, email_template = '', reset_pin_url = '')
|
60
|
-
if forgot_pin_link_by_email_model.blank?
|
61
|
-
raise LoginRadius::Error.new, getValidationMessage('forgot_pin_link_by_email_model')
|
62
|
-
end
|
63
|
-
|
64
|
-
query_parameters = {}
|
65
|
-
query_parameters['apiKey'] = @api_key
|
66
|
-
unless isNullOrWhiteSpace(email_template)
|
67
|
-
query_parameters['emailTemplate'] = email_template
|
68
|
-
end
|
69
|
-
unless isNullOrWhiteSpace(reset_pin_url)
|
70
|
-
query_parameters['resetPINUrl'] = reset_pin_url
|
71
|
-
end
|
72
|
-
|
73
|
-
resource_path = 'identity/v2/auth/pin/forgot/email'
|
74
|
-
post_request(resource_path, query_parameters, forgot_pin_link_by_email_model)
|
75
|
-
end
|
76
|
-
|
77
|
-
# This API sends the reset pin email using username.
|
78
|
-
#
|
79
|
-
# @param forgot_pin_link_by_user_name_model - Model Class containing Definition for Forgot Pin Link By UserName API
|
80
|
-
# @param email_template - Email template name
|
81
|
-
# @param reset_pin_url - Reset PIN Url
|
82
|
-
#
|
83
|
-
# @return Response containing Definition of Complete Validation data
|
84
|
-
# 42.2
|
85
|
-
def send_forgot_pin_email_by_username(forgot_pin_link_by_user_name_model, email_template = '', reset_pin_url = '')
|
86
|
-
if forgot_pin_link_by_user_name_model.blank?
|
87
|
-
raise LoginRadius::Error.new, getValidationMessage('forgot_pin_link_by_user_name_model')
|
88
|
-
end
|
89
|
-
|
90
|
-
query_parameters = {}
|
91
|
-
query_parameters['apiKey'] = @api_key
|
92
|
-
unless isNullOrWhiteSpace(email_template)
|
93
|
-
query_parameters['emailTemplate'] = email_template
|
94
|
-
end
|
95
|
-
unless isNullOrWhiteSpace(reset_pin_url)
|
96
|
-
query_parameters['resetPINUrl'] = reset_pin_url
|
97
|
-
end
|
98
|
-
|
99
|
-
resource_path = 'identity/v2/auth/pin/forgot/username'
|
100
|
-
post_request(resource_path, query_parameters, forgot_pin_link_by_user_name_model)
|
101
|
-
end
|
102
|
-
|
103
|
-
# This API is used to reset pin using reset token.
|
104
|
-
#
|
105
|
-
# @param reset_pin_by_reset_token - Model Class containing Definition of payload for Reset Pin By Reset Token API
|
106
|
-
#
|
107
|
-
# @return Response containing Definition of Complete Validation data
|
108
|
-
# 42.3
|
109
|
-
def reset_pin_by_reset_token(reset_pin_by_reset_token)
|
110
|
-
if reset_pin_by_reset_token.blank?
|
111
|
-
raise LoginRadius::Error.new, getValidationMessage('reset_pin_by_reset_token')
|
112
|
-
end
|
113
|
-
|
114
|
-
query_parameters = {}
|
115
|
-
query_parameters['apiKey'] = @api_key
|
116
|
-
|
117
|
-
resource_path = 'identity/v2/auth/pin/reset/token'
|
118
|
-
put_request(resource_path, query_parameters, reset_pin_by_reset_token)
|
119
|
-
end
|
120
|
-
|
121
|
-
# This API is used to reset pin using security question answer and email.
|
122
|
-
#
|
123
|
-
# @param reset_pin_by_security_question_answer_and_email_model - Model Class containing Definition of payload for Reset Pin By Security Question and Email API
|
124
|
-
#
|
125
|
-
# @return Response containing Definition of Complete Validation data
|
126
|
-
# 42.4
|
127
|
-
def reset_pin_by_email_and_security_answer(reset_pin_by_security_question_answer_and_email_model)
|
128
|
-
if reset_pin_by_security_question_answer_and_email_model.blank?
|
129
|
-
raise LoginRadius::Error.new, getValidationMessage('reset_pin_by_security_question_answer_and_email_model')
|
130
|
-
end
|
131
|
-
|
132
|
-
query_parameters = {}
|
133
|
-
query_parameters['apiKey'] = @api_key
|
134
|
-
|
135
|
-
resource_path = 'identity/v2/auth/pin/reset/securityanswer/email'
|
136
|
-
put_request(resource_path, query_parameters, reset_pin_by_security_question_answer_and_email_model)
|
137
|
-
end
|
138
|
-
|
139
|
-
# This API is used to reset pin using security question answer and username.
|
140
|
-
#
|
141
|
-
# @param reset_pin_by_security_question_answer_and_username_model - Model Class containing Definition of payload for Reset Pin By Security Question and UserName API
|
142
|
-
#
|
143
|
-
# @return Response containing Definition of Complete Validation data
|
144
|
-
# 42.5
|
145
|
-
def reset_pin_by_username_and_security_answer(reset_pin_by_security_question_answer_and_username_model)
|
146
|
-
if reset_pin_by_security_question_answer_and_username_model.blank?
|
147
|
-
raise LoginRadius::Error.new, getValidationMessage('reset_pin_by_security_question_answer_and_username_model')
|
148
|
-
end
|
149
|
-
|
150
|
-
query_parameters = {}
|
151
|
-
query_parameters['apiKey'] = @api_key
|
152
|
-
|
153
|
-
resource_path = 'identity/v2/auth/pin/reset/securityanswer/username'
|
154
|
-
put_request(resource_path, query_parameters, reset_pin_by_security_question_answer_and_username_model)
|
155
|
-
end
|
156
|
-
|
157
|
-
# This API is used to reset pin using security question answer and phone.
|
158
|
-
#
|
159
|
-
# @param reset_pin_by_security_question_answer_and_phone_model - Model Class containing Definition of payload for Reset Pin By Security Question and Phone API
|
160
|
-
#
|
161
|
-
# @return Response containing Definition of Complete Validation data
|
162
|
-
# 42.6
|
163
|
-
def reset_pin_by_phone_and_security_answer(reset_pin_by_security_question_answer_and_phone_model)
|
164
|
-
if reset_pin_by_security_question_answer_and_phone_model.blank?
|
165
|
-
raise LoginRadius::Error.new, getValidationMessage('reset_pin_by_security_question_answer_and_phone_model')
|
166
|
-
end
|
167
|
-
|
168
|
-
query_parameters = {}
|
169
|
-
query_parameters['apiKey'] = @api_key
|
170
|
-
|
171
|
-
resource_path = 'identity/v2/auth/pin/reset/securityanswer/phone'
|
172
|
-
put_request(resource_path, query_parameters, reset_pin_by_security_question_answer_and_phone_model)
|
173
|
-
end
|
174
|
-
|
175
|
-
# This API sends the OTP to specified phone number
|
176
|
-
#
|
177
|
-
# @param forgot_pin_otp_by_phone_model - Model Class containing Definition for Forgot Pin Otp By Phone API
|
178
|
-
# @param sms_template -
|
179
|
-
#
|
180
|
-
# @return Response Containing Validation Data and SMS Data
|
181
|
-
# 42.7
|
182
|
-
def send_forgot_pin_sms_by_phone(forgot_pin_otp_by_phone_model, sms_template = '')
|
183
|
-
if forgot_pin_otp_by_phone_model.blank?
|
184
|
-
raise LoginRadius::Error.new, getValidationMessage('forgot_pin_otp_by_phone_model')
|
185
|
-
end
|
186
|
-
|
187
|
-
query_parameters = {}
|
188
|
-
query_parameters['apiKey'] = @api_key
|
189
|
-
unless isNullOrWhiteSpace(sms_template)
|
190
|
-
query_parameters['smsTemplate'] = sms_template
|
191
|
-
end
|
192
|
-
|
193
|
-
resource_path = 'identity/v2/auth/pin/forgot/otp'
|
194
|
-
post_request(resource_path, query_parameters, forgot_pin_otp_by_phone_model)
|
195
|
-
end
|
196
|
-
|
197
|
-
# This API is used to change a user's PIN using access token.
|
198
|
-
#
|
199
|
-
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
200
|
-
# @param change_pin_model - Model Class containing Definition for change PIN Property
|
201
|
-
#
|
202
|
-
# @return Response containing Definition of Complete Validation data
|
203
|
-
# 42.8
|
204
|
-
def change_pin_by_access_token(access_token, change_pin_model)
|
205
|
-
if isNullOrWhiteSpace(access_token)
|
206
|
-
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
207
|
-
end
|
208
|
-
if change_pin_model.blank?
|
209
|
-
raise LoginRadius::Error.new, getValidationMessage('change_pin_model')
|
210
|
-
end
|
211
|
-
|
212
|
-
query_parameters = {}
|
213
|
-
query_parameters['access_token'] = access_token
|
214
|
-
query_parameters['apiKey'] = @api_key
|
215
|
-
|
216
|
-
resource_path = 'identity/v2/auth/pin/change'
|
217
|
-
put_request(resource_path, query_parameters, change_pin_model)
|
218
|
-
end
|
219
|
-
|
220
|
-
# This API is used to reset pin using phoneId and OTP.
|
221
|
-
#
|
222
|
-
# @param reset_pin_by_phone_and_otp_model - Model Class containing Definition of payload for Reset Pin By Phone and Otp API
|
223
|
-
#
|
224
|
-
# @return Response containing Definition of Complete Validation data
|
225
|
-
# 42.9
|
226
|
-
def reset_pin_by_phone_and_otp(reset_pin_by_phone_and_otp_model)
|
227
|
-
if reset_pin_by_phone_and_otp_model.blank?
|
228
|
-
raise LoginRadius::Error.new, getValidationMessage('reset_pin_by_phone_and_otp_model')
|
229
|
-
end
|
230
|
-
|
231
|
-
query_parameters = {}
|
232
|
-
query_parameters['apiKey'] = @api_key
|
233
|
-
|
234
|
-
resource_path = 'identity/v2/auth/pin/reset/otp/phone'
|
235
|
-
put_request(resource_path, query_parameters, reset_pin_by_phone_and_otp_model)
|
236
|
-
end
|
237
|
-
|
238
|
-
# This API is used to reset pin using email and OTP.
|
239
|
-
#
|
240
|
-
# @param reset_pin_by_email_and_otp_model - Model Class containing Definition of payload for Reset Pin By Email and Otp API
|
241
|
-
#
|
242
|
-
# @return Response containing Definition of Complete Validation data
|
243
|
-
# 42.10
|
244
|
-
def reset_pin_by_email_and_otp(reset_pin_by_email_and_otp_model)
|
245
|
-
if reset_pin_by_email_and_otp_model.blank?
|
246
|
-
raise LoginRadius::Error.new, getValidationMessage('reset_pin_by_email_and_otp_model')
|
247
|
-
end
|
248
|
-
|
249
|
-
query_parameters = {}
|
250
|
-
query_parameters['apiKey'] = @api_key
|
251
|
-
|
252
|
-
resource_path = 'identity/v2/auth/pin/reset/otp/email'
|
253
|
-
put_request(resource_path, query_parameters, reset_pin_by_email_and_otp_model)
|
254
|
-
end
|
255
|
-
|
256
|
-
# This API is used to reset pin using username and OTP.
|
257
|
-
#
|
258
|
-
# @param reset_pin_by_username_and_otp_model - Model Class containing Definition of payload for Reset Pin By Username and Otp API
|
259
|
-
#
|
260
|
-
# @return Response containing Definition of Complete Validation data
|
261
|
-
# 42.11
|
262
|
-
def reset_pin_by_username_and_otp(reset_pin_by_username_and_otp_model)
|
263
|
-
if reset_pin_by_username_and_otp_model.blank?
|
264
|
-
raise LoginRadius::Error.new, getValidationMessage('reset_pin_by_username_and_otp_model')
|
265
|
-
end
|
266
|
-
|
267
|
-
query_parameters = {}
|
268
|
-
query_parameters['apiKey'] = @api_key
|
269
|
-
|
270
|
-
resource_path = 'identity/v2/auth/pin/reset/otp/username'
|
271
|
-
put_request(resource_path, query_parameters, reset_pin_by_username_and_otp_model)
|
272
|
-
end
|
273
|
-
|
274
|
-
# This API is used to change a user's PIN using Pin Auth token.
|
275
|
-
#
|
276
|
-
# @param pin_required_model - Model Class containing Definition for PIN
|
277
|
-
# @param pin_auth_token - Pin Auth Token
|
278
|
-
#
|
279
|
-
# @return Response containing User Profile Data and access token
|
280
|
-
# 42.12
|
281
|
-
def set_pin_by_pin_auth_token(pin_required_model, pin_auth_token)
|
282
|
-
if pin_required_model.blank?
|
283
|
-
raise LoginRadius::Error.new, getValidationMessage('pin_required_model')
|
284
|
-
end
|
285
|
-
if isNullOrWhiteSpace(pin_auth_token)
|
286
|
-
raise LoginRadius::Error.new, getValidationMessage('pin_auth_token')
|
287
|
-
end
|
288
|
-
|
289
|
-
query_parameters = {}
|
290
|
-
query_parameters['apiKey'] = @api_key
|
291
|
-
query_parameters['pinAuthToken'] = pin_auth_token
|
292
|
-
|
293
|
-
resource_path = 'identity/v2/auth/pin/set/pinauthtoken'
|
294
|
-
post_request(resource_path, query_parameters, pin_required_model)
|
295
|
-
end
|
296
|
-
|
297
|
-
# This API is used to invalidate pin session token.
|
298
|
-
#
|
299
|
-
# @param session_token - Session Token of user
|
300
|
-
#
|
301
|
-
# @return Response containing Definition of Complete Validation data
|
302
|
-
# 44.1
|
303
|
-
def in_validate_pin_session_token(session_token)
|
304
|
-
if isNullOrWhiteSpace(session_token)
|
305
|
-
raise LoginRadius::Error.new, getValidationMessage('session_token')
|
306
|
-
end
|
307
|
-
|
308
|
-
query_parameters = {}
|
309
|
-
query_parameters['apiKey'] = @api_key
|
310
|
-
query_parameters['session_token'] = session_token
|
311
|
-
|
312
|
-
resource_path = 'identity/v2/auth/session_token/invalidate'
|
313
|
-
get_request(resource_path, query_parameters,
|
314
|
-
end
|
315
|
-
end
|
316
|
-
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
|
+
# PINAuthenticationApi module
|
9
|
+
class PINAuthenticationApi
|
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 login a user by pin and session token.
|
29
|
+
#
|
30
|
+
# @param login_by_pin_model - Model Class containing Definition of payload for LoginByPin API
|
31
|
+
# @param session_token - Session Token of user
|
32
|
+
#
|
33
|
+
# @return Response containing User Profile Data and access token
|
34
|
+
# 9.22
|
35
|
+
def pin_login(login_by_pin_model, session_token)
|
36
|
+
if login_by_pin_model.blank?
|
37
|
+
raise LoginRadius::Error.new, getValidationMessage('login_by_pin_model')
|
38
|
+
end
|
39
|
+
if isNullOrWhiteSpace(session_token)
|
40
|
+
raise LoginRadius::Error.new, getValidationMessage('session_token')
|
41
|
+
end
|
42
|
+
|
43
|
+
query_parameters = {}
|
44
|
+
query_parameters['apiKey'] = @api_key
|
45
|
+
query_parameters['session_token'] = session_token
|
46
|
+
|
47
|
+
resource_path = 'identity/v2/auth/login/pin'
|
48
|
+
post_request(resource_path, query_parameters, login_by_pin_model)
|
49
|
+
end
|
50
|
+
|
51
|
+
# This API sends the reset pin email to specified email address.
|
52
|
+
#
|
53
|
+
# @param forgot_pin_link_by_email_model - Model Class containing Definition for Forgot Pin Link By Email API
|
54
|
+
# @param email_template - Email template name
|
55
|
+
# @param reset_pin_url - Reset PIN Url
|
56
|
+
#
|
57
|
+
# @return Response containing Definition of Complete Validation data
|
58
|
+
# 42.1
|
59
|
+
def send_forgot_pin_email_by_email(forgot_pin_link_by_email_model, email_template = '', reset_pin_url = '')
|
60
|
+
if forgot_pin_link_by_email_model.blank?
|
61
|
+
raise LoginRadius::Error.new, getValidationMessage('forgot_pin_link_by_email_model')
|
62
|
+
end
|
63
|
+
|
64
|
+
query_parameters = {}
|
65
|
+
query_parameters['apiKey'] = @api_key
|
66
|
+
unless isNullOrWhiteSpace(email_template)
|
67
|
+
query_parameters['emailTemplate'] = email_template
|
68
|
+
end
|
69
|
+
unless isNullOrWhiteSpace(reset_pin_url)
|
70
|
+
query_parameters['resetPINUrl'] = reset_pin_url
|
71
|
+
end
|
72
|
+
|
73
|
+
resource_path = 'identity/v2/auth/pin/forgot/email'
|
74
|
+
post_request(resource_path, query_parameters, forgot_pin_link_by_email_model)
|
75
|
+
end
|
76
|
+
|
77
|
+
# This API sends the reset pin email using username.
|
78
|
+
#
|
79
|
+
# @param forgot_pin_link_by_user_name_model - Model Class containing Definition for Forgot Pin Link By UserName API
|
80
|
+
# @param email_template - Email template name
|
81
|
+
# @param reset_pin_url - Reset PIN Url
|
82
|
+
#
|
83
|
+
# @return Response containing Definition of Complete Validation data
|
84
|
+
# 42.2
|
85
|
+
def send_forgot_pin_email_by_username(forgot_pin_link_by_user_name_model, email_template = '', reset_pin_url = '')
|
86
|
+
if forgot_pin_link_by_user_name_model.blank?
|
87
|
+
raise LoginRadius::Error.new, getValidationMessage('forgot_pin_link_by_user_name_model')
|
88
|
+
end
|
89
|
+
|
90
|
+
query_parameters = {}
|
91
|
+
query_parameters['apiKey'] = @api_key
|
92
|
+
unless isNullOrWhiteSpace(email_template)
|
93
|
+
query_parameters['emailTemplate'] = email_template
|
94
|
+
end
|
95
|
+
unless isNullOrWhiteSpace(reset_pin_url)
|
96
|
+
query_parameters['resetPINUrl'] = reset_pin_url
|
97
|
+
end
|
98
|
+
|
99
|
+
resource_path = 'identity/v2/auth/pin/forgot/username'
|
100
|
+
post_request(resource_path, query_parameters, forgot_pin_link_by_user_name_model)
|
101
|
+
end
|
102
|
+
|
103
|
+
# This API is used to reset pin using reset token.
|
104
|
+
#
|
105
|
+
# @param reset_pin_by_reset_token - Model Class containing Definition of payload for Reset Pin By Reset Token API
|
106
|
+
#
|
107
|
+
# @return Response containing Definition of Complete Validation data
|
108
|
+
# 42.3
|
109
|
+
def reset_pin_by_reset_token(reset_pin_by_reset_token)
|
110
|
+
if reset_pin_by_reset_token.blank?
|
111
|
+
raise LoginRadius::Error.new, getValidationMessage('reset_pin_by_reset_token')
|
112
|
+
end
|
113
|
+
|
114
|
+
query_parameters = {}
|
115
|
+
query_parameters['apiKey'] = @api_key
|
116
|
+
|
117
|
+
resource_path = 'identity/v2/auth/pin/reset/token'
|
118
|
+
put_request(resource_path, query_parameters, reset_pin_by_reset_token)
|
119
|
+
end
|
120
|
+
|
121
|
+
# This API is used to reset pin using security question answer and email.
|
122
|
+
#
|
123
|
+
# @param reset_pin_by_security_question_answer_and_email_model - Model Class containing Definition of payload for Reset Pin By Security Question and Email API
|
124
|
+
#
|
125
|
+
# @return Response containing Definition of Complete Validation data
|
126
|
+
# 42.4
|
127
|
+
def reset_pin_by_email_and_security_answer(reset_pin_by_security_question_answer_and_email_model)
|
128
|
+
if reset_pin_by_security_question_answer_and_email_model.blank?
|
129
|
+
raise LoginRadius::Error.new, getValidationMessage('reset_pin_by_security_question_answer_and_email_model')
|
130
|
+
end
|
131
|
+
|
132
|
+
query_parameters = {}
|
133
|
+
query_parameters['apiKey'] = @api_key
|
134
|
+
|
135
|
+
resource_path = 'identity/v2/auth/pin/reset/securityanswer/email'
|
136
|
+
put_request(resource_path, query_parameters, reset_pin_by_security_question_answer_and_email_model)
|
137
|
+
end
|
138
|
+
|
139
|
+
# This API is used to reset pin using security question answer and username.
|
140
|
+
#
|
141
|
+
# @param reset_pin_by_security_question_answer_and_username_model - Model Class containing Definition of payload for Reset Pin By Security Question and UserName API
|
142
|
+
#
|
143
|
+
# @return Response containing Definition of Complete Validation data
|
144
|
+
# 42.5
|
145
|
+
def reset_pin_by_username_and_security_answer(reset_pin_by_security_question_answer_and_username_model)
|
146
|
+
if reset_pin_by_security_question_answer_and_username_model.blank?
|
147
|
+
raise LoginRadius::Error.new, getValidationMessage('reset_pin_by_security_question_answer_and_username_model')
|
148
|
+
end
|
149
|
+
|
150
|
+
query_parameters = {}
|
151
|
+
query_parameters['apiKey'] = @api_key
|
152
|
+
|
153
|
+
resource_path = 'identity/v2/auth/pin/reset/securityanswer/username'
|
154
|
+
put_request(resource_path, query_parameters, reset_pin_by_security_question_answer_and_username_model)
|
155
|
+
end
|
156
|
+
|
157
|
+
# This API is used to reset pin using security question answer and phone.
|
158
|
+
#
|
159
|
+
# @param reset_pin_by_security_question_answer_and_phone_model - Model Class containing Definition of payload for Reset Pin By Security Question and Phone API
|
160
|
+
#
|
161
|
+
# @return Response containing Definition of Complete Validation data
|
162
|
+
# 42.6
|
163
|
+
def reset_pin_by_phone_and_security_answer(reset_pin_by_security_question_answer_and_phone_model)
|
164
|
+
if reset_pin_by_security_question_answer_and_phone_model.blank?
|
165
|
+
raise LoginRadius::Error.new, getValidationMessage('reset_pin_by_security_question_answer_and_phone_model')
|
166
|
+
end
|
167
|
+
|
168
|
+
query_parameters = {}
|
169
|
+
query_parameters['apiKey'] = @api_key
|
170
|
+
|
171
|
+
resource_path = 'identity/v2/auth/pin/reset/securityanswer/phone'
|
172
|
+
put_request(resource_path, query_parameters, reset_pin_by_security_question_answer_and_phone_model)
|
173
|
+
end
|
174
|
+
|
175
|
+
# This API sends the OTP to specified phone number
|
176
|
+
#
|
177
|
+
# @param forgot_pin_otp_by_phone_model - Model Class containing Definition for Forgot Pin Otp By Phone API
|
178
|
+
# @param sms_template -
|
179
|
+
#
|
180
|
+
# @return Response Containing Validation Data and SMS Data
|
181
|
+
# 42.7
|
182
|
+
def send_forgot_pin_sms_by_phone(forgot_pin_otp_by_phone_model, sms_template = '')
|
183
|
+
if forgot_pin_otp_by_phone_model.blank?
|
184
|
+
raise LoginRadius::Error.new, getValidationMessage('forgot_pin_otp_by_phone_model')
|
185
|
+
end
|
186
|
+
|
187
|
+
query_parameters = {}
|
188
|
+
query_parameters['apiKey'] = @api_key
|
189
|
+
unless isNullOrWhiteSpace(sms_template)
|
190
|
+
query_parameters['smsTemplate'] = sms_template
|
191
|
+
end
|
192
|
+
|
193
|
+
resource_path = 'identity/v2/auth/pin/forgot/otp'
|
194
|
+
post_request(resource_path, query_parameters, forgot_pin_otp_by_phone_model)
|
195
|
+
end
|
196
|
+
|
197
|
+
# This API is used to change a user's PIN using access token.
|
198
|
+
#
|
199
|
+
# @param access_token - Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
|
200
|
+
# @param change_pin_model - Model Class containing Definition for change PIN Property
|
201
|
+
#
|
202
|
+
# @return Response containing Definition of Complete Validation data
|
203
|
+
# 42.8
|
204
|
+
def change_pin_by_access_token(access_token, change_pin_model)
|
205
|
+
if isNullOrWhiteSpace(access_token)
|
206
|
+
raise LoginRadius::Error.new, getValidationMessage('access_token')
|
207
|
+
end
|
208
|
+
if change_pin_model.blank?
|
209
|
+
raise LoginRadius::Error.new, getValidationMessage('change_pin_model')
|
210
|
+
end
|
211
|
+
|
212
|
+
query_parameters = {}
|
213
|
+
query_parameters['access_token'] = access_token
|
214
|
+
query_parameters['apiKey'] = @api_key
|
215
|
+
|
216
|
+
resource_path = 'identity/v2/auth/pin/change'
|
217
|
+
put_request(resource_path, query_parameters, change_pin_model)
|
218
|
+
end
|
219
|
+
|
220
|
+
# This API is used to reset pin using phoneId and OTP.
|
221
|
+
#
|
222
|
+
# @param reset_pin_by_phone_and_otp_model - Model Class containing Definition of payload for Reset Pin By Phone and Otp API
|
223
|
+
#
|
224
|
+
# @return Response containing Definition of Complete Validation data
|
225
|
+
# 42.9
|
226
|
+
def reset_pin_by_phone_and_otp(reset_pin_by_phone_and_otp_model)
|
227
|
+
if reset_pin_by_phone_and_otp_model.blank?
|
228
|
+
raise LoginRadius::Error.new, getValidationMessage('reset_pin_by_phone_and_otp_model')
|
229
|
+
end
|
230
|
+
|
231
|
+
query_parameters = {}
|
232
|
+
query_parameters['apiKey'] = @api_key
|
233
|
+
|
234
|
+
resource_path = 'identity/v2/auth/pin/reset/otp/phone'
|
235
|
+
put_request(resource_path, query_parameters, reset_pin_by_phone_and_otp_model)
|
236
|
+
end
|
237
|
+
|
238
|
+
# This API is used to reset pin using email and OTP.
|
239
|
+
#
|
240
|
+
# @param reset_pin_by_email_and_otp_model - Model Class containing Definition of payload for Reset Pin By Email and Otp API
|
241
|
+
#
|
242
|
+
# @return Response containing Definition of Complete Validation data
|
243
|
+
# 42.10
|
244
|
+
def reset_pin_by_email_and_otp(reset_pin_by_email_and_otp_model)
|
245
|
+
if reset_pin_by_email_and_otp_model.blank?
|
246
|
+
raise LoginRadius::Error.new, getValidationMessage('reset_pin_by_email_and_otp_model')
|
247
|
+
end
|
248
|
+
|
249
|
+
query_parameters = {}
|
250
|
+
query_parameters['apiKey'] = @api_key
|
251
|
+
|
252
|
+
resource_path = 'identity/v2/auth/pin/reset/otp/email'
|
253
|
+
put_request(resource_path, query_parameters, reset_pin_by_email_and_otp_model)
|
254
|
+
end
|
255
|
+
|
256
|
+
# This API is used to reset pin using username and OTP.
|
257
|
+
#
|
258
|
+
# @param reset_pin_by_username_and_otp_model - Model Class containing Definition of payload for Reset Pin By Username and Otp API
|
259
|
+
#
|
260
|
+
# @return Response containing Definition of Complete Validation data
|
261
|
+
# 42.11
|
262
|
+
def reset_pin_by_username_and_otp(reset_pin_by_username_and_otp_model)
|
263
|
+
if reset_pin_by_username_and_otp_model.blank?
|
264
|
+
raise LoginRadius::Error.new, getValidationMessage('reset_pin_by_username_and_otp_model')
|
265
|
+
end
|
266
|
+
|
267
|
+
query_parameters = {}
|
268
|
+
query_parameters['apiKey'] = @api_key
|
269
|
+
|
270
|
+
resource_path = 'identity/v2/auth/pin/reset/otp/username'
|
271
|
+
put_request(resource_path, query_parameters, reset_pin_by_username_and_otp_model)
|
272
|
+
end
|
273
|
+
|
274
|
+
# This API is used to change a user's PIN using Pin Auth token.
|
275
|
+
#
|
276
|
+
# @param pin_required_model - Model Class containing Definition for PIN
|
277
|
+
# @param pin_auth_token - Pin Auth Token
|
278
|
+
#
|
279
|
+
# @return Response containing User Profile Data and access token
|
280
|
+
# 42.12
|
281
|
+
def set_pin_by_pin_auth_token(pin_required_model, pin_auth_token)
|
282
|
+
if pin_required_model.blank?
|
283
|
+
raise LoginRadius::Error.new, getValidationMessage('pin_required_model')
|
284
|
+
end
|
285
|
+
if isNullOrWhiteSpace(pin_auth_token)
|
286
|
+
raise LoginRadius::Error.new, getValidationMessage('pin_auth_token')
|
287
|
+
end
|
288
|
+
|
289
|
+
query_parameters = {}
|
290
|
+
query_parameters['apiKey'] = @api_key
|
291
|
+
query_parameters['pinAuthToken'] = pin_auth_token
|
292
|
+
|
293
|
+
resource_path = 'identity/v2/auth/pin/set/pinauthtoken'
|
294
|
+
post_request(resource_path, query_parameters, pin_required_model)
|
295
|
+
end
|
296
|
+
|
297
|
+
# This API is used to invalidate pin session token.
|
298
|
+
#
|
299
|
+
# @param session_token - Session Token of user
|
300
|
+
#
|
301
|
+
# @return Response containing Definition of Complete Validation data
|
302
|
+
# 44.1
|
303
|
+
def in_validate_pin_session_token(session_token)
|
304
|
+
if isNullOrWhiteSpace(session_token)
|
305
|
+
raise LoginRadius::Error.new, getValidationMessage('session_token')
|
306
|
+
end
|
307
|
+
|
308
|
+
query_parameters = {}
|
309
|
+
query_parameters['apiKey'] = @api_key
|
310
|
+
query_parameters['session_token'] = session_token
|
311
|
+
|
312
|
+
resource_path = 'identity/v2/auth/session_token/invalidate'
|
313
|
+
get_request(resource_path, query_parameters, {})
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|