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.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +21 -21
  3. data/README.md +58 -58
  4. data/lib/login_radius/api/account/account_api.rb +581 -581
  5. data/lib/login_radius/api/account/role_api.rb +330 -330
  6. data/lib/login_radius/api/account/sott_api.rb +47 -47
  7. data/lib/login_radius/api/advanced/configuration_api.rb +57 -57
  8. data/lib/login_radius/api/advanced/consent_management_api.rb +161 -161
  9. data/lib/login_radius/api/advanced/custom_object_api.rb +316 -316
  10. data/lib/login_radius/api/advanced/custom_registration_data_api.rb +195 -195
  11. data/lib/login_radius/api/advanced/multi_factor_authentication_api.rb +942 -606
  12. data/lib/login_radius/api/advanced/re_authentication_api.rb +317 -243
  13. data/lib/login_radius/api/advanced/web_hook_api.rb +101 -101
  14. data/lib/login_radius/api/authentication/authentication_api.rb +1036 -989
  15. data/lib/login_radius/api/authentication/one_touch_login_api.rb +160 -160
  16. data/lib/login_radius/api/authentication/password_less_login_api.rb +202 -158
  17. data/lib/login_radius/api/authentication/phone_authentication_api.rb +329 -329
  18. data/lib/login_radius/api/authentication/pin_authentication_api.rb +316 -316
  19. data/lib/login_radius/api/authentication/risk_based_authentication_api.rb +286 -286
  20. data/lib/login_radius/api/authentication/smart_login_api.rb +146 -146
  21. data/lib/login_radius/api/social/native_social_api.rb +255 -255
  22. data/lib/login_radius/api/social/social_api.rb +784 -806
  23. data/lib/login_radius/error.rb +7 -7
  24. data/lib/login_radius/request_client.rb +311 -295
  25. data/lib/login_radius/response.rb +18 -12
  26. data/lib/login_radius/version.rb +2 -2
  27. data/lib/login_radius.rb +30 -30
  28. data/login_radius.gemspec +25 -28
  29. metadata +7 -7
