fusionauth_client 1.60.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f8a63f23ddce8707ad91ed2a0e96e9ebd2f1d09b47aa46ce0b94270fdf2e0fe
4
- data.tar.gz: 85dbfbfdb996a0941e244791877c2cf17f2769ed02e52acebad60709ed443150
3
+ metadata.gz: ad9bb0667684cd1aab1c1e8b45c03fe842fbed008238d3e636e811a4f52822ca
4
+ data.tar.gz: 907bcdb90937fe0a6e7ccc3bc2899abfbc32ea148b77a000d51d02cf0aa65428
5
5
  SHA512:
6
- metadata.gz: 896b8cee7da26919d1b6a2806838479dbcd0344da87a147d1d74fbea54b71223a8fd9e0050a0fc00514c73a1eac08ba53de7d35fc4a1ffd5131195cb49cb957f
7
- data.tar.gz: 8b4740ec09ad5b18e83854b1dde7285a8f43c7a7476cef112d78b87890dc0d3a0fe5779ec9074ae1349e55a846e9e2c937ca1d37b20bc1612bca1ae25bb6e158
6
+ metadata.gz: 5cd9b38be5b0a2c55a187cd1dab96b99caa84c2c473115dc3b147e4105c45fefbd4789852da88926d7cfb2cbbd8ed5997ee0bdc6f770a31f3f0124c2c2f373a2
7
+ data.tar.gz: 3defa696a2f6a444efd38249f0b34260033b39ea7356075d3507b588122c9546a261e41f50d789f706c8f17d5ddba722e560532c3b272905d1192876cf139d76
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fusionauth_client (1.60.0)
4
+ fusionauth_client (1.62.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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.60.0", licenses: ["ApacheV2_0"]) {
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()
@@ -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>
@@ -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.60.0'
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
- body = {
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(body))
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
@@ -222,11 +277,67 @@ module FusionAuth
222
277
  #
223
278
  # 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.
224
279
  #
225
- # @param login_id [string] The loginId of the User that you intend to change the password for.
280
+ # @param login_id [string] The loginId (email or username) of the User that you intend to change the password for.
226
281
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
227
282
  def check_change_password_using_login_id(login_id)
228
283
  start.uri('/api/user/change-password')
229
- .url_parameter('username', login_id)
284
+ .url_parameter('loginId', login_id)
285
+ .get
286
+ .go
287
+ end
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
+
307
+ #
308
+ # Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
309
+ # When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
310
+ # your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
311
+ #
312
+ # 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.
313
+ #
314
+ # @param login_id [string] The loginId of the User that you intend to change the password for.
315
+ # @param login_id_types [Array] The identity types that FusionAuth will compare the loginId to.
316
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
317
+ def check_change_password_using_login_id_and_login_id_types(login_id, login_id_types)
318
+ start.uri('/api/user/change-password')
319
+ .url_parameter('loginId', login_id)
320
+ .url_parameter('loginIdTypes', login_id_types)
321
+ .get
322
+ .go
323
+ end
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)
230
341
  .get
231
342
  .go
232
343
  end
@@ -241,14 +352,33 @@ module FusionAuth
241
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:&lt;target-entity-id&gt;:&lt;roles&gt;. Roles are an optional comma separated list.
242
353
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
243
354
  def client_credentials_grant(client_id, client_secret, scope)
