keycloak-admin 1.1.3 → 1.1.4
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/.github/workflows/Dockerfile +24 -24
- data/.github/workflows/ci.yml +80 -83
- data/.gitignore +9 -9
- data/.rspec +2 -2
- data/CHANGELOG.md +194 -188
- data/Dockerfile +12 -12
- data/Gemfile +3 -3
- data/Gemfile.lock +51 -49
- data/MIT-LICENSE +20 -20
- data/README.md +748 -748
- data/bin/console +9 -9
- data/keycloak-admin.gemspec +24 -24
- data/lib/keycloak-admin/client/attack_detection_client.rb +41 -41
- data/lib/keycloak-admin/client/client.rb +56 -56
- data/lib/keycloak-admin/client/client_authz_permission_client.rb +80 -80
- data/lib/keycloak-admin/client/client_authz_policy_client.rb +75 -75
- data/lib/keycloak-admin/client/client_authz_resource_client.rb +92 -92
- data/lib/keycloak-admin/client/client_authz_scope_client.rb +70 -70
- data/lib/keycloak-admin/client/client_client.rb +71 -71
- data/lib/keycloak-admin/client/client_role_client.rb +20 -20
- data/lib/keycloak-admin/client/client_role_mappings_client.rb +32 -32
- data/lib/keycloak-admin/client/configurable_token_client.rb +35 -35
- data/lib/keycloak-admin/client/group_client.rb +148 -131
- data/lib/keycloak-admin/client/identity_provider_client.rb +51 -51
- data/lib/keycloak-admin/client/realm_client.rb +122 -122
- data/lib/keycloak-admin/client/role_client.rb +59 -59
- data/lib/keycloak-admin/client/role_mapper_client.rb +47 -45
- data/lib/keycloak-admin/client/token_client.rb +29 -29
- data/lib/keycloak-admin/client/user_client.rb +266 -266
- data/lib/keycloak-admin/configuration.rb +52 -52
- data/lib/keycloak-admin/representation/attack_detection_representation.rb +17 -17
- data/lib/keycloak-admin/representation/camel_json.rb +12 -12
- data/lib/keycloak-admin/representation/client_authz_permission_representation.rb +33 -33
- data/lib/keycloak-admin/representation/client_authz_policy_config_representation.rb +14 -14
- data/lib/keycloak-admin/representation/client_authz_policy_representation.rb +26 -26
- data/lib/keycloak-admin/representation/client_authz_resource_representation.rb +25 -25
- data/lib/keycloak-admin/representation/client_authz_scope_representation.rb +16 -16
- data/lib/keycloak-admin/representation/client_representation.rb +71 -71
- data/lib/keycloak-admin/representation/credential_representation.rb +38 -38
- data/lib/keycloak-admin/representation/federated_identity_representation.rb +15 -15
- data/lib/keycloak-admin/representation/group_representation.rb +21 -21
- data/lib/keycloak-admin/representation/identity_provider_mapper_representation.rb +19 -19
- data/lib/keycloak-admin/representation/identity_provider_representation.rb +67 -67
- data/lib/keycloak-admin/representation/impersonation_redirection_representation.rb +16 -16
- data/lib/keycloak-admin/representation/impersonation_representation.rb +43 -43
- data/lib/keycloak-admin/representation/protocol_mapper_representation.rb +19 -19
- data/lib/keycloak-admin/representation/realm_representation.rb +14 -14
- data/lib/keycloak-admin/representation/representation.rb +23 -23
- data/lib/keycloak-admin/representation/role_representation.rb +19 -19
- data/lib/keycloak-admin/representation/session_representation.rb +22 -22
- data/lib/keycloak-admin/representation/token_representation.rb +39 -39
- data/lib/keycloak-admin/representation/user_representation.rb +47 -47
- data/lib/keycloak-admin/resource/base_role_containing_resource.rb +28 -28
- data/lib/keycloak-admin/resource/group_resource.rb +11 -11
- data/lib/keycloak-admin/resource/user_resource.rb +7 -7
- data/lib/keycloak-admin/version.rb +3 -3
- data/lib/keycloak-admin.rb +84 -84
- data/spec/client/attack_detection_client_spec.rb +102 -102
- data/spec/client/client_authz_permission_client_spec.rb +170 -170
- data/spec/client/client_authz_policy_client_spec.rb +169 -169
- data/spec/client/client_authz_resource_client_spec.rb +150 -150
- data/spec/client/client_authz_scope_client_spec.rb +133 -133
- data/spec/client/client_client_spec.rb +133 -133
- data/spec/client/client_role_mappings_client_spec.rb +82 -82
- data/spec/client/client_spec.rb +28 -28
- data/spec/client/configurable_token_client_spec.rb +34 -34
- data/spec/client/group_client_spec.rb +328 -258
- data/spec/client/identity_provider_client_spec.rb +92 -92
- data/spec/client/realm_client_spec.rb +155 -155
- data/spec/client/role_client_spec.rb +79 -79
- data/spec/client/role_mapper_client_spec.rb +113 -68
- data/spec/client/token_client_spec.rb +68 -68
- data/spec/client/user_client_spec.rb +373 -373
- data/spec/configuration_spec.rb +113 -113
- data/spec/integration/client_authorization_spec.rb +93 -95
- data/spec/representation/attack_detection_representation_spec.rb +15 -15
- data/spec/representation/client_authz_permission_representation_spec.rb +52 -52
- data/spec/representation/client_authz_policy_representation_spec.rb +46 -46
- data/spec/representation/client_authz_resource_representation_spec.rb +33 -33
- data/spec/representation/client_authz_scope_representation_spec.rb +18 -18
- data/spec/representation/client_representation_spec.rb +119 -119
- data/spec/representation/group_representation_spec.rb +22 -22
- data/spec/representation/identity_provider_mapper_representation_spec.rb +24 -24
- data/spec/representation/identity_provider_representation_spec.rb +113 -113
- data/spec/representation/impersonation_representation_spec.rb +163 -163
- data/spec/representation/protocol_mapper_representation_spec.rb +57 -57
- data/spec/representation/role_representation_spec.rb +37 -37
- data/spec/representation/session_representation_spec.rb +15 -15
- data/spec/representation/user_representation_spec.rb +15 -15
- data/spec/resource/group_resource_spec.rb +14 -14
- data/spec/resource/user_resource_spec.rb +14 -14
- data/spec/spec_helper.rb +37 -37
- metadata +10 -10
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
RSpec.describe KeycloakAdmin::ProtocolMapperRepresentation do
|
|
2
|
-
describe "#to_json" do
|
|
3
|
-
before(:each) do
|
|
4
|
-
@mapper = KeycloakAdmin::ProtocolMapperRepresentation.from_hash(
|
|
5
|
-
{
|
|
6
|
-
"id" => "hello",
|
|
7
|
-
"name" => "abcd",
|
|
8
|
-
"protocol" => "openid-connect",
|
|
9
|
-
"protocolMapper" => "oidc-hardcoded-claim-mapper",
|
|
10
|
-
"consentRequired" => false,
|
|
11
|
-
"config" => {
|
|
12
|
-
"claim.value" => "123456",
|
|
13
|
-
"userinfo.token.claim" => "false",
|
|
14
|
-
"id.token.claim" => "false",
|
|
15
|
-
"access.token.claim" => "true",
|
|
16
|
-
"claim.name" => "abcd",
|
|
17
|
-
"jsonType.label" => "String",
|
|
18
|
-
"access.tokenResponse.claim" => "false"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it "can convert to json" do
|
|
25
|
-
expect(@mapper.to_json).to eq "{\"id\":\"hello\",\"config\":{\"claim.value\":\"123456\",\"userinfo.token.claim\":\"false\",\"id.token.claim\":\"false\",\"access.token.claim\":\"true\",\"claim.name\":\"abcd\",\"jsonType.label\":\"String\",\"access.tokenResponse.claim\":\"false\"},\"name\":\"abcd\",\"protocol\":\"openid-connect\",\"protocolMapper\":\"oidc-hardcoded-claim-mapper\"}"
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
describe "array#to_json" do
|
|
30
|
-
before(:each) do
|
|
31
|
-
@mapper = [
|
|
32
|
-
KeycloakAdmin::ProtocolMapperRepresentation.from_hash(
|
|
33
|
-
{
|
|
34
|
-
"id" => "hello",
|
|
35
|
-
"name" => "abcd",
|
|
36
|
-
"protocol" => "openid-connect",
|
|
37
|
-
"protocolMapper" => "oidc-hardcoded-claim-mapper",
|
|
38
|
-
"consentRequired" => false,
|
|
39
|
-
"config" => {
|
|
40
|
-
"claim.value" => "123456",
|
|
41
|
-
"userinfo.token.claim" => "false",
|
|
42
|
-
"id.token.claim" => "false",
|
|
43
|
-
"access.token.claim" => "true",
|
|
44
|
-
"claim.name" => "abcd",
|
|
45
|
-
"jsonType.label" => "String",
|
|
46
|
-
"access.tokenResponse.claim" => "false"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
)
|
|
50
|
-
]
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it "can convert to json" do
|
|
54
|
-
expect(@mapper.to_json).to eq "[{\"id\":\"hello\",\"config\":{\"claim.value\":\"123456\",\"userinfo.token.claim\":\"false\",\"id.token.claim\":\"false\",\"access.token.claim\":\"true\",\"claim.name\":\"abcd\",\"jsonType.label\":\"String\",\"access.tokenResponse.claim\":\"false\"},\"name\":\"abcd\",\"protocol\":\"openid-connect\",\"protocolMapper\":\"oidc-hardcoded-claim-mapper\"}]"
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
1
|
+
RSpec.describe KeycloakAdmin::ProtocolMapperRepresentation do
|
|
2
|
+
describe "#to_json" do
|
|
3
|
+
before(:each) do
|
|
4
|
+
@mapper = KeycloakAdmin::ProtocolMapperRepresentation.from_hash(
|
|
5
|
+
{
|
|
6
|
+
"id" => "hello",
|
|
7
|
+
"name" => "abcd",
|
|
8
|
+
"protocol" => "openid-connect",
|
|
9
|
+
"protocolMapper" => "oidc-hardcoded-claim-mapper",
|
|
10
|
+
"consentRequired" => false,
|
|
11
|
+
"config" => {
|
|
12
|
+
"claim.value" => "123456",
|
|
13
|
+
"userinfo.token.claim" => "false",
|
|
14
|
+
"id.token.claim" => "false",
|
|
15
|
+
"access.token.claim" => "true",
|
|
16
|
+
"claim.name" => "abcd",
|
|
17
|
+
"jsonType.label" => "String",
|
|
18
|
+
"access.tokenResponse.claim" => "false"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "can convert to json" do
|
|
25
|
+
expect(@mapper.to_json).to eq "{\"id\":\"hello\",\"config\":{\"claim.value\":\"123456\",\"userinfo.token.claim\":\"false\",\"id.token.claim\":\"false\",\"access.token.claim\":\"true\",\"claim.name\":\"abcd\",\"jsonType.label\":\"String\",\"access.tokenResponse.claim\":\"false\"},\"name\":\"abcd\",\"protocol\":\"openid-connect\",\"protocolMapper\":\"oidc-hardcoded-claim-mapper\"}"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe "array#to_json" do
|
|
30
|
+
before(:each) do
|
|
31
|
+
@mapper = [
|
|
32
|
+
KeycloakAdmin::ProtocolMapperRepresentation.from_hash(
|
|
33
|
+
{
|
|
34
|
+
"id" => "hello",
|
|
35
|
+
"name" => "abcd",
|
|
36
|
+
"protocol" => "openid-connect",
|
|
37
|
+
"protocolMapper" => "oidc-hardcoded-claim-mapper",
|
|
38
|
+
"consentRequired" => false,
|
|
39
|
+
"config" => {
|
|
40
|
+
"claim.value" => "123456",
|
|
41
|
+
"userinfo.token.claim" => "false",
|
|
42
|
+
"id.token.claim" => "false",
|
|
43
|
+
"access.token.claim" => "true",
|
|
44
|
+
"claim.name" => "abcd",
|
|
45
|
+
"jsonType.label" => "String",
|
|
46
|
+
"access.tokenResponse.claim" => "false"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
]
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it "can convert to json" do
|
|
54
|
+
expect(@mapper.to_json).to eq "[{\"id\":\"hello\",\"config\":{\"claim.value\":\"123456\",\"userinfo.token.claim\":\"false\",\"id.token.claim\":\"false\",\"access.token.claim\":\"true\",\"claim.name\":\"abcd\",\"jsonType.label\":\"String\",\"access.tokenResponse.claim\":\"false\"},\"name\":\"abcd\",\"protocol\":\"openid-connect\",\"protocolMapper\":\"oidc-hardcoded-claim-mapper\"}]"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -1,37 +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,\"containerId\":null}"
|
|
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,\"containerId\":null}]"
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
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,\"containerId\":null}"
|
|
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,\"containerId\":null}]"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
RSpec.describe KeycloakAdmin::SessionRepresentation do
|
|
4
|
-
describe '.from_hash' do
|
|
5
|
-
it 'converts json response to class structure' do
|
|
6
|
-
rep = described_class.from_hash({
|
|
7
|
-
'username' => 'test_username',
|
|
8
|
-
'userId' => '95985b21-d884-4bbd-b852-cb8cd365afc2',
|
|
9
|
-
'ipAddress' => '1.1.1.1',
|
|
10
|
-
'start' => 12345678
|
|
11
|
-
})
|
|
12
|
-
expect(rep.user_id).to eq '95985b21-d884-4bbd-b852-cb8cd365afc2'
|
|
13
|
-
expect(rep).to be_a described_class
|
|
14
|
-
end
|
|
15
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe KeycloakAdmin::SessionRepresentation do
|
|
4
|
+
describe '.from_hash' do
|
|
5
|
+
it 'converts json response to class structure' do
|
|
6
|
+
rep = described_class.from_hash({
|
|
7
|
+
'username' => 'test_username',
|
|
8
|
+
'userId' => '95985b21-d884-4bbd-b852-cb8cd365afc2',
|
|
9
|
+
'ipAddress' => '1.1.1.1',
|
|
10
|
+
'start' => 12345678
|
|
11
|
+
})
|
|
12
|
+
expect(rep.user_id).to eq '95985b21-d884-4bbd-b852-cb8cd365afc2'
|
|
13
|
+
expect(rep).to be_a described_class
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
16
|
end
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
RSpec.describe KeycloakAdmin::UserRepresentation do
|
|
2
|
-
describe "#to_json" do
|
|
3
|
-
before(:each) do
|
|
4
|
-
@user = KeycloakAdmin::UserRepresentation.from_hash(
|
|
5
|
-
"username" => "test_username",
|
|
6
|
-
"createdTimestamp" => Time.at(1559836000).to_i,
|
|
7
|
-
"enabled" => true
|
|
8
|
-
)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it "can convert to json" do
|
|
12
|
-
expect(@user.to_json).to eq '{"id":null,"createdTimestamp":1559836000,"origin":null,"username":"test_username","email":null,"enabled":true,"emailVerified":null,"firstName":null,"lastName":null,"attributes":null,"requiredActions":[],"totp":false,"credentials":[],"federatedIdentities":[]}'
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
1
|
+
RSpec.describe KeycloakAdmin::UserRepresentation do
|
|
2
|
+
describe "#to_json" do
|
|
3
|
+
before(:each) do
|
|
4
|
+
@user = KeycloakAdmin::UserRepresentation.from_hash(
|
|
5
|
+
"username" => "test_username",
|
|
6
|
+
"createdTimestamp" => Time.at(1559836000).to_i,
|
|
7
|
+
"enabled" => true
|
|
8
|
+
)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "can convert to json" do
|
|
12
|
+
expect(@user.to_json).to eq '{"id":null,"createdTimestamp":1559836000,"origin":null,"username":"test_username","email":null,"enabled":true,"emailVerified":null,"firstName":null,"lastName":null,"attributes":null,"requiredActions":[],"totp":false,"credentials":[],"federatedIdentities":[]}'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
RSpec.describe KeycloakAdmin::GroupResource do
|
|
2
|
-
describe "#resource_url" do
|
|
3
|
-
let(:realm_name) { "valid-realm" }
|
|
4
|
-
let(:group_id) { "95985b21-d884-4bbd-b852-cb8cd365afc2" }
|
|
5
|
-
|
|
6
|
-
before(:each) do
|
|
7
|
-
@built_url = KeycloakAdmin.realm(realm_name).group(group_id).resource_url
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it "return a proper url" do
|
|
11
|
-
expect(@built_url).to eq "http://auth.service.io/auth/admin/realms/valid-realm/groups/95985b21-d884-4bbd-b852-cb8cd365afc2"
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
1
|
+
RSpec.describe KeycloakAdmin::GroupResource do
|
|
2
|
+
describe "#resource_url" do
|
|
3
|
+
let(:realm_name) { "valid-realm" }
|
|
4
|
+
let(:group_id) { "95985b21-d884-4bbd-b852-cb8cd365afc2" }
|
|
5
|
+
|
|
6
|
+
before(:each) do
|
|
7
|
+
@built_url = KeycloakAdmin.realm(realm_name).group(group_id).resource_url
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "return a proper url" do
|
|
11
|
+
expect(@built_url).to eq "http://auth.service.io/auth/admin/realms/valid-realm/groups/95985b21-d884-4bbd-b852-cb8cd365afc2"
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
RSpec.describe KeycloakAdmin::UserResource do
|
|
2
|
-
describe "#resource_url" do
|
|
3
|
-
let(:realm_name) { "valid-realm" }
|
|
4
|
-
let(:user_id) { "95985b21-d884-4bbd-b852-cb8cd365afc2" }
|
|
5
|
-
|
|
6
|
-
before(:each) do
|
|
7
|
-
@built_url = KeycloakAdmin.realm(realm_name).user(user_id).resource_url
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it "return a proper url" do
|
|
11
|
-
expect(@built_url).to eq "http://auth.service.io/auth/admin/realms/valid-realm/users/95985b21-d884-4bbd-b852-cb8cd365afc2"
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
1
|
+
RSpec.describe KeycloakAdmin::UserResource do
|
|
2
|
+
describe "#resource_url" do
|
|
3
|
+
let(:realm_name) { "valid-realm" }
|
|
4
|
+
let(:user_id) { "95985b21-d884-4bbd-b852-cb8cd365afc2" }
|
|
5
|
+
|
|
6
|
+
before(:each) do
|
|
7
|
+
@built_url = KeycloakAdmin.realm(realm_name).user(user_id).resource_url
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "return a proper url" do
|
|
11
|
+
expect(@built_url).to eq "http://auth.service.io/auth/admin/realms/valid-realm/users/95985b21-d884-4bbd-b852-cb8cd365afc2"
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
require_relative "../lib/keycloak-admin"
|
|
2
|
-
|
|
3
|
-
require "byebug"
|
|
4
|
-
|
|
5
|
-
def configure
|
|
6
|
-
KeycloakAdmin.configure do |config|
|
|
7
|
-
config.server_url = "http://auth.service.io/auth"
|
|
8
|
-
config.server_domain = "auth.service.io"
|
|
9
|
-
config.client_id = "admin-cli"
|
|
10
|
-
config.client_secret = "aaaaaaaa"
|
|
11
|
-
config.client_realm_name = "master2"
|
|
12
|
-
config.use_service_account = true
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
RSpec.configure do |config|
|
|
17
|
-
config.expect_with :rspec do |expectations|
|
|
18
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
configure
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def stub_token_client
|
|
25
|
-
allow_any_instance_of(KeycloakAdmin::TokenClient).to receive(:get).and_return KeycloakAdmin::TokenRepresentation.new(
|
|
26
|
-
"test_access_token", "token_type", "expires_in", "refresh_token",
|
|
27
|
-
"refresh_expires_in", "id_token", "not_before_policy", "session_state"
|
|
28
|
-
)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def stub_net_http_res(res_class, code, message)
|
|
32
|
-
net_http_res = double(message: message, code: code)
|
|
33
|
-
allow(net_http_res).to receive(:is_a?) do |target_class|
|
|
34
|
-
target_class == res_class
|
|
35
|
-
end
|
|
36
|
-
allow(@response).to receive(:net_http_res).and_return(net_http_res)
|
|
37
|
-
end
|
|
1
|
+
require_relative "../lib/keycloak-admin"
|
|
2
|
+
|
|
3
|
+
require "byebug"
|
|
4
|
+
|
|
5
|
+
def configure
|
|
6
|
+
KeycloakAdmin.configure do |config|
|
|
7
|
+
config.server_url = "http://auth.service.io/auth"
|
|
8
|
+
config.server_domain = "auth.service.io"
|
|
9
|
+
config.client_id = "admin-cli"
|
|
10
|
+
config.client_secret = "aaaaaaaa"
|
|
11
|
+
config.client_realm_name = "master2"
|
|
12
|
+
config.use_service_account = true
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
RSpec.configure do |config|
|
|
17
|
+
config.expect_with :rspec do |expectations|
|
|
18
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
configure
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def stub_token_client
|
|
25
|
+
allow_any_instance_of(KeycloakAdmin::TokenClient).to receive(:get).and_return KeycloakAdmin::TokenRepresentation.new(
|
|
26
|
+
"test_access_token", "token_type", "expires_in", "refresh_token",
|
|
27
|
+
"refresh_expires_in", "id_token", "not_before_policy", "session_state"
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def stub_net_http_res(res_class, code, message)
|
|
32
|
+
net_http_res = double(message: message, code: code)
|
|
33
|
+
allow(net_http_res).to receive(:is_a?) do |target_class|
|
|
34
|
+
target_class == res_class
|
|
35
|
+
end
|
|
36
|
+
allow(@response).to receive(:net_http_res).and_return(net_http_res)
|
|
37
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: keycloak-admin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lorent Lempereur
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-11-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: http-cookie
|
|
@@ -50,28 +50,28 @@ dependencies:
|
|
|
50
50
|
requirements:
|
|
51
51
|
- - '='
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 3.
|
|
53
|
+
version: 3.13.2
|
|
54
54
|
type: :development
|
|
55
55
|
prerelease: false
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - '='
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 3.
|
|
60
|
+
version: 3.13.2
|
|
61
61
|
- !ruby/object:Gem::Dependency
|
|
62
62
|
name: byebug
|
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - '='
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version:
|
|
67
|
+
version: 12.0.0
|
|
68
68
|
type: :development
|
|
69
69
|
prerelease: false
|
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
|
72
72
|
- - '='
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version:
|
|
74
|
+
version: 12.0.0
|
|
75
75
|
description: Keycloak Admin REST API client written in Ruby
|
|
76
76
|
email:
|
|
77
77
|
- lorent.lempereur.dev@gmail.com
|
|
@@ -175,7 +175,7 @@ homepage: https://github.com/looorent/keycloak-admin-ruby
|
|
|
175
175
|
licenses:
|
|
176
176
|
- MIT
|
|
177
177
|
metadata: {}
|
|
178
|
-
post_install_message:
|
|
178
|
+
post_install_message:
|
|
179
179
|
rdoc_options: []
|
|
180
180
|
require_paths:
|
|
181
181
|
- lib
|
|
@@ -190,8 +190,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
190
190
|
- !ruby/object:Gem::Version
|
|
191
191
|
version: '0'
|
|
192
192
|
requirements: []
|
|
193
|
-
rubygems_version: 3.
|
|
194
|
-
signing_key:
|
|
193
|
+
rubygems_version: 3.4.10
|
|
194
|
+
signing_key:
|
|
195
195
|
specification_version: 4
|
|
196
196
|
summary: Keycloak Admin REST API client written in Ruby
|
|
197
197
|
test_files: []
|