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.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/Dockerfile +24 -24
  3. data/.github/workflows/ci.yml +80 -80
  4. data/.gitignore +9 -9
  5. data/.rspec +2 -2
  6. data/CHANGELOG.md +23 -0
  7. data/Dockerfile +12 -12
  8. data/Gemfile +3 -3
  9. data/Gemfile.lock +1 -1
  10. data/MIT-LICENSE +20 -20
  11. data/README.md +20 -1
  12. data/bin/console +9 -9
  13. data/keycloak-admin.gemspec +24 -24
  14. data/lib/keycloak-admin/client/attack_detection_client.rb +41 -41
  15. data/lib/keycloak-admin/client/client.rb +56 -56
  16. data/lib/keycloak-admin/client/client_authz_permission_client.rb +80 -80
  17. data/lib/keycloak-admin/client/client_authz_policy_client.rb +75 -75
  18. data/lib/keycloak-admin/client/client_authz_resource_client.rb +92 -92
  19. data/lib/keycloak-admin/client/client_authz_scope_client.rb +70 -70
  20. data/lib/keycloak-admin/client/client_client.rb +71 -71
  21. data/lib/keycloak-admin/client/client_role_client.rb +20 -20
  22. data/lib/keycloak-admin/client/client_role_mappings_client.rb +32 -32
  23. data/lib/keycloak-admin/client/configurable_token_client.rb +35 -35
  24. data/lib/keycloak-admin/client/group_client.rb +148 -148
  25. data/lib/keycloak-admin/client/identity_provider_client.rb +51 -51
  26. data/lib/keycloak-admin/client/organization_client.rb +245 -0
  27. data/lib/keycloak-admin/client/realm_client.rb +126 -122
  28. data/lib/keycloak-admin/client/role_client.rb +59 -59
  29. data/lib/keycloak-admin/client/role_mapper_client.rb +47 -47
  30. data/lib/keycloak-admin/client/token_client.rb +29 -29
  31. data/lib/keycloak-admin/client/user_client.rb +278 -266
  32. data/lib/keycloak-admin/configuration.rb +52 -52
  33. data/lib/keycloak-admin/representation/attack_detection_representation.rb +17 -17
  34. data/lib/keycloak-admin/representation/camel_json.rb +12 -12
  35. data/lib/keycloak-admin/representation/client_authz_permission_representation.rb +33 -33
  36. data/lib/keycloak-admin/representation/client_authz_policy_config_representation.rb +14 -14
  37. data/lib/keycloak-admin/representation/client_authz_policy_representation.rb +26 -26
  38. data/lib/keycloak-admin/representation/client_authz_resource_representation.rb +25 -25
  39. data/lib/keycloak-admin/representation/client_authz_scope_representation.rb +16 -16
  40. data/lib/keycloak-admin/representation/client_representation.rb +71 -71
  41. data/lib/keycloak-admin/representation/credential_representation.rb +71 -38
  42. data/lib/keycloak-admin/representation/federated_identity_representation.rb +15 -15
  43. data/lib/keycloak-admin/representation/group_representation.rb +21 -21
  44. data/lib/keycloak-admin/representation/identity_provider_mapper_representation.rb +19 -19
  45. data/lib/keycloak-admin/representation/identity_provider_representation.rb +71 -67
  46. data/lib/keycloak-admin/representation/impersonation_redirection_representation.rb +16 -16
  47. data/lib/keycloak-admin/representation/impersonation_representation.rb +43 -43
  48. data/lib/keycloak-admin/representation/member_representation.rb +11 -0
  49. data/lib/keycloak-admin/representation/organization_domain_representation.rb +18 -0
  50. data/lib/keycloak-admin/representation/organization_representation.rb +30 -0
  51. data/lib/keycloak-admin/representation/protocol_mapper_representation.rb +19 -19
  52. data/lib/keycloak-admin/representation/realm_representation.rb +14 -14
  53. data/lib/keycloak-admin/representation/representation.rb +23 -23
  54. data/lib/keycloak-admin/representation/role_representation.rb +19 -19
  55. data/lib/keycloak-admin/representation/session_representation.rb +22 -22
  56. data/lib/keycloak-admin/representation/token_representation.rb +39 -39
  57. data/lib/keycloak-admin/representation/user_representation.rb +47 -47
  58. data/lib/keycloak-admin/resource/base_role_containing_resource.rb +28 -28
  59. data/lib/keycloak-admin/resource/group_resource.rb +11 -11
  60. data/lib/keycloak-admin/resource/user_resource.rb +7 -7
  61. data/lib/keycloak-admin/version.rb +3 -3
  62. data/lib/keycloak-admin.rb +88 -84
  63. data/spec/client/attack_detection_client_spec.rb +102 -102
  64. data/spec/client/client_authz_permission_client_spec.rb +170 -170
  65. data/spec/client/client_authz_policy_client_spec.rb +169 -169
  66. data/spec/client/client_authz_resource_client_spec.rb +150 -150
  67. data/spec/client/client_authz_scope_client_spec.rb +133 -133
  68. data/spec/client/client_client_spec.rb +133 -133
  69. data/spec/client/client_role_mappings_client_spec.rb +82 -82
  70. data/spec/client/client_spec.rb +28 -28
  71. data/spec/client/configurable_token_client_spec.rb +34 -34
  72. data/spec/client/group_client_spec.rb +328 -328
  73. data/spec/client/identity_provider_client_spec.rb +92 -92
  74. data/spec/client/organization_client_spec.rb +595 -0
  75. data/spec/client/realm_client_spec.rb +155 -155
  76. data/spec/client/role_client_spec.rb +79 -79
  77. data/spec/client/role_mapper_client_spec.rb +113 -113
  78. data/spec/client/token_client_spec.rb +68 -68
  79. data/spec/client/user_client_spec.rb +418 -373
  80. data/spec/configuration_spec.rb +113 -113
  81. data/spec/integration/client_authorization_spec.rb +93 -93
  82. data/spec/representation/attack_detection_representation_spec.rb +15 -15
  83. data/spec/representation/client_authz_permission_representation_spec.rb +52 -52
  84. data/spec/representation/client_authz_policy_representation_spec.rb +46 -46
  85. data/spec/representation/client_authz_resource_representation_spec.rb +33 -33
  86. data/spec/representation/client_authz_scope_representation_spec.rb +18 -18
  87. data/spec/representation/client_representation_spec.rb +119 -119
  88. data/spec/representation/credential_representation_spec.rb +68 -0
  89. data/spec/representation/group_representation_spec.rb +22 -22
  90. data/spec/representation/identity_provider_mapper_representation_spec.rb +24 -24
  91. data/spec/representation/identity_provider_representation_spec.rb +113 -113
  92. data/spec/representation/impersonation_representation_spec.rb +163 -163
  93. data/spec/representation/organization_representation_spec.rb +64 -0
  94. data/spec/representation/protocol_mapper_representation_spec.rb +57 -57
  95. data/spec/representation/role_representation_spec.rb +37 -37
  96. data/spec/representation/session_representation_spec.rb +15 -15
  97. data/spec/representation/user_representation_spec.rb +15 -15
  98. data/spec/resource/group_resource_spec.rb +14 -14
  99. data/spec/resource/user_resource_spec.rb +14 -14
  100. data/spec/spec_helper.rb +37 -37
  101. metadata +13 -6