244
- body = {
355
+ form_parameters = {
245
356
  "client_id" => client_id,
246
357
  "client_secret" => client_secret,
247
- "grant_type" => "client_credentials",
248
- "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,
249
379
  }
250
380
  startAnonymous.uri('/oauth2/token')
251
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
381
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
252
382
  .post
253
383
  .go
254
384
  end
@@ -1294,6 +1424,43 @@ module FusionAuth
1294
1424
  .go
1295
1425
  end
1296
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
+
1297
1464
  #
1298
1465
  # Disable two-factor authentication for a user.
1299
1466
  #
@@ -1349,15 +1516,15 @@ module FusionAuth
1349
1516
  # @param redirect_uri [string] The URI to redirect to upon a successful request.
1350
1517
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
1351
1518
  def exchange_o_auth_code_for_access_token(code, client_id, client_secret, redirect_uri)
1352
- body = {
1519
+ form_parameters = {
1353
1520
  "code" => code,
1354
1521
  "client_id" => client_id,
1355
1522
  "client_secret" => client_secret,
1356
- "grant_type" => "authorization_code",
1357
- "redirect_uri" => redirect_uri
1523
+ "grant_type" => 'authorization_code',
1524
+ "redirect_uri" => redirect_uri,
1358
1525
  }
1359
1526
  startAnonymous.uri('/oauth2/token')
1360
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
1527
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1361
1528
  .post
1362
1529
  .go
1363
1530
  end
@@ -1374,16 +1541,59 @@ module FusionAuth
1374
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.
1375
1542
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
1376
1543
  def exchange_o_auth_code_for_access_token_using_pkce(code, client_id, client_secret, redirect_uri, code_verifier)
1377
- body = {
1544
+ form_parameters = {
1378
1545
  "code" => code,
1379
1546
  "client_id" => client_id,
1380
1547
  "client_secret" => client_secret,
1381
- "grant_type" => "authorization_code",
1548
+ "grant_type" => 'authorization_code',
1382
1549
  "redirect_uri" => redirect_uri,
1383
- "code_verifier" => code_verifier
1550
+ "code_verifier" => code_verifier,
1384
1551
  }
1385
1552
  startAnonymous.uri('/oauth2/token')
1386
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
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))
1387
1597
  .post
1388
1598
  .go
1389
1599
  end
@@ -1400,16 +1610,38 @@ module FusionAuth
1400
1610
  # @param user_code [string] (Optional) The end-user verification code. This code is required if using this endpoint to approve the Device Authorization.
1401
1611
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
1402
1612
  def exchange_refresh_token_for_access_token(refresh_token, client_id, client_secret, scope, user_code)
1403
- body = {
1613
+ form_parameters = {
1404
1614
  "refresh_token" => refresh_token,
1405
1615
  "client_id" => client_id,
1406
1616
  "client_secret" => client_secret,
1407
- "grant_type" => "refresh_token",
1617
+ "grant_type" => 'refresh_token',
1408
1618
  "scope" => scope,
1409
- "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,
1410
1642
  }
1411
1643
  startAnonymous.uri('/oauth2/token')
1412
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
1644
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1413
1645
  .post
1414
1646
  .go
1415
1647
  end
@@ -1439,17 +1671,40 @@ module FusionAuth
1439
1671
  # @param user_code [string] (Optional) The end-user verification code. This code is required if using this endpoint to approve the Device Authorization.
1440
1672
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
1441
1673
  def exchange_user_credentials_for_access_token(username, password, client_id, client_secret, scope, user_code)
1442
- body = {
1674
+ form_parameters = {
1443
1675
  "username" => username,
1444
1676
  "password" => password,
1445
1677
  "client_id" => client_id,
1446
1678
  "client_secret" => client_secret,
1447
- "grant_type" => "password",
1679
+ "grant_type" => 'password',
1448
1680
  "scope" => scope,
1449
- "user_code" => user_code
1681
+ "user_code" => user_code,
1450
1682
  }
1451
1683
  startAnonymous.uri('/oauth2/token')
1452
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
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,
1705
+ }
1706
+ startAnonymous.uri('/oauth2/token')
1707
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1453
1708
  .post
1454
1709
  .go
1455
1710
  end
@@ -1633,12 +1888,29 @@ module FusionAuth
1633
1888
  # @param token [string] The access token returned by this OAuth provider as the result of a successful client credentials grant.
1634
1889
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
1635
1890
  def introspect_access_token(client_id, token)
1636
- body = {
1891
+ form_parameters = {
1637
1892
  "client_id" => client_id,
1638
- "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,
1639
1911
  }
1640
1912
  startAnonymous.uri('/oauth2/introspect')
1641
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
1913
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1642
1914
  .post
1643
1915
  .go
1644
1916
  end
@@ -1649,11 +1921,27 @@ module FusionAuth
1649
1921
  # @param token [string] The access token returned by this OAuth provider as the result of a successful client credentials grant.
1650
1922
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
1651
1923
  def introspect_client_credentials_access_token(token)
1652
- body = {
1653
- "token" => token
1924
+ form_parameters = {
1925
+ "token" => token,
1654
1926
  }
1655
1927
  startAnonymous.uri('/oauth2/introspect')
1656
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
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,
1942
+ }
1943
+ startAnonymous.uri('/oauth2/introspect')
1944
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
1657
1945
  .post
1658
1946
  .go
1659
1947
  end
@@ -3291,6 +3579,18 @@ module FusionAuth
3291
3579
  .go
3292
3580
  end
3293
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
+
3294
3594
  #
3295
3595
  # Retrieve two-factor recovery codes for a user.
3296
3596
  #
@@ -3322,6 +3622,22 @@ module FusionAuth
3322
3622
  .go
3323
3623
  end
3324
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
+
3325
3641
  #
3326
3642
  # Retrieves the user for the given Id.
3327
3643
  #
@@ -3421,7 +3737,7 @@ module FusionAuth
3421
3737
  # Retrieves the user for the loginId, using specific loginIdTypes.
3422
3738
  #
3423
3739
  # @param login_id [string] The email or username of the user.
3424
- # @param login_id_types [Array] the identity types that FusionAuth will compare the loginId to.
3740
+ # @param login_id_types [Array] The identity types that FusionAuth will compare the loginId to.
3425
3741
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
3426
3742
  def retrieve_user_by_login_id_with_login_id_types(login_id, login_id_types)
3427
3743
  start.uri('/api/user')
@@ -3466,13 +3782,13 @@ module FusionAuth
3466
3782
  # @param user_code [string] The end-user verification code.
3467
3783
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
3468
3784
  def retrieve_user_code(client_id, client_secret, user_code)
3469
- body = {
3785
+ form_parameters = {
3470
3786
  "client_id" => client_id,
3471
3787
  "client_secret" => client_secret,
3472
- "user_code" => user_code
3788
+ "user_code" => user_code,
3473
3789
  }
3474
3790
  startAnonymous.uri('/oauth2/device/user-code')
3475
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
3791
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
3476
3792
  .get
3477
3793
  .go
3478
3794
  end
@@ -3487,15 +3803,55 @@ module FusionAuth
3487
3803
  # @param user_code [string] The end-user verification code.
3488
3804
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
3489
3805
  def retrieve_user_code_using_api_key(user_code)
3490
- body = {
3491
- "user_code" => user_code
3806
+ form_parameters = {
3807
+ "user_code" => user_code,
3492
3808
  }
3493
3809
  startAnonymous.uri('/oauth2/device/user-code')
3494
- .body_handler(FusionAuth::FormDataBodyHandler.new(body))
3810
+ .body_handler(FusionAuth::FormDataBodyHandler.new(form_parameters))
3495
3811
  .get
3496
3812
  .go
3497
3813
  end
3498
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
+
3499
3855
  #
3500
3856
  # Retrieves all the comments for the user with the given Id.
3501
3857
  #
@@ -3620,7 +3976,7 @@ module FusionAuth
3620
3976
  # @param login_id [string] The userId id.
3621
3977
  # @param start [OpenStruct, Hash] The start instant as UTC milliseconds since Epoch.
3622
3978
  # @param _end [OpenStruct, Hash] The end instant as UTC milliseconds since Epoch.
3623
- # @param login_id_types [Array] the identity types that FusionAuth will compare the loginId to.
3979
+ # @param login_id_types [Array] The identity types that FusionAuth will compare the loginId to.
3624
3980
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
3625
3981
  def retrieve_user_login_report_by_login_id_and_login_id_types(application_id, login_id, start, _end, login_id_types)
3626
3982
  start.uri('/api/report/login')
@@ -4833,6 +5189,21 @@ module FusionAuth
4833
5189
  .go
4834
5190
  end
4835
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
+
4836
5207
  #
4837
5208
  # Validates the provided JWT (encoded JWT string) to ensure the token is valid. A valid access token is properly
4838
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.60.0
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-09-11 00:00:00.000000000 Z
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.