@@ -1,158 +1,202 @@
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
- # PasswordLessLoginApi module
9
- class PasswordLessLoginApi
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 verifies an account by OTP and allows the customer to login.
29
- #
30
- # @param password_less_login_otp_model - Model Class containing Definition of payload for PasswordLessLoginOtpModel API
31
- # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
32
- # @param sms_template - SMS Template name
33
- #
34
- # @return Response containing User Profile Data and access token
35
- # 9.6
36
- def passwordless_login_phone_verification(password_less_login_otp_model, fields = '', sms_template = '')
37
- if password_less_login_otp_model.blank?
38
- raise LoginRadius::Error.new, getValidationMessage('password_less_login_otp_model')
39
- end
40
-
41
- query_parameters = {}
42
- query_parameters['apiKey'] = @api_key
43
- unless isNullOrWhiteSpace(fields)
44
- query_parameters['fields'] = fields
45
- end
46
- unless isNullOrWhiteSpace(sms_template)
47
- query_parameters['smsTemplate'] = sms_template
48
- end
49
-
50
- resource_path = 'identity/v2/auth/login/passwordlesslogin/otp/verify'
51
- put_request(resource_path, query_parameters, password_less_login_otp_model)
52
- end
53
-
54
- # API can be used to send a One-time Passcode (OTP) provided that the account has a verified PhoneID
55
- #
56
- # @param phone - The Registered Phone Number
57
- # @param sms_template - SMS Template name
58
- #
59
- # @return Response Containing Definition of SMS Data
60
- # 9.15
61
- def passwordless_login_by_phone(phone, sms_template = '')
62
- if isNullOrWhiteSpace(phone)
63
- raise LoginRadius::Error.new, getValidationMessage('phone')
64
- end
65
-
66
- query_parameters = {}
67
- query_parameters['apiKey'] = @api_key
68
- query_parameters['phone'] = phone
69
- unless isNullOrWhiteSpace(sms_template)
70
- query_parameters['smsTemplate'] = sms_template
71
- end
72
-
73
- resource_path = 'identity/v2/auth/login/passwordlesslogin/otp'
74
- get_request(resource_path, query_parameters, nil)
75
- end
76
-
77
- # This API is used to send a Passwordless Login verification link to the provided Email ID
78
- #
79
- # @param email - Email of the user
80
- # @param password_less_login_template - Passwordless Login Template Name
81
- # @param verification_url - Email verification url
82
- #
83
- # @return Response containing Definition of Complete Validation data
84
- # 9.18.1
85
- def passwordless_login_by_email(email, password_less_login_template = '', verification_url = '')
86
- if isNullOrWhiteSpace(email)
87
- raise LoginRadius::Error.new, getValidationMessage('email')
88
- end
89
-
90
- query_parameters = {}
91
- query_parameters['apiKey'] = @api_key
92
- query_parameters['email'] = email
93
- unless isNullOrWhiteSpace(password_less_login_template)
94
- query_parameters['passwordLessLoginTemplate'] = password_less_login_template
95
- end
96
- unless isNullOrWhiteSpace(verification_url)
97
- query_parameters['verificationUrl'] = verification_url
98
- end
99
-
100
- resource_path = 'identity/v2/auth/login/passwordlesslogin/email'
101
- get_request(resource_path, query_parameters, nil)
102
- end
103
-
104
- # This API is used to send a Passwordless Login Verification Link to a customer by providing their UserName
105
- #
106
- # @param username - UserName of the user
107
- # @param password_less_login_template - Passwordless Login Template Name
108
- # @param verification_url - Email verification url
109
- #
110
- # @return Response containing Definition of Complete Validation data
111
- # 9.18.2
112
- def passwordless_login_by_user_name(username, password_less_login_template = '', verification_url = '')
113
- if isNullOrWhiteSpace(username)
114
- raise LoginRadius::Error.new, getValidationMessage('username')
115
- end
116
-
117
- query_parameters = {}
118
- query_parameters['apiKey'] = @api_key
119
- query_parameters['username'] = username
120
- unless isNullOrWhiteSpace(password_less_login_template)
121
- query_parameters['passwordLessLoginTemplate'] = password_less_login_template
122
- end
123
- unless isNullOrWhiteSpace(verification_url)
124
- query_parameters['verificationUrl'] = verification_url
125
- end
126
-
127
- resource_path = 'identity/v2/auth/login/passwordlesslogin/email'
128
- get_request(resource_path, query_parameters, nil)
129
- end
130
-
131
- # This API is used to verify the Passwordless Login verification link. Note: If you are using Passwordless Login by Phone you will need to use the Passwordless Login Phone Verification API
132
- #
133
- # @param verification_token - Verification token received in the email
134
- # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
135
- # @param welcome_email_template - Name of the welcome email template
136
- #
137
- # @return Response containing User Profile Data and access token
138
- # 9.19
139
- def passwordless_login_verification(verification_token, fields = '', welcome_email_template = '')
140
- if isNullOrWhiteSpace(verification_token)
141
- raise LoginRadius::Error.new, getValidationMessage('verification_token')
142
- end
143
-
144
- query_parameters = {}
145
- query_parameters['apikey'] = @api_key
146
- query_parameters['verificationToken'] = verification_token
147
- unless isNullOrWhiteSpace(fields)
148
- query_parameters['fields'] = fields
149
- end
150
- unless isNullOrWhiteSpace(welcome_email_template)
151
- query_parameters['welcomeEmailTemplate'] = welcome_email_template
152
- end
153
-
154
- resource_path = 'identity/v2/auth/login/passwordlesslogin/email/verify'
155
- get_request(resource_path, query_parameters, nil)
156
- end
157
- end
158
- 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
+ # PasswordLessLoginApi module
9
+ class PasswordLessLoginApi
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 verifies an account by OTP and allows the customer to login.
29
+ #
30
+ # @param password_less_login_otp_model - Model Class containing Definition of payload for PasswordLessLoginOtpModel API
31
+ # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
32
+ # @param sms_template - SMS Template name
33
+ #
34
+ # @return Response containing User Profile Data and access token
35
+ # 9.6
36
+ def passwordless_login_phone_verification(password_less_login_otp_model, fields = '', sms_template = '')
37
+ if password_less_login_otp_model.blank?
38
+ raise LoginRadius::Error.new, getValidationMessage('password_less_login_otp_model')
39
+ end
40
+
41
+ query_parameters = {}
42
+ query_parameters['apiKey'] = @api_key
43
+ unless isNullOrWhiteSpace(fields)
44
+ query_parameters['fields'] = fields
45
+ end
46
+ unless isNullOrWhiteSpace(sms_template)
47
+ query_parameters['smsTemplate'] = sms_template
48
+ end
49
+
50
+ resource_path = 'identity/v2/auth/login/passwordlesslogin/otp/verify'
51
+ put_request(resource_path, query_parameters, password_less_login_otp_model)
52
+ end
53
+
54
+ # API can be used to send a One-time Passcode (OTP) provided that the account has a verified PhoneID
55
+ #
56
+ # @param phone - The Registered Phone Number
57
+ # @param sms_template - SMS Template name
58
+ #
59
+ # @return Response Containing Definition of SMS Data
60
+ # 9.15
61
+ def passwordless_login_by_phone(phone, sms_template = '')
62
+ if isNullOrWhiteSpace(phone)
63
+ raise LoginRadius::Error.new, getValidationMessage('phone')
64
+ end
65
+
66
+ query_parameters = {}
67
+ query_parameters['apiKey'] = @api_key
68
+ query_parameters['phone'] = phone
69
+ unless isNullOrWhiteSpace(sms_template)
70
+ query_parameters['smsTemplate'] = sms_template
71
+ end
72
+
73
+ resource_path = 'identity/v2/auth/login/passwordlesslogin/otp'
74
+ get_request(resource_path, query_parameters, {})
75
+ end
76
+
77
+ # This API is used to send a Passwordless Login verification link to the provided Email ID
78
+ #
79
+ # @param email - Email of the user
80
+ # @param password_less_login_template - Passwordless Login Template Name
81
+ # @param verification_url - Email verification url
82
+ #
83
+ # @return Response containing Definition of Complete Validation data
84
+ # 9.18.1
85
+ def passwordless_login_by_email(email, password_less_login_template = '', verification_url = '')
86
+ if isNullOrWhiteSpace(email)
87
+ raise LoginRadius::Error.new, getValidationMessage('email')
88
+ end
89
+
90
+ query_parameters = {}
91
+ query_parameters['apiKey'] = @api_key
92
+ query_parameters['email'] = email
93
+ unless isNullOrWhiteSpace(password_less_login_template)
94
+ query_parameters['passwordLessLoginTemplate'] = password_less_login_template
95
+ end
96
+ unless isNullOrWhiteSpace(verification_url)
97
+ query_parameters['verificationUrl'] = verification_url
98
+ end
99
+
100
+ resource_path = 'identity/v2/auth/login/passwordlesslogin/email'
101
+ get_request(resource_path, query_parameters, {})
102
+ end
103
+
104
+ # This API is used to send a Passwordless Login Verification Link to a customer by providing their UserName
105
+ #
106
+ # @param username - UserName of the user
107
+ # @param password_less_login_template - Passwordless Login Template Name
108
+ # @param verification_url - Email verification url
109
+ #
110
+ # @return Response containing Definition of Complete Validation data
111
+ # 9.18.2
112
+ def passwordless_login_by_user_name(username, password_less_login_template = '', verification_url = '')
113
+ if isNullOrWhiteSpace(username)
114
+ raise LoginRadius::Error.new, getValidationMessage('username')
115
+ end
116
+
117
+ query_parameters = {}
118
+ query_parameters['apiKey'] = @api_key
119
+ query_parameters['username'] = username
120
+ unless isNullOrWhiteSpace(password_less_login_template)
121
+ query_parameters['passwordLessLoginTemplate'] = password_less_login_template
122
+ end
123
+ unless isNullOrWhiteSpace(verification_url)
124
+ query_parameters['verificationUrl'] = verification_url
125
+ end
126
+
127
+ resource_path = 'identity/v2/auth/login/passwordlesslogin/email'
128
+ get_request(resource_path, query_parameters, {})
129
+ end
130
+
131
+ # This API is used to verify the Passwordless Login verification link. Note: If you are using Passwordless Login by Phone you will need to use the Passwordless Login Phone Verification API
132
+ #
133
+ # @param verification_token - Verification token received in the email
134
+ # @param fields - The fields parameter filters the API response so that the response only includes a specific set of fields
135
+ # @param welcome_email_template - Name of the welcome email template
136
+ #
137
+ # @return Response containing User Profile Data and access token
138
+ # 9.19
139
+ def passwordless_login_verification(verification_token, fields = '', welcome_email_template = '')
140
+ if isNullOrWhiteSpace(verification_token)
141
+ raise LoginRadius::Error.new, getValidationMessage('verification_token')
142
+ end
143
+
144
+ query_parameters = {}
145
+ query_parameters['apikey'] = @api_key
146
+ query_parameters['verificationToken'] = verification_token
147
+ unless isNullOrWhiteSpace(fields)
148
+ query_parameters['fields'] = fields
149
+ end
150
+ unless isNullOrWhiteSpace(welcome_email_template)
151
+ query_parameters['welcomeEmailTemplate'] = welcome_email_template
152
+ end
153
+
154
+ resource_path = 'identity/v2/auth/login/passwordlesslogin/email/verify'
155
+ get_request(resource_path, query_parameters, {})
156
+ end
157
+
158
+ # This API is used to verify the otp sent to the email when doing a passwordless login.
159
+ #
160
+ # @param password_less_login_by_email_and_otp_model - payload
161
+ # @param fields - Fields
162
+ #
163
+ # @return Response containing User Profile Data and access token
164
+ # 9.23
165
+ def passwordless_login_verification_by_email_and_otp(password_less_login_by_email_and_otp_model, fields = '')
166
+ if password_less_login_by_email_and_otp_model.blank?
167
+ raise LoginRadius::Error.new, getValidationMessage('password_less_login_by_email_and_otp_model')
168
+ end
169
+
170
+ query_parameters = {}
171
+ query_parameters['apiKey'] = @api_key
172
+ unless isNullOrWhiteSpace(fields)
173
+ query_parameters['fields'] = fields
174
+ end
175
+
176
+ resource_path = 'identity/v2/auth/login/passwordlesslogin/email/verifyotp'
177
+ post_request(resource_path, query_parameters, password_less_login_by_email_and_otp_model)
178
+ end
179
+
180
+ # This API is used to verify the otp sent to the email when doing a passwordless login.
181
+ #
182
+ # @param password_less_login_by_user_name_and_otp_model - payload
183
+ # @param fields - Fields
184
+ #
185
+ # @return Response containing User Profile Data and access token
186
+ # 9.24
187
+ def passwordless_login_verification_by_user_name_and_otp(password_less_login_by_user_name_and_otp_model, fields = '')
188
+ if password_less_login_by_user_name_and_otp_model.blank?
189
+ raise LoginRadius::Error.new, getValidationMessage('password_less_login_by_user_name_and_otp_model')
190
+ end
191
+
192
+ query_parameters = {}
193
+ query_parameters['apiKey'] = @api_key
194
+ unless isNullOrWhiteSpace(fields)
195
+ query_parameters['fields'] = fields
196
+ end
197
+
198
+ resource_path = 'identity/v2/auth/login/passwordlesslogin/username/verifyotp'
199
+ post_request(resource_path, query_parameters, password_less_login_by_user_name_and_otp_model)
200
+ end
201
+ end
202
+ end