keycloak-admin 1.0.6 → 1.0.7
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +2 -2
- data/README.md +1 -1
- data/lib/keycloak-admin/client/client.rb +1 -1
- data/lib/keycloak-admin/representation/protocol_mapper_representation.rb +7 -7
- data/lib/keycloak-admin/version.rb +1 -1
- data/lib/keycloak-admin.rb +5 -1
- data/spec/representation/role_representation_spec.rb +37 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1c9e5505dc0883709f4b37f86e2344d352d9994474c316e2f5dabef44494dfb
|
4
|
+
data.tar.gz: 8046d950cbd37f43afd97764339a581ca9f98ffd311189b7504e1144e9e3e1e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
@@ -10,7 +10,7 @@ module KeycloakAdmin
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def current_token
|
13
|
-
@current_token ||= KeycloakAdmin.
|
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
|
-
:
|
7
|
+
:protocol_mapper
|
8
8
|
|
9
9
|
def self.from_hash(hash)
|
10
|
-
rep
|
11
|
-
rep.id
|
12
|
-
rep.config
|
13
|
-
rep.name
|
14
|
-
rep.protocol
|
15
|
-
rep.
|
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
|
data/lib/keycloak-admin.rb
CHANGED
@@ -42,7 +42,11 @@ module KeycloakAdmin
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.realm(realm_name)
|
45
|
-
|
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.
|
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
|