keycloak-admin 1.1.2 → 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 -0
- data/.github/workflows/ci.yml +80 -0
- data/.gitignore +9 -9
- data/.rspec +2 -2
- data/CHANGELOG.md +194 -183
- data/Dockerfile +12 -12
- data/Gemfile +3 -3
- data/Gemfile.lock +51 -49
- data/MIT-LICENSE +20 -20
- data/README.md +748 -482
- 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 +81 -0
- data/lib/keycloak-admin/client/client_authz_policy_client.rb +76 -0
- data/lib/keycloak-admin/client/client_authz_resource_client.rb +93 -0
- data/lib/keycloak-admin/client/client_authz_scope_client.rb +71 -0
- 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 -106
- 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 +34 -0
- data/lib/keycloak-admin/representation/client_authz_policy_config_representation.rb +15 -0
- data/lib/keycloak-admin/representation/client_authz_policy_representation.rb +27 -0
- data/lib/keycloak-admin/representation/client_authz_resource_representation.rb +26 -0
- data/lib/keycloak-admin/representation/client_authz_scope_representation.rb +17 -0
- 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 -75
- data/spec/client/attack_detection_client_spec.rb +102 -102
- data/spec/client/client_authz_permission_client_spec.rb +170 -0
- data/spec/client/client_authz_policy_client_spec.rb +170 -0
- data/spec/client/client_authz_resource_client_spec.rb +150 -0
- data/spec/client/client_authz_scope_client_spec.rb +134 -0
- 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 -0
- data/spec/representation/attack_detection_representation_spec.rb +15 -15
- data/spec/representation/client_authz_permission_representation_spec.rb +52 -0
- data/spec/representation/client_authz_policy_representation_spec.rb +47 -0
- data/spec/representation/client_authz_resource_representation_spec.rb +33 -0
- data/spec/representation/client_authz_scope_representation_spec.rb +19 -0
- 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 +29 -9
|
@@ -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
|
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
RSpec.describe KeycloakAdmin::IdentityProviderRepresentation do
|
|
2
|
-
describe "#from_hash" do
|
|
3
|
-
before(:each) do
|
|
4
|
-
json = <<-JSON
|
|
5
|
-
{
|
|
6
|
-
"alias": "acme",
|
|
7
|
-
"displayName": "ACME",
|
|
8
|
-
"internalId": "20fea77e-ae3d-411e-9467-2b3a20cd3e6d",
|
|
9
|
-
"providerId": "saml",
|
|
10
|
-
"enabled": true,
|
|
11
|
-
"updateProfileFirstLoginMode": "on",
|
|
12
|
-
"trustEmail": true,
|
|
13
|
-
"storeToken": false,
|
|
14
|
-
"addReadTokenRoleOnCreate": false,
|
|
15
|
-
"authenticateByDefault": false,
|
|
16
|
-
"linkOnly": false,
|
|
17
|
-
"firstBrokerLoginFlowAlias": "first broker login",
|
|
18
|
-
"config": {
|
|
19
|
-
"hideOnLoginPage": "",
|
|
20
|
-
"validateSignature": "true",
|
|
21
|
-
"samlXmlKeyNameTranformer": "KEY_ID",
|
|
22
|
-
"signingCertificate": "",
|
|
23
|
-
"postBindingLogout": "false",
|
|
24
|
-
"nameIDPolicyFormat": "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent",
|
|
25
|
-
"postBindingResponse": "true",
|
|
26
|
-
"backchannelSupported": "",
|
|
27
|
-
"signatureAlgorithm": "RSA_SHA256",
|
|
28
|
-
"wantAssertionsEncrypted": "false",
|
|
29
|
-
"xmlSigKeyInfoKeyNameTransformer": "CERT_SUBJECT",
|
|
30
|
-
"useJwksUrl": "true",
|
|
31
|
-
"wantAssertionsSigned": "true",
|
|
32
|
-
"postBindingAuthnRequest": "true",
|
|
33
|
-
"forceAuthn": "",
|
|
34
|
-
"wantAuthnRequestsSigned": "true",
|
|
35
|
-
"singleSignOnServiceUrl": "https://login.microsoftonline.com/test/saml2",
|
|
36
|
-
"addExtensionsElementWithKeyInfo": "false"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
JSON
|
|
40
|
-
payload = JSON.parse(json)
|
|
41
|
-
@identity_provider = KeycloakAdmin::IdentityProviderRepresentation.from_hash(payload)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
it "parses the alias" do
|
|
45
|
-
expect(@identity_provider.alias).to eq "acme"
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
it "parses the display name" do
|
|
49
|
-
expect(@identity_provider.display_name).to eq "ACME"
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it "parses the internalId" do
|
|
53
|
-
expect(@identity_provider.internal_id).to eq "20fea77e-ae3d-411e-9467-2b3a20cd3e6d"
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
it "parses the provider id" do
|
|
57
|
-
expect(@identity_provider.provider_id).to eq "saml"
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
it "parses the enabled" do
|
|
61
|
-
expect(@identity_provider.enabled).to eq true
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
it "parses the update_profile_first_login_mode" do
|
|
65
|
-
expect(@identity_provider.update_profile_first_login_mode).to eq "on"
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
it "parses the trust_email" do
|
|
69
|
-
expect(@identity_provider.trust_email).to eq true
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
it "parses the store_token" do
|
|
73
|
-
expect(@identity_provider.store_token).to eq false
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
it "parses the add_read_token_role_on_create" do
|
|
77
|
-
expect(@identity_provider.add_read_token_role_on_create).to eq false
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it "parses the authenticate_by_default" do
|
|
81
|
-
expect(@identity_provider.authenticate_by_default).to eq false
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
it "parses the link_only" do
|
|
85
|
-
expect(@identity_provider.link_only).to eq false
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
it "parses the first_broker_login_flow_alias" do
|
|
89
|
-
expect(@identity_provider.first_broker_login_flow_alias).to eq "first broker login"
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
it "parses the configuration as a hash with camel properties" do
|
|
93
|
-
expect(@identity_provider.config["hideOnLoginPage"]).to eq ""
|
|
94
|
-
expect(@identity_provider.config["validateSignature"]).to eq "true"
|
|
95
|
-
expect(@identity_provider.config["samlXmlKeyNameTranformer"]).to eq "KEY_ID"
|
|
96
|
-
expect(@identity_provider.config["signingCertificate"]).to eq ""
|
|
97
|
-
expect(@identity_provider.config["postBindingLogout"]).to eq "false"
|
|
98
|
-
expect(@identity_provider.config["nameIDPolicyFormat"]).to eq "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
|
|
99
|
-
expect(@identity_provider.config["postBindingResponse"]).to eq "true"
|
|
100
|
-
expect(@identity_provider.config["backchannelSupported"]).to eq ""
|
|
101
|
-
expect(@identity_provider.config["signatureAlgorithm"]).to eq "RSA_SHA256"
|
|
102
|
-
expect(@identity_provider.config["wantAssertionsEncrypted"]).to eq "false"
|
|
103
|
-
expect(@identity_provider.config["xmlSigKeyInfoKeyNameTransformer"]).to eq "CERT_SUBJECT"
|
|
104
|
-
expect(@identity_provider.config["useJwksUrl"]).to eq "true"
|
|
105
|
-
expect(@identity_provider.config["wantAssertionsSigned"]).to eq "true"
|
|
106
|
-
expect(@identity_provider.config["postBindingAuthnRequest"]).to eq "true"
|
|
107
|
-
expect(@identity_provider.config["forceAuthn"]).to eq ""
|
|
108
|
-
expect(@identity_provider.config["wantAuthnRequestsSigned"]).to eq "true"
|
|
109
|
-
expect(@identity_provider.config["singleSignOnServiceUrl"]).to eq "https://login.microsoftonline.com/test/saml2"
|
|
110
|
-
expect(@identity_provider.config["addExtensionsElementWithKeyInfo"]).to eq "false"
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
end
|
|
1
|
+
RSpec.describe KeycloakAdmin::IdentityProviderRepresentation do
|
|
2
|
+
describe "#from_hash" do
|
|
3
|
+
before(:each) do
|
|
4
|
+
json = <<-JSON
|
|
5
|
+
{
|
|
6
|
+
"alias": "acme",
|
|
7
|
+
"displayName": "ACME",
|
|
8
|
+
"internalId": "20fea77e-ae3d-411e-9467-2b3a20cd3e6d",
|
|
9
|
+
"providerId": "saml",
|
|
10
|
+
"enabled": true,
|
|
11
|
+
"updateProfileFirstLoginMode": "on",
|
|
12
|
+
"trustEmail": true,
|
|
13
|
+
"storeToken": false,
|
|
14
|
+
"addReadTokenRoleOnCreate": false,
|
|
15
|
+
"authenticateByDefault": false,
|
|
16
|
+
"linkOnly": false,
|
|
17
|
+
"firstBrokerLoginFlowAlias": "first broker login",
|
|
18
|
+
"config": {
|
|
19
|
+
"hideOnLoginPage": "",
|
|
20
|
+
"validateSignature": "true",
|
|
21
|
+
"samlXmlKeyNameTranformer": "KEY_ID",
|
|
22
|
+
"signingCertificate": "",
|
|
23
|
+
"postBindingLogout": "false",
|
|
24
|
+
"nameIDPolicyFormat": "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent",
|
|
25
|
+
"postBindingResponse": "true",
|
|
26
|
+
"backchannelSupported": "",
|
|
27
|
+
"signatureAlgorithm": "RSA_SHA256",
|
|
28
|
+
"wantAssertionsEncrypted": "false",
|
|
29
|
+
"xmlSigKeyInfoKeyNameTransformer": "CERT_SUBJECT",
|
|
30
|
+
"useJwksUrl": "true",
|
|
31
|
+
"wantAssertionsSigned": "true",
|
|
32
|
+
"postBindingAuthnRequest": "true",
|
|
33
|
+
"forceAuthn": "",
|
|
34
|
+
"wantAuthnRequestsSigned": "true",
|
|
35
|
+
"singleSignOnServiceUrl": "https://login.microsoftonline.com/test/saml2",
|
|
36
|
+
"addExtensionsElementWithKeyInfo": "false"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
JSON
|
|
40
|
+
payload = JSON.parse(json)
|
|
41
|
+
@identity_provider = KeycloakAdmin::IdentityProviderRepresentation.from_hash(payload)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "parses the alias" do
|
|
45
|
+
expect(@identity_provider.alias).to eq "acme"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "parses the display name" do
|
|
49
|
+
expect(@identity_provider.display_name).to eq "ACME"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "parses the internalId" do
|
|
53
|
+
expect(@identity_provider.internal_id).to eq "20fea77e-ae3d-411e-9467-2b3a20cd3e6d"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "parses the provider id" do
|
|
57
|
+
expect(@identity_provider.provider_id).to eq "saml"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "parses the enabled" do
|
|
61
|
+
expect(@identity_provider.enabled).to eq true
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "parses the update_profile_first_login_mode" do
|
|
65
|
+
expect(@identity_provider.update_profile_first_login_mode).to eq "on"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it "parses the trust_email" do
|
|
69
|
+
expect(@identity_provider.trust_email).to eq true
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it "parses the store_token" do
|
|
73
|
+
expect(@identity_provider.store_token).to eq false
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it "parses the add_read_token_role_on_create" do
|
|
77
|
+
expect(@identity_provider.add_read_token_role_on_create).to eq false
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "parses the authenticate_by_default" do
|
|
81
|
+
expect(@identity_provider.authenticate_by_default).to eq false
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it "parses the link_only" do
|
|
85
|
+
expect(@identity_provider.link_only).to eq false
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it "parses the first_broker_login_flow_alias" do
|
|
89
|
+
expect(@identity_provider.first_broker_login_flow_alias).to eq "first broker login"
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
it "parses the configuration as a hash with camel properties" do
|
|
93
|
+
expect(@identity_provider.config["hideOnLoginPage"]).to eq ""
|
|
94
|
+
expect(@identity_provider.config["validateSignature"]).to eq "true"
|
|
95
|
+
expect(@identity_provider.config["samlXmlKeyNameTranformer"]).to eq "KEY_ID"
|
|
96
|
+
expect(@identity_provider.config["signingCertificate"]).to eq ""
|
|
97
|
+
expect(@identity_provider.config["postBindingLogout"]).to eq "false"
|
|
98
|
+
expect(@identity_provider.config["nameIDPolicyFormat"]).to eq "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
|
|
99
|
+
expect(@identity_provider.config["postBindingResponse"]).to eq "true"
|
|
100
|
+
expect(@identity_provider.config["backchannelSupported"]).to eq ""
|
|
101
|
+
expect(@identity_provider.config["signatureAlgorithm"]).to eq "RSA_SHA256"
|
|
102
|
+
expect(@identity_provider.config["wantAssertionsEncrypted"]).to eq "false"
|
|
103
|
+
expect(@identity_provider.config["xmlSigKeyInfoKeyNameTransformer"]).to eq "CERT_SUBJECT"
|
|
104
|
+
expect(@identity_provider.config["useJwksUrl"]).to eq "true"
|
|
105
|
+
expect(@identity_provider.config["wantAssertionsSigned"]).to eq "true"
|
|
106
|
+
expect(@identity_provider.config["postBindingAuthnRequest"]).to eq "true"
|
|
107
|
+
expect(@identity_provider.config["forceAuthn"]).to eq ""
|
|
108
|
+
expect(@identity_provider.config["wantAuthnRequestsSigned"]).to eq "true"
|
|
109
|
+
expect(@identity_provider.config["singleSignOnServiceUrl"]).to eq "https://login.microsoftonline.com/test/saml2"
|
|
110
|
+
expect(@identity_provider.config["addExtensionsElementWithKeyInfo"]).to eq "false"
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|