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,47 +1,47 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
RSpec.describe KeycloakAdmin::ClientAuthzPolicyRepresentation do
|
|
4
|
-
let(:realm_name) { "valid-realm" }
|
|
5
|
-
let(:client_id) { "valid-client-id" }
|
|
6
|
-
let(:policy_id) { "valid-policy-id" }
|
|
7
|
-
let(:role_id) { "valid-role-id" }
|
|
8
|
-
let(:role_name) { "valid-role-name" }
|
|
9
|
-
let(:policy_name) { "valid-policy-name" }
|
|
10
|
-
let(:policy_description) { "valid-policy-description" }
|
|
11
|
-
let(:policy_type) { "role" }
|
|
12
|
-
let(:policy_logic) { "POSITIVE" }
|
|
13
|
-
let(:policy_decision_strategy) { "UNANIMOUS" }
|
|
14
|
-
let(:policy) do
|
|
15
|
-
{
|
|
16
|
-
"id": policy_id,
|
|
17
|
-
"name": policy_name,
|
|
18
|
-
"description": policy_description,
|
|
19
|
-
"type": policy_type,
|
|
20
|
-
"logic": policy_logic,
|
|
21
|
-
"decisionStrategy": policy_decision_strategy,
|
|
22
|
-
"roles": [{ "id": role_id, "required": true }]
|
|
23
|
-
}
|
|
24
|
-
end
|
|
25
|
-
let(:client_authz_policy) { KeycloakAdmin.realm(realm_name).authz_policies(client_id, 'role') }
|
|
26
|
-
|
|
27
|
-
before(:each) do
|
|
28
|
-
stub_token_client
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
describe "#create!" do
|
|
32
|
-
before(:each) do
|
|
33
|
-
allow_any_instance_of(RestClient::Resource).to receive(:post).and_return policy.to_json
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it "returns created authz policy" do
|
|
37
|
-
response = client_authz_policy.create!(policy_name, policy_description, policy_type, policy_logic, policy_decision_strategy, true, [{ id: role_id, required: true }])
|
|
38
|
-
expect(response.id).to eq policy_id
|
|
39
|
-
expect(response.name).to eq policy_name
|
|
40
|
-
expect(response.description).to eq policy_description
|
|
41
|
-
expect(response.type).to eq policy_type
|
|
42
|
-
expect(response.logic).to eq policy_logic
|
|
43
|
-
expect(response.decision_strategy).to eq policy_decision_strategy
|
|
44
|
-
expect(response.roles).to eq [{ "id" => role_id, "required" => true }]
|
|
45
|
-
end
|
|
46
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe KeycloakAdmin::ClientAuthzPolicyRepresentation do
|
|
4
|
+
let(:realm_name) { "valid-realm" }
|
|
5
|
+
let(:client_id) { "valid-client-id" }
|
|
6
|
+
let(:policy_id) { "valid-policy-id" }
|
|
7
|
+
let(:role_id) { "valid-role-id" }
|
|
8
|
+
let(:role_name) { "valid-role-name" }
|
|
9
|
+
let(:policy_name) { "valid-policy-name" }
|
|
10
|
+
let(:policy_description) { "valid-policy-description" }
|
|
11
|
+
let(:policy_type) { "role" }
|
|
12
|
+
let(:policy_logic) { "POSITIVE" }
|
|
13
|
+
let(:policy_decision_strategy) { "UNANIMOUS" }
|
|
14
|
+
let(:policy) do
|
|
15
|
+
{
|
|
16
|
+
"id": policy_id,
|
|
17
|
+
"name": policy_name,
|
|
18
|
+
"description": policy_description,
|
|
19
|
+
"type": policy_type,
|
|
20
|
+
"logic": policy_logic,
|
|
21
|
+
"decisionStrategy": policy_decision_strategy,
|
|
22
|
+
"roles": [{ "id": role_id, "required": true }]
|
|
23
|
+
}
|
|
24
|
+
end
|
|
25
|
+
let(:client_authz_policy) { KeycloakAdmin.realm(realm_name).authz_policies(client_id, 'role') }
|
|
26
|
+
|
|
27
|
+
before(:each) do
|
|
28
|
+
stub_token_client
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe "#create!" do
|
|
32
|
+
before(:each) do
|
|
33
|
+
allow_any_instance_of(RestClient::Resource).to receive(:post).and_return policy.to_json
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "returns created authz policy" do
|
|
37
|
+
response = client_authz_policy.create!(policy_name, policy_description, policy_type, policy_logic, policy_decision_strategy, true, [{ id: role_id, required: true }])
|
|
38
|
+
expect(response.id).to eq policy_id
|
|
39
|
+
expect(response.name).to eq policy_name
|
|
40
|
+
expect(response.description).to eq policy_description
|
|
41
|
+
expect(response.type).to eq policy_type
|
|
42
|
+
expect(response.logic).to eq policy_logic
|
|
43
|
+
expect(response.decision_strategy).to eq policy_decision_strategy
|
|
44
|
+
expect(response.roles).to eq [{ "id" => role_id, "required" => true }]
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
47
|
end
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
RSpec.describe KeycloakAdmin::ClientAuthzResourceRepresentation do
|
|
2
|
-
describe '.from_hash' do
|
|
3
|
-
it 'converts json response to class structure' do
|
|
4
|
-
rep = described_class.from_hash({
|
|
5
|
-
"name" => "Default Resource",
|
|
6
|
-
"type" => "urn:delme-client-id:resources:default",
|
|
7
|
-
"owner" => {
|
|
8
|
-
"id" => "d259b451-371b-432a-a526-3508f3a36f3b",
|
|
9
|
-
"name" => "delme-client-id"
|
|
10
|
-
},
|
|
11
|
-
"ownerManagedAccess" => true,
|
|
12
|
-
"displayName" => "Display Name",
|
|
13
|
-
"attributes" => { "a" => ["b"]},
|
|
14
|
-
"_id" => "385966a2-14b9-4cc4-9539-5f2fe1008222",
|
|
15
|
-
"uris" => ["/*"],
|
|
16
|
-
"scopes" => [{"id"=>"c0779ce3-0900-4ea3-b1d6-b23e1f19c662",
|
|
17
|
-
"name" => "GET",
|
|
18
|
-
"iconUri" => "http=>//asdfasdf"}],
|
|
19
|
-
"icon_uri" => "http://icon"
|
|
20
|
-
})
|
|
21
|
-
expect(rep.id).to eq "385966a2-14b9-4cc4-9539-5f2fe1008222"
|
|
22
|
-
expect(rep.name).to eq "Default Resource"
|
|
23
|
-
expect(rep.type).to eq "urn:delme-client-id:resources:default"
|
|
24
|
-
expect(rep.uris).to eq ["/*"]
|
|
25
|
-
expect(rep.owner_managed_access).to eq true
|
|
26
|
-
expect(rep.attributes).to eq({ :"a" => ["b"]})
|
|
27
|
-
expect(rep.display_name).to eq "Display Name"
|
|
28
|
-
expect(rep.scopes[0].id).to eq "c0779ce3-0900-4ea3-b1d6-b23e1f19c662"
|
|
29
|
-
expect(rep.scopes[0].name).to eq "GET"
|
|
30
|
-
expect(rep).to be_a described_class
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
1
|
+
RSpec.describe KeycloakAdmin::ClientAuthzResourceRepresentation do
|
|
2
|
+
describe '.from_hash' do
|
|
3
|
+
it 'converts json response to class structure' do
|
|
4
|
+
rep = described_class.from_hash({
|
|
5
|
+
"name" => "Default Resource",
|
|
6
|
+
"type" => "urn:delme-client-id:resources:default",
|
|
7
|
+
"owner" => {
|
|
8
|
+
"id" => "d259b451-371b-432a-a526-3508f3a36f3b",
|
|
9
|
+
"name" => "delme-client-id"
|
|
10
|
+
},
|
|
11
|
+
"ownerManagedAccess" => true,
|
|
12
|
+
"displayName" => "Display Name",
|
|
13
|
+
"attributes" => { "a" => ["b"]},
|
|
14
|
+
"_id" => "385966a2-14b9-4cc4-9539-5f2fe1008222",
|
|
15
|
+
"uris" => ["/*"],
|
|
16
|
+
"scopes" => [{"id"=>"c0779ce3-0900-4ea3-b1d6-b23e1f19c662",
|
|
17
|
+
"name" => "GET",
|
|
18
|
+
"iconUri" => "http=>//asdfasdf"}],
|
|
19
|
+
"icon_uri" => "http://icon"
|
|
20
|
+
})
|
|
21
|
+
expect(rep.id).to eq "385966a2-14b9-4cc4-9539-5f2fe1008222"
|
|
22
|
+
expect(rep.name).to eq "Default Resource"
|
|
23
|
+
expect(rep.type).to eq "urn:delme-client-id:resources:default"
|
|
24
|
+
expect(rep.uris).to eq ["/*"]
|
|
25
|
+
expect(rep.owner_managed_access).to eq true
|
|
26
|
+
expect(rep.attributes).to eq({ :"a" => ["b"]})
|
|
27
|
+
expect(rep.display_name).to eq "Display Name"
|
|
28
|
+
expect(rep.scopes[0].id).to eq "c0779ce3-0900-4ea3-b1d6-b23e1f19c662"
|
|
29
|
+
expect(rep.scopes[0].name).to eq "GET"
|
|
30
|
+
expect(rep).to be_a described_class
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
RSpec.describe KeycloakAdmin::ClientAuthzScopeRepresentation do
|
|
4
|
-
describe '.from_hash' do
|
|
5
|
-
it 'converts json response to class structure' do
|
|
6
|
-
rep = described_class.from_hash({
|
|
7
|
-
"id" =>"c0779ce3-0900-4ea3-b1d6-b23e1f19c662",
|
|
8
|
-
"name" => "GET",
|
|
9
|
-
"iconUri" => "http://asdfasdf/image.png",
|
|
10
|
-
"displayName" => "GET authz scope"
|
|
11
|
-
})
|
|
12
|
-
expect(rep.id).to eq "c0779ce3-0900-4ea3-b1d6-b23e1f19c662"
|
|
13
|
-
expect(rep.name).to eq "GET"
|
|
14
|
-
expect(rep.icon_uri).to eq "http://asdfasdf/image.png"
|
|
15
|
-
expect(rep.display_name).to eq "GET authz scope"
|
|
16
|
-
expect(rep).to be_a described_class
|
|
17
|
-
end
|
|
18
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe KeycloakAdmin::ClientAuthzScopeRepresentation do
|
|
4
|
+
describe '.from_hash' do
|
|
5
|
+
it 'converts json response to class structure' do
|
|
6
|
+
rep = described_class.from_hash({
|
|
7
|
+
"id" =>"c0779ce3-0900-4ea3-b1d6-b23e1f19c662",
|
|
8
|
+
"name" => "GET",
|
|
9
|
+
"iconUri" => "http://asdfasdf/image.png",
|
|
10
|
+
"displayName" => "GET authz scope"
|
|
11
|
+
})
|
|
12
|
+
expect(rep.id).to eq "c0779ce3-0900-4ea3-b1d6-b23e1f19c662"
|
|
13
|
+
expect(rep.name).to eq "GET"
|
|
14
|
+
expect(rep.icon_uri).to eq "http://asdfasdf/image.png"
|
|
15
|
+
expect(rep.display_name).to eq "GET authz scope"
|
|
16
|
+
expect(rep).to be_a described_class
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
19
|
end
|
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
RSpec.describe KeycloakAdmin::ClientRepresentation do
|
|
2
|
-
describe "#to_json" do
|
|
3
|
-
before(:each) do
|
|
4
|
-
@client = KeycloakAdmin::ClientRepresentation.from_hash(
|
|
5
|
-
{
|
|
6
|
-
"id" => "c9104bc7-04d8-4348-b4df-8d883f9f6095",
|
|
7
|
-
"clientId" => "clien-test",
|
|
8
|
-
"name" => "Client TEST",
|
|
9
|
-
"description" => "Test to parse a client repsentation",
|
|
10
|
-
"surrogateAuthRequired" => false,
|
|
11
|
-
"enabled" => true,
|
|
12
|
-
"alwaysDisplayInConsole" => false,
|
|
13
|
-
"clientAuthenticatorType" => "client-secret",
|
|
14
|
-
"redirectUris" => [],
|
|
15
|
-
"webOrigins" => [],
|
|
16
|
-
"notBefore" => 0,
|
|
17
|
-
"bearerOnly" => false,
|
|
18
|
-
"consentRequired" => false,
|
|
19
|
-
"standardFlowEnabled" => false,
|
|
20
|
-
"implicitFlowEnabled" => false,
|
|
21
|
-
"directAccessGrantsEnabled" => false,
|
|
22
|
-
"serviceAccountsEnabled" => true,
|
|
23
|
-
"publicClient" => false,
|
|
24
|
-
"frontchannelLogout" => false,
|
|
25
|
-
"protocol" => "openid-connect",
|
|
26
|
-
"attributes" => {
|
|
27
|
-
"saml.assertion.signature" => "false",
|
|
28
|
-
"access.token.lifespan" => "86400",
|
|
29
|
-
"saml.multivalued.roles" => "false",
|
|
30
|
-
"saml.force.post.binding" => "false",
|
|
31
|
-
"saml.encrypt" => "false",
|
|
32
|
-
"saml.server.signature" => "false",
|
|
33
|
-
"backchannel.logout.revoke.offline.tokens" => "false",
|
|
34
|
-
"saml.server.signature.keyinfo.ext" => "false",
|
|
35
|
-
"exclude.session.state.from.auth.response" => "false",
|
|
36
|
-
"backchannel.logout.session.required" => "true",
|
|
37
|
-
"saml_force_name_id_format" => "false",
|
|
38
|
-
"saml.client.signature" => "false",
|
|
39
|
-
"tls.client.certificate.bound.access.tokens" => "false",
|
|
40
|
-
"saml.authnstatement" => "false",
|
|
41
|
-
"display.on.consent.screen" => "false",
|
|
42
|
-
"saml.onetimeuse.condition" => "false"
|
|
43
|
-
},
|
|
44
|
-
"authenticationFlowBindingOverrides" => {},
|
|
45
|
-
"fullScopeAllowed" => true,
|
|
46
|
-
"nodeReRegistrationTimeout" => -1,
|
|
47
|
-
"protocolMappers" => [
|
|
48
|
-
{
|
|
49
|
-
"id" => "2220432a-e953-422c-b176-62b65e085fe5",
|
|
50
|
-
"name" => "Client Host",
|
|
51
|
-
"protocol" => "openid-connect",
|
|
52
|
-
"protocolMapper" => "oidc-usersessionmodel-note-mapper",
|
|
53
|
-
"consentRequired" => false,
|
|
54
|
-
"config" => {
|
|
55
|
-
"user.session.note" => "clientHost",
|
|
56
|
-
"userinfo.token.claim" => "true",
|
|
57
|
-
"id.token.claim" => "true",
|
|
58
|
-
"access.token.claim" => "true",
|
|
59
|
-
"claim.name" => "clientHost",
|
|
60
|
-
"jsonType.label" => "String"
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"id" => "5509e428-574d-4137-b396-9108244f31ee",
|
|
65
|
-
"name" => "Client IP Address",
|
|
66
|
-
"protocol" => "openid-connect",
|
|
67
|
-
"protocolMapper" => "oidc-usersessionmodel-note-mapper",
|
|
68
|
-
"consentRequired" => false,
|
|
69
|
-
"config" => {
|
|
70
|
-
"user.session.note" => "clientAddress",
|
|
71
|
-
"userinfo.token.claim" => "true",
|
|
72
|
-
"id.token.claim" => "true",
|
|
73
|
-
"access.token.claim" => "true",
|
|
74
|
-
"claim.name" => "clientAddress",
|
|
75
|
-
"jsonType.label" => "String"
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"id" => "44504b93-dbce-48b8-9570-9a48d5421ae9",
|
|
80
|
-
"name" => "Client ID",
|
|
81
|
-
"protocol" => "openid-connect",
|
|
82
|
-
"protocolMapper" => "oidc-usersessionmodel-note-mapper",
|
|
83
|
-
"consentRequired" => false,
|
|
84
|
-
"config" => {
|
|
85
|
-
"user.session.note" => "clientId",
|
|
86
|
-
"userinfo.token.claim" => "true",
|
|
87
|
-
"id.token.claim" => "true",
|
|
88
|
-
"access.token.claim" => "true",
|
|
89
|
-
"claim.name" => "clientId",
|
|
90
|
-
"jsonType.label" => "String"
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
],
|
|
94
|
-
"defaultClientScopes" => [
|
|
95
|
-
"web-origins",
|
|
96
|
-
"roles",
|
|
97
|
-
"profile",
|
|
98
|
-
"email"
|
|
99
|
-
],
|
|
100
|
-
"optionalClientScopes" => [
|
|
101
|
-
"address",
|
|
102
|
-
"phone",
|
|
103
|
-
"offline_access",
|
|
104
|
-
"microprofile-jwt"
|
|
105
|
-
],
|
|
106
|
-
"access" => {
|
|
107
|
-
"view" => true,
|
|
108
|
-
"configure" => true,
|
|
109
|
-
"manage" => true
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
)
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
it "can convert to json" do
|
|
116
|
-
expect(@client.to_json).to eq "{\"id\":\"c9104bc7-04d8-4348-b4df-8d883f9f6095\",\"name\":\"Client TEST\",\"clientId\":\"clien-test\",\"description\":\"Test to parse a client repsentation\",\"clientAuthenticatorType\":\"client-secret\",\"alwaysDisplayInConsole\":false,\"surrogateAuthRequired\":false,\"redirectUris\":[],\"webOrigins\":[],\"notBefore\":0,\"bearerOnly\":false,\"consentRequired\":false,\"standardFlowEnabled\":false,\"implicitFlowEnabled\":false,\"directAccessGrantsEnabled\":false,\"serviceAccountsEnabled\":true,\"authorizationServicesEnabled\":false,\"publicClient\":false,\"frontchannelLogout\":false,\"protocol\":\"openid-connect\",\"baseUrl\":null,\"rootUrl\":null,\"attributes\":{\"saml.assertion.signature\":\"false\",\"access.token.lifespan\":\"86400\",\"saml.multivalued.roles\":\"false\",\"saml.force.post.binding\":\"false\",\"saml.encrypt\":\"false\",\"saml.server.signature\":\"false\",\"backchannel.logout.revoke.offline.tokens\":\"false\",\"saml.server.signature.keyinfo.ext\":\"false\",\"exclude.session.state.from.auth.response\":\"false\",\"backchannel.logout.session.required\":\"true\",\"saml_force_name_id_format\":\"false\",\"saml.client.signature\":\"false\",\"tls.client.certificate.bound.access.tokens\":\"false\",\"saml.authnstatement\":\"false\",\"display.on.consent.screen\":\"false\",\"saml.onetimeuse.condition\":\"false\"},\"authenticationFlowBindingOverrides\":{},\"fullScopeAllowed\":true,\"nodeReRegistrationTimeout\":-1,\"protocolMappers\":[{\"id\":\"2220432a-e953-422c-b176-62b65e085fe5\",\"config\":{\"user.session.note\":\"clientHost\",\"userinfo.token.claim\":\"true\",\"id.token.claim\":\"true\",\"access.token.claim\":\"true\",\"claim.name\":\"clientHost\",\"jsonType.label\":\"String\"},\"name\":\"Client Host\",\"protocol\":\"openid-connect\",\"protocolMapper\":\"oidc-usersessionmodel-note-mapper\"},{\"id\":\"5509e428-574d-4137-b396-9108244f31ee\",\"config\":{\"user.session.note\":\"clientAddress\",\"userinfo.token.claim\":\"true\",\"id.token.claim\":\"true\",\"access.token.claim\":\"true\",\"claim.name\":\"clientAddress\",\"jsonType.label\":\"String\"},\"name\":\"Client IP Address\",\"protocol\":\"openid-connect\",\"protocolMapper\":\"oidc-usersessionmodel-note-mapper\"},{\"id\":\"44504b93-dbce-48b8-9570-9a48d5421ae9\",\"config\":{\"user.session.note\":\"clientId\",\"userinfo.token.claim\":\"true\",\"id.token.claim\":\"true\",\"access.token.claim\":\"true\",\"claim.name\":\"clientId\",\"jsonType.label\":\"String\"},\"name\":\"Client ID\",\"protocol\":\"openid-connect\",\"protocolMapper\":\"oidc-usersessionmodel-note-mapper\"}],\"defaultClientScopes\":[\"web-origins\",\"roles\",\"profile\",\"email\"],\"optionalClientScopes\":[\"address\",\"phone\",\"offline_access\",\"microprofile-jwt\"],\"access\":{\"view\":true,\"configure\":true,\"manage\":true}}"
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
end
|
|
1
|
+
RSpec.describe KeycloakAdmin::ClientRepresentation do
|
|
2
|
+
describe "#to_json" do
|
|
3
|
+
before(:each) do
|
|
4
|
+
@client = KeycloakAdmin::ClientRepresentation.from_hash(
|
|
5
|
+
{
|
|
6
|
+
"id" => "c9104bc7-04d8-4348-b4df-8d883f9f6095",
|
|
7
|
+
"clientId" => "clien-test",
|
|
8
|
+
"name" => "Client TEST",
|
|
9
|
+
"description" => "Test to parse a client repsentation",
|
|
10
|
+
"surrogateAuthRequired" => false,
|
|
11
|
+
"enabled" => true,
|
|
12
|
+
"alwaysDisplayInConsole" => false,
|
|
13
|
+
"clientAuthenticatorType" => "client-secret",
|
|
14
|
+
"redirectUris" => [],
|
|
15
|
+
"webOrigins" => [],
|
|
16
|
+
"notBefore" => 0,
|
|
17
|
+
"bearerOnly" => false,
|
|
18
|
+
"consentRequired" => false,
|
|
19
|
+
"standardFlowEnabled" => false,
|
|
20
|
+
"implicitFlowEnabled" => false,
|
|
21
|
+
"directAccessGrantsEnabled" => false,
|
|
22
|
+
"serviceAccountsEnabled" => true,
|
|
23
|
+
"publicClient" => false,
|
|
24
|
+
"frontchannelLogout" => false,
|
|
25
|
+
"protocol" => "openid-connect",
|
|
26
|
+
"attributes" => {
|
|
27
|
+
"saml.assertion.signature" => "false",
|
|
28
|
+
"access.token.lifespan" => "86400",
|
|
29
|
+
"saml.multivalued.roles" => "false",
|
|
30
|
+
"saml.force.post.binding" => "false",
|
|
31
|
+
"saml.encrypt" => "false",
|
|
32
|
+
"saml.server.signature" => "false",
|
|
33
|
+
"backchannel.logout.revoke.offline.tokens" => "false",
|
|
34
|
+
"saml.server.signature.keyinfo.ext" => "false",
|
|
35
|
+
"exclude.session.state.from.auth.response" => "false",
|
|
36
|
+
"backchannel.logout.session.required" => "true",
|
|
37
|
+
"saml_force_name_id_format" => "false",
|
|
38
|
+
"saml.client.signature" => "false",
|
|
39
|
+
"tls.client.certificate.bound.access.tokens" => "false",
|
|
40
|
+
"saml.authnstatement" => "false",
|
|
41
|
+
"display.on.consent.screen" => "false",
|
|
42
|
+
"saml.onetimeuse.condition" => "false"
|
|
43
|
+
},
|
|
44
|
+
"authenticationFlowBindingOverrides" => {},
|
|
45
|
+
"fullScopeAllowed" => true,
|
|
46
|
+
"nodeReRegistrationTimeout" => -1,
|
|
47
|
+
"protocolMappers" => [
|
|
48
|
+
{
|
|
49
|
+
"id" => "2220432a-e953-422c-b176-62b65e085fe5",
|
|
50
|
+
"name" => "Client Host",
|
|
51
|
+
"protocol" => "openid-connect",
|
|
52
|
+
"protocolMapper" => "oidc-usersessionmodel-note-mapper",
|
|
53
|
+
"consentRequired" => false,
|
|
54
|
+
"config" => {
|
|
55
|
+
"user.session.note" => "clientHost",
|
|
56
|
+
"userinfo.token.claim" => "true",
|
|
57
|
+
"id.token.claim" => "true",
|
|
58
|
+
"access.token.claim" => "true",
|
|
59
|
+
"claim.name" => "clientHost",
|
|
60
|
+
"jsonType.label" => "String"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"id" => "5509e428-574d-4137-b396-9108244f31ee",
|
|
65
|
+
"name" => "Client IP Address",
|
|
66
|
+
"protocol" => "openid-connect",
|
|
67
|
+
"protocolMapper" => "oidc-usersessionmodel-note-mapper",
|
|
68
|
+
"consentRequired" => false,
|
|
69
|
+
"config" => {
|
|
70
|
+
"user.session.note" => "clientAddress",
|
|
71
|
+
"userinfo.token.claim" => "true",
|
|
72
|
+
"id.token.claim" => "true",
|
|
73
|
+
"access.token.claim" => "true",
|
|
74
|
+
"claim.name" => "clientAddress",
|
|
75
|
+
"jsonType.label" => "String"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"id" => "44504b93-dbce-48b8-9570-9a48d5421ae9",
|
|
80
|
+
"name" => "Client ID",
|
|
81
|
+
"protocol" => "openid-connect",
|
|
82
|
+
"protocolMapper" => "oidc-usersessionmodel-note-mapper",
|
|
83
|
+
"consentRequired" => false,
|
|
84
|
+
"config" => {
|
|
85
|
+
"user.session.note" => "clientId",
|
|
86
|
+
"userinfo.token.claim" => "true",
|
|
87
|
+
"id.token.claim" => "true",
|
|
88
|
+
"access.token.claim" => "true",
|
|
89
|
+
"claim.name" => "clientId",
|
|
90
|
+
"jsonType.label" => "String"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
"defaultClientScopes" => [
|
|
95
|
+
"web-origins",
|
|
96
|
+
"roles",
|
|
97
|
+
"profile",
|
|
98
|
+
"email"
|
|
99
|
+
],
|
|
100
|
+
"optionalClientScopes" => [
|
|
101
|
+
"address",
|
|
102
|
+
"phone",
|
|
103
|
+
"offline_access",
|
|
104
|
+
"microprofile-jwt"
|
|
105
|
+
],
|
|
106
|
+
"access" => {
|
|
107
|
+
"view" => true,
|
|
108
|
+
"configure" => true,
|
|
109
|
+
"manage" => true
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
it "can convert to json" do
|
|
116
|
+
expect(@client.to_json).to eq "{\"id\":\"c9104bc7-04d8-4348-b4df-8d883f9f6095\",\"name\":\"Client TEST\",\"clientId\":\"clien-test\",\"description\":\"Test to parse a client repsentation\",\"clientAuthenticatorType\":\"client-secret\",\"alwaysDisplayInConsole\":false,\"surrogateAuthRequired\":false,\"redirectUris\":[],\"webOrigins\":[],\"notBefore\":0,\"bearerOnly\":false,\"consentRequired\":false,\"standardFlowEnabled\":false,\"implicitFlowEnabled\":false,\"directAccessGrantsEnabled\":false,\"serviceAccountsEnabled\":true,\"authorizationServicesEnabled\":false,\"publicClient\":false,\"frontchannelLogout\":false,\"protocol\":\"openid-connect\",\"baseUrl\":null,\"rootUrl\":null,\"attributes\":{\"saml.assertion.signature\":\"false\",\"access.token.lifespan\":\"86400\",\"saml.multivalued.roles\":\"false\",\"saml.force.post.binding\":\"false\",\"saml.encrypt\":\"false\",\"saml.server.signature\":\"false\",\"backchannel.logout.revoke.offline.tokens\":\"false\",\"saml.server.signature.keyinfo.ext\":\"false\",\"exclude.session.state.from.auth.response\":\"false\",\"backchannel.logout.session.required\":\"true\",\"saml_force_name_id_format\":\"false\",\"saml.client.signature\":\"false\",\"tls.client.certificate.bound.access.tokens\":\"false\",\"saml.authnstatement\":\"false\",\"display.on.consent.screen\":\"false\",\"saml.onetimeuse.condition\":\"false\"},\"authenticationFlowBindingOverrides\":{},\"fullScopeAllowed\":true,\"nodeReRegistrationTimeout\":-1,\"protocolMappers\":[{\"id\":\"2220432a-e953-422c-b176-62b65e085fe5\",\"config\":{\"user.session.note\":\"clientHost\",\"userinfo.token.claim\":\"true\",\"id.token.claim\":\"true\",\"access.token.claim\":\"true\",\"claim.name\":\"clientHost\",\"jsonType.label\":\"String\"},\"name\":\"Client Host\",\"protocol\":\"openid-connect\",\"protocolMapper\":\"oidc-usersessionmodel-note-mapper\"},{\"id\":\"5509e428-574d-4137-b396-9108244f31ee\",\"config\":{\"user.session.note\":\"clientAddress\",\"userinfo.token.claim\":\"true\",\"id.token.claim\":\"true\",\"access.token.claim\":\"true\",\"claim.name\":\"clientAddress\",\"jsonType.label\":\"String\"},\"name\":\"Client IP Address\",\"protocol\":\"openid-connect\",\"protocolMapper\":\"oidc-usersessionmodel-note-mapper\"},{\"id\":\"44504b93-dbce-48b8-9570-9a48d5421ae9\",\"config\":{\"user.session.note\":\"clientId\",\"userinfo.token.claim\":\"true\",\"id.token.claim\":\"true\",\"access.token.claim\":\"true\",\"claim.name\":\"clientId\",\"jsonType.label\":\"String\"},\"name\":\"Client ID\",\"protocol\":\"openid-connect\",\"protocolMapper\":\"oidc-usersessionmodel-note-mapper\"}],\"defaultClientScopes\":[\"web-origins\",\"roles\",\"profile\",\"email\"],\"optionalClientScopes\":[\"address\",\"phone\",\"offline_access\",\"microprofile-jwt\"],\"access\":{\"view\":true,\"configure\":true,\"manage\":true}}"
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
RSpec.describe KeycloakAdmin::GroupRepresentation do
|
|
3
|
-
describe ".from_hash" do
|
|
4
|
-
it "parses the sub groups into group representations" do
|
|
5
|
-
group = described_class.from_hash({
|
|
6
|
-
"name" => "group a",
|
|
7
|
-
"attributes" => {
|
|
8
|
-
"key" => ["value"]
|
|
9
|
-
},
|
|
10
|
-
"subGroupCount" => 1,
|
|
11
|
-
"subGroups" => [{
|
|
12
|
-
"name" => "subgroup b"
|
|
13
|
-
}]
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
expect(group.attributes).to eq(key: ["value"])
|
|
17
|
-
expect(group.sub_group_count).to eq 1
|
|
18
|
-
expect(group.sub_groups.length).to eq 1
|
|
19
|
-
expect(group.sub_groups.first).to be_a described_class
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
1
|
+
|
|
2
|
+
RSpec.describe KeycloakAdmin::GroupRepresentation do
|
|
3
|
+
describe ".from_hash" do
|
|
4
|
+
it "parses the sub groups into group representations" do
|
|
5
|
+
group = described_class.from_hash({
|
|
6
|
+
"name" => "group a",
|
|
7
|
+
"attributes" => {
|
|
8
|
+
"key" => ["value"]
|
|
9
|
+
},
|
|
10
|
+
"subGroupCount" => 1,
|
|
11
|
+
"subGroups" => [{
|
|
12
|
+
"name" => "subgroup b"
|
|
13
|
+
}]
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
expect(group.attributes).to eq(key: ["value"])
|
|
17
|
+
expect(group.sub_group_count).to eq 1
|
|
18
|
+
expect(group.sub_groups.length).to eq 1
|
|
19
|
+
expect(group.sub_groups.first).to be_a described_class
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
RSpec.describe KeycloakAdmin::IdentityProviderMapperRepresentation do
|
|
2
|
-
describe "#to_json" do
|
|
3
|
-
before(:each) do
|
|
4
|
-
@mapper = KeycloakAdmin::IdentityProviderMapperRepresentation.from_hash(
|
|
5
|
-
{
|
|
6
|
-
"id" => "91895ce9-b225-4274-993e-c8e6b8e490f0",
|
|
7
|
-
"name" => "IDP",
|
|
8
|
-
"identityProviderAlias" => "test",
|
|
9
|
-
"identityProviderMapper" => "hardcoded-attribute-idp-mapper",
|
|
10
|
-
"config" => {
|
|
11
|
-
"syncMode" => "INHERIT",
|
|
12
|
-
"attribute.value" => "test",
|
|
13
|
-
"attributes" => "[]",
|
|
14
|
-
"attribute" => "keycloak.idp"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "can convert to json" do
|
|
21
|
-
expect(@mapper.to_json).to eq "{\"id\":\"91895ce9-b225-4274-993e-c8e6b8e490f0\",\"name\":\"IDP\",\"identityProviderAlias\":\"test\",\"identityProviderMapper\":\"hardcoded-attribute-idp-mapper\",\"config\":{\"syncMode\":\"INHERIT\",\"attribute.value\":\"test\",\"attributes\":\"[]\",\"attribute\":\"keycloak.idp\"}}"
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
1
|
+
RSpec.describe KeycloakAdmin::IdentityProviderMapperRepresentation do
|
|
2
|
+
describe "#to_json" do
|
|
3
|
+
before(:each) do
|
|
4
|
+
@mapper = KeycloakAdmin::IdentityProviderMapperRepresentation.from_hash(
|
|
5
|
+
{
|
|
6
|
+
"id" => "91895ce9-b225-4274-993e-c8e6b8e490f0",
|
|
7
|
+
"name" => "IDP",
|
|
8
|
+
"identityProviderAlias" => "test",
|
|
9
|
+
"identityProviderMapper" => "hardcoded-attribute-idp-mapper",
|
|
10
|
+
"config" => {
|
|
11
|
+
"syncMode" => "INHERIT",
|
|
12
|
+
"attribute.value" => "test",
|
|
13
|
+
"attributes" => "[]",
|
|
14
|
+
"attribute" => "keycloak.idp"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "can convert to json" do
|
|
21
|
+
expect(@mapper.to_json).to eq "{\"id\":\"91895ce9-b225-4274-993e-c8e6b8e490f0\",\"name\":\"IDP\",\"identityProviderAlias\":\"test\",\"identityProviderMapper\":\"hardcoded-attribute-idp-mapper\",\"config\":{\"syncMode\":\"INHERIT\",\"attribute.value\":\"test\",\"attributes\":\"[]\",\"attribute\":\"keycloak.idp\"}}"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|