fusionauth_client 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.ruby-version +1 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +201 -0
- data/README.md +64 -0
- data/Rakefile +10 -0
- data/build.savant +84 -0
- data/fusionauth-ruby-client.iml +15 -0
- data/fusionauth_client.gemspec +34 -0
- data/lib/fusionauth/fusionauth_client.rb +1816 -0
- data/lib/fusionauth/rest_client.rb +330 -0
- metadata +59 -0
@@ -0,0 +1,1816 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
require 'rest_client'
|
3
|
+
|
4
|
+
#
|
5
|
+
# Copyright (c) 2018, FusionAuth, All Rights Reserved
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing,
|
14
|
+
# software distributed under the License is distributed on an
|
15
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
16
|
+
# either express or implied. See the License for the specific
|
17
|
+
# language governing permissions and limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
module FusionAuth
|
21
|
+
#
|
22
|
+
# This class is the the Ruby client library for the FusionAuth CIAM Platform {https://fusionauth.io}
|
23
|
+
#
|
24
|
+
# Each method on this class calls one of the APIs for FusionAuth. In most cases, the methods will take either a Hash, an
|
25
|
+
# OpenStruct or any object that can be safely converted to JSON that conforms to the FusionAuth API interface. Likewise,
|
26
|
+
# most methods will return an OpenStruct that contains the response JSON from FusionAuth.
|
27
|
+
#
|
28
|
+
# noinspection RubyInstanceMethodNamingConvention,RubyTooManyMethodsInspection,RubyParameterNamingConvention
|
29
|
+
class FusionAuthClient
|
30
|
+
attr_accessor :api_key, :base_url, :connect_timeout, :read_timeout
|
31
|
+
|
32
|
+
def initialize(api_key, base_url)
|
33
|
+
@api_key = api_key
|
34
|
+
@base_url = base_url
|
35
|
+
@connect_timeout = 1000
|
36
|
+
@read_timeout = 2000
|
37
|
+
end
|
38
|
+
|
39
|
+
#
|
40
|
+
# Takes an action on a user. The user being actioned is called the "actionee" and the user taking the action is called the
|
41
|
+
# "actioner". Both user ids are required. You pass the actionee's user id into the method and the actioner's is put into the
|
42
|
+
# request object.
|
43
|
+
#
|
44
|
+
# @param actionee_user_id [string] The actionee's user id.
|
45
|
+
# @param request [OpenStruct, Hash] The action request that includes all of the information about the action being taken including
|
46
|
+
# the id of the action, any options and the duration (if applicable).
|
47
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
48
|
+
#
|
49
|
+
def action_user(actionee_user_id, request)
|
50
|
+
start.uri('/api/user/action')
|
51
|
+
.url_segment(actionee_user_id)
|
52
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
53
|
+
.post()
|
54
|
+
.go()
|
55
|
+
end
|
56
|
+
|
57
|
+
#
|
58
|
+
# Cancels the user action.
|
59
|
+
#
|
60
|
+
# @param action_id [string] The action id of the action to cancel.
|
61
|
+
# @param request [OpenStruct, Hash] The action request that contains the information about the cancellation.
|
62
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
63
|
+
#
|
64
|
+
def cancel_action(action_id, request)
|
65
|
+
start.uri('/api/user/action')
|
66
|
+
.url_segment(action_id)
|
67
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
68
|
+
.delete()
|
69
|
+
.go()
|
70
|
+
end
|
71
|
+
|
72
|
+
#
|
73
|
+
# Changes a user's password using the change password Id. This usually occurs after an email has been sent to the user
|
74
|
+
# and they clicked on a link to reset their password.
|
75
|
+
#
|
76
|
+
# @param change_password_id [string] The change password Id used to find the user. This value is generated by FusionAuth once the change password workflow has been initiated.
|
77
|
+
# @param request [OpenStruct, Hash] The change password request that contains all of the information used to change the password.
|
78
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
79
|
+
#
|
80
|
+
def change_password(change_password_id, request)
|
81
|
+
start.uri('/api/user/change-password')
|
82
|
+
.url_segment(change_password_id)
|
83
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
84
|
+
.post()
|
85
|
+
.go()
|
86
|
+
end
|
87
|
+
|
88
|
+
#
|
89
|
+
# Changes a user's password using their identity (login id and password). Using a loginId instead of the changePasswordId
|
90
|
+
# bypasses the email verification and allows a password to be changed directly without first calling the #forgotPassword
|
91
|
+
# method.
|
92
|
+
#
|
93
|
+
# @param request [OpenStruct, Hash] The change password request that contains all of the information used to change the password.
|
94
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
95
|
+
#
|
96
|
+
def change_password_by_identity(request)
|
97
|
+
start.uri('/api/user/change-password')
|
98
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
99
|
+
.post()
|
100
|
+
.go()
|
101
|
+
end
|
102
|
+
|
103
|
+
#
|
104
|
+
# Adds a comment to the user's account.
|
105
|
+
#
|
106
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the user comment.
|
107
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
108
|
+
#
|
109
|
+
def comment_on_user(request)
|
110
|
+
start.uri('/api/user/comment')
|
111
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
112
|
+
.post()
|
113
|
+
.go()
|
114
|
+
end
|
115
|
+
|
116
|
+
#
|
117
|
+
# Creates an application. You can optionally specify an Id for the application, if not provided one will be generated.
|
118
|
+
#
|
119
|
+
# @param application_id [string] (Optional) The Id to use for the application. If not provided a secure random UUID will be generated.
|
120
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the application.
|
121
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
122
|
+
#
|
123
|
+
def create_application(application_id, request)
|
124
|
+
start.uri('/api/application')
|
125
|
+
.url_segment(application_id)
|
126
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
127
|
+
.post()
|
128
|
+
.go()
|
129
|
+
end
|
130
|
+
|
131
|
+
#
|
132
|
+
# Creates a new role for an application. You must specify the id of the application you are creating the role for.
|
133
|
+
# You can optionally specify an Id for the role inside the ApplicationRole object itself, if not provided one will be generated.
|
134
|
+
#
|
135
|
+
# @param application_id [string] The Id of the application to create the role on.
|
136
|
+
# @param role_id [string] (Optional) The Id of the role. If not provided a secure random UUID will be generated.
|
137
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the application role.
|
138
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
139
|
+
#
|
140
|
+
def create_application_role(application_id, role_id, request)
|
141
|
+
start.uri('/api/application')
|
142
|
+
.url_segment(application_id)
|
143
|
+
.url_segment("role")
|
144
|
+
.url_segment(role_id)
|
145
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
146
|
+
.post()
|
147
|
+
.go()
|
148
|
+
end
|
149
|
+
|
150
|
+
#
|
151
|
+
# Creates an audit log with the message and user name (usually an email). Audit logs should be written anytime you
|
152
|
+
# make changes to the FusionAuth database. When using the FusionAuth App web interface, any changes are automatically
|
153
|
+
# written to the audit log. However, if you are accessing the API, you must write the audit logs yourself.
|
154
|
+
#
|
155
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the audit log entry.
|
156
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
157
|
+
#
|
158
|
+
def create_audit_log(request)
|
159
|
+
start.uri('/api/system/audit-log')
|
160
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
161
|
+
.post()
|
162
|
+
.go()
|
163
|
+
end
|
164
|
+
|
165
|
+
#
|
166
|
+
# Creates an email template. You can optionally specify an Id for the template, if not provided one will be generated.
|
167
|
+
#
|
168
|
+
# @param email_template_id [string] (Optional) The Id for the template. If not provided a secure random UUID will be generated.
|
169
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the email template.
|
170
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
171
|
+
#
|
172
|
+
def create_email_template(email_template_id, request)
|
173
|
+
start.uri('/api/email/template')
|
174
|
+
.url_segment(email_template_id)
|
175
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
176
|
+
.post()
|
177
|
+
.go()
|
178
|
+
end
|
179
|
+
|
180
|
+
#
|
181
|
+
# Creates a group. You can optionally specify an Id for the group, if not provided one will be generated.
|
182
|
+
#
|
183
|
+
# @param group_id [string] (Optional) The Id for the group. If not provided a secure random UUID will be generated.
|
184
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the group.
|
185
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
186
|
+
#
|
187
|
+
def create_group(group_id, request)
|
188
|
+
start.uri('/api/group')
|
189
|
+
.url_segment(group_id)
|
190
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
191
|
+
.post()
|
192
|
+
.go()
|
193
|
+
end
|
194
|
+
|
195
|
+
#
|
196
|
+
# Creates a member in a group.
|
197
|
+
#
|
198
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the group member(s).
|
199
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
200
|
+
#
|
201
|
+
def create_group_members(request)
|
202
|
+
start.uri('/api/group/member')
|
203
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
204
|
+
.post()
|
205
|
+
.go()
|
206
|
+
end
|
207
|
+
|
208
|
+
#
|
209
|
+
# Creates an identity provider. You can optionally specify an Id for the identity provider, if not provided one will be generated.
|
210
|
+
#
|
211
|
+
# @param identity_provider_id [string] (Optional) The Id of the identity provider. If not provided a secure random UUID will be generated.
|
212
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the identity provider.
|
213
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
214
|
+
#
|
215
|
+
def create_identity_provider(identity_provider_id, request)
|
216
|
+
start.uri('/api/identity-provider')
|
217
|
+
.url_segment(identity_provider_id)
|
218
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
219
|
+
.post()
|
220
|
+
.go()
|
221
|
+
end
|
222
|
+
|
223
|
+
#
|
224
|
+
# Creates a tenant. You can optionally specify an Id for the tenant, if not provided one will be generated.
|
225
|
+
#
|
226
|
+
# @param tenant_id [string] (Optional) The Id for the tenant. If not provided a secure random UUID will be generated.
|
227
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the tenant.
|
228
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
229
|
+
#
|
230
|
+
def create_tenant(tenant_id, request)
|
231
|
+
start.uri('/api/tenant')
|
232
|
+
.url_segment(tenant_id)
|
233
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
234
|
+
.post()
|
235
|
+
.go()
|
236
|
+
end
|
237
|
+
|
238
|
+
#
|
239
|
+
# Creates a user. You can optionally specify an Id for the user, if not provided one will be generated.
|
240
|
+
#
|
241
|
+
# @param user_id [string] (Optional) The Id for the user. If not provided a secure random UUID will be generated.
|
242
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the user.
|
243
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
244
|
+
#
|
245
|
+
def create_user(user_id, request)
|
246
|
+
start.uri('/api/user')
|
247
|
+
.url_segment(user_id)
|
248
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
249
|
+
.post()
|
250
|
+
.go()
|
251
|
+
end
|
252
|
+
|
253
|
+
#
|
254
|
+
# Creates a user action. This action cannot be taken on a user until this call successfully returns. Anytime after
|
255
|
+
# that the user action can be applied to any user.
|
256
|
+
#
|
257
|
+
# @param user_action_id [string] (Optional) The Id for the user action. If not provided a secure random UUID will be generated.
|
258
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the user action.
|
259
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
260
|
+
#
|
261
|
+
def create_user_action(user_action_id, request)
|
262
|
+
start.uri('/api/user-action')
|
263
|
+
.url_segment(user_action_id)
|
264
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
265
|
+
.post()
|
266
|
+
.go()
|
267
|
+
end
|
268
|
+
|
269
|
+
#
|
270
|
+
# Creates a user reason. This user action reason cannot be used when actioning a user until this call completes
|
271
|
+
# successfully. Anytime after that the user action reason can be used.
|
272
|
+
#
|
273
|
+
# @param user_action_reason_id [string] (Optional) The Id for the user action reason. If not provided a secure random UUID will be generated.
|
274
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the user action reason.
|
275
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
276
|
+
#
|
277
|
+
def create_user_action_reason(user_action_reason_id, request)
|
278
|
+
start.uri('/api/user-action-reason')
|
279
|
+
.url_segment(user_action_reason_id)
|
280
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
281
|
+
.post()
|
282
|
+
.go()
|
283
|
+
end
|
284
|
+
|
285
|
+
#
|
286
|
+
# Creates a webhook. You can optionally specify an Id for the webhook, if not provided one will be generated.
|
287
|
+
#
|
288
|
+
# @param webhook_id [string] (Optional) The Id for the webhook. If not provided a secure random UUID will be generated.
|
289
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to create the webhook.
|
290
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
291
|
+
#
|
292
|
+
def create_webhook(webhook_id, request)
|
293
|
+
start.uri('/api/webhook')
|
294
|
+
.url_segment(webhook_id)
|
295
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
296
|
+
.post()
|
297
|
+
.go()
|
298
|
+
end
|
299
|
+
|
300
|
+
#
|
301
|
+
# Deactivates the application with the given Id.
|
302
|
+
#
|
303
|
+
# @param application_id [string] The Id of the application to deactivate.
|
304
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
305
|
+
#
|
306
|
+
def deactivate_application(application_id)
|
307
|
+
start.uri('/api/application')
|
308
|
+
.url_segment(application_id)
|
309
|
+
.delete()
|
310
|
+
.go()
|
311
|
+
end
|
312
|
+
|
313
|
+
#
|
314
|
+
# Deactivates the user with the given Id.
|
315
|
+
#
|
316
|
+
# @param user_id [string] The Id of the user to deactivate.
|
317
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
318
|
+
#
|
319
|
+
def deactivate_user(user_id)
|
320
|
+
start.uri('/api/user')
|
321
|
+
.url_segment(user_id)
|
322
|
+
.delete()
|
323
|
+
.go()
|
324
|
+
end
|
325
|
+
|
326
|
+
#
|
327
|
+
# Deactivates the user action with the given Id.
|
328
|
+
#
|
329
|
+
# @param user_action_id [string] The Id of the user action to deactivate.
|
330
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
331
|
+
#
|
332
|
+
def deactivate_user_action(user_action_id)
|
333
|
+
start.uri('/api/user-action')
|
334
|
+
.url_segment(user_action_id)
|
335
|
+
.delete()
|
336
|
+
.go()
|
337
|
+
end
|
338
|
+
|
339
|
+
#
|
340
|
+
# Deactivates the users with the given ids.
|
341
|
+
#
|
342
|
+
# @param user_ids [Array] The ids of the users to deactivate.
|
343
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
344
|
+
#
|
345
|
+
def deactivate_users(user_ids)
|
346
|
+
start.uri('/api/user/bulk')
|
347
|
+
.url_parameter('userId', user_ids)
|
348
|
+
.delete()
|
349
|
+
.go()
|
350
|
+
end
|
351
|
+
|
352
|
+
#
|
353
|
+
# Hard deletes an application. This is a dangerous operation and should not be used in most circumstances. This will
|
354
|
+
# delete the application, any registrations for that application, metrics and reports for the application, all the
|
355
|
+
# roles for the application, and any other data associated with the application. This operation could take a very
|
356
|
+
# long time, depending on the amount of data in your database.
|
357
|
+
#
|
358
|
+
# @param application_id [string] The Id of the application to delete.
|
359
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
360
|
+
#
|
361
|
+
def delete_application(application_id)
|
362
|
+
start.uri('/api/application')
|
363
|
+
.url_segment(application_id)
|
364
|
+
.url_parameter('hardDelete', true)
|
365
|
+
.delete()
|
366
|
+
.go()
|
367
|
+
end
|
368
|
+
|
369
|
+
#
|
370
|
+
# Hard deletes an application role. This is a dangerous operation and should not be used in most circumstances. This
|
371
|
+
# permanently removes the given role from all users that had it.
|
372
|
+
#
|
373
|
+
# @param application_id [string] The Id of the application to deactivate.
|
374
|
+
# @param role_id [string] The Id of the role to delete.
|
375
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
376
|
+
#
|
377
|
+
def delete_application_role(application_id, role_id)
|
378
|
+
start.uri('/api/application')
|
379
|
+
.url_segment(application_id)
|
380
|
+
.url_segment("role")
|
381
|
+
.url_segment(role_id)
|
382
|
+
.delete()
|
383
|
+
.go()
|
384
|
+
end
|
385
|
+
|
386
|
+
#
|
387
|
+
# Deletes the email template for the given Id.
|
388
|
+
#
|
389
|
+
# @param email_template_id [string] The Id of the email template to delete.
|
390
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
391
|
+
#
|
392
|
+
def delete_email_template(email_template_id)
|
393
|
+
start.uri('/api/email/template')
|
394
|
+
.url_segment(email_template_id)
|
395
|
+
.delete()
|
396
|
+
.go()
|
397
|
+
end
|
398
|
+
|
399
|
+
#
|
400
|
+
# Deletes the group for the given Id.
|
401
|
+
#
|
402
|
+
# @param group_id [string] The Id of the group to delete.
|
403
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
404
|
+
#
|
405
|
+
def delete_group(group_id)
|
406
|
+
start.uri('/api/group')
|
407
|
+
.url_segment(group_id)
|
408
|
+
.delete()
|
409
|
+
.go()
|
410
|
+
end
|
411
|
+
|
412
|
+
#
|
413
|
+
# Removes users as members of a group.
|
414
|
+
#
|
415
|
+
# @param request [OpenStruct, Hash] The member request that contains all of the information used to remove members to the group.
|
416
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
417
|
+
#
|
418
|
+
def delete_group_members(request)
|
419
|
+
start.uri('/api/group/member')
|
420
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
421
|
+
.delete()
|
422
|
+
.go()
|
423
|
+
end
|
424
|
+
|
425
|
+
#
|
426
|
+
# Deletes the identity provider for the given Id.
|
427
|
+
#
|
428
|
+
# @param identity_provider_id [string] The Id of the identity provider to delete.
|
429
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
430
|
+
#
|
431
|
+
def delete_identity_provider(identity_provider_id)
|
432
|
+
start.uri('/api/identity-provider')
|
433
|
+
.url_segment(identity_provider_id)
|
434
|
+
.delete()
|
435
|
+
.go()
|
436
|
+
end
|
437
|
+
|
438
|
+
#
|
439
|
+
# Deletes the user registration for the given user and application.
|
440
|
+
#
|
441
|
+
# @param user_id [string] The Id of the user whose registration is being deleted.
|
442
|
+
# @param application_id [string] The Id of the application to remove the registration for.
|
443
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
444
|
+
#
|
445
|
+
def delete_registration(user_id, application_id)
|
446
|
+
start.uri('/api/user/registration')
|
447
|
+
.url_segment(user_id)
|
448
|
+
.url_segment(application_id)
|
449
|
+
.delete()
|
450
|
+
.go()
|
451
|
+
end
|
452
|
+
|
453
|
+
#
|
454
|
+
# Deletes the tenant for the given Id.
|
455
|
+
#
|
456
|
+
# @param tenant_id [string] The Id of the tenant to delete.
|
457
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
458
|
+
#
|
459
|
+
def delete_tenant(tenant_id)
|
460
|
+
start.uri('/api/tenant')
|
461
|
+
.url_segment(tenant_id)
|
462
|
+
.delete()
|
463
|
+
.go()
|
464
|
+
end
|
465
|
+
|
466
|
+
#
|
467
|
+
# Deletes the user for the given Id. This permanently deletes all information, metrics, reports and data associated
|
468
|
+
# with the user.
|
469
|
+
#
|
470
|
+
# @param user_id [string] The Id of the user to delete.
|
471
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
472
|
+
#
|
473
|
+
def delete_user(user_id)
|
474
|
+
start.uri('/api/user')
|
475
|
+
.url_segment(user_id)
|
476
|
+
.url_parameter('hardDelete', true)
|
477
|
+
.delete()
|
478
|
+
.go()
|
479
|
+
end
|
480
|
+
|
481
|
+
#
|
482
|
+
# Deletes the user action for the given Id. This permanently deletes the user action and also any history and logs of
|
483
|
+
# the action being applied to any users.
|
484
|
+
#
|
485
|
+
# @param user_action_id [string] The Id of the user action to delete.
|
486
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
487
|
+
#
|
488
|
+
def delete_user_action(user_action_id)
|
489
|
+
start.uri('/api/user-action')
|
490
|
+
.url_segment(user_action_id)
|
491
|
+
.url_parameter('hardDelete', true)
|
492
|
+
.delete()
|
493
|
+
.go()
|
494
|
+
end
|
495
|
+
|
496
|
+
#
|
497
|
+
# Deletes the user action reason for the given Id.
|
498
|
+
#
|
499
|
+
# @param user_action_reason_id [string] The Id of the user action reason to delete.
|
500
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
501
|
+
#
|
502
|
+
def delete_user_action_reason(user_action_reason_id)
|
503
|
+
start.uri('/api/user-action-reason')
|
504
|
+
.url_segment(user_action_reason_id)
|
505
|
+
.delete()
|
506
|
+
.go()
|
507
|
+
end
|
508
|
+
|
509
|
+
#
|
510
|
+
# Deletes the users with the given ids.
|
511
|
+
#
|
512
|
+
# @param request [OpenStruct, Hash] The ids of the users to delete.
|
513
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
514
|
+
#
|
515
|
+
def delete_users(request)
|
516
|
+
start.uri('/api/user/bulk')
|
517
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
518
|
+
.delete()
|
519
|
+
.go()
|
520
|
+
end
|
521
|
+
|
522
|
+
#
|
523
|
+
# Deletes the webhook for the given Id.
|
524
|
+
#
|
525
|
+
# @param webhook_id [string] The Id of the webhook to delete.
|
526
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
527
|
+
#
|
528
|
+
def delete_webhook(webhook_id)
|
529
|
+
start.uri('/api/webhook')
|
530
|
+
.url_segment(webhook_id)
|
531
|
+
.delete()
|
532
|
+
.go()
|
533
|
+
end
|
534
|
+
|
535
|
+
#
|
536
|
+
# Disable Two Factor authentication for a user.
|
537
|
+
#
|
538
|
+
# @param user_id [string] The Id of the User for which you're disabling Two Factor authentication.
|
539
|
+
# @param code [string] The Two Factor code used verify the the caller knows the Two Factor secret.
|
540
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
541
|
+
#
|
542
|
+
def disable_two_factor(user_id, code)
|
543
|
+
start.uri('/api/user/two-factor')
|
544
|
+
.url_parameter('userId', user_id)
|
545
|
+
.url_parameter('code', code)
|
546
|
+
.delete()
|
547
|
+
.go()
|
548
|
+
end
|
549
|
+
|
550
|
+
#
|
551
|
+
# Enable Two Factor authentication for a user.
|
552
|
+
#
|
553
|
+
# @param user_id [string] The Id of the user to enable Two Factor authentication.
|
554
|
+
# @param request [OpenStruct, Hash] The two factor enable request information.
|
555
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
556
|
+
#
|
557
|
+
def enable_two_factor(user_id, request)
|
558
|
+
start.uri('/api/user/two-factor')
|
559
|
+
.url_segment(user_id)
|
560
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
561
|
+
.post()
|
562
|
+
.go()
|
563
|
+
end
|
564
|
+
|
565
|
+
#
|
566
|
+
# Exchange a refresh token for a new JWT.
|
567
|
+
#
|
568
|
+
# @param request [OpenStruct, Hash] The refresh request.
|
569
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
570
|
+
#
|
571
|
+
def exchange_refresh_token_for_jwt(request)
|
572
|
+
start.uri('/api/jwt/refresh')
|
573
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
574
|
+
.post()
|
575
|
+
.go()
|
576
|
+
end
|
577
|
+
|
578
|
+
#
|
579
|
+
# Begins the forgot password sequence, which kicks off an email to the user so that they can reset their password.
|
580
|
+
#
|
581
|
+
# @param request [OpenStruct, Hash] The request that contains the information about the user so that they can be emailed.
|
582
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
583
|
+
#
|
584
|
+
def forgot_password(request)
|
585
|
+
start.uri('/api/user/forgot-password')
|
586
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
587
|
+
.post()
|
588
|
+
.go()
|
589
|
+
end
|
590
|
+
|
591
|
+
#
|
592
|
+
# Generate a new Email Verification Id to be used with the Verify Email API. This API will not attempt to send an
|
593
|
+
# email to the User. This API may be used to collect the verificationId for use with a third party system.
|
594
|
+
#
|
595
|
+
# @param email [string] The email address of the user that needs a new verification email.
|
596
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
597
|
+
#
|
598
|
+
def generate_email_verification_id(email)
|
599
|
+
start.uri('/api/user/verify-email')
|
600
|
+
.url_parameter('email', email)
|
601
|
+
.url_parameter('sendVerifyPasswordEmail', false)
|
602
|
+
.put()
|
603
|
+
.go()
|
604
|
+
end
|
605
|
+
|
606
|
+
#
|
607
|
+
# Generate a new Application Registration Verification Id to be used with the Verify Registration API. This API will not attempt to send an
|
608
|
+
# email to the User. This API may be used to collect the verificationId for use with a third party system.
|
609
|
+
#
|
610
|
+
# @param email [string] The email address of the user that needs a new verification email.
|
611
|
+
# @param application_id [string] The Id of the application to be verified.
|
612
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
613
|
+
#
|
614
|
+
def generate_registration_verification_id(email, application_id)
|
615
|
+
start.uri('/api/user/verify-registration')
|
616
|
+
.url_parameter('email', email)
|
617
|
+
.url_parameter('sendVerifyPasswordEmail', false)
|
618
|
+
.url_parameter('applicationId', application_id)
|
619
|
+
.put()
|
620
|
+
.go()
|
621
|
+
end
|
622
|
+
|
623
|
+
#
|
624
|
+
# Generate a Two Factor secret that can be used to enable Two Factor authentication for a User. The response will contain
|
625
|
+
# both the secret and a Base32 encoded form of the secret which can be shown to a User when using a 2 Step Authentication
|
626
|
+
# application such as Google Authenticator.
|
627
|
+
#
|
628
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
629
|
+
#
|
630
|
+
def generate_two_factor_secret()
|
631
|
+
start.uri('/api/two-factor/secret')
|
632
|
+
.get()
|
633
|
+
.go()
|
634
|
+
end
|
635
|
+
|
636
|
+
#
|
637
|
+
# Generate a Two Factor secret that can be used to enable Two Factor authentication for a User. The response will contain
|
638
|
+
# both the secret and a Base32 encoded form of the secret which can be shown to a User when using a 2 Step Authentication
|
639
|
+
# application such as Google Authenticator.
|
640
|
+
#
|
641
|
+
# @param encoded_jwt [string] The encoded JWT (access token).
|
642
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
643
|
+
#
|
644
|
+
def generate_two_factor_secret_using_jwt(encoded_jwt)
|
645
|
+
start.uri('/api/two-factor/secret')
|
646
|
+
.authorization('JWT ' + encoded_jwt)
|
647
|
+
.get()
|
648
|
+
.go()
|
649
|
+
end
|
650
|
+
|
651
|
+
#
|
652
|
+
# Bulk imports multiple users. This does some validation, but then tries to run batch inserts of users. This reduces
|
653
|
+
# latency when inserting lots of users. Therefore, the error response might contain some information about failures,
|
654
|
+
# but it will likely be pretty generic.
|
655
|
+
#
|
656
|
+
# @param request [OpenStruct, Hash] The request that contains all of the information about all of the users to import.
|
657
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
658
|
+
#
|
659
|
+
def import_users(request)
|
660
|
+
start.uri('/api/user/import')
|
661
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
662
|
+
.post()
|
663
|
+
.go()
|
664
|
+
end
|
665
|
+
|
666
|
+
#
|
667
|
+
# Issue a new access token (JWT) for the requested Application after ensuring the provided JWT is valid. A valid
|
668
|
+
# access token is properly signed and not expired.
|
669
|
+
# <p>
|
670
|
+
# This API may be used in an SSO configuration to issue new tokens for another application after the user has
|
671
|
+
# obtained a valid token from authentication.
|
672
|
+
#
|
673
|
+
# @param application_id [string] The Application Id for which you are requesting a new access token be issued.
|
674
|
+
# @param encoded_jwt [string] The encoded JWT (access token).
|
675
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
676
|
+
#
|
677
|
+
def issue_jwt(application_id, encoded_jwt)
|
678
|
+
start.uri('/api/jwt/issue')
|
679
|
+
.authorization('JWT ' + encoded_jwt)
|
680
|
+
.url_parameter('applicationId', application_id)
|
681
|
+
.get()
|
682
|
+
.go()
|
683
|
+
end
|
684
|
+
|
685
|
+
#
|
686
|
+
# Logs a user in.
|
687
|
+
#
|
688
|
+
# @param request [OpenStruct, Hash] The login request that contains the user credentials used to log them in.
|
689
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
690
|
+
#
|
691
|
+
def login(request)
|
692
|
+
start.uri('/api/login')
|
693
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
694
|
+
.post()
|
695
|
+
.go()
|
696
|
+
end
|
697
|
+
|
698
|
+
#
|
699
|
+
# Sends a ping to FusionAuth indicating that the user was automatically logged into an application. When using
|
700
|
+
# FusionAuth's SSO or your own, you should call this if the user is already logged in centrally, but accesses an
|
701
|
+
# application where they no longer have a session. This helps correctly track login counts, times and helps with
|
702
|
+
# reporting.
|
703
|
+
#
|
704
|
+
# @param user_id [string] The Id of the user that was logged in.
|
705
|
+
# @param application_id [string] The Id of the application that they logged into.
|
706
|
+
# @param caller_ip_address [string] (Optional) The IP address of the end-user that is logging in. If a null value is provided
|
707
|
+
# the IP address will be that of the client or last proxy that sent the request.
|
708
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
709
|
+
#
|
710
|
+
def login_ping(user_id, application_id, caller_ip_address)
|
711
|
+
start.uri('/api/login')
|
712
|
+
.url_segment(user_id)
|
713
|
+
.url_segment(application_id)
|
714
|
+
.url_parameter('ipAddress', caller_ip_address)
|
715
|
+
.put()
|
716
|
+
.go()
|
717
|
+
end
|
718
|
+
|
719
|
+
#
|
720
|
+
# The Logout API is intended to be used to remove the refresh token and access token cookies if they exist on the
|
721
|
+
# client and revoke the refresh token stored. This API does nothing if the request does not contain an access
|
722
|
+
# token or refresh token cookies.
|
723
|
+
#
|
724
|
+
# @param global [OpenStruct, Hash] When this value is set to true all of the refresh tokens issued to the owner of the
|
725
|
+
# provided token will be revoked.
|
726
|
+
# @param refresh_token [string] (Optional) The refresh_token as a request parameter instead of coming in via a cookie.
|
727
|
+
# If provided this takes precedence over the cookie.
|
728
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
729
|
+
#
|
730
|
+
def logout(global, refresh_token)
|
731
|
+
start.uri('/api/logout')
|
732
|
+
.url_parameter('global', global)
|
733
|
+
.url_parameter('refreshToken', refresh_token)
|
734
|
+
.post()
|
735
|
+
.go()
|
736
|
+
end
|
737
|
+
|
738
|
+
#
|
739
|
+
# Retrieves the identity provider for the given domain. A 200 response code indicates the domain is managed
|
740
|
+
# by a registered identity provider. A 404 indicates the domain is not managed.
|
741
|
+
#
|
742
|
+
# @param domain [string] The domain or email address to lookup.
|
743
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
744
|
+
#
|
745
|
+
def lookup_identity_provider(domain)
|
746
|
+
start.uri('/api/identity-provider/lookup')
|
747
|
+
.url_parameter('domain', domain)
|
748
|
+
.get()
|
749
|
+
.go()
|
750
|
+
end
|
751
|
+
|
752
|
+
#
|
753
|
+
# Modifies a temporal user action by changing the expiration of the action and optionally adding a comment to the
|
754
|
+
# action.
|
755
|
+
#
|
756
|
+
# @param action_id [string] The Id of the action to modify. This is technically the user action log id.
|
757
|
+
# @param request [OpenStruct, Hash] The request that contains all of the information about the modification.
|
758
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
759
|
+
#
|
760
|
+
def modify_action(action_id, request)
|
761
|
+
start.uri('/api/user/action')
|
762
|
+
.url_segment(action_id)
|
763
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
764
|
+
.put()
|
765
|
+
.go()
|
766
|
+
end
|
767
|
+
|
768
|
+
#
|
769
|
+
# Reactivates the application with the given Id.
|
770
|
+
#
|
771
|
+
# @param application_id [string] The Id of the application to reactivate.
|
772
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
773
|
+
#
|
774
|
+
def reactivate_application(application_id)
|
775
|
+
start.uri('/api/application')
|
776
|
+
.url_segment(application_id)
|
777
|
+
.url_parameter('reactivate', true)
|
778
|
+
.put()
|
779
|
+
.go()
|
780
|
+
end
|
781
|
+
|
782
|
+
#
|
783
|
+
# Reactivates the user with the given Id.
|
784
|
+
#
|
785
|
+
# @param user_id [string] The Id of the user to reactivate.
|
786
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
787
|
+
#
|
788
|
+
def reactivate_user(user_id)
|
789
|
+
start.uri('/api/user')
|
790
|
+
.url_segment(user_id)
|
791
|
+
.url_parameter('reactivate', true)
|
792
|
+
.put()
|
793
|
+
.go()
|
794
|
+
end
|
795
|
+
|
796
|
+
#
|
797
|
+
# Reactivates the user action with the given Id.
|
798
|
+
#
|
799
|
+
# @param user_action_id [string] The Id of the user action to reactivate.
|
800
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
801
|
+
#
|
802
|
+
def reactivate_user_action(user_action_id)
|
803
|
+
start.uri('/api/user-action')
|
804
|
+
.url_segment(user_action_id)
|
805
|
+
.url_parameter('reactivate', true)
|
806
|
+
.put()
|
807
|
+
.go()
|
808
|
+
end
|
809
|
+
|
810
|
+
#
|
811
|
+
# Reconcile a User to FusionAuth using JWT issued from another Identity Provider.
|
812
|
+
#
|
813
|
+
# @param request [OpenStruct, Hash] The reconcile request that contains the data to reconcile the User.
|
814
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
815
|
+
#
|
816
|
+
def reconcile_jwt(request)
|
817
|
+
start.uri('/api/jwt/reconcile')
|
818
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
819
|
+
.post()
|
820
|
+
.go()
|
821
|
+
end
|
822
|
+
|
823
|
+
#
|
824
|
+
# Registers a user for an application. If you provide the User and the UserRegistration object on this request, it
|
825
|
+
# will create the user as well as register them for the application. This is called a Full Registration. However, if
|
826
|
+
# you only provide the UserRegistration object, then the user must already exist and they will be registered for the
|
827
|
+
# application. The user id can also be provided and it will either be used to look up an existing user or it will be
|
828
|
+
# used for the newly created User.
|
829
|
+
#
|
830
|
+
# @param user_id [string] (Optional) The Id of the user being registered for the application and optionally created.
|
831
|
+
# @param request [OpenStruct, Hash] The request that optionally contains the User and must contain the UserRegistration.
|
832
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
833
|
+
#
|
834
|
+
def register(user_id, request)
|
835
|
+
start.uri('/api/user/registration')
|
836
|
+
.url_segment(user_id)
|
837
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
838
|
+
.post()
|
839
|
+
.go()
|
840
|
+
end
|
841
|
+
|
842
|
+
#
|
843
|
+
# Re-sends the verification email to the user.
|
844
|
+
#
|
845
|
+
# @param email [string] The email address of the user that needs a new verification email.
|
846
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
847
|
+
#
|
848
|
+
def resend_email_verification(email)
|
849
|
+
start.uri('/api/user/verify-email')
|
850
|
+
.url_parameter('email', email)
|
851
|
+
.put()
|
852
|
+
.go()
|
853
|
+
end
|
854
|
+
|
855
|
+
#
|
856
|
+
# Re-sends the application registration verification email to the user.
|
857
|
+
#
|
858
|
+
# @param email [string] The email address of the user that needs a new verification email.
|
859
|
+
# @param application_id [string] The Id of the application to be verified.
|
860
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
861
|
+
#
|
862
|
+
def resend_registration_verification(email, application_id)
|
863
|
+
start.uri('/api/user/verify-registration')
|
864
|
+
.url_parameter('email', email)
|
865
|
+
.url_parameter('applicationId', application_id)
|
866
|
+
.put()
|
867
|
+
.go()
|
868
|
+
end
|
869
|
+
|
870
|
+
#
|
871
|
+
# Retrieves a single action log (the log of a user action that was taken on a user previously) for the given Id.
|
872
|
+
#
|
873
|
+
# @param action_id [string] The Id of the action to retrieve.
|
874
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
875
|
+
#
|
876
|
+
def retrieve_action(action_id)
|
877
|
+
start.uri('/api/user/action')
|
878
|
+
.url_segment(action_id)
|
879
|
+
.get()
|
880
|
+
.go()
|
881
|
+
end
|
882
|
+
|
883
|
+
#
|
884
|
+
# Retrieves all of the actions for the user with the given Id.
|
885
|
+
#
|
886
|
+
# @param user_id [string] The Id of the user to fetch the actions for.
|
887
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
888
|
+
#
|
889
|
+
def retrieve_actions(user_id)
|
890
|
+
start.uri('/api/user/action')
|
891
|
+
.url_parameter('userId', user_id)
|
892
|
+
.get()
|
893
|
+
.go()
|
894
|
+
end
|
895
|
+
|
896
|
+
#
|
897
|
+
# Retrieves the application for the given id or all of the applications if the id is null.
|
898
|
+
#
|
899
|
+
# @param application_id [string] (Optional) The application id.
|
900
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
901
|
+
#
|
902
|
+
def retrieve_application(application_id)
|
903
|
+
start.uri('/api/application')
|
904
|
+
.url_segment(application_id)
|
905
|
+
.get()
|
906
|
+
.go()
|
907
|
+
end
|
908
|
+
|
909
|
+
#
|
910
|
+
# Retrieves all of the applications.
|
911
|
+
#
|
912
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
913
|
+
#
|
914
|
+
def retrieve_applications()
|
915
|
+
start.uri('/api/application')
|
916
|
+
.get()
|
917
|
+
.go()
|
918
|
+
end
|
919
|
+
|
920
|
+
#
|
921
|
+
# Retrieves a single audit log for the given Id.
|
922
|
+
#
|
923
|
+
# @param audit_log_id [OpenStruct, Hash] The Id of the audit log to retrieve.
|
924
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
925
|
+
#
|
926
|
+
def retrieve_audit_log(audit_log_id)
|
927
|
+
start.uri('/api/system/audit-log')
|
928
|
+
.url_segment(audit_log_id)
|
929
|
+
.get()
|
930
|
+
.go()
|
931
|
+
end
|
932
|
+
|
933
|
+
#
|
934
|
+
# Retrieves the daily active user report between the two instants. If you specify an application id, it will only
|
935
|
+
# return the daily active counts for that application.
|
936
|
+
#
|
937
|
+
# @param application_id [string] (Optional) The application id.
|
938
|
+
# @param start [OpenStruct, Hash] The start instant as UTC milliseconds since Epoch.
|
939
|
+
# @param _end [OpenStruct, Hash] The end instant as UTC milliseconds since Epoch.
|
940
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
941
|
+
#
|
942
|
+
def retrieve_daily_active_report(application_id, start, _end)
|
943
|
+
start.uri('/api/report/daily-active-user')
|
944
|
+
.url_parameter('applicationId', application_id)
|
945
|
+
.url_parameter('start', start)
|
946
|
+
.url_parameter('end', _end)
|
947
|
+
.get()
|
948
|
+
.go()
|
949
|
+
end
|
950
|
+
|
951
|
+
#
|
952
|
+
# Retrieves the email template for the given Id. If you don't specify the id, this will return all of the email templates.
|
953
|
+
#
|
954
|
+
# @param email_template_id [string] (Optional) The Id of the email template.
|
955
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
956
|
+
#
|
957
|
+
def retrieve_email_template(email_template_id)
|
958
|
+
start.uri('/api/email/template')
|
959
|
+
.url_segment(email_template_id)
|
960
|
+
.get()
|
961
|
+
.go()
|
962
|
+
end
|
963
|
+
|
964
|
+
#
|
965
|
+
# Creates a preview of the email template provided in the request. This allows you to preview an email template that
|
966
|
+
# hasn't been saved to the database yet. The entire email template does not need to be provided on the request. This
|
967
|
+
# will create the preview based on whatever is given.
|
968
|
+
#
|
969
|
+
# @param request [OpenStruct, Hash] The request that contains the email template and optionally a locale to render it in.
|
970
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
971
|
+
#
|
972
|
+
def retrieve_email_template_preview(request)
|
973
|
+
start.uri('/api/email/template/preview')
|
974
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
975
|
+
.post()
|
976
|
+
.go()
|
977
|
+
end
|
978
|
+
|
979
|
+
#
|
980
|
+
# Retrieves all of the email templates.
|
981
|
+
#
|
982
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
983
|
+
#
|
984
|
+
def retrieve_email_templates()
|
985
|
+
start.uri('/api/email/template')
|
986
|
+
.get()
|
987
|
+
.go()
|
988
|
+
end
|
989
|
+
|
990
|
+
#
|
991
|
+
# Retrieves the group for the given Id.
|
992
|
+
#
|
993
|
+
# @param group_id [string] The Id of the group.
|
994
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
995
|
+
#
|
996
|
+
def retrieve_group(group_id)
|
997
|
+
start.uri('/api/group')
|
998
|
+
.url_segment(group_id)
|
999
|
+
.get()
|
1000
|
+
.go()
|
1001
|
+
end
|
1002
|
+
|
1003
|
+
#
|
1004
|
+
# Retrieves all of the groups.
|
1005
|
+
#
|
1006
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1007
|
+
#
|
1008
|
+
def retrieve_groups()
|
1009
|
+
start.uri('/api/group')
|
1010
|
+
.get()
|
1011
|
+
.go()
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
#
|
1015
|
+
# Retrieves the identity provider for the given id or all of the identity providers if the id is null.
|
1016
|
+
#
|
1017
|
+
# @param identity_provider_id [string] (Optional) The identity provider id.
|
1018
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1019
|
+
#
|
1020
|
+
def retrieve_identity_provider(identity_provider_id)
|
1021
|
+
start.uri('/api/identity-provider')
|
1022
|
+
.url_segment(identity_provider_id)
|
1023
|
+
.get()
|
1024
|
+
.go()
|
1025
|
+
end
|
1026
|
+
|
1027
|
+
#
|
1028
|
+
# Retrieves all of the identity providers.
|
1029
|
+
#
|
1030
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1031
|
+
#
|
1032
|
+
def retrieve_identity_providers()
|
1033
|
+
start.uri('/api/identity-provider')
|
1034
|
+
.get()
|
1035
|
+
.go()
|
1036
|
+
end
|
1037
|
+
|
1038
|
+
#
|
1039
|
+
# Retrieves all of the applications that are currently inactive.
|
1040
|
+
#
|
1041
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1042
|
+
#
|
1043
|
+
def retrieve_inactive_applications()
|
1044
|
+
start.uri('/api/application')
|
1045
|
+
.url_parameter('inactive', true)
|
1046
|
+
.get()
|
1047
|
+
.go()
|
1048
|
+
end
|
1049
|
+
|
1050
|
+
#
|
1051
|
+
# Retrieves all of the user actions that are currently inactive.
|
1052
|
+
#
|
1053
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1054
|
+
#
|
1055
|
+
def retrieve_inactive_user_actions()
|
1056
|
+
start.uri('/api/user-action')
|
1057
|
+
.url_parameter('inactive', true)
|
1058
|
+
.get()
|
1059
|
+
.go()
|
1060
|
+
end
|
1061
|
+
|
1062
|
+
#
|
1063
|
+
# Retrieves the available integrations.
|
1064
|
+
#
|
1065
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1066
|
+
#
|
1067
|
+
def retrieve_integration()
|
1068
|
+
start.uri('/api/integration')
|
1069
|
+
.get()
|
1070
|
+
.go()
|
1071
|
+
end
|
1072
|
+
|
1073
|
+
#
|
1074
|
+
# Retrieves the Public Key configured for verifying JSON Web Tokens (JWT) by the key Id. If the key Id is provided a
|
1075
|
+
# single public key will be returned if one is found by that id. If the optional parameter key Id is not provided all
|
1076
|
+
# public keys will be returned.
|
1077
|
+
#
|
1078
|
+
# @param key_id [string] (Optional) The Id of the public key.
|
1079
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1080
|
+
#
|
1081
|
+
def retrieve_jwt_public_key(key_id)
|
1082
|
+
start.uri('/api/jwt/public-key')
|
1083
|
+
.url_segment(key_id)
|
1084
|
+
.get()
|
1085
|
+
.go()
|
1086
|
+
end
|
1087
|
+
|
1088
|
+
#
|
1089
|
+
# Retrieves all Public Keys configured for verifying JSON Web Tokens (JWT).
|
1090
|
+
#
|
1091
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1092
|
+
#
|
1093
|
+
def retrieve_jwt_public_keys()
|
1094
|
+
start.uri('/api/jwt/public-key')
|
1095
|
+
.get()
|
1096
|
+
.go()
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
#
|
1100
|
+
# Retrieves the login report between the two instants. If you specify an application id, it will only return the
|
1101
|
+
# login counts for that application.
|
1102
|
+
#
|
1103
|
+
# @param application_id [string] (Optional) The application id.
|
1104
|
+
# @param start [OpenStruct, Hash] The start instant as UTC milliseconds since Epoch.
|
1105
|
+
# @param _end [OpenStruct, Hash] The end instant as UTC milliseconds since Epoch.
|
1106
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1107
|
+
#
|
1108
|
+
def retrieve_login_report(application_id, start, _end)
|
1109
|
+
start.uri('/api/report/login')
|
1110
|
+
.url_parameter('applicationId', application_id)
|
1111
|
+
.url_parameter('start', start)
|
1112
|
+
.url_parameter('end', _end)
|
1113
|
+
.get()
|
1114
|
+
.go()
|
1115
|
+
end
|
1116
|
+
|
1117
|
+
#
|
1118
|
+
# Retrieves the monthly active user report between the two instants. If you specify an application id, it will only
|
1119
|
+
# return the monthly active counts for that application.
|
1120
|
+
#
|
1121
|
+
# @param application_id [string] (Optional) The application id.
|
1122
|
+
# @param start [OpenStruct, Hash] The start instant as UTC milliseconds since Epoch.
|
1123
|
+
# @param _end [OpenStruct, Hash] The end instant as UTC milliseconds since Epoch.
|
1124
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1125
|
+
#
|
1126
|
+
def retrieve_monthly_active_report(application_id, start, _end)
|
1127
|
+
start.uri('/api/report/monthly-active-user')
|
1128
|
+
.url_parameter('applicationId', application_id)
|
1129
|
+
.url_parameter('start', start)
|
1130
|
+
.url_parameter('end', _end)
|
1131
|
+
.get()
|
1132
|
+
.go()
|
1133
|
+
end
|
1134
|
+
|
1135
|
+
#
|
1136
|
+
# Retrieves the Oauth2 configuration for the application for the given Application Id.
|
1137
|
+
#
|
1138
|
+
# @param application_id [string] The Id of the Application to retrieve OAuth configuration.
|
1139
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1140
|
+
#
|
1141
|
+
def retrieve_oauth_configuration(application_id)
|
1142
|
+
start.uri('/api/application')
|
1143
|
+
.url_segment(application_id)
|
1144
|
+
.url_segment("oauth-configuration")
|
1145
|
+
.get()
|
1146
|
+
.go()
|
1147
|
+
end
|
1148
|
+
|
1149
|
+
#
|
1150
|
+
# Retrieves the password validation rules.
|
1151
|
+
#
|
1152
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1153
|
+
#
|
1154
|
+
def retrieve_password_validation_rules()
|
1155
|
+
start.uri('/api/system-configuration/password-validation-rules')
|
1156
|
+
.get()
|
1157
|
+
.go()
|
1158
|
+
end
|
1159
|
+
|
1160
|
+
#
|
1161
|
+
# Retrieves the refresh tokens that belong to the user with the given Id.
|
1162
|
+
#
|
1163
|
+
# @param user_id [string] The Id of the user.
|
1164
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1165
|
+
#
|
1166
|
+
def retrieve_refresh_tokens(user_id)
|
1167
|
+
start.uri('/api/jwt/refresh')
|
1168
|
+
.url_parameter('userId', user_id)
|
1169
|
+
.get()
|
1170
|
+
.go()
|
1171
|
+
end
|
1172
|
+
|
1173
|
+
#
|
1174
|
+
# Retrieves the user registration for the user with the given id and the given application id.
|
1175
|
+
#
|
1176
|
+
# @param user_id [string] The Id of the user.
|
1177
|
+
# @param application_id [string] The Id of the application.
|
1178
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1179
|
+
#
|
1180
|
+
def retrieve_registration(user_id, application_id)
|
1181
|
+
start.uri('/api/user/registration')
|
1182
|
+
.url_segment(user_id)
|
1183
|
+
.url_segment(application_id)
|
1184
|
+
.get()
|
1185
|
+
.go()
|
1186
|
+
end
|
1187
|
+
|
1188
|
+
#
|
1189
|
+
# Retrieves the registration report between the two instants. If you specify an application id, it will only return
|
1190
|
+
# the registration counts for that application.
|
1191
|
+
#
|
1192
|
+
# @param application_id [string] (Optional) The application id.
|
1193
|
+
# @param start [OpenStruct, Hash] The start instant as UTC milliseconds since Epoch.
|
1194
|
+
# @param _end [OpenStruct, Hash] The end instant as UTC milliseconds since Epoch.
|
1195
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1196
|
+
#
|
1197
|
+
def retrieve_registration_report(application_id, start, _end)
|
1198
|
+
start.uri('/api/report/registration')
|
1199
|
+
.url_parameter('applicationId', application_id)
|
1200
|
+
.url_parameter('start', start)
|
1201
|
+
.url_parameter('end', _end)
|
1202
|
+
.get()
|
1203
|
+
.go()
|
1204
|
+
end
|
1205
|
+
|
1206
|
+
#
|
1207
|
+
# Retrieves the system configuration.
|
1208
|
+
#
|
1209
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1210
|
+
#
|
1211
|
+
def retrieve_system_configuration()
|
1212
|
+
start.uri('/api/system-configuration')
|
1213
|
+
.get()
|
1214
|
+
.go()
|
1215
|
+
end
|
1216
|
+
|
1217
|
+
#
|
1218
|
+
# Retrieves the tenant for the given Id.
|
1219
|
+
#
|
1220
|
+
# @param tenant_id [string] The Id of the tenant.
|
1221
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1222
|
+
#
|
1223
|
+
def retrieve_tenant(tenant_id)
|
1224
|
+
start.uri('/api/tenant')
|
1225
|
+
.url_segment(tenant_id)
|
1226
|
+
.get()
|
1227
|
+
.go()
|
1228
|
+
end
|
1229
|
+
|
1230
|
+
#
|
1231
|
+
# Retrieves all of the tenants.
|
1232
|
+
#
|
1233
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1234
|
+
#
|
1235
|
+
def retrieve_tenants()
|
1236
|
+
start.uri('/api/tenant')
|
1237
|
+
.get()
|
1238
|
+
.go()
|
1239
|
+
end
|
1240
|
+
|
1241
|
+
#
|
1242
|
+
# Retrieves the totals report. This contains all of the total counts for each application and the global registration
|
1243
|
+
# count.
|
1244
|
+
#
|
1245
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1246
|
+
#
|
1247
|
+
def retrieve_total_report()
|
1248
|
+
start.uri('/api/report/totals')
|
1249
|
+
.get()
|
1250
|
+
.go()
|
1251
|
+
end
|
1252
|
+
|
1253
|
+
#
|
1254
|
+
# Retrieves the user for the given Id.
|
1255
|
+
#
|
1256
|
+
# @param user_id [string] The Id of the user.
|
1257
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1258
|
+
#
|
1259
|
+
def retrieve_user(user_id)
|
1260
|
+
start.uri('/api/user')
|
1261
|
+
.url_segment(user_id)
|
1262
|
+
.get()
|
1263
|
+
.go()
|
1264
|
+
end
|
1265
|
+
|
1266
|
+
#
|
1267
|
+
# Retrieves the user action for the given Id. If you pass in null for the id, this will return all of the user
|
1268
|
+
# actions.
|
1269
|
+
#
|
1270
|
+
# @param user_action_id [string] (Optional) The Id of the user action.
|
1271
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1272
|
+
#
|
1273
|
+
def retrieve_user_action(user_action_id)
|
1274
|
+
start.uri('/api/user-action')
|
1275
|
+
.url_segment(user_action_id)
|
1276
|
+
.get()
|
1277
|
+
.go()
|
1278
|
+
end
|
1279
|
+
|
1280
|
+
#
|
1281
|
+
# Retrieves the user action reason for the given Id. If you pass in null for the id, this will return all of the user
|
1282
|
+
# action reasons.
|
1283
|
+
#
|
1284
|
+
# @param user_action_reason_id [string] (Optional) The Id of the user action reason.
|
1285
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1286
|
+
#
|
1287
|
+
def retrieve_user_action_reason(user_action_reason_id)
|
1288
|
+
start.uri('/api/user-action-reason')
|
1289
|
+
.url_segment(user_action_reason_id)
|
1290
|
+
.get()
|
1291
|
+
.go()
|
1292
|
+
end
|
1293
|
+
|
1294
|
+
#
|
1295
|
+
# Retrieves all the user action reasons.
|
1296
|
+
#
|
1297
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1298
|
+
#
|
1299
|
+
def retrieve_user_action_reasons()
|
1300
|
+
start.uri('/api/user-action-reason')
|
1301
|
+
.get()
|
1302
|
+
.go()
|
1303
|
+
end
|
1304
|
+
|
1305
|
+
#
|
1306
|
+
# Retrieves all of the user actions.
|
1307
|
+
#
|
1308
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1309
|
+
#
|
1310
|
+
def retrieve_user_actions()
|
1311
|
+
start.uri('/api/user-action')
|
1312
|
+
.get()
|
1313
|
+
.go()
|
1314
|
+
end
|
1315
|
+
|
1316
|
+
#
|
1317
|
+
# Retrieves the user by a change password Id. The intended use of this API is to retrieve a user after the forgot
|
1318
|
+
# password workflow has been initiated and you may not know the user's email or username.
|
1319
|
+
#
|
1320
|
+
# @param change_password_id [string] The unique change password Id that was sent via email or returned by the Forgot Password API.
|
1321
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1322
|
+
#
|
1323
|
+
def retrieve_user_by_change_password_id(change_password_id)
|
1324
|
+
start.uri('/api/user')
|
1325
|
+
.url_parameter('changePasswordId', change_password_id)
|
1326
|
+
.get()
|
1327
|
+
.go()
|
1328
|
+
end
|
1329
|
+
|
1330
|
+
#
|
1331
|
+
# Retrieves the user for the given email.
|
1332
|
+
#
|
1333
|
+
# @param email [string] The email of the user.
|
1334
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1335
|
+
#
|
1336
|
+
def retrieve_user_by_email(email)
|
1337
|
+
start.uri('/api/user')
|
1338
|
+
.url_parameter('email', email)
|
1339
|
+
.get()
|
1340
|
+
.go()
|
1341
|
+
end
|
1342
|
+
|
1343
|
+
#
|
1344
|
+
# Retrieves the user for the loginId. The loginId can be either the username or the email.
|
1345
|
+
#
|
1346
|
+
# @param login_id [string] The email or username of the user.
|
1347
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1348
|
+
#
|
1349
|
+
def retrieve_user_by_login_id(login_id)
|
1350
|
+
start.uri('/api/user')
|
1351
|
+
.url_parameter('loginId', login_id)
|
1352
|
+
.get()
|
1353
|
+
.go()
|
1354
|
+
end
|
1355
|
+
|
1356
|
+
#
|
1357
|
+
# Retrieves the user for the given username.
|
1358
|
+
#
|
1359
|
+
# @param username [string] The username of the user.
|
1360
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1361
|
+
#
|
1362
|
+
def retrieve_user_by_username(username)
|
1363
|
+
start.uri('/api/user')
|
1364
|
+
.url_parameter('username', username)
|
1365
|
+
.get()
|
1366
|
+
.go()
|
1367
|
+
end
|
1368
|
+
|
1369
|
+
#
|
1370
|
+
# Retrieves the user by a verificationId. The intended use of this API is to retrieve a user after the forgot
|
1371
|
+
# password workflow has been initiated and you may not know the user's email or username.
|
1372
|
+
#
|
1373
|
+
# @param verification_id [string] The unique verification Id that has been set on the user object.
|
1374
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1375
|
+
#
|
1376
|
+
def retrieve_user_by_verification_id(verification_id)
|
1377
|
+
start.uri('/api/user')
|
1378
|
+
.url_parameter('verificationId', verification_id)
|
1379
|
+
.get()
|
1380
|
+
.go()
|
1381
|
+
end
|
1382
|
+
|
1383
|
+
#
|
1384
|
+
# Retrieves all of the comments for the user with the given Id.
|
1385
|
+
#
|
1386
|
+
# @param user_id [string] The Id of the user.
|
1387
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1388
|
+
#
|
1389
|
+
def retrieve_user_comments(user_id)
|
1390
|
+
start.uri('/api/user/comment')
|
1391
|
+
.url_segment(user_id)
|
1392
|
+
.get()
|
1393
|
+
.go()
|
1394
|
+
end
|
1395
|
+
|
1396
|
+
#
|
1397
|
+
# Retrieves the last number of login records for a user.
|
1398
|
+
#
|
1399
|
+
# @param user_id [string] The Id of the user.
|
1400
|
+
# @param offset [OpenStruct, Hash] The initial record. e.g. 0 is the last login, 100 will be the 100th most recent login.
|
1401
|
+
# @param limit [OpenStruct, Hash] (Optional, defaults to 10) The number of records to retrieve.
|
1402
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1403
|
+
#
|
1404
|
+
def retrieve_user_login_report(user_id, offset, limit)
|
1405
|
+
start.uri('/api/report/user-login')
|
1406
|
+
.url_parameter('userId', user_id)
|
1407
|
+
.url_parameter('offset', offset)
|
1408
|
+
.url_parameter('limit', limit)
|
1409
|
+
.get()
|
1410
|
+
.go()
|
1411
|
+
end
|
1412
|
+
|
1413
|
+
#
|
1414
|
+
# Retrieves the user for the given Id. This method does not use an API key, instead it uses a JSON Web Token (JWT) for authentication.
|
1415
|
+
#
|
1416
|
+
# @param encoded_jwt [string] The encoded JWT (access token).
|
1417
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1418
|
+
#
|
1419
|
+
def retrieve_user_using_jwt(encoded_jwt)
|
1420
|
+
start.uri('/api/user')
|
1421
|
+
.authorization('JWT ' + encoded_jwt)
|
1422
|
+
.get()
|
1423
|
+
.go()
|
1424
|
+
end
|
1425
|
+
|
1426
|
+
#
|
1427
|
+
# Retrieves the webhook for the given Id. If you pass in null for the id, this will return all the webhooks.
|
1428
|
+
#
|
1429
|
+
# @param webhook_id [string] (Optional) The Id of the webhook.
|
1430
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1431
|
+
#
|
1432
|
+
def retrieve_webhook(webhook_id)
|
1433
|
+
start.uri('/api/webhook')
|
1434
|
+
.url_segment(webhook_id)
|
1435
|
+
.get()
|
1436
|
+
.go()
|
1437
|
+
end
|
1438
|
+
|
1439
|
+
#
|
1440
|
+
# Retrieves all the webhooks.
|
1441
|
+
#
|
1442
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1443
|
+
#
|
1444
|
+
def retrieve_webhooks()
|
1445
|
+
start.uri('/api/webhook')
|
1446
|
+
.get()
|
1447
|
+
.go()
|
1448
|
+
end
|
1449
|
+
|
1450
|
+
#
|
1451
|
+
# Revokes a single refresh token, all tokens for a user or all tokens for an application. If you provide a user id
|
1452
|
+
# and an application id, this will delete all the refresh tokens for that user for that application.
|
1453
|
+
#
|
1454
|
+
# @param token [string] (Optional) The refresh token to delete.
|
1455
|
+
# @param user_id [string] (Optional) The user id whose tokens to delete.
|
1456
|
+
# @param application_id [string] (Optional) The application id of the tokens to delete.
|
1457
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1458
|
+
#
|
1459
|
+
def revoke_refresh_token(token, user_id, application_id)
|
1460
|
+
start.uri('/api/jwt/refresh')
|
1461
|
+
.url_parameter('token', token)
|
1462
|
+
.url_parameter('userId', user_id)
|
1463
|
+
.url_parameter('applicationId', application_id)
|
1464
|
+
.delete()
|
1465
|
+
.go()
|
1466
|
+
end
|
1467
|
+
|
1468
|
+
#
|
1469
|
+
# Searches the audit logs with the specified criteria and pagination.
|
1470
|
+
#
|
1471
|
+
# @param request [OpenStruct, Hash] The search criteria and pagination information.
|
1472
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1473
|
+
#
|
1474
|
+
def search_audit_logs(request)
|
1475
|
+
start.uri('/api/system/audit-log/search')
|
1476
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1477
|
+
.post()
|
1478
|
+
.go()
|
1479
|
+
end
|
1480
|
+
|
1481
|
+
#
|
1482
|
+
# Retrieves the users for the given ids. If any id is invalid, it is ignored.
|
1483
|
+
#
|
1484
|
+
# @param ids [Array] The user ids to search for.
|
1485
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1486
|
+
#
|
1487
|
+
def search_users(ids)
|
1488
|
+
start.uri('/api/user/search')
|
1489
|
+
.url_parameter('ids', ids)
|
1490
|
+
.get()
|
1491
|
+
.go()
|
1492
|
+
end
|
1493
|
+
|
1494
|
+
#
|
1495
|
+
# Retrieves the users for the given search criteria and pagination.
|
1496
|
+
#
|
1497
|
+
# @param request [OpenStruct, Hash] The search criteria and pagination constraints. Fields used: queryString, numberOfResults, startRow,
|
1498
|
+
# and sort fields.
|
1499
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1500
|
+
#
|
1501
|
+
def search_users_by_query_string(request)
|
1502
|
+
start.uri('/api/user/search')
|
1503
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1504
|
+
.post()
|
1505
|
+
.go()
|
1506
|
+
end
|
1507
|
+
|
1508
|
+
#
|
1509
|
+
# Send an email using an email template id. You can optionally provide <code>requestData</code> to access key value
|
1510
|
+
# pairs in the email template.
|
1511
|
+
#
|
1512
|
+
# @param email_template_id [string] The id for the template.
|
1513
|
+
# @param request [OpenStruct, Hash] The send email request that contains all of the information used to send the email.
|
1514
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1515
|
+
#
|
1516
|
+
def send_email(email_template_id, request)
|
1517
|
+
start.uri('/api/email/send')
|
1518
|
+
.url_segment(email_template_id)
|
1519
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1520
|
+
.post()
|
1521
|
+
.go()
|
1522
|
+
end
|
1523
|
+
|
1524
|
+
#
|
1525
|
+
# Send a Two Factor authentication code to assist in setting up Two Factor authentication or disabling.
|
1526
|
+
#
|
1527
|
+
# @param request [OpenStruct, Hash] The request object that contains all of the information used to send the code.
|
1528
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1529
|
+
#
|
1530
|
+
def send_two_factor_code(request)
|
1531
|
+
start.uri('/api/two-factor/send')
|
1532
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1533
|
+
.post()
|
1534
|
+
.go()
|
1535
|
+
end
|
1536
|
+
|
1537
|
+
#
|
1538
|
+
# Send a Two Factor authentication code to allow the completion of Two Factor authentication.
|
1539
|
+
#
|
1540
|
+
# @param two_factor_id [string] The Id returned by the Login API necessary to complete Two Factor authentication.
|
1541
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1542
|
+
#
|
1543
|
+
def send_two_factor_code_for_login(two_factor_id)
|
1544
|
+
start.uri('/api/two-factor/send')
|
1545
|
+
.url_segment(two_factor_id)
|
1546
|
+
.post()
|
1547
|
+
.go()
|
1548
|
+
end
|
1549
|
+
|
1550
|
+
#
|
1551
|
+
# Complete login using a 2FA challenge
|
1552
|
+
#
|
1553
|
+
# @param request [OpenStruct, Hash] The login request that contains the user credentials used to log them in.
|
1554
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1555
|
+
#
|
1556
|
+
def two_factor_login(request)
|
1557
|
+
start.uri('/api/two-factor/login')
|
1558
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1559
|
+
.post()
|
1560
|
+
.go()
|
1561
|
+
end
|
1562
|
+
|
1563
|
+
#
|
1564
|
+
# Updates the application with the given Id.
|
1565
|
+
#
|
1566
|
+
# @param application_id [string] The Id of the application to update.
|
1567
|
+
# @param request [OpenStruct, Hash] The request that contains all of the new application information.
|
1568
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1569
|
+
#
|
1570
|
+
def update_application(application_id, request)
|
1571
|
+
start.uri('/api/application')
|
1572
|
+
.url_segment(application_id)
|
1573
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1574
|
+
.put()
|
1575
|
+
.go()
|
1576
|
+
end
|
1577
|
+
|
1578
|
+
#
|
1579
|
+
# Updates the application role with the given id for the application.
|
1580
|
+
#
|
1581
|
+
# @param application_id [string] The Id of the application that the role belongs to.
|
1582
|
+
# @param role_id [string] The Id of the role to update.
|
1583
|
+
# @param request [OpenStruct, Hash] The request that contains all of the new role information.
|
1584
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1585
|
+
#
|
1586
|
+
def update_application_role(application_id, role_id, request)
|
1587
|
+
start.uri('/api/application')
|
1588
|
+
.url_segment(application_id)
|
1589
|
+
.url_segment("role")
|
1590
|
+
.url_segment(role_id)
|
1591
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1592
|
+
.put()
|
1593
|
+
.go()
|
1594
|
+
end
|
1595
|
+
|
1596
|
+
#
|
1597
|
+
# Updates the email template with the given Id.
|
1598
|
+
#
|
1599
|
+
# @param email_template_id [string] The Id of the email template to update.
|
1600
|
+
# @param request [OpenStruct, Hash] The request that contains all of the new email template information.
|
1601
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1602
|
+
#
|
1603
|
+
def update_email_template(email_template_id, request)
|
1604
|
+
start.uri('/api/email/template')
|
1605
|
+
.url_segment(email_template_id)
|
1606
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1607
|
+
.put()
|
1608
|
+
.go()
|
1609
|
+
end
|
1610
|
+
|
1611
|
+
#
|
1612
|
+
# Updates the group with the given Id.
|
1613
|
+
#
|
1614
|
+
# @param group_id [string] The Id of the group to update.
|
1615
|
+
# @param request [OpenStruct, Hash] The request that contains all of the new group information.
|
1616
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1617
|
+
#
|
1618
|
+
def update_group(group_id, request)
|
1619
|
+
start.uri('/api/group')
|
1620
|
+
.url_segment(group_id)
|
1621
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1622
|
+
.put()
|
1623
|
+
.go()
|
1624
|
+
end
|
1625
|
+
|
1626
|
+
#
|
1627
|
+
# Updates the identity provider with the given Id.
|
1628
|
+
#
|
1629
|
+
# @param identity_provider_id [string] The Id of the identity provider to update.
|
1630
|
+
# @param request [OpenStruct, Hash] The request object that contains the updated identity provider.
|
1631
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1632
|
+
#
|
1633
|
+
def update_identity_provider(identity_provider_id, request)
|
1634
|
+
start.uri('/api/identity-provider')
|
1635
|
+
.url_segment(identity_provider_id)
|
1636
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1637
|
+
.put()
|
1638
|
+
.go()
|
1639
|
+
end
|
1640
|
+
|
1641
|
+
#
|
1642
|
+
# Updates the available integrations.
|
1643
|
+
#
|
1644
|
+
# @param request [OpenStruct, Hash] The request that contains all of the new integration information.
|
1645
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1646
|
+
#
|
1647
|
+
def update_integrations(request)
|
1648
|
+
start.uri('/api/integration')
|
1649
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1650
|
+
.put()
|
1651
|
+
.go()
|
1652
|
+
end
|
1653
|
+
|
1654
|
+
#
|
1655
|
+
# Updates the registration for the user with the given id and the application defined in the request.
|
1656
|
+
#
|
1657
|
+
# @param user_id [string] The Id of the user whose registration is going to be updated.
|
1658
|
+
# @param request [OpenStruct, Hash] The request that contains all of the new registration information.
|
1659
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1660
|
+
#
|
1661
|
+
def update_registration(user_id, request)
|
1662
|
+
start.uri('/api/user/registration')
|
1663
|
+
.url_segment(user_id)
|
1664
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1665
|
+
.put()
|
1666
|
+
.go()
|
1667
|
+
end
|
1668
|
+
|
1669
|
+
#
|
1670
|
+
# Updates the system configuration.
|
1671
|
+
#
|
1672
|
+
# @param request [OpenStruct, Hash] The request that contains all of the new system configuration information.
|
1673
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1674
|
+
#
|
1675
|
+
def update_system_configuration(request)
|
1676
|
+
start.uri('/api/system-configuration')
|
1677
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1678
|
+
.put()
|
1679
|
+
.go()
|
1680
|
+
end
|
1681
|
+
|
1682
|
+
#
|
1683
|
+
# Updates the tenant with the given Id.
|
1684
|
+
#
|
1685
|
+
# @param tenant_id [string] The Id of the tenant to update.
|
1686
|
+
# @param request [OpenStruct, Hash] The request that contains all of the new tenant information.
|
1687
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1688
|
+
#
|
1689
|
+
def update_tenant(tenant_id, request)
|
1690
|
+
start.uri('/api/tenant')
|
1691
|
+
.url_segment(tenant_id)
|
1692
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1693
|
+
.put()
|
1694
|
+
.go()
|
1695
|
+
end
|
1696
|
+
|
1697
|
+
#
|
1698
|
+
# Updates the user with the given Id.
|
1699
|
+
#
|
1700
|
+
# @param user_id [string] The Id of the user to update.
|
1701
|
+
# @param request [OpenStruct, Hash] The request that contains all of the new user information.
|
1702
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1703
|
+
#
|
1704
|
+
def update_user(user_id, request)
|
1705
|
+
start.uri('/api/user')
|
1706
|
+
.url_segment(user_id)
|
1707
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1708
|
+
.put()
|
1709
|
+
.go()
|
1710
|
+
end
|
1711
|
+
|
1712
|
+
#
|
1713
|
+
# Updates the user action with the given Id.
|
1714
|
+
#
|
1715
|
+
# @param user_action_id [string] The Id of the user action to update.
|
1716
|
+
# @param request [OpenStruct, Hash] The request that contains all of the new user action information.
|
1717
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1718
|
+
#
|
1719
|
+
def update_user_action(user_action_id, request)
|
1720
|
+
start.uri('/api/user-action')
|
1721
|
+
.url_segment(user_action_id)
|
1722
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1723
|
+
.put()
|
1724
|
+
.go()
|
1725
|
+
end
|
1726
|
+
|
1727
|
+
#
|
1728
|
+
# Updates the user action reason with the given Id.
|
1729
|
+
#
|
1730
|
+
# @param user_action_reason_id [string] The Id of the user action reason to update.
|
1731
|
+
# @param request [OpenStruct, Hash] The request that contains all of the new user action reason information.
|
1732
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1733
|
+
#
|
1734
|
+
def update_user_action_reason(user_action_reason_id, request)
|
1735
|
+
start.uri('/api/user-action-reason')
|
1736
|
+
.url_segment(user_action_reason_id)
|
1737
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1738
|
+
.put()
|
1739
|
+
.go()
|
1740
|
+
end
|
1741
|
+
|
1742
|
+
#
|
1743
|
+
# Updates the webhook with the given Id.
|
1744
|
+
#
|
1745
|
+
# @param webhook_id [string] The Id of the webhook to update.
|
1746
|
+
# @param request [OpenStruct, Hash] The request that contains all of the new webhook information.
|
1747
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1748
|
+
#
|
1749
|
+
def update_webhook(webhook_id, request)
|
1750
|
+
start.uri('/api/webhook')
|
1751
|
+
.url_segment(webhook_id)
|
1752
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
1753
|
+
.put()
|
1754
|
+
.go()
|
1755
|
+
end
|
1756
|
+
|
1757
|
+
#
|
1758
|
+
# Validates the provided JWT (encoded JWT string) to ensure the token is valid. A valid access token is properly
|
1759
|
+
# signed and not expired.
|
1760
|
+
# <p>
|
1761
|
+
# This API may be used to verify the JWT as well as decode the encoded JWT into human readable identity claims.
|
1762
|
+
#
|
1763
|
+
# @param encoded_jwt [string] The encoded JWT (access token).
|
1764
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1765
|
+
#
|
1766
|
+
def validate_jwt(encoded_jwt)
|
1767
|
+
start.uri('/api/jwt/validate')
|
1768
|
+
.authorization('JWT ' + encoded_jwt)
|
1769
|
+
.get()
|
1770
|
+
.go()
|
1771
|
+
end
|
1772
|
+
|
1773
|
+
#
|
1774
|
+
# Confirms a email verification. The Id given is usually from an email sent to the user.
|
1775
|
+
#
|
1776
|
+
# @param verification_id [string] The email verification id sent to the user.
|
1777
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1778
|
+
#
|
1779
|
+
def verify_email(verification_id)
|
1780
|
+
start.uri('/api/user/verify-email')
|
1781
|
+
.url_segment(verification_id)
|
1782
|
+
.post()
|
1783
|
+
.go()
|
1784
|
+
end
|
1785
|
+
|
1786
|
+
#
|
1787
|
+
# Confirms an application registration. The Id given is usually from an email sent to the user.
|
1788
|
+
#
|
1789
|
+
# @param verification_id [string] The registration verification Id sent to the user.
|
1790
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
1791
|
+
#
|
1792
|
+
def verify_registration(verification_id)
|
1793
|
+
start.uri('/api/user/verify-registration')
|
1794
|
+
.url_segment(verification_id)
|
1795
|
+
.post()
|
1796
|
+
.go()
|
1797
|
+
end
|
1798
|
+
|
1799
|
+
#
|
1800
|
+
# Starts the HTTP call
|
1801
|
+
#
|
1802
|
+
# @return [RESTClient] The RESTClient
|
1803
|
+
#
|
1804
|
+
private
|
1805
|
+
def start
|
1806
|
+
RESTClient.new
|
1807
|
+
.authorization(@api_key)
|
1808
|
+
.success_response_handler(FusionAuth::JSONResponseHandler.new(OpenStruct))
|
1809
|
+
.error_response_handler(FusionAuth::JSONResponseHandler.new(OpenStruct))
|
1810
|
+
.url(@base_url)
|
1811
|
+
.connect_timeout(@connect_timeout)
|
1812
|
+
.read_timeout(@read_timeout)
|
1813
|
+
end
|
1814
|
+
end
|
1815
|
+
end
|
1816
|
+
|