fusionauth_client 1.36.0 → 1.39.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f821148b188a2af1ed2e36d1c24b0fdae610792f4ebabe404e226bd6964d451
4
- data.tar.gz: a98b63e213361a0f0f7d759ca14294b8350596c9f8c27107baaf6ba1a4c36107
3
+ metadata.gz: 34a9f230af6ca7349f8fdee665b8ba23985c385637d9d64d5c355ffdf5bc77c6
4
+ data.tar.gz: c24e551fa66cbcd3621062f93204422acde7bdadd0b4f9a6884635cb756c65f7
5
5
  SHA512:
6
- metadata.gz: 063a4e86f5c39639528877e9b0d2e041d0324e004465e3ad7b7232fe2ae663105c758f91a000f15c911399daf3ab5c60cf13a57458abcb880b12d56d7d0b99b7
7
- data.tar.gz: 76cfedf73cff40f2383f9448e1db57bbed078c8b9fab7fbf526fd1f82885bab44c322a122e5918ac72d32f1269b98ce526bbefc58357161cc71cad9706cbdb96
6
+ metadata.gz: d5f95f92365e882fff1753ec87d4302f5933617f72c7faefe8decc9cd877b3e7f83ab785b507ba64f8b7244889982cc0f8c0ec6f4ddcf929a920504e017b1415
7
+ data.tar.gz: 30373ef50dd2fbc08020781e77d9ec8a03d96f0bce02f41ad8c3a2a01b9ebe9c025b0d90795e977bbc4b9f9c8f0e5f39bb6723920ed59d8d3a455de85a729c41
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fusionauth_client (1.36.0)
4
+ fusionauth_client (1.39.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -20,44 +20,9 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- Once the gem is installed, you can call FusionAuth APIs like this:
23
+ Once the gem is installed, you can call FusionAuth APIs.
24
24
 
25
- ```ruby
26
- require 'fusionauth/fusionauth_client'
27
-
28
- # Construct the FusionAuth Client
29
- client = FusionAuth::FusionAuthClient.new(
30
- '<YOUR_API_KEY>',
31
- 'http://localhost:9011'
32
- )
33
-
34
- # Create a user + registration
35
- id = SecureRandom.uuid
36
- client.register(id, {
37
- :user => {
38
- :firstName => 'Ruby',
39
- :lastName => 'Client',
40
- :email => 'ruby.client.test@fusionauth.io',
41
- :password => 'password'
42
- },
43
- :registration => {
44
- :applicationId => application_id,
45
- :data => {
46
- :foo => 'bar'
47
- },
48
- :preferredLanguages => %w(en fr),
49
- :roles => %w(user)
50
- }
51
- })
52
-
53
- # Authenticate the user
54
- response = client.login({
55
- :loginId => 'ruby.client.test@fusionauth.io',
56
- :password => 'password',
57
- :applicationId => application_id
58
- })
59
- user = response.success.response.user
60
- ```
25
+ See examples in the `examples` directory.
61
26
 
62
27
  ## Questions and support
63
28
 
data/build.savant CHANGED
@@ -16,7 +16,7 @@
16
16
  savantVersion = "1.0.0"
17
17
 
18
18
  pubVersion = ""
19
- project(group: "io.fusionauth", name: "fusionauth-ruby-client", version: "1.36.0", licenses: ["ApacheV2_0"]) {
19
+ project(group: "io.fusionauth", name: "fusionauth-ruby-client", version: "1.39.0", licenses: ["ApacheV2_0"]) {
20
20
  workflow {
21
21
  fetch {
22
22
  cache()
@@ -0,0 +1,35 @@
1
+ require 'fusionauth/fusionauth_client'
2
+ require 'securerandom'
3
+
4
+ # Construct the FusionAuth Client
5
+ client = FusionAuth::FusionAuthClient.new(
6
+ 'APIKEY',
7
+ 'http://localhost:9011'
8
+ )
9
+
10
+ application_id = '20ce6dac-b985-4c77-bb59-6369249f884b'
11
+
12
+ # Create a user + registration
13
+ id = SecureRandom.uuid
14
+ response = client.register(id, {
15
+ :user => {
16
+ :firstName => 'Ruby',
17
+ :lastName => 'Client',
18
+ :email => 'ruby.client.test@fusionauth.io',
19
+ :password => 'password'
20
+ },
21
+ :registration => {
22
+ :applicationId => application_id,
23
+ :data => {
24
+ :foo => 'bar'
25
+ },
26
+ :preferredLanguages => %w(en fr),
27
+ :roles => %w(user)
28
+ }
29
+ })
30
+
31
+ unless response.success_response
32
+ print response.error_response
33
+ exit
34
+ end
35
+
data/examples/login.rb ADDED
@@ -0,0 +1,24 @@
1
+ require 'fusionauth/fusionauth_client'
2
+ require 'securerandom'
3
+
4
+ # Construct the FusionAuth Client
5
+ client = FusionAuth::FusionAuthClient.new(
6
+ 'APIKEY',
7
+ 'http://localhost:9011'
8
+ )
9
+
10
+ application_id = '20ce6dac-b985-4c77-bb59-6369249f884b'
11
+
12
+ # Authenticate a user
13
+ response = client.login({
14
+ :loginId => 'ruby.client.test@fusionauth.io',
15
+ :password => 'password',
16
+ :applicationId => application_id
17
+ })
18
+
19
+ if response.success_response
20
+ user = response.success_response.user
21
+ print user.id
22
+ else
23
+ print response.error_response
24
+ end
@@ -16,16 +16,16 @@
16
16
  <option name="myRootTask">
17
17
  <RakeTaskImpl id="rake">
18
18
  <subtasks>
19
- <RakeTaskImpl description="Build fusionauth_client-1.28.1.gem into the pkg directory" fullCommand="build" id="build" />
19
+ <RakeTaskImpl description="Build fusionauth_client-1.37.0.gem into the pkg directory" fullCommand="build" id="build" />
20
20
  <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
21
21
  <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
22
- <RakeTaskImpl description="Build and install fusionauth_client-1.28.1.gem into system gems" fullCommand="install" id="install" />
22
+ <RakeTaskImpl description="Build and install fusionauth_client-1.37.0.gem into system gems" fullCommand="install" id="install" />
23
23
  <RakeTaskImpl id="install">
24
24
  <subtasks>
25
- <RakeTaskImpl description="Build and install fusionauth_client-1.28.1.gem into system gems without network access" fullCommand="install:local" id="local" />
25
+ <RakeTaskImpl description="Build and install fusionauth_client-1.37.0.gem into system gems without network access" fullCommand="install:local" id="local" />
26
26
  </subtasks>
27
27
  </RakeTaskImpl>
28
- <RakeTaskImpl description="Create tag v1.28.1 and build and push fusionauth_client-1.28.1.gem to https://rubygems.org" fullCommand="release[remote]" id="release[remote]" />
28
+ <RakeTaskImpl description="Create tag v1.37.0 and build and push fusionauth_client-1.37.0.gem to https://rubygems.org" fullCommand="release[remote]" id="release[remote]" />
29
29
  <RakeTaskImpl description="Run tests" fullCommand="test" id="test" />
30
30
  <RakeTaskImpl description="" fullCommand="default" id="default" />
31
31
  <RakeTaskImpl description="" fullCommand="release" id="release" />
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'fusionauth_client'
7
- spec.version = '1.36.0'
7
+ spec.version = '1.39.0'
8
8
  spec.authors = ['Brian Pontarelli', 'Daniel DeGroff']
9
9
  spec.email = %w(brian@fusionauth.io daniel@fusionauth.io)
10
10
 
@@ -2,7 +2,7 @@ require 'ostruct'
2
2
  require 'fusionauth/rest_client'
3
3
 
4
4
  #
5
- # Copyright (c) 2018-2019, FusionAuth, All Rights Reserved
5
+ # Copyright (c) 2018-2022, FusionAuth, All Rights Reserved
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
8
8
  # you may not use this file except in compliance with the License.
@@ -130,9 +130,9 @@ module FusionAuth
130
130
  #
131
131
  # Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
132
132
  # When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
133
- # your password, you must obtain a Truest Token by completing a Two-Factor Step-Up authentication.
133
+ # your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
134
134
  #
135
- # An HTTP status code of 412 indicates that a Trust Token is required to make a POST request to this API.
135
+ # 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.
136
136
  #
137
137
  # @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.
138
138
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
@@ -146,9 +146,9 @@ module FusionAuth
146
146
  #
147
147
  # Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
148
148
  # When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
149
- # your password, you must obtain a Truest Token by completing a Two-Factor Step-Up authentication.
149
+ # your password, you must obtain a Trust Token by completing a Two-Factor Step-Up authentication.
150
150
  #
151
- # An HTTP status code of 412 indicates that a Trust Token is required to make a POST request to this API.
151
+ # 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.
152
152
  #
153
153
  # @param encoded_jwt [string] The encoded JWT (access token).
154
154
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
@@ -162,9 +162,9 @@ module FusionAuth
162
162
  #
163
163
  # Check to see if the user must obtain a Trust Request Id in order to complete a change password request.
164
164
  # When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
165
- # your password, you must obtain a Truest Request Id by completing a Two-Factor Step-Up authentication.
165
+ # your password, you must obtain a Trust Request Id by completing a Two-Factor Step-Up authentication.
166
166
  #
167
- # An HTTP status code of 412 indicates that a Trust Token is required to make a POST request to this API.
167
+ # 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.
168
168
  #
169
169
  # @param login_id [string] The loginId of the User that you intend to change the password for.
170
170
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
@@ -1511,6 +1511,21 @@ module FusionAuth
1511
1511
  .go()
1512
1512
  end
1513
1513
 
1514
+ #
1515
+ # Sends a ping to FusionAuth indicating that the user was automatically logged into an application. When using
1516
+ # FusionAuth's SSO or your own, you should call this if the user is already logged in centrally, but accesses an
1517
+ # application where they no longer have a session. This helps correctly track login counts, times and helps with
1518
+ # reporting.
1519
+ #
1520
+ # @param request [OpenStruct, Hash] The login request that contains the user credentials used to log them in.
1521
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
1522
+ def login_ping_with_request(request)
1523
+ start.uri('/api/login')
1524
+ .body_handler(FusionAuth::JSONBodyHandler.new(request))
1525
+ .put()
1526
+ .go()
1527
+ end
1528
+
1514
1529
  #
1515
1530
  # The Logout API is intended to be used to remove the refresh token and access token cookies if they exist on the
1516
1531
  # client and revoke the refresh token stored. This API does nothing if the request does not contain an access
@@ -2780,13 +2795,13 @@ module FusionAuth
2780
2795
  end
2781
2796
 
2782
2797
  #
2783
- # Retrieves a single refresh token by unique Id. This is not the same thing as the string value of the refresh token, if you have that, you already have what you need..
2798
+ # Retrieves a single refresh token by unique Id. This is not the same thing as the string value of the refresh token. If you have that, you already have what you need.
2784
2799
  #
2785
- # @param user_id [string] The Id of the user.
2800
+ # @param token_id [string] The Id of the token.
2786
2801
  # @return [FusionAuth::ClientResponse] The ClientResponse object.
2787
- def retrieve_refresh_token_by_id(user_id)
2802
+ def retrieve_refresh_token_by_id(token_id)
2788
2803
  start.uri('/api/jwt/refresh')
2789
- .url_segment(user_id)
2804
+ .url_segment(token_id)
2790
2805
  .get()
2791
2806
  .go()
2792
2807
  end
@@ -2922,6 +2937,25 @@ module FusionAuth
2922
2937
  .go()
2923
2938
  end
2924
2939
 
2940
+ #
2941
+ # Retrieve a user's two-factor status.
2942
+ #
2943
+ # This can be used to see if a user will need to complete a two-factor challenge to complete a login,
2944
+ # and optionally identify the state of the two-factor trust across various applications.
2945
+ #
2946
+ # @param user_id [string] The user Id to retrieve the Two-Factor status.
2947
+ # @param application_id [string] The optional applicationId to verify.
2948
+ # @param two_factor_trust_id [string] The optional two-factor trust Id to verify.
2949
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
2950
+ def retrieve_two_factor_status(user_id, application_id, two_factor_trust_id)
2951
+ start.uri('/api/two-factor/status')
2952
+ .url_parameter('userId', user_id)
2953
+ .url_parameter('applicationId', application_id)
2954
+ .url_segment(two_factor_trust_id)
2955
+ .get()
2956
+ .go()
2957
+ end
2958
+
2925
2959
  #
2926
2960
  # Retrieves the user for the given Id.
2927
2961
  #
@@ -3428,6 +3462,18 @@ module FusionAuth
3428
3462
  .go()
3429
3463
  end
3430
3464
 
3465
+ #
3466
+ # Searches groups with the specified criteria and pagination.
3467
+ #
3468
+ # @param request [OpenStruct, Hash] The search criteria and pagination information.
3469
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
3470
+ def search_groups(request)
3471
+ start.uri('/api/group/search')
3472
+ .body_handler(FusionAuth::JSONBodyHandler.new(request))
3473
+ .post()
3474
+ .go()
3475
+ end
3476
+
3431
3477
  #
3432
3478
  # Searches the IP Access Control Lists with the specified criteria and pagination.
3433
3479
  #
@@ -4151,6 +4197,20 @@ module FusionAuth
4151
4197
  .go()
4152
4198
  end
4153
4199
 
4200
+ #
4201
+ # Administratively verify a user's email address. Use this method to bypass email verification for the user.
4202
+ #
4203
+ # The request body will contain the userId to be verified. An API key is required when sending the userId in the request body.
4204
+ #
4205
+ # @param request [OpenStruct, Hash] The request that contains the userId to verify.
4206
+ # @return [FusionAuth::ClientResponse] The ClientResponse object.
4207
+ def verify_email_address_by_user_id(request)
4208
+ start.uri('/api/user/verify-email')
4209
+ .body_handler(FusionAuth::JSONBodyHandler.new(request))
4210
+ .post()
4211
+ .go()
4212
+ end
4213
+
4154
4214
  #
4155
4215
  # Confirms an application registration. The Id given is usually from an email sent to the user.
4156
4216
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusionauth_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.36.0
4
+ version: 1.39.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Pontarelli
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-04-08 00:00:00.000000000 Z
12
+ date: 2022-09-11 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: This library contains the Ruby client library that helps you connect
15
15
  your application to FusionAuth.
@@ -28,6 +28,8 @@ files:
28
28
  - README.md
29
29
  - Rakefile
30
30
  - build.savant
31
+ - examples/create_user.rb
32
+ - examples/login.rb
31
33
  - fusionauth-ruby-client.iml
32
34
  - fusionauth_client.gemspec
33
35
  - lib/fusionauth/fusionauth_client.rb