fusionauth_client 1.61.0 → 1.62.0
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 +4 -4
- data/Gemfile.lock +1 -1
- data/build.savant +1 -1
- data/fusionauth-ruby-client.iml +12 -0
- data/fusionauth_client.gemspec +1 -1
- data/lib/fusionauth/fusionauth_client.rb +388 -35
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ad9bb0667684cd1aab1c1e8b45c03fe842fbed008238d3e636e811a4f52822ca
|
|
4
|
+
data.tar.gz: 907bcdb90937fe0a6e7ccc3bc2899abfbc32ea148b77a000d51d02cf0aa65428
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5cd9b38be5b0a2c55a187cd1dab96b99caa84c2c473115dc3b147e4105c45fefbd4789852da88926d7cfb2cbbd8ed5997ee0bdc6f770a31f3f0124c2c2f373a2
|
|
7
|
+
data.tar.gz: 3defa696a2f6a444efd38249f0b34260033b39ea7356075d3507b588122c9546a261e41f50d789f706c8f17d5ddba722e560532c3b272905d1192876cf139d76
|
data/Gemfile.lock
CHANGED
data/build.savant
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
pubVersion = ""
|
|
18
|
-
project(group: "io.fusionauth", name: "fusionauth-ruby-client", version: "1.
|
|
18
|
+
project(group: "io.fusionauth", name: "fusionauth-ruby-client", version: "1.62.0", licenses: ["ApacheV2_0"]) {
|
|
19
19
|
workflow {
|
|
20
20
|
fetch {
|
|
21
21
|
cache()
|
data/fusionauth-ruby-client.iml
CHANGED
|
@@ -9,7 +9,19 @@
|
|
|
9
9
|
<orderEntry type="jdk" jdkName="rbenv: 3.4.2" jdkType="RUBY_SDK" />
|
|
10
10
|
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
11
|
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.6.2, rbenv: 3.4.2) [gem]" level="application" />
|
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="cgi (v0.4.2, rbenv: 3.4.2) [gem]" level="application" />
|
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="date (v3.4.1, rbenv: 3.4.2) [gem]" level="application" />
|
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="erb (v2.2.3, rbenv: 3.4.2) [gem]" level="application" />
|
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="extralite-bundle (v1.27, rbenv: 3.4.2) [gem]" level="application" />
|
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.25.5, rbenv: 3.4.2) [gem]" level="application" />
|
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.18.6, rbenv: 3.4.2) [gem]" level="application" />
|
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="psych (v5.2.3, rbenv: 3.4.2) [gem]" level="application" />
|
|
12
19
|
<orderEntry type="library" scope="PROVIDED" name="racc (v1.8.1, rbenv: 3.4.2) [gem]" level="application" />
|
|
13
20
|
<orderEntry type="library" scope="PROVIDED" name="rake (v13.2.1, rbenv: 3.4.2) [gem]" level="application" />
|
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="rdoc (v6.13.0, rbenv: 3.4.2) [gem]" level="application" />
|
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="rdoc-markdown (v0.4.2, rbenv: 3.4.2) [gem]" level="application" />
|
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="reverse_markdown (v2.1.1, rbenv: 3.4.2) [gem]" level="application" />
|
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="stringio (v3.1.6, rbenv: 3.4.2) [gem]" level="application" />
|
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="unindent (v1.0, rbenv: 3.4.2) [gem]" level="application" />
|
|
14
26
|
</component>
|
|
15
27
|
</module>
|
data/fusionauth_client.gemspec
CHANGED
|
@@ -19,7 +19,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
19
19
|
|
|
20
20
|
Gem::Specification.new do |spec|
|
|
21
21
|
spec.name = 'fusionauth_client'
|
|
22
|
-
spec.version = '1.
|
|
22
|
+
spec.version = '1.62.0'
|
|
23
23
|
spec.authors = ['Brian Pontarelli', 'Daniel DeGroff']
|
|
24
24
|
spec.email = %w(brian@fusionauth.io daniel@fusionauth.io)
|
|
25
25
|
|
|
@@ -90,14 +90,33 @@ module FusionAuth
|
|
|
90
90
|
# @param user_code [string] The end-user verification code.
|
|
91
91
|
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
92
92
|
def approve_device(client_id, client_secret, token, user_code)
|
|
93
|
-
|
|
93
|
+
form_parameters = {
|
|
94
94
|
"client_id" => client_id,
|
|
95
95
|
"client_secret" => client_secret,
|
|
96
96
|
"token" => token,
|
|
97
|
-
"user_code" => user_code
|
|
97
|
+
"user_code" => user_code,
|
|
98
98
|
}
|
|
99
99
|
start.uri('/oauth2/device/approve')
|
|
100
|
-
.body_handler(FusionAuth::FormDataBodyHandler.new(
|
|
100
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
101
|
+
.post
|
|
102
|
+
.go
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
#
|
|
106
|
+
# Approve a device grant.
|
|
107
|
+
#
|
|
108
|
+
# @param request [OpenStruct, Hash] The request object containing the device approval information and optional tenantId.
|
|
109
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
110
|
+
def approve_device_with_request(request)
|
|
111
|
+
form_parameters = {
|
|
112
|
+
"client_id" => request.client_id,
|
|
113
|
+
"client_secret" => request.client_secret,
|
|
114
|
+
"tenantId" => (request.tenantId.to_s unless request.tenantId.nil?),
|
|
115
|
+
"token" => request.token,
|
|
116
|
+
"user_code" => request.user_code,
|
|
117
|
+
}
|
|
118
|
+
start.uri('/oauth2/device/approve')
|
|
119
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
101
120
|
.post
|
|
102
121
|
.go
|
|
103
122
|
end
|
|
@@ -199,6 +218,24 @@ module FusionAuth
|
|
|
199
218
|
.go
|
|
200
219
|
end
|
|
201
220
|
|
|
221
|
+
#
|
|
222
|
+
# Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
|
|
223
|
+
# When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
|
|
224
|
+
# your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
|
|
225
|
+
#
|
|
226
|
+
# An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
|
|
227
|
+
#
|
|
228
|
+
# @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.
|
|
229
|
+
# @param ip_address [string] (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
|
|
230
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
231
|
+
def check_change_password_using_id_and_ip_address(change_password_id, ip_address)
|
|
232
|
+
startAnonymous.uri('/api/user/change-password')
|
|
233
|
+
.url_segment(change_password_id)
|
|
234
|
+
.url_parameter('ipAddress', ip_address)
|
|
235
|
+
.get
|
|
236
|
+
.go
|
|
237
|
+
end
|
|
238
|
+
|
|
202
239
|
#
|
|
203
240
|
# Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
|
|
204
241
|
# When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
|
|
@@ -215,6 +252,24 @@ module FusionAuth
|
|
|
215
252
|
.go
|
|
216
253
|
end
|
|
217
254
|
|
|
255
|
+
#
|
|
256
|
+
# Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
|
|
257
|
+
# When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
|
|
258
|
+
# your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
|
|
259
|
+
#
|
|
260
|
+
# An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
|
|
261
|
+
#
|
|
262
|
+
# @param encoded_jwt [string] The encoded JWT (access token).
|
|
263
|
+
# @param ip_address [string] (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
|
|
264
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
265
|
+
def check_change_password_using_jwt_and_ip_address(encoded_jwt, ip_address)
|
|
266
|
+
startAnonymous.uri('/api/user/change-password')
|
|
267
|
+
.authorization('Bearer ' + encoded_jwt)
|
|
268
|
+
.url_parameter('ipAddress', ip_address)
|
|
269
|
+
.get
|
|
270
|
+
.go
|
|
271
|
+
end
|
|
272
|
+
|
|
218
273
|
#
|
|
219
274
|
# Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
|
|
220
275
|
# When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
|
|
@@ -231,6 +286,24 @@ module FusionAuth
|
|
|
231
286
|
.go
|
|
232
287
|
end
|
|
233
288
|
|
|
289
|
+
#
|
|
290
|
+
# Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
|
|
291
|
+
# When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
|
|
292
|
+
# your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
|
|
293
|
+
#
|
|
294
|
+
# An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
|
|
295
|
+
#
|
|
296
|
+
# @param login_id [string] The loginId (email or username) of the User that you intend to change the password for.
|
|
297
|
+
# @param ip_address [string] (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
|
|
298
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
299
|
+
def check_change_password_using_login_id_and_ip_address(login_id, ip_address)
|
|
300
|
+
start.uri('/api/user/change-password')
|
|
301
|
+
.url_parameter('loginId', login_id)
|
|
302
|
+
.url_parameter('ipAddress', ip_address)
|
|
303
|
+
.get
|
|
304
|
+
.go
|
|
305
|
+
end
|
|
306
|
+
|
|
234
307
|
#
|
|
235
308
|
# Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
|
|
236
309
|
# When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
|
|
@@ -249,6 +322,26 @@ module FusionAuth
|
|
|
249
322
|
.go
|
|
250
323
|
end
|
|
251
324
|
|
|
325
|
+
#
|
|
326
|
+
# Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
|
|
327
|
+
# When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
|
|
328
|
+
# your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
|
|
329
|
+
#
|
|
330
|
+
# An HTTP status code of 400 with a general error code of [TrustTokenRequired] indicates that a Trust Token is required to make a POST request to this API.
|
|
331
|
+
#
|
|
332
|
+
# @param login_id [string] The loginId of the User that you intend to change the password for.
|
|
333
|
+
# @param login_id_types [Array] The identity types that FusionAuth will compare the loginId to.
|
|
334
|
+
# @param ip_address [string] (Optional) IP address of the user changing their password. This is used for MFA risk assessment.
|
|
335
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
336
|
+
def check_change_password_using_login_id_and_login_id_types_and_ip_address(login_id, login_id_types, ip_address)
|
|
337
|
+
start.uri('/api/user/change-password')
|
|
338
|
+
.url_parameter('loginId', login_id)
|
|
339
|
+
.url_parameter('loginIdTypes', login_id_types)
|
|
340
|
+
.url_parameter('ipAddress', ip_address)
|
|
341
|
+
.get
|
|
342
|
+
.go
|
|
343
|
+
end
|
|
344
|
+
|
|
252
345
|
#
|
|
253
346
|
# Make a Client Credentials grant request to obtain an access token.
|
|
254
347
|
#
|
|
@@ -259,14 +352,33 @@ module FusionAuth
|
|
|
259
352
|
# @param scope [string] (Optional) This parameter is used to indicate which target entity you are requesting access. To request access to an entity, use the format target-entity:<target-entity-id>:<roles>. Roles are an optional comma separated list.
|
|
260
353
|
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
261
354
|
def client_credentials_grant(client_id, client_secret, scope)
|
|
262
|
-
|
|
355
|
+
form_parameters = {
|
|
263
356
|
"client_id" => client_id,
|
|
264
357
|
"client_secret" => client_secret,
|
|
265
|
-
"grant_type" =>
|
|
266
|
-
"scope" => scope
|
|
358
|
+
"grant_type" => 'client_credentials',
|
|
359
|
+
"scope" => scope,
|
|
360
|
+
}
|
|
361
|
+
startAnonymous.uri('/oauth2/token')
|
|
362
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
363
|
+
.post
|
|
364
|
+
.go
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
#
|
|
368
|
+
# Make a Client Credentials grant request to obtain an access token.
|
|
369
|
+
#
|
|
370
|
+
# @param request [OpenStruct, Hash] The client credentials grant request containing client authentication, scope and optional tenantId.
|
|
371
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
372
|
+
def client_credentials_grant_with_request(request)
|
|
373
|
+
form_parameters = {
|
|
374
|
+
"client_id" => request.client_id,
|
|
375
|
+
"client_secret" => request.client_secret,
|
|
376
|
+
"grant_type" => request.grant_type,
|
|
377
|
+
"scope" => request.scope,
|
|
378
|
+
"tenantId" => request.tenantId,
|
|
267
379
|
}
|
|
268
380
|
startAnonymous.uri('/oauth2/token')
|
|
269
|
-
.body_handler(FusionAuth::FormDataBodyHandler.new(
|
|
381
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
270
382
|
.post
|
|
271
383
|
.go
|
|
272
384
|
end
|
|
@@ -1312,6 +1424,43 @@ module FusionAuth
|
|
|
1312
1424
|
.go
|
|
1313
1425
|
end
|
|
1314
1426
|
|
|
1427
|
+
#
|
|
1428
|
+
# Start the Device Authorization flow using form-encoded parameters
|
|
1429
|
+
#
|
|
1430
|
+
# @param client_id [string] The unique client identifier. The client Id is the Id of the FusionAuth Application in which you are attempting to authenticate.
|
|
1431
|
+
# @param client_secret [string] (Optional) The client secret. This value may optionally be provided in the request body instead of the Authorization header.
|
|
1432
|
+
# @param scope [string] (Optional) A space-delimited string of the requested scopes. Defaults to all scopes configured in the Application's OAuth configuration.
|
|
1433
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
1434
|
+
def device_authorize(client_id, client_secret, scope)
|
|
1435
|
+
form_parameters = {
|
|
1436
|
+
"client_id" => client_id,
|
|
1437
|
+
"client_secret" => client_secret,
|
|
1438
|
+
"scope" => scope,
|
|
1439
|
+
}
|
|
1440
|
+
startAnonymous.uri('/oauth2/device_authorize')
|
|
1441
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
1442
|
+
.post
|
|
1443
|
+
.go
|
|
1444
|
+
end
|
|
1445
|
+
|
|
1446
|
+
#
|
|
1447
|
+
# Start the Device Authorization flow using a request body
|
|
1448
|
+
#
|
|
1449
|
+
# @param request [OpenStruct, Hash] The device authorization request containing client authentication, scope, and optional device metadata.
|
|
1450
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
1451
|
+
def device_authorize_with_request(request)
|
|
1452
|
+
form_parameters = {
|
|
1453
|
+
"client_id" => request.client_id,
|
|
1454
|
+
"client_secret" => request.client_secret,
|
|
1455
|
+
"scope" => request.scope,
|
|
1456
|
+
"tenantId" => (request.tenantId.to_s unless request.tenantId.nil?),
|
|
1457
|
+
}
|
|
1458
|
+
startAnonymous.uri('/oauth2/device_authorize')
|
|
1459
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
1460
|
+
.post
|
|
1461
|
+
.go
|
|
1462
|
+
end
|
|
1463
|
+
|
|
1315
1464
|
#
|
|
1316
1465
|
# Disable two-factor authentication for a user.
|
|
1317
1466
|
#
|
|
@@ -1367,15 +1516,15 @@ module FusionAuth
|
|
|
1367
1516
|
# @param redirect_uri [string] The URI to redirect to upon a successful request.
|
|
1368
1517
|
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
1369
1518
|
def exchange_o_auth_code_for_access_token(code, client_id, client_secret, redirect_uri)
|
|
1370
|
-
|
|
1519
|
+
form_parameters = {
|
|
1371
1520
|
"code" => code,
|
|
1372
1521
|
"client_id" => client_id,
|
|
1373
1522
|
"client_secret" => client_secret,
|
|
1374
|
-
"grant_type" =>
|
|
1375
|
-
"redirect_uri" => redirect_uri
|
|
1523
|
+
"grant_type" => 'authorization_code',
|
|
1524
|
+
"redirect_uri" => redirect_uri,
|
|
1376
1525
|
}
|
|
1377
1526
|
startAnonymous.uri('/oauth2/token')
|
|
1378
|
-
.body_handler(FusionAuth::FormDataBodyHandler.new(
|
|
1527
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
1379
1528
|
.post
|
|
1380
1529
|
.go
|
|
1381
1530
|
end
|
|
@@ -1392,16 +1541,59 @@ module FusionAuth
|
|
|
1392
1541
|
# @param code_verifier [string] The random string generated previously. Will be compared with the code_challenge sent previously, which allows the OAuth provider to authenticate your app.
|
|
1393
1542
|
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
1394
1543
|
def exchange_o_auth_code_for_access_token_using_pkce(code, client_id, client_secret, redirect_uri, code_verifier)
|
|
1395
|
-
|
|
1544
|
+
form_parameters = {
|
|
1396
1545
|
"code" => code,
|
|
1397
1546
|
"client_id" => client_id,
|
|
1398
1547
|
"client_secret" => client_secret,
|
|
1399
|
-
"grant_type" =>
|
|
1548
|
+
"grant_type" => 'authorization_code',
|
|
1400
1549
|
"redirect_uri" => redirect_uri,
|
|
1401
|
-
"code_verifier" => code_verifier
|
|
1550
|
+
"code_verifier" => code_verifier,
|
|
1402
1551
|
}
|
|
1403
1552
|
startAnonymous.uri('/oauth2/token')
|
|
1404
|
-
.body_handler(FusionAuth::FormDataBodyHandler.new(
|
|
1553
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
1554
|
+
.post
|
|
1555
|
+
.go
|
|
1556
|
+
end
|
|
1557
|
+
|
|
1558
|
+
#
|
|
1559
|
+
# Exchanges an OAuth authorization code and code_verifier for an access token.
|
|
1560
|
+
# Makes a request to the Token endpoint to exchange the authorization code returned from the Authorize endpoint and a code_verifier for an access token.
|
|
1561
|
+
#
|
|
1562
|
+
# @param request [OpenStruct, Hash] The PKCE OAuth code access token exchange request.
|
|
1563
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
1564
|
+
def exchange_o_auth_code_for_access_token_using_pkce_with_request(request)
|
|
1565
|
+
form_parameters = {
|
|
1566
|
+
"client_id" => request.client_id,
|
|
1567
|
+
"client_secret" => request.client_secret,
|
|
1568
|
+
"code" => request.code,
|
|
1569
|
+
"code_verifier" => request.code_verifier,
|
|
1570
|
+
"grant_type" => request.grant_type,
|
|
1571
|
+
"redirect_uri" => request.redirect_uri,
|
|
1572
|
+
"tenantId" => (request.tenantId.to_s unless request.tenantId.nil?),
|
|
1573
|
+
}
|
|
1574
|
+
startAnonymous.uri('/oauth2/token')
|
|
1575
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
1576
|
+
.post
|
|
1577
|
+
.go
|
|
1578
|
+
end
|
|
1579
|
+
|
|
1580
|
+
#
|
|
1581
|
+
# Exchanges an OAuth authorization code for an access token.
|
|
1582
|
+
# Makes a request to the Token endpoint to exchange the authorization code returned from the Authorize endpoint for an access token.
|
|
1583
|
+
#
|
|
1584
|
+
# @param request [OpenStruct, Hash] The OAuth code access token exchange request.
|
|
1585
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
1586
|
+
def exchange_o_auth_code_for_access_token_with_request(request)
|
|
1587
|
+
form_parameters = {
|
|
1588
|
+
"client_id" => request.client_id,
|
|
1589
|
+
"client_secret" => request.client_secret,
|
|
1590
|
+
"code" => request.code,
|
|
1591
|
+
"grant_type" => request.grant_type,
|
|
1592
|
+
"redirect_uri" => request.redirect_uri,
|
|
1593
|
+
"tenantId" => request.tenantId,
|
|
1594
|
+
}
|
|
1595
|
+
startAnonymous.uri('/oauth2/token')
|
|
1596
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
1405
1597
|
.post
|
|
1406
1598
|
.go
|
|
1407
1599
|
end
|
|
@@ -1418,16 +1610,38 @@ module FusionAuth
|
|
|
1418
1610
|
# @param user_code [string] (Optional) The end-user verification code. This code is required if using this endpoint to approve the Device Authorization.
|
|
1419
1611
|
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
1420
1612
|
def exchange_refresh_token_for_access_token(refresh_token, client_id, client_secret, scope, user_code)
|
|
1421
|
-
|
|
1613
|
+
form_parameters = {
|
|
1422
1614
|
"refresh_token" => refresh_token,
|
|
1423
1615
|
"client_id" => client_id,
|
|
1424
1616
|
"client_secret" => client_secret,
|
|
1425
|
-
"grant_type" =>
|
|
1617
|
+
"grant_type" => 'refresh_token',
|
|
1426
1618
|
"scope" => scope,
|
|
1427
|
-
"user_code" => user_code
|
|
1619
|
+
"user_code" => user_code,
|
|
1620
|
+
}
|
|
1621
|
+
startAnonymous.uri('/oauth2/token')
|
|
1622
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
1623
|
+
.post
|
|
1624
|
+
.go
|
|
1625
|
+
end
|
|
1626
|
+
|
|
1627
|
+
#
|
|
1628
|
+
# Exchange a Refresh Token for an Access Token.
|
|
1629
|
+
# If you will be using the Refresh Token Grant, you will make a request to the Token endpoint to exchange the user’s refresh token for an access token.
|
|
1630
|
+
#
|
|
1631
|
+
# @param request [OpenStruct, Hash] The refresh token access token exchange request.
|
|
1632
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
1633
|
+
def exchange_refresh_token_for_access_token_with_request(request)
|
|
1634
|
+
form_parameters = {
|
|
1635
|
+
"client_id" => request.client_id,
|
|
1636
|
+
"client_secret" => request.client_secret,
|
|
1637
|
+
"grant_type" => request.grant_type,
|
|
1638
|
+
"refresh_token" => request.refresh_token,
|
|
1639
|
+
"scope" => request.scope,
|
|
1640
|
+
"tenantId" => (request.tenantId.to_s unless request.tenantId.nil?),
|
|
1641
|
+
"user_code" => request.user_code,
|
|
1428
1642
|
}
|
|
1429
1643
|
startAnonymous.uri('/oauth2/token')
|
|
1430
|
-
.body_handler(FusionAuth::FormDataBodyHandler.new(
|
|
1644
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
1431
1645
|
.post
|
|
1432
1646
|
.go
|
|
1433
1647
|
end
|
|
@@ -1457,17 +1671,40 @@ module FusionAuth
|
|
|
1457
1671
|
# @param user_code [string] (Optional) The end-user verification code. This code is required if using this endpoint to approve the Device Authorization.
|
|
1458
1672
|
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
1459
1673
|
def exchange_user_credentials_for_access_token(username, password, client_id, client_secret, scope, user_code)
|
|
1460
|
-
|
|
1674
|
+
form_parameters = {
|
|
1461
1675
|
"username" => username,
|
|
1462
1676
|
"password" => password,
|
|
1463
1677
|
"client_id" => client_id,
|
|
1464
1678
|
"client_secret" => client_secret,
|
|
1465
|
-
"grant_type" =>
|
|
1679
|
+
"grant_type" => 'password',
|
|
1466
1680
|
"scope" => scope,
|
|
1467
|
-
"user_code" => user_code
|
|
1681
|
+
"user_code" => user_code,
|
|
1682
|
+
}
|
|
1683
|
+
startAnonymous.uri('/oauth2/token')
|
|
1684
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
1685
|
+
.post
|
|
1686
|
+
.go
|
|
1687
|
+
end
|
|
1688
|
+
|
|
1689
|
+
#
|
|
1690
|
+
# Exchange User Credentials for a Token.
|
|
1691
|
+
# If you will be using the Resource Owner Password Credential Grant, you will make a request to the Token endpoint to exchange the user’s email and password for an access token.
|
|
1692
|
+
#
|
|
1693
|
+
# @param request [OpenStruct, Hash] The user credentials access token exchange request.
|
|
1694
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
1695
|
+
def exchange_user_credentials_for_access_token_with_request(request)
|
|
1696
|
+
form_parameters = {
|
|
1697
|
+
"client_id" => request.client_id,
|
|
1698
|
+
"client_secret" => request.client_secret,
|
|
1699
|
+
"grant_type" => request.grant_type,
|
|
1700
|
+
"password" => request.password,
|
|
1701
|
+
"scope" => request.scope,
|
|
1702
|
+
"tenantId" => request.tenantId,
|
|
1703
|
+
"user_code" => request.user_code,
|
|
1704
|
+
"username" => request.username,
|
|
1468
1705
|
}
|
|
1469
1706
|
startAnonymous.uri('/oauth2/token')
|
|
1470
|
-
.body_handler(FusionAuth::FormDataBodyHandler.new(
|
|
1707
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
1471
1708
|
.post
|
|
1472
1709
|
.go
|
|
1473
1710
|
end
|
|
@@ -1651,12 +1888,29 @@ module FusionAuth
|
|
|
1651
1888
|
# @param token [string] The access token returned by this OAuth provider as the result of a successful client credentials grant.
|
|
1652
1889
|
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
1653
1890
|
def introspect_access_token(client_id, token)
|
|
1654
|
-
|
|
1891
|
+
form_parameters = {
|
|
1655
1892
|
"client_id" => client_id,
|
|
1656
|
-
"token" => token
|
|
1893
|
+
"token" => token,
|
|
1894
|
+
}
|
|
1895
|
+
startAnonymous.uri('/oauth2/introspect')
|
|
1896
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
1897
|
+
.post
|
|
1898
|
+
.go
|
|
1899
|
+
end
|
|
1900
|
+
|
|
1901
|
+
#
|
|
1902
|
+
# Inspect an access token issued as the result of the User based grant such as the Authorization Code Grant, Implicit Grant, the User Credentials Grant or the Refresh Grant.
|
|
1903
|
+
#
|
|
1904
|
+
# @param request [OpenStruct, Hash] The access token introspection request.
|
|
1905
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
1906
|
+
def introspect_access_token_with_request(request)
|
|
1907
|
+
form_parameters = {
|
|
1908
|
+
"client_id" => request.client_id,
|
|
1909
|
+
"tenantId" => request.tenantId,
|
|
1910
|
+
"token" => request.token,
|
|
1657
1911
|
}
|
|
1658
1912
|
startAnonymous.uri('/oauth2/introspect')
|
|
1659
|
-
.body_handler(FusionAuth::FormDataBodyHandler.new(
|
|
1913
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
1660
1914
|
.post
|
|
1661
1915
|
.go
|
|
1662
1916
|
end
|
|
@@ -1667,11 +1921,27 @@ module FusionAuth
|
|
|
1667
1921
|
# @param token [string] The access token returned by this OAuth provider as the result of a successful client credentials grant.
|
|
1668
1922
|
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
1669
1923
|
def introspect_client_credentials_access_token(token)
|
|
1670
|
-
|
|
1671
|
-
"token" => token
|
|
1924
|
+
form_parameters = {
|
|
1925
|
+
"token" => token,
|
|
1926
|
+
}
|
|
1927
|
+
startAnonymous.uri('/oauth2/introspect')
|
|
1928
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
1929
|
+
.post
|
|
1930
|
+
.go
|
|
1931
|
+
end
|
|
1932
|
+
|
|
1933
|
+
#
|
|
1934
|
+
# Inspect an access token issued as the result of the Client Credentials Grant.
|
|
1935
|
+
#
|
|
1936
|
+
# @param request [OpenStruct, Hash] The client credentials access token.
|
|
1937
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
1938
|
+
def introspect_client_credentials_access_token_with_request(request)
|
|
1939
|
+
form_parameters = {
|
|
1940
|
+
"tenantId" => request.tenantId,
|
|
1941
|
+
"token" => request.token,
|
|
1672
1942
|
}
|
|
1673
1943
|
startAnonymous.uri('/oauth2/introspect')
|
|
1674
|
-
.body_handler(FusionAuth::FormDataBodyHandler.new(
|
|
1944
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
1675
1945
|
.post
|
|
1676
1946
|
.go
|
|
1677
1947
|
end
|
|
@@ -3309,6 +3579,18 @@ module FusionAuth
|
|
|
3309
3579
|
.go
|
|
3310
3580
|
end
|
|
3311
3581
|
|
|
3582
|
+
#
|
|
3583
|
+
# Retrieves the totals report. This allows excluding applicationTotals from the report. An empty list will include the applicationTotals.
|
|
3584
|
+
#
|
|
3585
|
+
# @param excludes [Array] List of fields to exclude in the response. Currently only allows applicationTotals.
|
|
3586
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
3587
|
+
def retrieve_total_report_with_excludes(excludes)
|
|
3588
|
+
start.uri('/api/report/totals')
|
|
3589
|
+
.url_parameter('excludes', excludes)
|
|
3590
|
+
.get
|
|
3591
|
+
.go
|
|
3592
|
+
end
|
|
3593
|
+
|
|
3312
3594
|
#
|
|
3313
3595
|
# Retrieve two-factor recovery codes for a user.
|
|
3314
3596
|
#
|
|
@@ -3340,6 +3622,22 @@ module FusionAuth
|
|
|
3340
3622
|
.go
|
|
3341
3623
|
end
|
|
3342
3624
|
|
|
3625
|
+
#
|
|
3626
|
+
# Retrieve a user's two-factor status.
|
|
3627
|
+
#
|
|
3628
|
+
# This can be used to see if a user will need to complete a two-factor challenge to complete a login,
|
|
3629
|
+
# and optionally identify the state of the two-factor trust across various applications. This operation
|
|
3630
|
+
# provides more payload options than retrieveTwoFactorStatus.
|
|
3631
|
+
#
|
|
3632
|
+
# @param request [OpenStruct, Hash] The request object that contains all the information used to check the status.
|
|
3633
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
3634
|
+
def retrieve_two_factor_status_with_request(request)
|
|
3635
|
+
start.uri('/api/two-factor/status')
|
|
3636
|
+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
|
|
3637
|
+
.post
|
|
3638
|
+
.go
|
|
3639
|
+
end
|
|
3640
|
+
|
|
3343
3641
|
#
|
|
3344
3642
|
# Retrieves the user for the given Id.
|
|
3345
3643
|
#
|
|
@@ -3484,13 +3782,13 @@ module FusionAuth
|
|
|
3484
3782
|
# @param user_code [string] The end-user verification code.
|
|
3485
3783
|
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
3486
3784
|
def retrieve_user_code(client_id, client_secret, user_code)
|
|
3487
|
-
|
|
3785
|
+
form_parameters = {
|
|
3488
3786
|
"client_id" => client_id,
|
|
3489
3787
|
"client_secret" => client_secret,
|
|
3490
|
-
"user_code" => user_code
|
|
3788
|
+
"user_code" => user_code,
|
|
3491
3789
|
}
|
|
3492
3790
|
startAnonymous.uri('/oauth2/device/user-code')
|
|
3493
|
-
.body_handler(FusionAuth::FormDataBodyHandler.new(
|
|
3791
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
3494
3792
|
.get
|
|
3495
3793
|
.go
|
|
3496
3794
|
end
|
|
@@ -3505,15 +3803,55 @@ module FusionAuth
|
|
|
3505
3803
|
# @param user_code [string] The end-user verification code.
|
|
3506
3804
|
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
3507
3805
|
def retrieve_user_code_using_api_key(user_code)
|
|
3508
|
-
|
|
3509
|
-
"user_code" => user_code
|
|
3806
|
+
form_parameters = {
|
|
3807
|
+
"user_code" => user_code,
|
|
3510
3808
|
}
|
|
3511
3809
|
startAnonymous.uri('/oauth2/device/user-code')
|
|
3512
|
-
.body_handler(FusionAuth::FormDataBodyHandler.new(
|
|
3810
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
3513
3811
|
.get
|
|
3514
3812
|
.go
|
|
3515
3813
|
end
|
|
3516
3814
|
|
|
3815
|
+
#
|
|
3816
|
+
# Retrieve a user_code that is part of an in-progress Device Authorization Grant.
|
|
3817
|
+
#
|
|
3818
|
+
# This API is useful if you want to build your own login workflow to complete a device grant.
|
|
3819
|
+
#
|
|
3820
|
+
# This request will require an API key.
|
|
3821
|
+
#
|
|
3822
|
+
# @param request [OpenStruct, Hash] The user code retrieval request including optional tenantId.
|
|
3823
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
3824
|
+
def retrieve_user_code_using_api_key_with_request(request)
|
|
3825
|
+
form_parameters = {
|
|
3826
|
+
"tenantId" => (request.tenantId.to_s unless request.tenantId.nil?),
|
|
3827
|
+
"user_code" => request.user_code,
|
|
3828
|
+
}
|
|
3829
|
+
startAnonymous.uri('/oauth2/device/user-code')
|
|
3830
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
3831
|
+
.post
|
|
3832
|
+
.go
|
|
3833
|
+
end
|
|
3834
|
+
|
|
3835
|
+
#
|
|
3836
|
+
# Retrieve a user_code that is part of an in-progress Device Authorization Grant.
|
|
3837
|
+
#
|
|
3838
|
+
# This API is useful if you want to build your own login workflow to complete a device grant.
|
|
3839
|
+
#
|
|
3840
|
+
# @param request [OpenStruct, Hash] The user code retrieval request.
|
|
3841
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
3842
|
+
def retrieve_user_code_with_request(request)
|
|
3843
|
+
form_parameters = {
|
|
3844
|
+
"client_id" => request.client_id,
|
|
3845
|
+
"client_secret" => request.client_secret,
|
|
3846
|
+
"tenantId" => (request.tenantId.to_s unless request.tenantId.nil?),
|
|
3847
|
+
"user_code" => request.user_code,
|
|
3848
|
+
}
|
|
3849
|
+
startAnonymous.uri('/oauth2/device/user-code')
|
|
3850
|
+
.body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
|
|
3851
|
+
.post
|
|
3852
|
+
.go
|
|
3853
|
+
end
|
|
3854
|
+
|
|
3517
3855
|
#
|
|
3518
3856
|
# Retrieves all the comments for the user with the given Id.
|
|
3519
3857
|
#
|
|
@@ -4851,6 +5189,21 @@ module FusionAuth
|
|
|
4851
5189
|
.go
|
|
4852
5190
|
end
|
|
4853
5191
|
|
|
5192
|
+
#
|
|
5193
|
+
# Validates the end-user provided user_code from the user-interaction of the Device Authorization Grant.
|
|
5194
|
+
# If you build your own activation form you should validate the user provided code prior to beginning the Authorization grant.
|
|
5195
|
+
#
|
|
5196
|
+
# @param request [OpenStruct, Hash] The device validation request.
|
|
5197
|
+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
|
|
5198
|
+
def validate_device_with_request(request)
|
|
5199
|
+
startAnonymous.uri('/oauth2/device/validate')
|
|
5200
|
+
.url_parameter('client_id', request.client_id)
|
|
5201
|
+
.url_parameter('tenantId', request.tenantId.nil? ? nil : request.tenantId.to_s)
|
|
5202
|
+
.url_parameter('user_code', request.user_code)
|
|
5203
|
+
.get
|
|
5204
|
+
.go
|
|
5205
|
+
end
|
|
5206
|
+
|
|
4854
5207
|
#
|
|
4855
5208
|
# Validates the provided JWT (encoded JWT string) to ensure the token is valid. A valid access token is properly
|
|
4856
5209
|
# signed and not expired.
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fusionauth_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.62.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brian Pontarelli
|
|
8
8
|
- Daniel DeGroff
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-12-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: This library contains the Ruby client library that helps you connect
|
|
14
14
|
your application to FusionAuth.
|