keycloak-admin 1.1.4 → 1.1.6
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 -80
- data/.gitignore +9 -9
- data/.rspec +2 -2
- data/CHANGELOG.md +23 -0
- data/Dockerfile +12 -12
- data/Gemfile +3 -3
- data/Gemfile.lock +1 -1
- data/MIT-LICENSE +20 -20
- data/README.md +20 -1
- 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 -148
- data/lib/keycloak-admin/client/identity_provider_client.rb +51 -51
- data/lib/keycloak-admin/client/organization_client.rb +245 -0
- data/lib/keycloak-admin/client/realm_client.rb +126 -122
- data/lib/keycloak-admin/client/role_client.rb +59 -59
- data/lib/keycloak-admin/client/role_mapper_client.rb +47 -47
- data/lib/keycloak-admin/client/token_client.rb +29 -29
- data/lib/keycloak-admin/client/user_client.rb +278 -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 +71 -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 +71 -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/member_representation.rb +11 -0
- data/lib/keycloak-admin/representation/organization_domain_representation.rb +18 -0
- data/lib/keycloak-admin/representation/organization_representation.rb +30 -0
- 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 +88 -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 -328
- data/spec/client/identity_provider_client_spec.rb +92 -92
- data/spec/client/organization_client_spec.rb +595 -0
- 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 -113
- data/spec/client/token_client_spec.rb +68 -68
- data/spec/client/user_client_spec.rb +418 -373
- data/spec/configuration_spec.rb +113 -113
- data/spec/integration/client_authorization_spec.rb +93 -93
- 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/credential_representation_spec.rb +68 -0
- 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/organization_representation_spec.rb +64 -0
- 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 +13 -6
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
RSpec.describe KeycloakAdmin::IdentityProviderClient do
|
|
2
|
-
describe "#identity_providers_url" do
|
|
3
|
-
let(:realm_name) { "valid-realm" }
|
|
4
|
-
let(:provider_id) { nil }
|
|
5
|
-
|
|
6
|
-
before(:each) do
|
|
7
|
-
@built_url = KeycloakAdmin.realm(realm_name).identity_providers.identity_providers_url(provider_id)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
context "when provider_id is not defined" do
|
|
11
|
-
let(:provider_id) { nil }
|
|
12
|
-
it "returns a proper url without provider id" do
|
|
13
|
-
expect(@built_url).to eq "http://auth.service.io/auth/admin/realms/valid-realm/identity-provider/instances"
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
context "when provider_id is defined" do
|
|
18
|
-
let(:provider_id) { "95985b21-d884-4bbd-b852-cb8cd365afc2" }
|
|
19
|
-
it "returns a proper url with the provider id" do
|
|
20
|
-
expect(@built_url).to eq "http://auth.service.io/auth/admin/realms/valid-realm/identity-provider/instances/95985b21-d884-4bbd-b852-cb8cd365afc2"
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe "#list" do
|
|
26
|
-
let(:realm_name) { "valid-realm" }
|
|
27
|
-
let(:json_response) do
|
|
28
|
-
<<-JSON
|
|
29
|
-
[
|
|
30
|
-
{
|
|
31
|
-
"alias": "acme",
|
|
32
|
-
"displayName": "ACME",
|
|
33
|
-
"internalId": "20fea77e-ae3d-411e-9467-2b3a20cd3e6d",
|
|
34
|
-
"providerId": "saml",
|
|
35
|
-
"enabled": true,
|
|
36
|
-
"updateProfileFirstLoginMode": "on",
|
|
37
|
-
"trustEmail": true,
|
|
38
|
-
"storeToken": false,
|
|
39
|
-
"addReadTokenRoleOnCreate": false,
|
|
40
|
-
"authenticateByDefault": false,
|
|
41
|
-
"linkOnly": false,
|
|
42
|
-
"firstBrokerLoginFlowAlias": "first broker login",
|
|
43
|
-
"config": {
|
|
44
|
-
"hideOnLoginPage": "",
|
|
45
|
-
"validateSignature": "true",
|
|
46
|
-
"samlXmlKeyNameTranformer": "KEY_ID",
|
|
47
|
-
"signingCertificate": "",
|
|
48
|
-
"postBindingLogout": "false",
|
|
49
|
-
"nameIDPolicyFormat": "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent",
|
|
50
|
-
"postBindingResponse": "true",
|
|
51
|
-
"backchannelSupported": "",
|
|
52
|
-
"signatureAlgorithm": "RSA_SHA256",
|
|
53
|
-
"wantAssertionsEncrypted": "false",
|
|
54
|
-
"xmlSigKeyInfoKeyNameTransformer": "CERT_SUBJECT",
|
|
55
|
-
"useJwksUrl": "true",
|
|
56
|
-
"wantAssertionsSigned": "true",
|
|
57
|
-
"postBindingAuthnRequest": "true",
|
|
58
|
-
"forceAuthn": "",
|
|
59
|
-
"wantAuthnRequestsSigned": "true",
|
|
60
|
-
"singleSignOnServiceUrl": "https://login.microsoftonline.com/test/saml2",
|
|
61
|
-
"addExtensionsElementWithKeyInfo": "false"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
JSON
|
|
66
|
-
end
|
|
67
|
-
before(:each) do
|
|
68
|
-
@identity_provider_client = KeycloakAdmin.realm(realm_name).identity_providers
|
|
69
|
-
|
|
70
|
-
stub_token_client
|
|
71
|
-
allow_any_instance_of(RestClient::Resource).to receive(:get).and_return json_response
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
it "lists identity providers" do
|
|
75
|
-
identity_providers = @identity_provider_client.list
|
|
76
|
-
expect(identity_providers.length).to eq 1
|
|
77
|
-
expect(identity_providers[0].alias).to eq "acme"
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it "passes rest client options" do
|
|
81
|
-
rest_client_options = {timeout: 10}
|
|
82
|
-
allow_any_instance_of(KeycloakAdmin::Configuration).to receive(:rest_client_options).and_return rest_client_options
|
|
83
|
-
|
|
84
|
-
expect(RestClient::Resource).to receive(:new).with(
|
|
85
|
-
"http://auth.service.io/auth/admin/realms/valid-realm/identity-provider/instances", rest_client_options).and_call_original
|
|
86
|
-
|
|
87
|
-
identity_providers = @identity_provider_client.list
|
|
88
|
-
expect(identity_providers.length).to eq 1
|
|
89
|
-
expect(identity_providers[0].alias).to eq "acme"
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
end
|
|
1
|
+
RSpec.describe KeycloakAdmin::IdentityProviderClient do
|
|
2
|
+
describe "#identity_providers_url" do
|
|
3
|
+
let(:realm_name) { "valid-realm" }
|
|
4
|
+
let(:provider_id) { nil }
|
|
5
|
+
|
|
6
|
+
before(:each) do
|
|
7
|
+
@built_url = KeycloakAdmin.realm(realm_name).identity_providers.identity_providers_url(provider_id)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
context "when provider_id is not defined" do
|
|
11
|
+
let(:provider_id) { nil }
|
|
12
|
+
it "returns a proper url without provider id" do
|
|
13
|
+
expect(@built_url).to eq "http://auth.service.io/auth/admin/realms/valid-realm/identity-provider/instances"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
context "when provider_id is defined" do
|
|
18
|
+
let(:provider_id) { "95985b21-d884-4bbd-b852-cb8cd365afc2" }
|
|
19
|
+
it "returns a proper url with the provider id" do
|
|
20
|
+
expect(@built_url).to eq "http://auth.service.io/auth/admin/realms/valid-realm/identity-provider/instances/95985b21-d884-4bbd-b852-cb8cd365afc2"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
describe "#list" do
|
|
26
|
+
let(:realm_name) { "valid-realm" }
|
|
27
|
+
let(:json_response) do
|
|
28
|
+
<<-JSON
|
|
29
|
+
[
|
|
30
|
+
{
|
|
31
|
+
"alias": "acme",
|
|
32
|
+
"displayName": "ACME",
|
|
33
|
+
"internalId": "20fea77e-ae3d-411e-9467-2b3a20cd3e6d",
|
|
34
|
+
"providerId": "saml",
|
|
35
|
+
"enabled": true,
|
|
36
|
+
"updateProfileFirstLoginMode": "on",
|
|
37
|
+
"trustEmail": true,
|
|
38
|
+
"storeToken": false,
|
|
39
|
+
"addReadTokenRoleOnCreate": false,
|
|
40
|
+
"authenticateByDefault": false,
|
|
41
|
+
"linkOnly": false,
|
|
42
|
+
"firstBrokerLoginFlowAlias": "first broker login",
|
|
43
|
+
"config": {
|
|
44
|
+
"hideOnLoginPage": "",
|
|
45
|
+
"validateSignature": "true",
|
|
46
|
+
"samlXmlKeyNameTranformer": "KEY_ID",
|
|
47
|
+
"signingCertificate": "",
|
|
48
|
+
"postBindingLogout": "false",
|
|
49
|
+
"nameIDPolicyFormat": "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent",
|
|
50
|
+
"postBindingResponse": "true",
|
|
51
|
+
"backchannelSupported": "",
|
|
52
|
+
"signatureAlgorithm": "RSA_SHA256",
|
|
53
|
+
"wantAssertionsEncrypted": "false",
|
|
54
|
+
"xmlSigKeyInfoKeyNameTransformer": "CERT_SUBJECT",
|
|
55
|
+
"useJwksUrl": "true",
|
|
56
|
+
"wantAssertionsSigned": "true",
|
|
57
|
+
"postBindingAuthnRequest": "true",
|
|
58
|
+
"forceAuthn": "",
|
|
59
|
+
"wantAuthnRequestsSigned": "true",
|
|
60
|
+
"singleSignOnServiceUrl": "https://login.microsoftonline.com/test/saml2",
|
|
61
|
+
"addExtensionsElementWithKeyInfo": "false"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
JSON
|
|
66
|
+
end
|
|
67
|
+
before(:each) do
|
|
68
|
+
@identity_provider_client = KeycloakAdmin.realm(realm_name).identity_providers
|
|
69
|
+
|
|
70
|
+
stub_token_client
|
|
71
|
+
allow_any_instance_of(RestClient::Resource).to receive(:get).and_return json_response
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it "lists identity providers" do
|
|
75
|
+
identity_providers = @identity_provider_client.list
|
|
76
|
+
expect(identity_providers.length).to eq 1
|
|
77
|
+
expect(identity_providers[0].alias).to eq "acme"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "passes rest client options" do
|
|
81
|
+
rest_client_options = {timeout: 10}
|
|
82
|
+
allow_any_instance_of(KeycloakAdmin::Configuration).to receive(:rest_client_options).and_return rest_client_options
|
|
83
|
+
|
|
84
|
+
expect(RestClient::Resource).to receive(:new).with(
|
|
85
|
+
"http://auth.service.io/auth/admin/realms/valid-realm/identity-provider/instances", rest_client_options).and_call_original
|
|
86
|
+
|
|
87
|
+
identity_providers = @identity_provider_client.list
|
|
88
|
+
expect(identity_providers.length).to eq 1
|
|
89
|
+
expect(identity_providers[0].alias).to eq "acme"
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|