login_radius 10.0.0 → 11.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +19 -0
  3. data/LICENSE.txt +21 -21
  4. data/README.md +58 -58
  5. data/lib/login_radius/api/account/account_api.rb +581 -581
  6. data/lib/login_radius/api/account/role_api.rb +330 -330
  7. data/lib/login_radius/api/account/sott_api.rb +47 -47
  8. data/lib/login_radius/api/advanced/configuration_api.rb +57 -57
  9. data/lib/login_radius/api/advanced/consent_management_api.rb +161 -161
  10. data/lib/login_radius/api/advanced/custom_object_api.rb +316 -316
  11. data/lib/login_radius/api/advanced/custom_registration_data_api.rb +195 -195
  12. data/lib/login_radius/api/advanced/multi_factor_authentication_api.rb +942 -606
  13. data/lib/login_radius/api/advanced/re_authentication_api.rb +317 -243
  14. data/lib/login_radius/api/advanced/web_hook_api.rb +101 -101
  15. data/lib/login_radius/api/authentication/authentication_api.rb +1036 -986
  16. data/lib/login_radius/api/authentication/one_touch_login_api.rb +160 -160
  17. data/lib/login_radius/api/authentication/password_less_login_api.rb +202 -158
  18. data/lib/login_radius/api/authentication/phone_authentication_api.rb +329 -329
  19. data/lib/login_radius/api/authentication/pin_authentication_api.rb +316 -316
  20. data/lib/login_radius/api/authentication/risk_based_authentication_api.rb +286 -286
  21. data/lib/login_radius/api/authentication/smart_login_api.rb +146 -146
  22. data/lib/login_radius/api/social/native_social_api.rb +255 -193
  23. data/lib/login_radius/api/social/social_api.rb +784 -802
  24. data/lib/login_radius/error.rb +7 -7
  25. data/lib/login_radius/request_client.rb +316 -295
  26. data/lib/login_radius/response.rb +18 -12
  27. data/lib/login_radius/version.rb +2 -2
  28. data/lib/login_radius.rb +30 -30
  29. data/login_radius.gemspec +25 -28
  30. metadata +8 -7
