keycloak-ruby-client 0.0.17 → 0.0.18

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
  SHA1:
3
- metadata.gz: e4ad3912988cbe99dc48089b5081e231741f91ff
4
- data.tar.gz: 934aea6bfdc668da71cd61b558e699062bea6a58
3
+ metadata.gz: ad0512b14993b6c29da87aacc53c064c926152bf
4
+ data.tar.gz: 683cc0dcd8ddf7f33744fb19398fdef2247ad4d6
5
5
  SHA512:
6
- metadata.gz: 7c098a81780d4a276ae9886ae31bfce0bb5a188bd7e13d46b8f16361430e9b9a5b374cc40afa5fbd7b820e88a992f602123ed7ea4703c40e30f8499d75a04a80
7
- data.tar.gz: 760a84debe8978adf16a9d26d4ae966c5d9141b7930d4ee463f3b561fd185f29d7d2a827360354bc9f239d14f19989fb12aa32bb5c1edeb3e7267b367e93c7e6
6
+ metadata.gz: a60226b5ec10dd7cf6d33e6954d5e69851b713407ae71e4b7fbadd0fb31fa8920d4cd8a958d126e3552f388ef3ed679e90a4bfa91cffa1ed52dfef68cb82831b
7
+ data.tar.gz: a7918aec954a71d228d7c369d64f358631ea81bab2a7aa79ea090e2f66f017360fb0e3f2b9d6cac36dc62fbfa4a70964716182872ff8a031baf7079b69c98f91
data/lib/keycloak/api.rb CHANGED
@@ -4,3 +4,4 @@ require 'keycloak/api/user_resources'
4
4
  require 'keycloak/api/client_resources'
5
5
  require 'keycloak/api/client_role_resources'
6
6
  require 'keycloak/api/realm_resources'
7
+ require 'keycloak/api/keycloak_api_extension_resources'
@@ -0,0 +1,28 @@
1
+ # Keycloak API extension resource from https://github.com/FX-HAO/keycloak-api-extension
2
+ module Keycloak
3
+ module API
4
+ module KeycloakAPIExtensionResources
5
+ extend ActiveSupport::Concern
6
+ include Concerns::APIUtil
7
+
8
+ def api_extension_resources_url
9
+ realm_url + "/keycloak-api-extension/"
10
+ end
11
+
12
+ # @param user_id [String] user id
13
+ # @return Boolean
14
+ def if_otp_exists(user_id)
15
+ url = api_extension_resources_url + "users/#{user_id}/if-otp-exists"
16
+ JSON.parse(get(url))["status"]
17
+ end
18
+
19
+ # @param user_id [String] user id
20
+ # @param otp [String] otp
21
+ # @return Boolean
22
+ def validate_otp(user_id, otp)
23
+ url = api_extension_resources_url + "users/#{user_id}/validate-otp"
24
+ JSON.parse(post(url, otp: otp))["status"]
25
+ end
26
+ end
27
+ end
28
+ end
@@ -8,6 +8,7 @@ module Keycloak
8
8
  include API::ClientResources
9
9
  include API::ClientRoleResources
10
10
  include API::RealmResources
11
+ include API::KeycloakAPIExtensionResources
11
12
 
12
13
  attr_reader :auth_server_url, :realm
13
14
 
@@ -1,3 +1,3 @@
1
1
  module Keycloak
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keycloak-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fuxin Hao
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-11 00:00:00.000000000 Z
11
+ date: 2019-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -143,6 +143,7 @@ files:
143
143
  - lib/keycloak/api.rb
144
144
  - lib/keycloak/api/client_resources.rb
145
145
  - lib/keycloak/api/client_role_resources.rb
146
+ - lib/keycloak/api/keycloak_api_extension_resources.rb
146
147
  - lib/keycloak/api/protection_resources.rb
147
148
  - lib/keycloak/api/realm_resources.rb
148
149
  - lib/keycloak/api/role_resources.rb