@@ -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
@@ -1,67 +1,71 @@
1
- module KeycloakAdmin
2
- class IdentityProviderRepresentation < Representation
3
- attr_accessor :alias,
4
- :display_name,
5
- :internal_id,
6
- :provider_id,
7
- :enabled,
8
- :update_profile_first_login_mode,
9
- :trust_email,
10
- :store_token,
11
- :add_read_token_role_on_create,
12
- :authenticate_by_default,
13
- :link_only,
14
- :first_broker_login_flow_alias,
15
- :config
16
-
17
- def self.from_hash(hash)
18
- if hash.nil?
19
- nil
20
- else
21
- new(
22
- hash["alias"],
23
- hash["displayName"],
24
- hash["internalId"],
25
- hash["providerId"],
26
- hash["enabled"],
27
- hash["updateProfileFirstLoginMode"],
28
- hash["trustEmail"],
29
- hash["storeToken"],
30
- hash["addReadTokenRoleOnCreate"],
31
- hash["authenticateByDefault"],
32
- hash["linkOnly"],
33
- hash["firstBrokerLoginFlowAlias"],
34
- hash["config"]
35
- )
36
- end
37
- end
38
-
39
- def initialize(alias_name,
40
- display_name,
41
- internal_id,
42
- provider_id,
43
- enabled,
44
- update_profile_first_login_mode,
45
- trust_email,
46
- store_token,
47
- add_read_token_role_on_create,
48
- authenticate_by_default,
49
- link_only,
50
- first_broker_login_flow_alias,
51
- config)
52
- @alias = alias_name
53
- @display_name = display_name
54
- @internal_id = internal_id
55
- @provider_id = provider_id
56
- @enabled = enabled
57
- @update_profile_first_login_mode = update_profile_first_login_mode
58
- @trust_email = trust_email
59
- @store_token = store_token
60
- @add_read_token_role_on_create = add_read_token_role_on_create
61
- @authenticate_by_default = authenticate_by_default
62
- @link_only = link_only
63
- @first_broker_login_flow_alias = first_broker_login_flow_alias
64
- @config = config || {}
65
- end
66
- end
67
- end
1
+ module KeycloakAdmin
2
+ class IdentityProviderRepresentation < Representation
3
+ attr_accessor :alias,
4
+ :display_name,
5
+ :internal_id,
6
+ :provider_id,
7
+ :enabled,
8
+ :update_profile_first_login_mode,
9
+ :trust_email,
10
+ :store_token,
11
+ :add_read_token_role_on_create,
12
+ :authenticate_by_default,
13
+ :link_only,
14
+ :organization_id,
15
+ :first_broker_login_flow_alias,
16
+ :config
17
+
18
+ def self.from_hash(hash)
19
+ if hash.nil?
20
+ nil
21
+ else
22
+ new(
23
+ hash["alias"],
24
+ hash["displayName"],
25
+ hash["internalId"],
26
+ hash["providerId"],
27
+ hash["enabled"],
28
+ hash["updateProfileFirstLoginMode"],
29
+ hash["trustEmail"],
30
+ hash["storeToken"],
31
+ hash["addReadTokenRoleOnCreate"],
32
+ hash["authenticateByDefault"],
33
+ hash["linkOnly"],
34
+ hash["organizationId"],
35
+ hash["firstBrokerLoginFlowAlias"],
36
+ hash["config"]
37
+ )
38
+ end
39
+ end
40
+
41
+ def initialize(alias_name,
42
+ display_name,
43
+ internal_id,
44
+ provider_id,
45
+ enabled,
46
+ update_profile_first_login_mode,
47
+ trust_email,
48
+ store_token,
49
+ add_read_token_role_on_create,
50
+ authenticate_by_default,
51
+ link_only,
52
+ organization_id,
53
+ first_broker_login_flow_alias,
54
+ config)
55
+ @alias = alias_name
56
+ @display_name = display_name
57
+ @internal_id = internal_id
58
+ @provider_id = provider_id
59
+ @enabled = enabled
60
+ @update_profile_first_login_mode = update_profile_first_login_mode
61
+ @trust_email = trust_email
62
+ @store_token = store_token
63
+ @add_read_token_role_on_create = add_read_token_role_on_create
64
+ @authenticate_by_default = authenticate_by_default
65
+ @link_only = link_only
66
+ @organization_id = organization_id
67
+ @first_broker_login_flow_alias = first_broker_login_flow_alias
68
+ @config = config || {}
69
+ end
70
+ end
71
+ end
@@ -1,16 +1,16 @@
1
- module KeycloakAdmin
2
- class ImpersonationRedirectionRepresentation < Representation
3
- attr_reader :headers, :impersonation_url, :http_method, :body
4
-
5
- def initialize(http_method, body, impersonation_url, headers)
6
- @http_method = http_method
7
- @body = body
8
- @impersonation_url = impersonation_url
9
- @headers = headers
10
- end
11
-
12
- def self.from_url(url, headers)
13
- new(:post, {}, url, headers)
14
- end
15
- end
16
- end
1
+ module KeycloakAdmin
2
+ class ImpersonationRedirectionRepresentation < Representation
3
+ attr_reader :headers, :impersonation_url, :http_method, :body
4
+
5
+ def initialize(http_method, body, impersonation_url, headers)
6
+ @http_method = http_method
7
+ @body = body
8
+ @impersonation_url = impersonation_url
9
+ @headers = headers
10
+ end
11
+
12
+ def self.from_url(url, headers)
13
+ new(:post, {}, url, headers)
14
+ end
15
+ end
16
+ end
@@ -1,43 +1,43 @@
1
- require "http-cookie"
2
-
3
- module KeycloakAdmin
4
- class ImpersonationRepresentation < Representation
5
- attr_accessor :set_cookie_strings,
6
- :set_cookies,
7
- :same_realm,
8
- :redirect,
9
- :domain
10
-
11
- def self.from_response(response, origin)
12
- body = JSON.parse(response.body)
13
- representation = new
14
- representation.set_cookie_strings = response.headers[:set_cookie]
15
- representation.set_cookies = representation.set_cookie_strings.map { |set_cookie| parse_set_cookie_string(set_cookie, origin) }
16
- representation.same_realm = body["sameRealm"]
17
- representation.redirect = body["redirect"]
18
- representation.domain = origin
19
- representation
20
- end
21
-
22
- def self.parse_set_cookie_string(set_cookie_string, origin)
23
- HTTP::Cookie.parse(set_cookie_string, origin).first
24
- end
25
-
26
- def cookies_to_rails_hash
27
- @set_cookies.map do |cookie|
28
- rails_cookie = {
29
- name: cookie.name,
30
- value: cookie.value,
31
- httponly: cookie.httponly,
32
- expires: cookie.expires,
33
- path: cookie.path,
34
- domain: cookie.domain
35
- }
36
-
37
- rails_cookie[:max_age] = cookie.max_age if cookie.max_age
38
- rails_cookie[:secure] = cookie.secure if cookie.secure
39
- rails_cookie
40
- end
41
- end
42
- end
43
- end
1
+ require "http-cookie"
2
+
3
+ module KeycloakAdmin
4
+ class ImpersonationRepresentation < Representation
5
+ attr_accessor :set_cookie_strings,
6
+ :set_cookies,
7
+ :same_realm,
8
+ :redirect,
9
+ :domain
10
+
11
+ def self.from_response(response, origin)
12
+ body = JSON.parse(response.body)
13
+ representation = new
14
+ representation.set_cookie_strings = response.headers[:set_cookie]
15
+ representation.set_cookies = representation.set_cookie_strings.map { |set_cookie| parse_set_cookie_string(set_cookie, origin) }
16
+ representation.same_realm = body["sameRealm"]
17
+ representation.redirect = body["redirect"]
18
+ representation.domain = origin
19
+ representation
20
+ end
21
+
22
+ def self.parse_set_cookie_string(set_cookie_string, origin)
23
+ HTTP::Cookie.parse(set_cookie_string, origin).first
24
+ end
25
+
26
+ def cookies_to_rails_hash
27
+ @set_cookies.map do |cookie|
28
+ rails_cookie = {
29
+ name: cookie.name,
30
+ value: cookie.value,
31
+ httponly: cookie.httponly,
32
+ expires: cookie.expires,
33
+ path: cookie.path,
34
+ domain: cookie.domain
35
+ }
36
+
37
+ rails_cookie[:max_age] = cookie.max_age if cookie.max_age
38
+ rails_cookie[:secure] = cookie.secure if cookie.secure
39
+ rails_cookie
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,11 @@
1
+ module KeycloakAdmin
2
+ class MemberRepresentation < UserRepresentation
3
+ attr_accessor :membership_type
4
+
5
+ def self.from_hash(hash)
6
+ member = super(hash)
7
+ member.membership_type = hash["membershipType"]
8
+ member
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ module KeycloakAdmin
2
+ class OrganizationDomainRepresentation < Representation
3
+ attr_accessor :name, :verified
4
+
5
+ def initialize(name, verified)
6
+ @name = name
7
+ @verified = verified
8
+ end
9
+
10
+ def self.from_hash(hash)
11
+ new(hash["name"], hash["verified"])
12
+ end
13
+ end
14
+ end
15
+
16
+
17
+
18
+
@@ -0,0 +1,30 @@
1
+ module KeycloakAdmin
2
+ class OrganizationRepresentation < Representation
3
+ attr_accessor :id,
4
+ :name,
5
+ :alias,
6
+ :enabled,
7
+ :description,
8
+ :redirect_url,
9
+ :attributes,
10
+ :domains,
11
+ :members,
12
+ :attributes,
13
+ :identity_providers
14
+
15
+ def self.from_hash(hash)
16
+ role = new
17
+ role.id = hash["id"]
18
+ role.name = hash["name"]
19
+ role.alias = hash["alias"]
20
+ role.enabled = hash["enabled"]
21
+ role.description = hash["description"]
22
+ role.redirect_url = hash["redirectUrl"]
23
+ role.attributes = hash["attributes"] || {}
24
+ role.domains = hash["domains"].nil? ? [] : hash["domains"].map { |domain| KeycloakAdmin::OrganizationDomainRepresentation.from_hash(domain) }
25
+ role.members = hash["members"].nil? ? [] : hash["members"].map { |member| KeycloakAdmin::MemberRepresentation.from_hash(member) }
26
+ role.identity_providers = hash["identityProviders"].nil? ? [] : hash["identityProviders"].map { |provider| KeycloakAdmin::IdentityProviderRepresentation.from_hash(provider) }
27
+ role
28
+ end
29
+ end
30
+ end
@@ -1,19 +1,19 @@
1
- module KeycloakAdmin
2
- class ProtocolMapperRepresentation < Representation
3
- attr_accessor :config,
4
- :id,
5
- :name,
6
- :protocol,
7
- :protocolMapper
8
-
9
- def self.from_hash(hash)
10
- rep = new
11
- rep.id = hash["id"]
12
- rep.config = hash["config"]
13
- rep.name = hash["name"]
14
- rep.protocol = hash["protocol"]
15
- rep.protocolMapper = hash["protocolMapper"]
16
- rep
17
- end
18
- end
19
- end
1
+ module KeycloakAdmin
2
+ class ProtocolMapperRepresentation < Representation
3
+ attr_accessor :config,
4
+ :id,
5
+ :name,
6
+ :protocol,
7
+ :protocolMapper
8
+
9
+ def self.from_hash(hash)
10
+ rep = new
11
+ rep.id = hash["id"]
12
+ rep.config = hash["config"]
13
+ rep.name = hash["name"]
14
+ rep.protocol = hash["protocol"]
15
+ rep.protocolMapper = hash["protocolMapper"]
16
+ rep
17
+ end
18
+ end
19
+ end
@@ -1,14 +1,14 @@
1
- module KeycloakAdmin
2
- class RealmRepresentation < Representation
3
- attr_accessor :id,
4
- :realm
5
- # TODO: Add more attributes
6
-
7
- def self.from_hash(hash)
8
- realm = new
9
- realm.id = hash["id"]
10
- realm.realm = hash["realm"]
11
- realm
12
- end
13
- end
14
- end
1
+ module KeycloakAdmin
2
+ class RealmRepresentation < Representation
3
+ attr_accessor :id,
4
+ :realm
5
+ # TODO: Add more attributes
6
+
7
+ def self.from_hash(hash)
8
+ realm = new
9
+ realm.id = hash["id"]
10
+ realm.realm = hash["realm"]
11
+ realm
12
+ end
13
+ end
14
+ end
@@ -1,23 +1,23 @@
1
- require "json"
2
- require_relative "camel_json"
3
-
4
- class Representation
5
- include ::KeycloakAdmin::CamelJson
6
-
7
- def as_json(options=nil)
8
- Hash[instance_variables.map { |ivar| [ivar.to_s[1..-1], instance_variable_get(ivar)] }]
9
- end
10
-
11
- def to_json(options=nil)
12
- snaked_hash = as_json(options)
13
- snaked_hash.keys.reduce({}) do |camelized_hash, key|
14
- camelized_hash[camelize(key, false)] = snaked_hash[key]
15
- camelized_hash
16
- end.to_json(options)
17
- end
18
-
19
- def self.from_json(json)
20
- hash = JSON.parse(json)
21
- from_hash(hash)
22
- end
23
- end
1
+ require "json"
2
+ require_relative "camel_json"
3
+
4
+ class Representation
5
+ include ::KeycloakAdmin::CamelJson
6
+
7
+ def as_json(options=nil)
8
+ Hash[instance_variables.map { |ivar| [ivar.to_s[1..-1], instance_variable_get(ivar)] }]
9
+ end
10
+
11
+ def to_json(options=nil)
12
+ snaked_hash = as_json(options)
13
+ snaked_hash.keys.reduce({}) do |camelized_hash, key|
14
+ camelized_hash[camelize(key, false)] = snaked_hash[key]
15
+ camelized_hash
16
+ end.to_json(options)
17
+ end
18
+
19
+ def self.from_json(json)
20
+ hash = JSON.parse(json)
21
+ from_hash(hash)
22
+ end
23
+ end
@@ -1,19 +1,19 @@
1
- module KeycloakAdmin
2
- class RoleRepresentation < Representation
3
- attr_accessor :id,
4
- :name,
5
- :composite,
6
- :client_role,
7
- :container_id,
8
-
9
- def self.from_hash(hash)
10
- role = new
11
- role.id = hash["id"]
12
- role.name = hash["name"]
13
- role.composite = hash["composite"]
14
- role.client_role = hash["clientRole"]
15
- role.container_id = hash["containerId"]
16
- role
17
- end
18
- end
19
- end
1
+ module KeycloakAdmin
2
+ class RoleRepresentation < Representation
3
+ attr_accessor :id,
4
+ :name,
5
+ :composite,
6
+ :client_role,
7
+ :container_id,
8
+
9
+ def self.from_hash(hash)
10
+ role = new
11
+ role.id = hash["id"]
12
+ role.name = hash["name"]
13
+ role.composite = hash["composite"]
14
+ role.client_role = hash["clientRole"]
15
+ role.container_id = hash["containerId"]
16
+ role
17
+ end
18
+ end
19
+ end
@@ -1,23 +1,23 @@
1
- module KeycloakAdmin
2
- class SessionRepresentation < Representation
3
- attr_accessor :id,
4
- :username,
5
- :user_id,
6
- :ip_address,
7
- :start,
8
- :last_access,
9
- :remember_me,
10
-
11
- def self.from_hash(hash)
12
- rep = new
13
- rep.id = hash["id"]
14
- rep.username = hash["username"]
15
- rep.user_id = hash["userId"]
16
- rep.ip_address = hash["ipAddress"]
17
- rep.start = hash["start"]
18
- rep.last_access = hash["lastAccess"]
19
- rep.remember_me = hash["rememberMe"]
20
- rep
21
- end
22
- end
1
+ module KeycloakAdmin
2
+ class SessionRepresentation < Representation
3
+ attr_accessor :id,
4
+ :username,
5
+ :user_id,
6
+ :ip_address,
7
+ :start,
8
+ :last_access,
9
+ :remember_me,
10
+
11
+ def self.from_hash(hash)
12
+ rep = new
13
+ rep.id = hash["id"]
14
+ rep.username = hash["username"]
15
+ rep.user_id = hash["userId"]
16
+ rep.ip_address = hash["ipAddress"]
17
+ rep.start = hash["start"]
18
+ rep.last_access = hash["lastAccess"]
19
+ rep.remember_me = hash["rememberMe"]
20
+ rep
21
+ end
22
+ end
23
23
  end