@@ -1,193 +1,255 @@
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
- # NativeSocialApi module
9
- class NativeSocialApi
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
- # The API is used to get LoginRadius access token by sending Facebook's access token. It will be valid for the specific duration of time specified in the response.
29
- #
30
- # @param fb__access__token - Facebook Access Token
31
- #
32
- # @return Response containing Definition of Complete Token data
33
- # 20.3
34
- def get_access_token_by_facebook_access_token(fb__access__token)
35
- if isNullOrWhiteSpace(fb__access__token)
36
- raise LoginRadius::Error.new, getValidationMessage('fb__access__token')
37
- end
38
-
39
- query_parameters = {}
40
- query_parameters['fb_Access_Token'] = fb__access__token
41
- query_parameters['key'] = @api_key
42
-
43
- resource_path = 'api/v2/access_token/facebook'
44
- get_request(resource_path, query_parameters, nil)
45
- end
46
-
47
- # The API is used to get LoginRadius access token by sending Twitter's access token. It will be valid for the specific duration of time specified in the response.
48
- #
49
- # @param tw__access__token - Twitter Access Token
50
- # @param tw__token__secret - Twitter Token Secret
51
- #
52
- # @return Response containing Definition of Complete Token data
53
- # 20.4
54
- def get_access_token_by_twitter_access_token(tw__access__token, tw__token__secret)
55
- if isNullOrWhiteSpace(tw__access__token)
56
- raise LoginRadius::Error.new, getValidationMessage('tw__access__token')
57
- end
58
- if isNullOrWhiteSpace(tw__token__secret)
59
- raise LoginRadius::Error.new, getValidationMessage('tw__token__secret')
60
- end
61
-
62
- query_parameters = {}
63
- query_parameters['key'] = @api_key
64
- query_parameters['tw_Access_Token'] = tw__access__token
65
- query_parameters['tw_Token_Secret'] = tw__token__secret
66
-
67
- resource_path = 'api/v2/access_token/twitter'
68
- get_request(resource_path, query_parameters, nil)
69
- end
70
-
71
- # The API is used to get LoginRadius access token by sending Google's access token. It will be valid for the specific duration of time specified in the response.
72
- #
73
- # @param google__access__token - Google Access Token
74
- # @param client_id - Google Client ID
75
- # @param refresh_token - LoginRadius refresh token
76
- #
77
- # @return Response containing Definition of Complete Token data
78
- # 20.5
79
- def get_access_token_by_google_access_token(google__access__token, client_id = '', refresh_token = '')
80
- if isNullOrWhiteSpace(google__access__token)
81
- raise LoginRadius::Error.new, getValidationMessage('google__access__token')
82
- end
83
-
84
- query_parameters = {}
85
- query_parameters['google_Access_Token'] = google__access__token
86
- query_parameters['key'] = @api_key
87
- unless isNullOrWhiteSpace(client_id)
88
- query_parameters['client_id'] = client_id
89
- end
90
- unless isNullOrWhiteSpace(refresh_token)
91
- query_parameters['refresh_token'] = refresh_token
92
- end
93
-
94
- resource_path = 'api/v2/access_token/google'
95
- get_request(resource_path, query_parameters, nil)
96
- end
97
-
98
- # This API is used to Get LoginRadius Access Token using google jwt id token for google native mobile login/registration.
99
- #
100
- # @param id__token - Google JWT id_token
101
- #
102
- # @return Response containing Definition of Complete Token data
103
- # 20.6
104
- def get_access_token_by_google_j_w_t_access_token(id__token)
105
- if isNullOrWhiteSpace(id__token)
106
- raise LoginRadius::Error.new, getValidationMessage('id__token')
107
- end
108
-
109
- query_parameters = {}
110
- query_parameters['id_Token'] = id__token
111
- query_parameters['key'] = @api_key
112
-
113
- resource_path = 'api/v2/access_token/googlejwt'
114
- get_request(resource_path, query_parameters, nil)
115
- end
116
-
117
- # The API is used to get LoginRadius access token by sending Linkedin's access token. It will be valid for the specific duration of time specified in the response.
118
- #
119
- # @param ln__access__token - Linkedin Access Token
120
- #
121
- # @return Response containing Definition of Complete Token data
122
- # 20.7
123
- def get_access_token_by_linkedin_access_token(ln__access__token)
124
- if isNullOrWhiteSpace(ln__access__token)
125
- raise LoginRadius::Error.new, getValidationMessage('ln__access__token')
126
- end
127
-
128
- query_parameters = {}
129
- query_parameters['key'] = @api_key
130
- query_parameters['ln_Access_Token'] = ln__access__token
131
-
132
- resource_path = 'api/v2/access_token/linkedin'
133
- get_request(resource_path, query_parameters, nil)
134
- end
135
-
136
- # The API is used to get LoginRadius access token by sending Foursquare's access token. It will be valid for the specific duration of time specified in the response.
137
- #
138
- # @param fs__access__token - Foursquare Access Token
139
- #
140
- # @return Response containing Definition of Complete Token data
141
- # 20.8
142
- def get_access_token_by_foursquare_access_token(fs__access__token)
143
- if isNullOrWhiteSpace(fs__access__token)
144
- raise LoginRadius::Error.new, getValidationMessage('fs__access__token')
145
- end
146
-
147
- query_parameters = {}
148
- query_parameters['fs_Access_Token'] = fs__access__token
149
- query_parameters['key'] = @api_key
150
-
151
- resource_path = 'api/v2/access_token/foursquare'
152
- get_request(resource_path, query_parameters, nil)
153
- end
154
-
155
- # The API is used to get LoginRadius access token by sending Vkontakte's access token. It will be valid for the specific duration of time specified in the response.
156
- #
157
- # @param vk_access_token - Vkontakte Access Token
158
- #
159
- # @return Response containing Definition of Complete Token data
160
- # 20.15
161
- def get_access_token_by_vkontakte_access_token(vk_access_token)
162
- if isNullOrWhiteSpace(vk_access_token)
163
- raise LoginRadius::Error.new, getValidationMessage('vk_access_token')
164
- end
165
-
166
- query_parameters = {}
167
- query_parameters['key'] = @api_key
168
- query_parameters['vk_access_token'] = vk_access_token
169
-
170
- resource_path = 'api/v2/access_token/vkontakte'
171
- get_request(resource_path, query_parameters, nil)
172
- end
173
-
174
- # The API is used to get LoginRadius access token by sending Google's AuthCode. It will be valid for the specific duration of time specified in the response.
175
- #
176
- # @param google_authcode - Google AuthCode
177
- #
178
- # @return Response containing Definition of Complete Token data
179
- # 20.16
180
- def get_access_token_by_google_auth_code(google_authcode)
181
- if isNullOrWhiteSpace(google_authcode)
182
- raise LoginRadius::Error.new, getValidationMessage('google_authcode')
183
- end
184
-
185
- query_parameters = {}
186
- query_parameters['apiKey'] = @api_key
187
- query_parameters['google_authcode'] = google_authcode
188
-
189
- resource_path = 'api/v2/access_token/google'
190
- get_request(resource_path, query_parameters, nil)
191
- end
192
- end
193
- 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
+ # NativeSocialApi module
9
+ class NativeSocialApi
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
+ # The API is used to get LoginRadius access token by sending Facebook's access token. It will be valid for the specific duration of time specified in the response.
29
+ #
30
+ # @param fb__access__token - Facebook Access Token
31
+ # @param social_app_name - Name of Social provider APP
32
+ #
33
+ # @return Response containing Definition of Complete Token data
34
+ # 20.3
35
+ def get_access_token_by_facebook_access_token(fb__access__token, social_app_name = '')
36
+ if isNullOrWhiteSpace(fb__access__token)
37
+ raise LoginRadius::Error.new, getValidationMessage('fb__access__token')
38
+ end
39
+
40
+ query_parameters = {}
41
+ query_parameters['fb_Access_Token'] = fb__access__token
42
+ query_parameters['key'] = @api_key
43
+ unless isNullOrWhiteSpace(social_app_name)
44
+ query_parameters['socialAppName'] = social_app_name
45
+ end
46
+
47
+ resource_path = 'api/v2/access_token/facebook'
48
+ get_request(resource_path, query_parameters, {})
49
+ end
50
+
51
+ # The API is used to get LoginRadius access token by sending Twitter's access token. It will be valid for the specific duration of time specified in the response.
52
+ #
53
+ # @param tw__access__token - Twitter Access Token
54
+ # @param tw__token__secret - Twitter Token Secret
55
+ # @param social_app_name - Name of Social provider APP
56
+ #
57
+ # @return Response containing Definition of Complete Token data
58
+ # 20.4
59
+ def get_access_token_by_twitter_access_token(tw__access__token, tw__token__secret, social_app_name = '')
60
+ if isNullOrWhiteSpace(tw__access__token)
61
+ raise LoginRadius::Error.new, getValidationMessage('tw__access__token')
62
+ end
63
+ if isNullOrWhiteSpace(tw__token__secret)
64
+ raise LoginRadius::Error.new, getValidationMessage('tw__token__secret')
65
+ end
66
+
67
+ query_parameters = {}
68
+ query_parameters['key'] = @api_key
69
+ query_parameters['tw_Access_Token'] = tw__access__token
70
+ query_parameters['tw_Token_Secret'] = tw__token__secret
71
+ unless isNullOrWhiteSpace(social_app_name)
72
+ query_parameters['socialAppName'] = social_app_name
73
+ end
74
+
75
+ resource_path = 'api/v2/access_token/twitter'
76
+ get_request(resource_path, query_parameters, {})
77
+ end
78
+
79
+ # The API is used to get LoginRadius access token by sending Google's access token. It will be valid for the specific duration of time specified in the response.
80
+ #
81
+ # @param google__access__token - Google Access Token
82
+ # @param client_id - Google Client ID
83
+ # @param refresh_token - LoginRadius refresh token
84
+ # @param social_app_name - Name of Social provider APP
85
+ #
86
+ # @return Response containing Definition of Complete Token data
87
+ # 20.5
88
+ def get_access_token_by_google_access_token(google__access__token, client_id = '', refresh_token = '', social_app_name = '')
89
+ if isNullOrWhiteSpace(google__access__token)
90
+ raise LoginRadius::Error.new, getValidationMessage('google__access__token')
91
+ end
92
+
93
+ query_parameters = {}
94
+ query_parameters['google_Access_Token'] = google__access__token
95
+ query_parameters['key'] = @api_key
96
+ unless isNullOrWhiteSpace(client_id)
97
+ query_parameters['client_id'] = client_id
98
+ end
99
+ unless isNullOrWhiteSpace(refresh_token)
100
+ query_parameters['refresh_token'] = refresh_token
101
+ end
102
+ unless isNullOrWhiteSpace(social_app_name)
103
+ query_parameters['socialAppName'] = social_app_name
104
+ end
105
+
106
+ resource_path = 'api/v2/access_token/google'
107
+ get_request(resource_path, query_parameters, {})
108
+ end
109
+
110
+ # This API is used to Get LoginRadius Access Token using google jwt id token for google native mobile login/registration.
111
+ #
112
+ # @param id__token - Google JWT id_token
113
+ #
114
+ # @return Response containing Definition of Complete Token data
115
+ # 20.6
116
+ def get_access_token_by_google_j_w_t_access_token(id__token)
117
+ if isNullOrWhiteSpace(id__token)
118
+ raise LoginRadius::Error.new, getValidationMessage('id__token')
119
+ end
120
+
121
+ query_parameters = {}
122
+ query_parameters['id_Token'] = id__token
123
+ query_parameters['key'] = @api_key
124
+
125
+ resource_path = 'api/v2/access_token/googlejwt'
126
+ get_request(resource_path, query_parameters, {})
127
+ end
128
+
129
+ # The API is used to get LoginRadius access token by sending Linkedin's access token. It will be valid for the specific duration of time specified in the response.
130
+ #
131
+ # @param ln__access__token - Linkedin Access Token
132
+ # @param social_app_name - Name of Social provider APP
133
+ #
134
+ # @return Response containing Definition of Complete Token data
135
+ # 20.7
136
+ def get_access_token_by_linkedin_access_token(ln__access__token, social_app_name = '')
137
+ if isNullOrWhiteSpace(ln__access__token)
138
+ raise LoginRadius::Error.new, getValidationMessage('ln__access__token')
139
+ end
140
+
141
+ query_parameters = {}
142
+ query_parameters['key'] = @api_key
143
+ query_parameters['ln_Access_Token'] = ln__access__token
144
+ unless isNullOrWhiteSpace(social_app_name)
145
+ query_parameters['socialAppName'] = social_app_name
146
+ end
147
+
148
+ resource_path = 'api/v2/access_token/linkedin'
149
+ get_request(resource_path, query_parameters, {})
150
+ end
151
+
152
+ # The API is used to get LoginRadius access token by sending Foursquare's access token. It will be valid for the specific duration of time specified in the response.
153
+ #
154
+ # @param fs__access__token - Foursquare Access Token
155
+ #
156
+ # @return Response containing Definition of Complete Token data
157
+ # 20.8
158
+ def get_access_token_by_foursquare_access_token(fs__access__token)
159
+ if isNullOrWhiteSpace(fs__access__token)
160
+ raise LoginRadius::Error.new, getValidationMessage('fs__access__token')
161
+ end
162
+
163
+ query_parameters = {}
164
+ query_parameters['fs_Access_Token'] = fs__access__token
165
+ query_parameters['key'] = @api_key
166
+
167
+ resource_path = 'api/v2/access_token/foursquare'
168
+ get_request(resource_path, query_parameters, {})
169
+ end
170
+
171
+ # The API is used to get LoginRadius access token by sending a valid Apple ID OAuth Code. It will be valid for the specific duration of time specified in the response.
172
+ #
173
+ # @param code - Apple Code
174
+ # @param social_app_name - Name of Social provider APP
175
+ #
176
+ # @return Response containing Definition of Complete Token data
177
+ # 20.12
178
+ def get_access_token_by_apple_id_code(code, social_app_name = '')
179
+ if isNullOrWhiteSpace(code)
180
+ raise LoginRadius::Error.new, getValidationMessage('code')
181
+ end
182
+
183
+ query_parameters = {}
184
+ query_parameters['code'] = code
185
+ query_parameters['key'] = @api_key
186
+ unless isNullOrWhiteSpace(social_app_name)
187
+ query_parameters['socialAppName'] = social_app_name
188
+ end
189
+
190
+ resource_path = 'api/v2/access_token/apple'
191
+ get_request(resource_path, query_parameters, {})
192
+ end
193
+
194
+ # This API is used to retrieve a LoginRadius access token by passing in a valid WeChat OAuth Code.
195
+ #
196
+ # @param code - WeChat Code
197
+ #
198
+ # @return Response containing Definition of Complete Token data
199
+ # 20.13
200
+ def get_access_token_by_we_chat_code(code)
201
+ if isNullOrWhiteSpace(code)
202
+ raise LoginRadius::Error.new, getValidationMessage('code')
203
+ end
204
+
205
+ query_parameters = {}
206
+ query_parameters['code'] = code
207
+ query_parameters['key'] = @api_key
208
+
209
+ resource_path = 'api/v2/access_token/wechat'
210
+ get_request(resource_path, query_parameters, {})
211
+ end
212
+
213
+ # The API is used to get LoginRadius access token by sending Vkontakte's access token. It will be valid for the specific duration of time specified in the response.
214
+ #
215
+ # @param vk_access_token - Vkontakte Access Token
216
+ #
217
+ # @return Response containing Definition of Complete Token data
218
+ # 20.15
219
+ def get_access_token_by_vkontakte_access_token(vk_access_token)
220
+ if isNullOrWhiteSpace(vk_access_token)
221
+ raise LoginRadius::Error.new, getValidationMessage('vk_access_token')
222
+ end
223
+
224
+ query_parameters = {}
225
+ query_parameters['key'] = @api_key
226
+ query_parameters['vk_access_token'] = vk_access_token
227
+
228
+ resource_path = 'api/v2/access_token/vkontakte'
229
+ get_request(resource_path, query_parameters, {})
230
+ end
231
+
232
+ # The API is used to get LoginRadius access token by sending Google's AuthCode. It will be valid for the specific duration of time specified in the response.
233
+ #
234
+ # @param google_authcode - Google AuthCode
235
+ # @param social_app_name - Name of Social provider APP
236
+ #
237
+ # @return Response containing Definition of Complete Token data
238
+ # 20.16
239
+ def get_access_token_by_google_auth_code(google_authcode, social_app_name = '')
240
+ if isNullOrWhiteSpace(google_authcode)
241
+ raise LoginRadius::Error.new, getValidationMessage('google_authcode')
242
+ end
243
+
244
+ query_parameters = {}
245
+ query_parameters['apiKey'] = @api_key
246
+ query_parameters['google_authcode'] = google_authcode
247
+ unless isNullOrWhiteSpace(social_app_name)
248
+ query_parameters['socialAppName'] = social_app_name
249
+ end
250
+
251
+ resource_path = 'api/v2/access_token/google'
252
+ get_request(resource_path, query_parameters, {})
253
+ end
254
+ end
255
+ end