keycloak-admin 1.0.6 → 1.0.7

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: a78897f6f30b684a57e9233d436c4cd338061729abc161e0afd8c904ca8890d7
4
- data.tar.gz: 75c438cf89337f0823d0cd4b7f0379dc5d40dcf090309b319e02ee5145b92f6c
3
+ metadata.gz: b1c9e5505dc0883709f4b37f86e2344d352d9994474c316e2f5dabef44494dfb
4
+ data.tar.gz: 8046d950cbd37f43afd97764339a581ca9f98ffd311189b7504e1144e9e3e1e0
5
5
  SHA512:
6
- metadata.gz: e1f43d6a122d6e5ce869a38773293fc8bb913865c4febef40904cb660b7440dede79fdb477476bf4f73b001999fc4adb4eb662677b74b8c908baa0370538a09e
7
- data.tar.gz: bc883a362f07cbec20df4ae07fd0fbabe5b5d9056fc0df443df65d768c0887dd33a0b0c3127b45efa80f5d60231a09cab3e45358cf969ea097b2bfa5173df431
6
+ metadata.gz: '0875ad8a22ab4495faa6d21e842b6cf4f28cdf7fffdcf79cefd49e8d7c6178b8beb651f5e7ce8f8557c8b2431b8c07ffd482cca7710f53088a64ca1710eacfaf'
7
+ data.tar.gz: 23ab8ac413cd13cd94eec79ca45a7744a057d40b876af7c4e6432ef343cb5ca9a881182172eb8c97e842c4103fd248a8b2899d8e97998abcf043909e129df124
data/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+
9
+ ## [1.0.7] - 2022-03-13
10
+
11
+ * Allow to use multiple `KeycloakAdmin::Client` in the same environment
12
+
8
13
  ## [1.0.6] - 2022-03-13
9
14
 
10
15
  * When serializing an array to JSON, force the serialization to use `to_json` for each element. In several contexts (e.g. Rails), `to_json` is not used.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- keycloak-admin (1.0.5)
4
+ keycloak-admin (1.0.6)
5
5
  http-cookie (~> 1.0, >= 1.0.3)
6
6
  rest-client (~> 2.0)
7
7
 
@@ -39,7 +39,7 @@ GEM
39
39
  rspec-support (3.7.0)
40
40
  unf (0.1.4)
41
41
  unf_ext
42
- unf_ext (0.0.8)
42
+ unf_ext (0.0.8.1)
43
43
 
44
44
  PLATFORMS
45
45
  ruby
data/README.md CHANGED
@@ -12,7 +12,7 @@ This gem *does not* require Rails.
12
12
  For example, using `bundle`, add this line to your Gemfile.
13
13
 
14
14
  ```ruby
15
- gem "keycloak-admin", "1.0.6"
15
+ gem "keycloak-admin", "1.0.7"
16
16
  ```
17
17
 
18
18
  ## Login
@@ -10,7 +10,7 @@ module KeycloakAdmin
10
10
  end
11
11
 
12
12
  def current_token
13
- @current_token ||= KeycloakAdmin.realm(@configuration.client_realm_name).token.get
13
+ @current_token ||= KeycloakAdmin.create_client(@configuration, @configuration.client_realm_name).token.get
14
14
  end
15
15
 
16
16
  def headers
@@ -4,15 +4,15 @@ module KeycloakAdmin
4
4
  :id,
5
5
  :name,
6
6
  :protocol,
7
- :protocolMapper
7
+ :protocol_mapper
8
8
 
9
9
  def self.from_hash(hash)
10
- rep = new
11
- rep.id = hash["id"]
12
- rep.config = hash["config"]
13
- rep.name = hash["name"]
14
- rep.protocol = hash["protocol"]
15
- rep.protocolMapper = hash["protocolMapper"]
10
+ rep = new
11
+ rep.id = hash["id"]
12
+ rep.config = hash["config"]
13
+ rep.name = hash["name"]
14
+ rep.protocol = hash["protocol"]
15
+ rep.protocol_mapper = hash["protocolMapper"]
16
16
  rep
17
17
  end
18
18
  end
@@ -1,3 +1,3 @@
1
1
  module KeycloakAdmin
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
@@ -42,7 +42,11 @@ module KeycloakAdmin
42
42
  end
43
43
 
44
44
  def self.realm(realm_name)
45
- RealmClient.new(@configuration, realm_name)
45
+ create_client(@configuration, realm_name)
46
+ end
47
+
48
+ def self.create_client(configuration, realm_name)
49
+ RealmClient.new(configuration, realm_name)
46
50
  end
47
51
 
48
52
  def self.logger
@@ -0,0 +1,37 @@
1
+ RSpec.describe KeycloakAdmin::RoleRepresentation do
2
+ describe "#to_json" do
3
+ before(:each) do
4
+ @mapper = KeycloakAdmin::RoleRepresentation.from_hash(
5
+ {
6
+ "id" => "bb79fb10-a7b4-4728-a662-82a4de7844a3",
7
+ "name" => "abcd",
8
+ "composite" => true,
9
+ "clientRole" => false
10
+ }
11
+ )
12
+ end
13
+
14
+ it "can convert to json" do
15
+ expect(@mapper.to_json).to eq "{\"id\":\"bb79fb10-a7b4-4728-a662-82a4de7844a3\",\"name\":\"abcd\",\"composite\":true,\"clientRole\":false}"
16
+ end
17
+ end
18
+
19
+ describe "array#to_json" do
20
+ before(:each) do
21
+ @mappers = [
22
+ KeycloakAdmin::RoleRepresentation.from_hash(
23
+ {
24
+ "id" => "bb79fb10-a7b4-4728-a662-82a4de7844a3",
25
+ "name" => "abcd",
26
+ "composite" => true,
27
+ "clientRole" => false
28
+ }
29
+ )
30
+ ]
31
+ end
32
+
33
+ it "can convert to json" do
34
+ expect(@mappers.to_json).to eq "[{\"id\":\"bb79fb10-a7b4-4728-a662-82a4de7844a3\",\"name\":\"abcd\",\"composite\":true,\"clientRole\":false}]"
35
+ end
36
+ end
37
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keycloak-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorent Lempereur
@@ -137,6 +137,7 @@ files:
137
137
  - spec/representation/identity_provider_representation_spec.rb
138
138
  - spec/representation/impersonation_representation_spec.rb
139
139
  - spec/representation/protocol_mapper_representation_spec.rb
140
+ - spec/representation/role_representation_spec.rb
140
141
  - spec/representation/user_representation_spec.rb
141
142
  - spec/resource/group_resource_spec.rb
142
143
  - spec/resource/user_resource_spec.rb