hydra-keycloak-client 0.1.1.1 → 0.1.5

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: 4f053fe306d2a64970e0b894bd9f23315f518bbd83a1c500e278c43f30f3b164
4
- data.tar.gz: c5569feb5e94069a9d6e34bff42af1dc2a9fd1ec48287c3f3670bd4fd1348202
3
+ metadata.gz: c1c2501b9655a228734d10a9d4c1faad122811861727dc8aa66e10b4219e9a12
4
+ data.tar.gz: 3c86bc796eb4377e4a5defcfb75b908ada14386f10386abe745c2472959137c5
5
5
  SHA512:
6
- metadata.gz: 30c0b180b10067409a0ea8b7857be94035e772f444e622e10046e3def5e52fb7fb14cd9aeb1902027a0d4bbbf2c09b4e68891b063c01bfc6e11ad83f43d36342
7
- data.tar.gz: 68000c68b4c1ce3a8ed4a6f19e82c1783de349b6df75d8a0cdd361b2493910777f335afffeb5bafd2ebca34335a4c0de9e7eeea34d163fb3eb9d11071af2d020
6
+ metadata.gz: eb1200c121405ff86550a47bbf646b15f658e9a95125ad54317768f58b2d05604a97d6c24939d5817fed75c7551fac59f47b1934a7d579092f99cdb8cac6fdde
7
+ data.tar.gz: 02ec5a5fc49112fb2f2dc9e09b8828e47cf69e9d23628d3dacae0ea0dfbfcd284be162a42e86bd3cecb5290c42241df616a88607d05c86afbcf1ce7886e0d118
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hydra-keycloak-client (0.1.0)
4
+ hydra-keycloak-client (0.1.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -16,6 +16,17 @@ module Hydra
16
16
  extend ::Hydra::Keycloak::Mixin
17
17
 
18
18
  def self.call(config:)
19
+ memcached_schema = Dry::Schema.JSON do
20
+ required(:memcached_host).filled(:string)
21
+ required(:memcached_port).filled(:string)
22
+ required(:memcached_namespace).filled(:string)
23
+ end
24
+
25
+ redis_schema = Dry::Schema.JSON do
26
+ required(:redis_host).filled(:string)
27
+ required(:redis_port).filled(:string)
28
+ end
29
+
19
30
  config_schema = Dry::Schema.JSON do
20
31
  required(:auth_server_url).filled(:string)
21
32
  required(:realm).filled(:string)
@@ -24,17 +35,7 @@ module Hydra
24
35
  required(:secret).filled(:string)
25
36
  required(:logout_redirect).filled(:string)
26
37
  required(:store_client).value(included_in?: ['redis', 'memcached'])
27
-
28
- optional(:memcached).hash do
29
- required(:memcached_host).filled(:string)
30
- required(:memcached_port).filled(:string)
31
- required(:memcached_namespace).filled(:string)
32
- end
33
-
34
- optional(:redis).hash do
35
- required(:redis_host).filled(:string)
36
- required(:redis_port).filled(:string)
37
- end
38
+ required(:store_client_options).hash(memcached_schema | redis_schema)
38
39
  end
39
40
 
40
41
  validated_config = config_schema.call(config)
@@ -55,7 +56,7 @@ module Hydra
55
56
  ::Hydra::Keycloak::Queries::Gateway.new
56
57
  end
57
58
 
58
- if validated_config[:store_client] == :redis
59
+ if validated_config[:store_client] == 'redis'
59
60
  container.register :redis do
60
61
  require 'redis'
61
62
 
@@ -67,7 +68,7 @@ module Hydra
67
68
 
68
69
  ::Hydra::Keycloak::Store::RedisClient.new
69
70
  end
70
- else validated_config[:store_client] == :memcached
71
+ else validated_config[:store_client] == 'memcached'
71
72
  container.register :dalli do
72
73
  require 'dalli'
73
74
 
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'redis'
4
+ require 'dry/monads'
5
+ require 'dry/auto_inject'
6
+
7
+ module Hydra
8
+ module Keycloak
9
+ module Store
10
+ class RedisClient
11
+ extend ::Hydra::Keycloak::Mixin
12
+ include ::Dry::Monads[:result]
13
+ inject['redis']
14
+
15
+ def set(key, value)
16
+ redis.set(key, value)
17
+
18
+ Success(:ok)
19
+ rescue Redis::BaseError
20
+ Failure(status: 400, code: :redis_unavailable)
21
+ end
22
+
23
+ def get(key)
24
+ Success(redis.get(key))
25
+ rescue Redis::BaseError
26
+ Failure(status: 400, code: :redis_unavailable)
27
+ end
28
+
29
+ def delete(key)
30
+ redis.del(key)
31
+
32
+ Success(:ok)
33
+ rescue Redis::BaseError
34
+ Failure(status: 400, code: :redis_unavailable)
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Hydra
4
4
  module Keycloak
5
- VERSION = '0.1.1.1'
5
+ VERSION = '0.1.5'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-keycloak-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.1
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fedor Kosolapov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-08 00:00:00.000000000 Z
11
+ date: 2022-02-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Keycloak client for SSO
14
14
  email:
@@ -33,6 +33,7 @@ files:
33
33
  - lib/hydra/keycloak/queries/http_client.rb
34
34
  - lib/hydra/keycloak/store/gateway.rb
35
35
  - lib/hydra/keycloak/store/memcached_client.rb
36
+ - lib/hydra/keycloak/store/redis_client.rb
36
37
  - lib/hydra/keycloak/token.rb
37
38
  - lib/hydra/keycloak/urls.rb
38
39
  - lib/hydra/keycloak/user_data.rb