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,12 +1,12 @@
|
|
|
1
|
-
module KeycloakAdmin
|
|
2
|
-
module CamelJson
|
|
3
|
-
|
|
4
|
-
def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
|
|
5
|
-
if first_letter_in_uppercase
|
|
6
|
-
lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
|
|
7
|
-
else
|
|
8
|
-
lower_case_and_underscored_word[0] + camelize(lower_case_and_underscored_word)[1..-1]
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
1
|
+
module KeycloakAdmin
|
|
2
|
+
module CamelJson
|
|
3
|
+
|
|
4
|
+
def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
|
|
5
|
+
if first_letter_in_uppercase
|
|
6
|
+
lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
|
|
7
|
+
else
|
|
8
|
+
lower_case_and_underscored_word[0] + camelize(lower_case_and_underscored_word)[1..-1]
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
## ### {"resources":["4f55e984-d1ec-405c-a25c-1387f88acd5c"],"policies":["e9e3bc49-fe11-4287-b6fc-fa8be4930ffa"],"name":"delme policy","description":"delme polidy ","decisionStrategy":"UNANIMOUS","resourceType":""}
|
|
5
|
-
#
|
|
6
|
-
module KeycloakAdmin
|
|
7
|
-
class ClientAuthzPermissionRepresentation < Representation
|
|
8
|
-
attr_accessor :id,
|
|
9
|
-
:name,
|
|
10
|
-
:description,
|
|
11
|
-
:decision_strategy,
|
|
12
|
-
:resource_type,
|
|
13
|
-
:resources,
|
|
14
|
-
:policies,
|
|
15
|
-
:scopes,
|
|
16
|
-
:logic,
|
|
17
|
-
:type
|
|
18
|
-
|
|
19
|
-
def self.from_hash(hash)
|
|
20
|
-
resource = new
|
|
21
|
-
resource.id = hash["id"]
|
|
22
|
-
resource.name = hash["name"]
|
|
23
|
-
resource.description = hash["description"]
|
|
24
|
-
resource.decision_strategy = hash["decisionStrategy"]
|
|
25
|
-
resource.resource_type = hash["resourceType"]
|
|
26
|
-
resource.resources = hash["resources"]
|
|
27
|
-
resource.policies = hash["policies"]
|
|
28
|
-
resource.scopes = hash["scopes"]
|
|
29
|
-
resource.logic = hash["logic"]
|
|
30
|
-
resource.type = hash["type"]
|
|
31
|
-
resource
|
|
32
|
-
end
|
|
33
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## ### {"resources":["4f55e984-d1ec-405c-a25c-1387f88acd5c"],"policies":["e9e3bc49-fe11-4287-b6fc-fa8be4930ffa"],"name":"delme policy","description":"delme polidy ","decisionStrategy":"UNANIMOUS","resourceType":""}
|
|
5
|
+
#
|
|
6
|
+
module KeycloakAdmin
|
|
7
|
+
class ClientAuthzPermissionRepresentation < Representation
|
|
8
|
+
attr_accessor :id,
|
|
9
|
+
:name,
|
|
10
|
+
:description,
|
|
11
|
+
:decision_strategy,
|
|
12
|
+
:resource_type,
|
|
13
|
+
:resources,
|
|
14
|
+
:policies,
|
|
15
|
+
:scopes,
|
|
16
|
+
:logic,
|
|
17
|
+
:type
|
|
18
|
+
|
|
19
|
+
def self.from_hash(hash)
|
|
20
|
+
resource = new
|
|
21
|
+
resource.id = hash["id"]
|
|
22
|
+
resource.name = hash["name"]
|
|
23
|
+
resource.description = hash["description"]
|
|
24
|
+
resource.decision_strategy = hash["decisionStrategy"]
|
|
25
|
+
resource.resource_type = hash["resourceType"]
|
|
26
|
+
resource.resources = hash["resources"]
|
|
27
|
+
resource.policies = hash["policies"]
|
|
28
|
+
resource.scopes = hash["scopes"]
|
|
29
|
+
resource.logic = hash["logic"]
|
|
30
|
+
resource.type = hash["type"]
|
|
31
|
+
resource
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
34
|
end
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
module KeycloakAdmin
|
|
2
|
-
class ClientAuthzPolicyConfigRepresentation < Representation
|
|
3
|
-
attr_accessor :roles,
|
|
4
|
-
:code
|
|
5
|
-
|
|
6
|
-
def self.from_hash(hash)
|
|
7
|
-
resource = new
|
|
8
|
-
resource.code = hash["code"]
|
|
9
|
-
resource.roles = JSON.parse(hash["roles"] || '[]').map do |str|
|
|
10
|
-
RoleRepresentation.from_hash(str)
|
|
11
|
-
end
|
|
12
|
-
resource
|
|
13
|
-
end
|
|
14
|
-
end
|
|
1
|
+
module KeycloakAdmin
|
|
2
|
+
class ClientAuthzPolicyConfigRepresentation < Representation
|
|
3
|
+
attr_accessor :roles,
|
|
4
|
+
:code
|
|
5
|
+
|
|
6
|
+
def self.from_hash(hash)
|
|
7
|
+
resource = new
|
|
8
|
+
resource.code = hash["code"]
|
|
9
|
+
resource.roles = JSON.parse(hash["roles"] || '[]').map do |str|
|
|
10
|
+
RoleRepresentation.from_hash(str)
|
|
11
|
+
end
|
|
12
|
+
resource
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
15
|
end
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
module KeycloakAdmin
|
|
2
|
-
class ClientAuthzPolicyRepresentation < Representation
|
|
3
|
-
attr_accessor :id,
|
|
4
|
-
:name,
|
|
5
|
-
:description,
|
|
6
|
-
:type,
|
|
7
|
-
:logic,
|
|
8
|
-
:decision_strategy,
|
|
9
|
-
:config,
|
|
10
|
-
:fetch_roles,
|
|
11
|
-
:roles
|
|
12
|
-
|
|
13
|
-
def self.from_hash(hash)
|
|
14
|
-
resource = new
|
|
15
|
-
resource.id = hash["id"]
|
|
16
|
-
resource.name = hash["name"]
|
|
17
|
-
resource.description = hash["description"]
|
|
18
|
-
resource.type = hash["type"]
|
|
19
|
-
resource.logic = hash["logic"]
|
|
20
|
-
resource.decision_strategy = hash["decisionStrategy"]
|
|
21
|
-
resource.roles = hash["roles"]
|
|
22
|
-
resource.fetch_roles = hash["fetchRoles"]
|
|
23
|
-
resource.config = ClientAuthzPolicyConfigRepresentation.from_hash((hash["config"] || {}))
|
|
24
|
-
resource
|
|
25
|
-
end
|
|
26
|
-
end
|
|
1
|
+
module KeycloakAdmin
|
|
2
|
+
class ClientAuthzPolicyRepresentation < Representation
|
|
3
|
+
attr_accessor :id,
|
|
4
|
+
:name,
|
|
5
|
+
:description,
|
|
6
|
+
:type,
|
|
7
|
+
:logic,
|
|
8
|
+
:decision_strategy,
|
|
9
|
+
:config,
|
|
10
|
+
:fetch_roles,
|
|
11
|
+
:roles
|
|
12
|
+
|
|
13
|
+
def self.from_hash(hash)
|
|
14
|
+
resource = new
|
|
15
|
+
resource.id = hash["id"]
|
|
16
|
+
resource.name = hash["name"]
|
|
17
|
+
resource.description = hash["description"]
|
|
18
|
+
resource.type = hash["type"]
|
|
19
|
+
resource.logic = hash["logic"]
|
|
20
|
+
resource.decision_strategy = hash["decisionStrategy"]
|
|
21
|
+
resource.roles = hash["roles"]
|
|
22
|
+
resource.fetch_roles = hash["fetchRoles"]
|
|
23
|
+
resource.config = ClientAuthzPolicyConfigRepresentation.from_hash((hash["config"] || {}))
|
|
24
|
+
resource
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
27
|
end
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
module KeycloakAdmin
|
|
2
|
-
|
|
3
|
-
class ClientAuthzResourceRepresentation < Representation
|
|
4
|
-
attr_accessor :id,
|
|
5
|
-
:name,
|
|
6
|
-
:type,
|
|
7
|
-
:uris,
|
|
8
|
-
:owner_managed_access,
|
|
9
|
-
:display_name,
|
|
10
|
-
:attributes,
|
|
11
|
-
:scopes
|
|
12
|
-
|
|
13
|
-
def self.from_hash(hash)
|
|
14
|
-
resource = new
|
|
15
|
-
resource.id = hash["_id"]
|
|
16
|
-
resource.type = hash["type"]
|
|
17
|
-
resource.name = hash["name"]
|
|
18
|
-
resource.owner_managed_access = hash["ownerManagedAccess"]
|
|
19
|
-
resource.uris = hash["uris"]
|
|
20
|
-
resource.display_name = hash["displayName"]
|
|
21
|
-
resource.attributes = hash.fetch("attributes", {}).map { |k, v| [k.to_sym, Array(v)] }.to_h
|
|
22
|
-
resource.scopes = (hash["scopes"] || []).map { |scope_hash| ClientAuthzScopeRepresentation.from_hash(scope_hash) }
|
|
23
|
-
resource
|
|
24
|
-
end
|
|
25
|
-
end
|
|
1
|
+
module KeycloakAdmin
|
|
2
|
+
|
|
3
|
+
class ClientAuthzResourceRepresentation < Representation
|
|
4
|
+
attr_accessor :id,
|
|
5
|
+
:name,
|
|
6
|
+
:type,
|
|
7
|
+
:uris,
|
|
8
|
+
:owner_managed_access,
|
|
9
|
+
:display_name,
|
|
10
|
+
:attributes,
|
|
11
|
+
:scopes
|
|
12
|
+
|
|
13
|
+
def self.from_hash(hash)
|
|
14
|
+
resource = new
|
|
15
|
+
resource.id = hash["_id"]
|
|
16
|
+
resource.type = hash["type"]
|
|
17
|
+
resource.name = hash["name"]
|
|
18
|
+
resource.owner_managed_access = hash["ownerManagedAccess"]
|
|
19
|
+
resource.uris = hash["uris"]
|
|
20
|
+
resource.display_name = hash["displayName"]
|
|
21
|
+
resource.attributes = hash.fetch("attributes", {}).map { |k, v| [k.to_sym, Array(v)] }.to_h
|
|
22
|
+
resource.scopes = (hash["scopes"] || []).map { |scope_hash| ClientAuthzScopeRepresentation.from_hash(scope_hash) }
|
|
23
|
+
resource
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
26
|
end
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
module KeycloakAdmin
|
|
2
|
-
class ClientAuthzScopeRepresentation < Representation
|
|
3
|
-
attr_accessor :id,
|
|
4
|
-
:name,
|
|
5
|
-
:icon_uri,
|
|
6
|
-
:display_name
|
|
7
|
-
|
|
8
|
-
def self.from_hash(hash)
|
|
9
|
-
scope = new
|
|
10
|
-
scope.id = hash["id"]
|
|
11
|
-
scope.name = hash["name"]
|
|
12
|
-
scope.icon_uri = hash["iconUri"]
|
|
13
|
-
scope.display_name = hash["displayName"]
|
|
14
|
-
scope
|
|
15
|
-
end
|
|
16
|
-
end
|
|
1
|
+
module KeycloakAdmin
|
|
2
|
+
class ClientAuthzScopeRepresentation < Representation
|
|
3
|
+
attr_accessor :id,
|
|
4
|
+
:name,
|
|
5
|
+
:icon_uri,
|
|
6
|
+
:display_name
|
|
7
|
+
|
|
8
|
+
def self.from_hash(hash)
|
|
9
|
+
scope = new
|
|
10
|
+
scope.id = hash["id"]
|
|
11
|
+
scope.name = hash["name"]
|
|
12
|
+
scope.icon_uri = hash["iconUri"]
|
|
13
|
+
scope.display_name = hash["displayName"]
|
|
14
|
+
scope
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
17
|
end
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
module KeycloakAdmin
|
|
2
|
-
class ClientRepresentation < Representation
|
|
3
|
-
attr_accessor :id,
|
|
4
|
-
:name,
|
|
5
|
-
:client_id,
|
|
6
|
-
:description,
|
|
7
|
-
:client_authenticator_type,
|
|
8
|
-
:always_display_in_console,
|
|
9
|
-
:surrogate_auth_required,
|
|
10
|
-
:redirect_uris,
|
|
11
|
-
:web_origins,
|
|
12
|
-
:not_before,
|
|
13
|
-
:bearer_only,
|
|
14
|
-
:consent_required,
|
|
15
|
-
:standard_flow_enabled,
|
|
16
|
-
:implicit_flow_enabled,
|
|
17
|
-
:direct_access_grants_enabled,
|
|
18
|
-
:service_accounts_enabled,
|
|
19
|
-
:authorization_services_enabled,
|
|
20
|
-
:public_client,
|
|
21
|
-
:frontchannel_logout,
|
|
22
|
-
:protocol,
|
|
23
|
-
:base_url,
|
|
24
|
-
:root_url,
|
|
25
|
-
:attributes,
|
|
26
|
-
:authentication_flow_binding_overrides,
|
|
27
|
-
:full_scope_allowed,
|
|
28
|
-
:node_re_registration_timeout,
|
|
29
|
-
:attributes,
|
|
30
|
-
:protocol_mappers,
|
|
31
|
-
:default_client_scopes,
|
|
32
|
-
:optional_client_scopes,
|
|
33
|
-
:access
|
|
34
|
-
|
|
35
|
-
def self.from_hash(hash)
|
|
36
|
-
client = new
|
|
37
|
-
client.id = hash["id"]
|
|
38
|
-
client.name = hash["name"]
|
|
39
|
-
client.client_id = hash["clientId"]
|
|
40
|
-
client.description = hash["description"]
|
|
41
|
-
client.client_authenticator_type = hash["clientAuthenticatorType"]
|
|
42
|
-
client.always_display_in_console = hash["alwaysDisplayInConsole"] || false
|
|
43
|
-
client.surrogate_auth_required = hash["surrogateAuthRequired"] || false
|
|
44
|
-
client.redirect_uris = hash["redirectUris"] || false
|
|
45
|
-
client.web_origins = hash["webOrigins"] || false
|
|
46
|
-
client.not_before = hash["notBefore"] || false
|
|
47
|
-
client.bearer_only = hash["bearerOnly"] || false
|
|
48
|
-
client.consent_required = hash["consentRequired"] || false
|
|
49
|
-
client.standard_flow_enabled = hash["standardFlowEnabled"] || false
|
|
50
|
-
client.implicit_flow_enabled = hash["implicitFlowEnabled"] || false
|
|
51
|
-
client.direct_access_grants_enabled = hash["directAccessGrantsEnabled"] || false
|
|
52
|
-
client.service_accounts_enabled = hash["serviceAccountsEnabled"] || false
|
|
53
|
-
client.authorization_services_enabled = hash["authorizationServicesEnabled"] || false
|
|
54
|
-
client.public_client = hash["publicClient"] || false
|
|
55
|
-
client.frontchannel_logout = hash["frontchannelLogout"] || false
|
|
56
|
-
client.protocol = hash["protocol"]
|
|
57
|
-
client.base_url = hash["baseUrl"]
|
|
58
|
-
client.root_url = hash["rootUrl"]
|
|
59
|
-
client.attributes = hash["attributes"] || {}
|
|
60
|
-
client.authentication_flow_binding_overrides = hash["authenticationFlowBindingOverrides"] || {}
|
|
61
|
-
client.full_scope_allowed = hash["fullScopeAllowed"] || false
|
|
62
|
-
client.node_re_registration_timeout = hash["nodeReRegistrationTimeout"] || -1
|
|
63
|
-
client.attributes = hash["attributes"]
|
|
64
|
-
client.protocol_mappers = (hash["protocolMappers"] || []).map { |protocol_mapper_hash| ProtocolMapperRepresentation.from_hash(protocol_mapper_hash) }
|
|
65
|
-
client.default_client_scopes = hash["defaultClientScopes"] || []
|
|
66
|
-
client.optional_client_scopes = hash["optionalClientScopes"] || []
|
|
67
|
-
client.access = hash["access"] || {}
|
|
68
|
-
client
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
1
|
+
module KeycloakAdmin
|
|
2
|
+
class ClientRepresentation < Representation
|
|
3
|
+
attr_accessor :id,
|
|
4
|
+
:name,
|
|
5
|
+
:client_id,
|
|
6
|
+
:description,
|
|
7
|
+
:client_authenticator_type,
|
|
8
|
+
:always_display_in_console,
|
|
9
|
+
:surrogate_auth_required,
|
|
10
|
+
:redirect_uris,
|
|
11
|
+
:web_origins,
|
|
12
|
+
:not_before,
|
|
13
|
+
:bearer_only,
|
|
14
|
+
:consent_required,
|
|
15
|
+
:standard_flow_enabled,
|
|
16
|
+
:implicit_flow_enabled,
|
|
17
|
+
:direct_access_grants_enabled,
|
|
18
|
+
:service_accounts_enabled,
|
|
19
|
+
:authorization_services_enabled,
|
|
20
|
+
:public_client,
|
|
21
|
+
:frontchannel_logout,
|
|
22
|
+
:protocol,
|
|
23
|
+
:base_url,
|
|
24
|
+
:root_url,
|
|
25
|
+
:attributes,
|
|
26
|
+
:authentication_flow_binding_overrides,
|
|
27
|
+
:full_scope_allowed,
|
|
28
|
+
:node_re_registration_timeout,
|
|
29
|
+
:attributes,
|
|
30
|
+
:protocol_mappers,
|
|
31
|
+
:default_client_scopes,
|
|
32
|
+
:optional_client_scopes,
|
|
33
|
+
:access
|
|
34
|
+
|
|
35
|
+
def self.from_hash(hash)
|
|
36
|
+
client = new
|
|
37
|
+
client.id = hash["id"]
|
|
38
|
+
client.name = hash["name"]
|
|
39
|
+
client.client_id = hash["clientId"]
|
|
40
|
+
client.description = hash["description"]
|
|
41
|
+
client.client_authenticator_type = hash["clientAuthenticatorType"]
|
|
42
|
+
client.always_display_in_console = hash["alwaysDisplayInConsole"] || false
|
|
43
|
+
client.surrogate_auth_required = hash["surrogateAuthRequired"] || false
|
|
44
|
+
client.redirect_uris = hash["redirectUris"] || false
|
|
45
|
+
client.web_origins = hash["webOrigins"] || false
|
|
46
|
+
client.not_before = hash["notBefore"] || false
|
|
47
|
+
client.bearer_only = hash["bearerOnly"] || false
|
|
48
|
+
client.consent_required = hash["consentRequired"] || false
|
|
49
|
+
client.standard_flow_enabled = hash["standardFlowEnabled"] || false
|
|
50
|
+
client.implicit_flow_enabled = hash["implicitFlowEnabled"] || false
|
|
51
|
+
client.direct_access_grants_enabled = hash["directAccessGrantsEnabled"] || false
|
|
52
|
+
client.service_accounts_enabled = hash["serviceAccountsEnabled"] || false
|
|
53
|
+
client.authorization_services_enabled = hash["authorizationServicesEnabled"] || false
|
|
54
|
+
client.public_client = hash["publicClient"] || false
|
|
55
|
+
client.frontchannel_logout = hash["frontchannelLogout"] || false
|
|
56
|
+
client.protocol = hash["protocol"]
|
|
57
|
+
client.base_url = hash["baseUrl"]
|
|
58
|
+
client.root_url = hash["rootUrl"]
|
|
59
|
+
client.attributes = hash["attributes"] || {}
|
|
60
|
+
client.authentication_flow_binding_overrides = hash["authenticationFlowBindingOverrides"] || {}
|
|
61
|
+
client.full_scope_allowed = hash["fullScopeAllowed"] || false
|
|
62
|
+
client.node_re_registration_timeout = hash["nodeReRegistrationTimeout"] || -1
|
|
63
|
+
client.attributes = hash["attributes"]
|
|
64
|
+
client.protocol_mappers = (hash["protocolMappers"] || []).map { |protocol_mapper_hash| ProtocolMapperRepresentation.from_hash(protocol_mapper_hash) }
|
|
65
|
+
client.default_client_scopes = hash["defaultClientScopes"] || []
|
|
66
|
+
client.optional_client_scopes = hash["optionalClientScopes"] || []
|
|
67
|
+
client.access = hash["access"] || {}
|
|
68
|
+
client
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
module KeycloakAdmin
|
|
2
|
-
class CredentialRepresentation < Representation
|
|
3
|
-
attr_accessor :type,
|
|
4
|
-
:device,
|
|
5
|
-
:value,
|
|
6
|
-
:hashedSaltedValue,
|
|
7
|
-
:salt,
|
|
8
|
-
:hashIterations,
|
|
9
|
-
:counter,
|
|
10
|
-
:algorithm,
|
|
11
|
-
:digits,
|
|
12
|
-
:period,
|
|
13
|
-
:created_date,
|
|
14
|
-
:config,
|
|
15
|
-
:temporary
|
|
16
|
-
|
|
17
|
-
def self.from_password(password, temporary=false)
|
|
18
|
-
credential = new
|
|
19
|
-
credential.value = password
|
|
20
|
-
credential.type = "password"
|
|
21
|
-
credential.temporary = temporary
|
|
22
|
-
credential
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def self.from_json(json)
|
|
26
|
-
attributes = JSON.parse(json)
|
|
27
|
-
from_hash(attributes)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def self.from_hash(hash)
|
|
31
|
-
credential = new
|
|
32
|
-
hash.each do |key, value|
|
|
33
|
-
property = "@#{key}".to_sym
|
|
34
|
-
credential.instance_variable_set(property, value)
|
|
35
|
-
end
|
|
36
|
-
credential
|
|
37
|
-
end
|
|
38
|
-
end
|
|
1
|
+
module KeycloakAdmin
|
|
2
|
+
class CredentialRepresentation < Representation
|
|
3
|
+
attr_accessor :type,
|
|
4
|
+
:device,
|
|
5
|
+
:value,
|
|
6
|
+
:hashedSaltedValue,
|
|
7
|
+
:salt,
|
|
8
|
+
:hashIterations,
|
|
9
|
+
:counter,
|
|
10
|
+
:algorithm,
|
|
11
|
+
:digits,
|
|
12
|
+
:period,
|
|
13
|
+
:created_date,
|
|
14
|
+
:config,
|
|
15
|
+
:temporary
|
|
16
|
+
|
|
17
|
+
def self.from_password(password, temporary=false)
|
|
18
|
+
credential = new
|
|
19
|
+
credential.value = password
|
|
20
|
+
credential.type = "password"
|
|
21
|
+
credential.temporary = temporary
|
|
22
|
+
credential
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.from_json(json)
|
|
26
|
+
attributes = JSON.parse(json)
|
|
27
|
+
from_hash(attributes)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.from_hash(hash)
|
|
31
|
+
credential = new
|
|
32
|
+
hash.each do |key, value|
|
|
33
|
+
property = "@#{key}".to_sym
|
|
34
|
+
credential.instance_variable_set(property, value)
|
|
35
|
+
end
|
|
36
|
+
credential
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
39
|
end
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
module KeycloakAdmin
|
|
2
|
-
class FederatedIdentityRepresentation < Representation
|
|
3
|
-
attr_accessor :identity_provider,
|
|
4
|
-
:user_id,
|
|
5
|
-
:user_name
|
|
6
|
-
|
|
7
|
-
def self.from_hash(hash)
|
|
8
|
-
rep = new
|
|
9
|
-
rep.identity_provider = hash["identityProvider"]
|
|
10
|
-
rep.user_id = hash["userId"]
|
|
11
|
-
rep.user_name = hash["userName"]
|
|
12
|
-
rep
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
1
|
+
module KeycloakAdmin
|
|
2
|
+
class FederatedIdentityRepresentation < Representation
|
|
3
|
+
attr_accessor :identity_provider,
|
|
4
|
+
:user_id,
|
|
5
|
+
:user_name
|
|
6
|
+
|
|
7
|
+
def self.from_hash(hash)
|
|
8
|
+
rep = new
|
|
9
|
+
rep.identity_provider = hash["identityProvider"]
|
|
10
|
+
rep.user_id = hash["userId"]
|
|
11
|
+
rep.user_name = hash["userName"]
|
|
12
|
+
rep
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
module KeycloakAdmin
|
|
2
|
-
class GroupRepresentation < Representation
|
|
3
|
-
attr_accessor :id,
|
|
4
|
-
:name,
|
|
5
|
-
:path,
|
|
6
|
-
:attributes,
|
|
7
|
-
:sub_group_count,
|
|
8
|
-
:sub_groups
|
|
9
|
-
|
|
10
|
-
def self.from_hash(hash)
|
|
11
|
-
group = new
|
|
12
|
-
group.id = hash["id"]
|
|
13
|
-
group.name = hash["name"]
|
|
14
|
-
group.path = hash["path"]
|
|
15
|
-
group.attributes = hash.fetch("attributes", {}).map { |k, v| [k.to_sym, Array(v)] }.to_h
|
|
16
|
-
group.sub_group_count = hash["subGroupCount"]
|
|
17
|
-
group.sub_groups = hash.fetch("subGroups", []).map { |sub_group_hash| self.from_hash(sub_group_hash) }
|
|
18
|
-
group
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
1
|
+
module KeycloakAdmin
|
|
2
|
+
class GroupRepresentation < Representation
|
|
3
|
+
attr_accessor :id,
|
|
4
|
+
:name,
|
|
5
|
+
:path,
|
|
6
|
+
:attributes,
|
|
7
|
+
:sub_group_count,
|
|
8
|
+
:sub_groups
|
|
9
|
+
|
|
10
|
+
def self.from_hash(hash)
|
|
11
|
+
group = new
|
|
12
|
+
group.id = hash["id"]
|
|
13
|
+
group.name = hash["name"]
|
|
14
|
+
group.path = hash["path"]
|
|
15
|
+
group.attributes = hash.fetch("attributes", {}).map { |k, v| [k.to_sym, Array(v)] }.to_h
|
|
16
|
+
group.sub_group_count = hash["subGroupCount"]
|
|
17
|
+
group.sub_groups = hash.fetch("subGroups", []).map { |sub_group_hash| self.from_hash(sub_group_hash) }
|
|
18
|
+
group
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
module KeycloakAdmin
|
|
2
|
-
class IdentityProviderMapperRepresentation < Representation
|
|
3
|
-
attr_accessor :id,
|
|
4
|
-
:name,
|
|
5
|
-
:identity_provider_alias,
|
|
6
|
-
:identity_provider_mapper,
|
|
7
|
-
:config
|
|
8
|
-
|
|
9
|
-
def self.from_hash(hash)
|
|
10
|
-
client = new
|
|
11
|
-
client.id = hash["id"]
|
|
12
|
-
client.name = hash["name"]
|
|
13
|
-
client.identity_provider_alias = hash["identityProviderAlias"]
|
|
14
|
-
client.identity_provider_mapper = hash["identityProviderMapper"]
|
|
15
|
-
client.config = hash["config"]
|
|
16
|
-
client
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
1
|
+
module KeycloakAdmin
|
|
2
|
+
class IdentityProviderMapperRepresentation < Representation
|
|
3
|
+
attr_accessor :id,
|
|
4
|
+
:name,
|
|
5
|
+
:identity_provider_alias,
|
|
6
|
+
:identity_provider_mapper,
|
|
7
|
+
:config
|
|
8
|
+
|
|
9
|
+
def self.from_hash(hash)
|
|
10
|
+
client = new
|
|
11
|
+
client.id = hash["id"]
|
|
12
|
+
client.name = hash["name"]
|
|
13
|
+
client.identity_provider_alias = hash["identityProviderAlias"]
|
|
14
|
+
client.identity_provider_mapper = hash["identityProviderMapper"]
|
|
15
|
+
client.config = hash["config"]
|
|
16
|
+
client
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|