@@ -1,39 +1,39 @@
1
-
2
- module KeycloakAdmin
3
- class TokenRepresentation < Representation
4
- attr_accessor :access_token,
5
- :token_type,
6
- :expires_in,
7
- :refresh_token,
8
- :refresh_expires_in,
9
- :id_token,
10
- :not_before_policy,
11
- :session_state
12
-
13
- def initialize(access_token, token_type, expires_in, refresh_token, refresh_expires_in, id_token, not_before_policy, session_state)
14
- @access_token = access_token
15
- @token_type = token_type
16
- @expires_in = expires_in
17
- @refresh_token = refresh_token
18
- @refresh_expires_in = refresh_expires_in
19
- @id_token = id_token
20
- @not_before_policy = not_before_policy
21
- @session_state = session_state
22
- end
23
-
24
- def self.from_hash(hash)
25
- new(
26
- hash["access_token"],
27
- hash["token_type"],
28
- hash["expires_in"],
29
- hash["refresh_token"],
30
- hash["refresh_expires_in"],
31
- hash["id_token"],
32
- hash["not-before-policy"],
33
- hash["session_state"],
34
- )
35
- end
36
- end
37
- end
38
-
39
-
1
+
2
+ module KeycloakAdmin
3
+ class TokenRepresentation < Representation
4
+ attr_accessor :access_token,
5
+ :token_type,
6
+ :expires_in,
7
+ :refresh_token,
8
+ :refresh_expires_in,
9
+ :id_token,
10
+ :not_before_policy,
11
+ :session_state
12
+
13
+ def initialize(access_token, token_type, expires_in, refresh_token, refresh_expires_in, id_token, not_before_policy, session_state)
14
+ @access_token = access_token
15
+ @token_type = token_type
16
+ @expires_in = expires_in
17
+ @refresh_token = refresh_token
18
+ @refresh_expires_in = refresh_expires_in
19
+ @id_token = id_token
20
+ @not_before_policy = not_before_policy
21
+ @session_state = session_state
22
+ end
23
+
24
+ def self.from_hash(hash)
25
+ new(
26
+ hash["access_token"],
27
+ hash["token_type"],
28
+ hash["expires_in"],
29
+ hash["refresh_token"],
30
+ hash["refresh_expires_in"],
31
+ hash["id_token"],
32
+ hash["not-before-policy"],
33
+ hash["session_state"],
34
+ )
35
+ end
36
+ end
37
+ end
38
+
39
+