keycloak-admin 2.0.1 → 2.0.3

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 (115) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +40 -0
  3. data/MIT-LICENSE +18 -17
  4. data/README.md +102 -5
  5. data/keycloak-admin.gemspec +15 -6
  6. data/lib/keycloak-admin/client/attack_detection_client.rb +2 -1
  7. data/lib/keycloak-admin/client/client.rb +36 -11
  8. data/lib/keycloak-admin/client/client_authz_permission_client.rb +5 -4
  9. data/lib/keycloak-admin/client/client_authz_policy_client.rb +4 -3
  10. data/lib/keycloak-admin/client/client_authz_resource_client.rb +15 -11
  11. data/lib/keycloak-admin/client/client_authz_scope_client.rb +5 -4
  12. data/lib/keycloak-admin/client/client_client.rb +6 -2
  13. data/lib/keycloak-admin/client/client_role_client.rb +2 -1
  14. data/lib/keycloak-admin/client/client_role_mappings_client.rb +3 -2
  15. data/lib/keycloak-admin/client/client_scope_client.rb +2 -1
  16. data/lib/keycloak-admin/client/client_scope_protocol_mapper_client.rb +3 -2
  17. data/lib/keycloak-admin/client/configurable_token_client.rb +2 -1
  18. data/lib/keycloak-admin/client/group_client.rb +15 -9
  19. data/lib/keycloak-admin/client/identity_provider_client.rb +2 -1
  20. data/lib/keycloak-admin/client/organization_client.rb +12 -11
  21. data/lib/keycloak-admin/client/realm_client.rb +3 -2
  22. data/lib/keycloak-admin/client/resource.rb +8 -6
  23. data/lib/keycloak-admin/client/response.rb +1 -0
  24. data/lib/keycloak-admin/client/role_client.rb +3 -6
  25. data/lib/keycloak-admin/client/role_mapper_client.rb +2 -1
  26. data/lib/keycloak-admin/client/token_client.rb +1 -0
  27. data/lib/keycloak-admin/client/user_client.rb +70 -47
  28. data/lib/keycloak-admin/configuration.rb +37 -2
  29. data/lib/keycloak-admin/error.rb +63 -0
  30. data/lib/keycloak-admin/path_encoding.rb +24 -0
  31. data/lib/keycloak-admin/representation/attack_detection_representation.rb +1 -0
  32. data/lib/keycloak-admin/representation/camel_json.rb +7 -3
  33. data/lib/keycloak-admin/representation/client_authz_policy_config_representation.rb +1 -0
  34. data/lib/keycloak-admin/representation/client_authz_policy_representation.rb +1 -0
  35. data/lib/keycloak-admin/representation/client_authz_resource_representation.rb +1 -0
  36. data/lib/keycloak-admin/representation/client_authz_scope_representation.rb +1 -0
  37. data/lib/keycloak-admin/representation/client_representation.rb +4 -5
  38. data/lib/keycloak-admin/representation/client_scope_representation.rb +1 -0
  39. data/lib/keycloak-admin/representation/credential_representation.rb +1 -0
  40. data/lib/keycloak-admin/representation/federated_identity_representation.rb +1 -0
  41. data/lib/keycloak-admin/representation/group_representation.rb +1 -0
  42. data/lib/keycloak-admin/representation/identity_provider_mapper_representation.rb +1 -0
  43. data/lib/keycloak-admin/representation/identity_provider_representation.rb +1 -0
  44. data/lib/keycloak-admin/representation/impersonation_redirection_representation.rb +1 -0
  45. data/lib/keycloak-admin/representation/impersonation_representation.rb +1 -0
  46. data/lib/keycloak-admin/representation/member_representation.rb +1 -0
  47. data/lib/keycloak-admin/representation/organization_domain_representation.rb +1 -0
  48. data/lib/keycloak-admin/representation/organization_representation.rb +1 -1
  49. data/lib/keycloak-admin/representation/protocol_mapper_representation.rb +1 -0
  50. data/lib/keycloak-admin/representation/realm_representation.rb +1 -0
  51. data/lib/keycloak-admin/representation/representation.rb +7 -5
  52. data/lib/keycloak-admin/representation/role_representation.rb +2 -1
  53. data/lib/keycloak-admin/representation/session_representation.rb +2 -1
  54. data/lib/keycloak-admin/representation/token_representation.rb +1 -0
  55. data/lib/keycloak-admin/representation/user_representation.rb +1 -0
  56. data/lib/keycloak-admin/resource/base_role_containing_resource.rb +4 -1
  57. data/lib/keycloak-admin/resource/group_resource.rb +1 -0
  58. data/lib/keycloak-admin/resource/user_resource.rb +1 -0
  59. data/lib/keycloak-admin/version.rb +2 -1
  60. data/lib/keycloak-admin.rb +4 -0
  61. metadata +36 -56
  62. data/.github/workflows/Dockerfile +0 -24
  63. data/.github/workflows/ci.yml +0 -94
  64. data/.github/workflows/release.yml +0 -112
  65. data/.gitignore +0 -10
  66. data/.rspec +0 -2
  67. data/Dockerfile +0 -13
  68. data/Gemfile +0 -3
  69. data/Gemfile.lock +0 -54
  70. data/Rakefile +0 -6
  71. data/bin/console +0 -9
  72. data/spec/client/attack_detection_client_spec.rb +0 -102
  73. data/spec/client/client_authz_permission_client_spec.rb +0 -170
  74. data/spec/client/client_authz_policy_client_spec.rb +0 -170
  75. data/spec/client/client_authz_resource_client_spec.rb +0 -150
  76. data/spec/client/client_authz_scope_client_spec.rb +0 -134
  77. data/spec/client/client_client_spec.rb +0 -133
  78. data/spec/client/client_role_mappings_client_spec.rb +0 -83
  79. data/spec/client/client_scope_client_spec.rb +0 -220
  80. data/spec/client/client_scope_protocol_mapper_client_spec.rb +0 -230
  81. data/spec/client/client_spec.rb +0 -101
  82. data/spec/client/configurable_token_client_spec.rb +0 -34
  83. data/spec/client/group_client_spec.rb +0 -328
  84. data/spec/client/identity_provider_client_spec.rb +0 -92
  85. data/spec/client/organization_client_spec.rb +0 -595
  86. data/spec/client/realm_client_spec.rb +0 -155
  87. data/spec/client/resource_spec.rb +0 -223
  88. data/spec/client/response_spec.rb +0 -68
  89. data/spec/client/role_client_spec.rb +0 -79
  90. data/spec/client/role_mapper_client_spec.rb +0 -113
  91. data/spec/client/token_client_spec.rb +0 -68
  92. data/spec/client/user_client_spec.rb +0 -418
  93. data/spec/configuration_spec.rb +0 -150
  94. data/spec/gemspec_spec.rb +0 -25
  95. data/spec/integration/client_authorization_spec.rb +0 -93
  96. data/spec/representation/attack_detection_representation_spec.rb +0 -16
  97. data/spec/representation/client_authz_permission_representation_spec.rb +0 -52
  98. data/spec/representation/client_authz_policy_representation_spec.rb +0 -47
  99. data/spec/representation/client_authz_resource_representation_spec.rb +0 -33
  100. data/spec/representation/client_authz_scope_representation_spec.rb +0 -19
  101. data/spec/representation/client_representation_spec.rb +0 -119
  102. data/spec/representation/client_scope_representation_spec.rb +0 -125
  103. data/spec/representation/credential_representation_spec.rb +0 -68
  104. data/spec/representation/group_representation_spec.rb +0 -22
  105. data/spec/representation/identity_provider_mapper_representation_spec.rb +0 -24
  106. data/spec/representation/identity_provider_representation_spec.rb +0 -113
  107. data/spec/representation/impersonation_representation_spec.rb +0 -163
  108. data/spec/representation/organization_representation_spec.rb +0 -64
  109. data/spec/representation/protocol_mapper_representation_spec.rb +0 -57
  110. data/spec/representation/role_representation_spec.rb +0 -37
  111. data/spec/representation/session_representation_spec.rb +0 -16
  112. data/spec/representation/user_representation_spec.rb +0 -15
  113. data/spec/resource/group_resource_spec.rb +0 -14
  114. data/spec/resource/user_resource_spec.rb +0 -14
  115. data/spec/spec_helper.rb +0 -36
@@ -1,11 +1,15 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  module CamelJson
3
4
 
4
5
  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 }
6
+ word = lower_case_and_underscored_word.to_s
7
+ if word.empty?
8
+ word
9
+ elsif first_letter_in_uppercase
10
+ word.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
7
11
  else
8
- lower_case_and_underscored_word[0] + camelize(lower_case_and_underscored_word)[1..-1]
12
+ word[0] + camelize(word)[1..-1]
9
13
  end
10
14
  end
11
15
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class ClientAuthzPolicyConfigRepresentation < Representation
3
4
  attr_accessor :roles,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class ClientAuthzPolicyRepresentation < Representation
3
4
  attr_accessor :id,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
 
3
4
  class ClientAuthzResourceRepresentation < Representation
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class ClientAuthzScopeRepresentation < Representation
3
4
  attr_accessor :id,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class ClientRepresentation < Representation
3
4
  attr_accessor :id,
@@ -26,7 +27,6 @@ module KeycloakAdmin
26
27
  :authentication_flow_binding_overrides,
27
28
  :full_scope_allowed,
28
29
  :node_re_registration_timeout,
29
- :attributes,
30
30
  :protocol_mappers,
31
31
  :default_client_scopes,
32
32
  :optional_client_scopes,
@@ -41,9 +41,9 @@ module KeycloakAdmin
41
41
  client.client_authenticator_type = hash["clientAuthenticatorType"]
42
42
  client.always_display_in_console = hash["alwaysDisplayInConsole"] || false
43
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
44
+ client.redirect_uris = hash["redirectUris"] || []
45
+ client.web_origins = hash["webOrigins"] || []
46
+ client.not_before = hash["notBefore"] || 0
47
47
  client.bearer_only = hash["bearerOnly"] || false
48
48
  client.consent_required = hash["consentRequired"] || false
49
49
  client.standard_flow_enabled = hash["standardFlowEnabled"] || false
@@ -60,7 +60,6 @@ module KeycloakAdmin
60
60
  client.authentication_flow_binding_overrides = hash["authenticationFlowBindingOverrides"] || {}
61
61
  client.full_scope_allowed = hash["fullScopeAllowed"] || false
62
62
  client.node_re_registration_timeout = hash["nodeReRegistrationTimeout"] || -1
63
- client.attributes = hash["attributes"]
64
63
  client.protocol_mappers = (hash["protocolMappers"] || []).map { |protocol_mapper_hash| ProtocolMapperRepresentation.from_hash(protocol_mapper_hash) }
65
64
  client.default_client_scopes = hash["defaultClientScopes"] || []
66
65
  client.optional_client_scopes = hash["optionalClientScopes"] || []
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class ClientScopeRepresentation < Representation
3
4
  attr_accessor :id,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class CredentialRepresentation < Representation
3
4
  attr_accessor :id,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class FederatedIdentityRepresentation < Representation
3
4
  attr_accessor :identity_provider,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class GroupRepresentation < Representation
3
4
  attr_accessor :id,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class IdentityProviderMapperRepresentation < Representation
3
4
  attr_accessor :id,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class IdentityProviderRepresentation < Representation
3
4
  attr_accessor :alias,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class ImpersonationRedirectionRepresentation < Representation
3
4
  attr_reader :headers, :impersonation_url, :http_method, :body
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "http-cookie"
2
3
 
3
4
  module KeycloakAdmin
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class MemberRepresentation < UserRepresentation
3
4
  attr_accessor :membership_type
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class OrganizationDomainRepresentation < Representation
3
4
  attr_accessor :name, :verified
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class OrganizationRepresentation < Representation
3
4
  attr_accessor :id,
@@ -9,7 +10,6 @@ module KeycloakAdmin
9
10
  :attributes,
10
11
  :domains,
11
12
  :members,
12
- :attributes,
13
13
  :identity_providers
14
14
 
15
15
  def self.from_hash(hash)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class ProtocolMapperRepresentation < Representation
3
4
  attr_accessor :config,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class RealmRepresentation < Representation
3
4
  attr_accessor :id,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "json"
2
3
  require_relative "camel_json"
3
4
 
@@ -5,14 +6,15 @@ class Representation
5
6
  include ::KeycloakAdmin::CamelJson
6
7
 
7
8
  def as_json(options=nil)
8
- Hash[instance_variables.map { |ivar| [ivar.to_s[1..-1], instance_variable_get(ivar)] }]
9
+ instance_variables.each_with_object({}) do |ivar, hash|
10
+ val = instance_variable_get(ivar)
11
+ hash[ivar.to_s[1..-1]] = val unless val.nil?
12
+ end
9
13
  end
10
14
 
11
15
  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
+ as_json(options).each_with_object({}) do |(key, val), hash|
17
+ hash[camelize(key, false)] = val
16
18
  end.to_json(options)
17
19
  end
18
20
 
@@ -1,10 +1,11 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class RoleRepresentation < Representation
3
4
  attr_accessor :id,
4
5
  :name,
5
6
  :composite,
6
7
  :client_role,
7
- :container_id,
8
+ :container_id
8
9
 
9
10
  def self.from_hash(hash)
10
11
  role = new
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class SessionRepresentation < Representation
3
4
  attr_accessor :id,
@@ -6,7 +7,7 @@ module KeycloakAdmin
6
7
  :ip_address,
7
8
  :start,
8
9
  :last_access,
9
- :remember_me,
10
+ :remember_me
10
11
 
11
12
  def self.from_hash(hash)
12
13
  rep = new
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  module KeycloakAdmin
3
4
  class TokenRepresentation < Representation
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class UserRepresentation < Representation
3
4
  attr_accessor :id,
@@ -1,5 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class BaseRoleContainingResource
4
+ include PathEncoding
5
+
3
6
  attr_reader :resource_id
4
7
 
5
8
  def initialize(configuration, realm_client, resource_id)
@@ -14,7 +17,7 @@ module KeycloakAdmin
14
17
  end
15
18
 
16
19
  def resource_url
17
- "#{@realm_client.realm_admin_url}/#{resources_name}/#{@resource_id}"
20
+ "#{@realm_client.realm_admin_url}/#{resources_name}/#{encode_segment(@resource_id)}"
18
21
  end
19
22
 
20
23
  def client_role_mappings(client_id)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class GroupResource < BaseRoleContainingResource
3
4
  def resources_name
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
3
  class UserResource < BaseRoleContainingResource
3
4
  def resources_name
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module KeycloakAdmin
2
- VERSION = "2.0.1"
3
+ VERSION = "2.0.3"
3
4
  end
@@ -1,5 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  require "logger"
2
3
 
4
+ require_relative "keycloak-admin/error"
5
+ require_relative "keycloak-admin/path_encoding"
3
6
  require_relative "keycloak-admin/configuration"
4
7
  require_relative "keycloak-admin/client/response"
5
8
  require_relative "keycloak-admin/client/resource"
@@ -86,6 +89,7 @@ module KeycloakAdmin
86
89
  config.username = nil
87
90
  config.password = nil
88
91
  config.faraday_options = {}
92
+ config.faraday_adapter = nil
89
93
  end
90
94
  end
91
95
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keycloak-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorent Lempereur
@@ -99,6 +99,34 @@ dependencies:
99
99
  - - ">="
100
100
  - !ruby/object:Gem::Version
101
101
  version: '13.0'
102
+ - !ruby/object:Gem::Dependency
103
+ name: webmock
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '3.0'
109
+ type: :development
110
+ prerelease: false
111
+ version_requirements: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '3.0'
116
+ - !ruby/object:Gem::Dependency
117
+ name: bundler-audit
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '0.9'
123
+ type: :development
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '0.9'
102
130
  description: Keycloak Admin REST API client written in Ruby
103
131
  email:
104
132
  - lorent.lempereur.dev@gmail.com
@@ -106,19 +134,9 @@ executables: []
106
134
  extensions: []
107
135
  extra_rdoc_files: []
108
136
  files:
109
- - ".github/workflows/Dockerfile"
110
- - ".github/workflows/ci.yml"
111
- - ".github/workflows/release.yml"
112
- - ".gitignore"
113
- - ".rspec"
114
137
  - CHANGELOG.md
115
- - Dockerfile
116
- - Gemfile
117
- - Gemfile.lock
118
138
  - MIT-LICENSE
119
139
  - README.md
120
- - Rakefile
121
- - bin/console
122
140
  - keycloak-admin.gemspec
123
141
  - lib/keycloak-admin.rb
124
142
  - lib/keycloak-admin/client/attack_detection_client.rb
@@ -144,6 +162,8 @@ files:
144
162
  - lib/keycloak-admin/client/token_client.rb
145
163
  - lib/keycloak-admin/client/user_client.rb
146
164
  - lib/keycloak-admin/configuration.rb
165
+ - lib/keycloak-admin/error.rb
166
+ - lib/keycloak-admin/path_encoding.rb
147
167
  - lib/keycloak-admin/representation/attack_detection_representation.rb
148
168
  - lib/keycloak-admin/representation/camel_json.rb
149
169
  - lib/keycloak-admin/representation/client_authz_permission_representation.rb
@@ -174,54 +194,14 @@ files:
174
194
  - lib/keycloak-admin/resource/group_resource.rb
175
195
  - lib/keycloak-admin/resource/user_resource.rb
176
196
  - lib/keycloak-admin/version.rb
177
- - spec/client/attack_detection_client_spec.rb
178
- - spec/client/client_authz_permission_client_spec.rb
179
- - spec/client/client_authz_policy_client_spec.rb
180
- - spec/client/client_authz_resource_client_spec.rb
181
- - spec/client/client_authz_scope_client_spec.rb
182
- - spec/client/client_client_spec.rb
183
- - spec/client/client_role_mappings_client_spec.rb
184
- - spec/client/client_scope_client_spec.rb
185
- - spec/client/client_scope_protocol_mapper_client_spec.rb
186
- - spec/client/client_spec.rb
187
- - spec/client/configurable_token_client_spec.rb
188
- - spec/client/group_client_spec.rb
189
- - spec/client/identity_provider_client_spec.rb
190
- - spec/client/organization_client_spec.rb
191
- - spec/client/realm_client_spec.rb
192
- - spec/client/resource_spec.rb
193
- - spec/client/response_spec.rb
194
- - spec/client/role_client_spec.rb
195
- - spec/client/role_mapper_client_spec.rb
196
- - spec/client/token_client_spec.rb
197
- - spec/client/user_client_spec.rb
198
- - spec/configuration_spec.rb
199
- - spec/gemspec_spec.rb
200
- - spec/integration/client_authorization_spec.rb
201
- - spec/representation/attack_detection_representation_spec.rb
202
- - spec/representation/client_authz_permission_representation_spec.rb
203
- - spec/representation/client_authz_policy_representation_spec.rb
204
- - spec/representation/client_authz_resource_representation_spec.rb
205
- - spec/representation/client_authz_scope_representation_spec.rb
206
- - spec/representation/client_representation_spec.rb
207
- - spec/representation/client_scope_representation_spec.rb
208
- - spec/representation/credential_representation_spec.rb
209
- - spec/representation/group_representation_spec.rb
210
- - spec/representation/identity_provider_mapper_representation_spec.rb
211
- - spec/representation/identity_provider_representation_spec.rb
212
- - spec/representation/impersonation_representation_spec.rb
213
- - spec/representation/organization_representation_spec.rb
214
- - spec/representation/protocol_mapper_representation_spec.rb
215
- - spec/representation/role_representation_spec.rb
216
- - spec/representation/session_representation_spec.rb
217
- - spec/representation/user_representation_spec.rb
218
- - spec/resource/group_resource_spec.rb
219
- - spec/resource/user_resource_spec.rb
220
- - spec/spec_helper.rb
221
197
  homepage: https://github.com/looorent/keycloak-admin-ruby
222
198
  licenses:
223
199
  - MIT
224
- metadata: {}
200
+ metadata:
201
+ source_code_uri: https://github.com/looorent/keycloak-admin-ruby
202
+ changelog_uri: https://github.com/looorent/keycloak-admin-ruby/blob/main/CHANGELOG.md
203
+ bug_tracker_uri: https://github.com/looorent/keycloak-admin-ruby/issues
204
+ rubygems_mfa_required: 'true'
225
205
  rdoc_options: []
226
206
  require_paths:
227
207
  - lib
@@ -1,24 +0,0 @@
1
- ### Dockerfile for: tillawy/keycloak-github-actions
2
- ##
3
- ## To build & push
4
- # docker buildx build . --platform linux/amd64 -t tillawy/keycloak-github-actions:25.0.1
5
- # docker push tillawy/keycloak-github-actions:25.0.1
6
- #
7
- ## To Run Locally
8
- # docker run \
9
- # --rm \
10
- # -p 8080:8080 \
11
- # -e KEYCLOAK_ADMIN="admin" \
12
- # -e KEYCLOAK_ADMIN_PASSWORD="admin" \
13
- # -e KC_HOSTNAME="http://localhost:8080" \
14
- # -e KC_HOSTNAME_ADMIN="http://localhost:8080" \
15
- # -e KC_HTTP_ENABLED="true" \
16
- # -e KC_DB="dev-file" \
17
- # tillawy/keycloak-github-actions:25.0.1
18
-
19
- FROM quay.io/keycloak/keycloak:25.0.1
20
-
21
- ENTRYPOINT ["/opt/keycloak/bin/kc.sh"]
22
-
23
- CMD ["start-dev", "--hostname=http://localhost:8080" , "--hostname-admin=http://localhost:8080" , "--http-enabled=true", "--verbose"]
24
-
@@ -1,94 +0,0 @@
1
- # This workflow uses actions that are not certified by GitHub.
2
- # They are provided by a third-party and are governed by
3
- # separate terms of service, privacy policy, and support
4
- # documentation.
5
- # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
- # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
-
8
- name: Ruby
9
-
10
- on:
11
- push:
12
- branches: [ "main" ]
13
- pull_request:
14
- branches: [ "main" ]
15
-
16
- permissions:
17
- contents: read
18
-
19
- jobs:
20
- test:
21
- name: Ruby ${{ matrix.ruby-version }}
22
- runs-on: ubuntu-24.04
23
-
24
- strategy:
25
- fail-fast: false
26
- matrix:
27
- ruby-version: ['3.1', '3.2', '3.3', '3.4']
28
-
29
- steps:
30
- - name: Start Keycloak
31
- run: |
32
- docker run -d --name keycloak -p 8080:8080 \
33
- -e KC_BOOTSTRAP_ADMIN_USERNAME=admin \
34
- -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin \
35
- -e KC_HOSTNAME=http://localhost:8080 \
36
- -e KC_HOSTNAME_ADMIN=http://localhost:8080 \
37
- -e KC_HTTP_ENABLED=true \
38
- -e KC_DB=dev-file \
39
- quay.io/keycloak/keycloak:26.7.0 \
40
- start-dev
41
-
42
- - name: Wait for Keycloak to be ready
43
- run: |
44
- for i in $(seq 1 30); do
45
- if curl --silent --fail http://localhost:8080/realms/master > /dev/null; then
46
- echo "Keycloak is ready"
47
- exit 0
48
- fi
49
- sleep 5
50
- done
51
- echo "Keycloak did not become ready in time"
52
- docker logs keycloak
53
- exit 1
54
-
55
- - name: create realm
56
- run: |
57
- TOKEN=$(curl --silent --location --request POST "http://localhost:8080/realms/master/protocol/openid-connect/token" \
58
- --header 'Content-Type: application/x-www-form-urlencoded' \
59
- --data-urlencode 'grant_type=password' \
60
- --data-urlencode 'username=admin' \
61
- --data-urlencode 'password=admin' \
62
- --data-urlencode 'client_id=admin-cli' | jq -r '.access_token')
63
-
64
- curl --silent --show-error -L -X POST "http://localhost:8080/admin/realms" \
65
- --header "Content-Type: application/json" \
66
- --header "Authorization: Bearer ${TOKEN}" \
67
- --data '{"realm":"dummy","enabled":true}'
68
-
69
- curl --silent --show-error --request POST 'http://localhost:8080/admin/realms/dummy/clients' \
70
- --header 'Authorization: Bearer '$TOKEN \
71
- --header 'Content-Type: application/json' \
72
- --data-raw '{
73
- "clientId":"dummy-client",
74
- "enabled":true,
75
- "consentRequired": false,
76
- "attributes":{},
77
- "serviceAccountsEnabled": true,
78
- "protocol":"openid-connect",
79
- "publicClient":false,
80
- "authorizationServicesEnabled": true,
81
- "clientAuthenticatorType":"client-secret",
82
- "redirectUris":["http://localhost:8180/demo"]
83
- }'
84
-
85
- - uses: actions/checkout@v6
86
- - name: Set up Ruby
87
- uses: ruby/setup-ruby@v1
88
- with:
89
- ruby-version: ${{ matrix.ruby-version }}
90
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
91
- - name: Run tests
92
- run: bundle exec rspec
93
- env:
94
- GITHUB_ACTIONS: true
@@ -1,112 +0,0 @@
1
- name: Release
2
-
3
- # Publishing is triggered by pushing a version tag, e.g.:
4
- # git tag -a v1.2.0 -m "Version 1.2.0" && git push origin v1.2.0
5
- #
6
- # No RubyGems API key is stored in this repository: the gem is pushed through
7
- # RubyGems' Trusted Publishing, which exchanges a short-lived GitHub OIDC token
8
- # for a scoped RubyGems credential. This requires a trusted publisher declared on
9
- # https://rubygems.org/gems/keycloak-admin pointing to this repository, this
10
- # workflow file name and the 'release' environment.
11
- on:
12
- push:
13
- tags: [ "v*" ]
14
-
15
- permissions:
16
- contents: read
17
-
18
- jobs:
19
- release:
20
- name: Push gem to RubyGems.org
21
- # Pinned rather than 'ubuntu-latest', for the same reason as in ci.yml.
22
- runs-on: ubuntu-24.04
23
-
24
- environment: release
25
-
26
- permissions:
27
- contents: write # 'rake release' pushes the version tag when it does not exist yet
28
- id-token: write # mandatory to request the OIDC token used by trusted publishing
29
-
30
- steps:
31
- # The test suite includes an integration spec that talks to a real Keycloak
32
- # (spec/integration/client_authorization_spec.rb, gated on ENV["GITHUB_ACTIONS"],
33
- # which GitHub Actions sets on every run regardless of workflow). Keycloak is
34
- # provisioned here the same way ci.yml does it, so 'bundle exec rspec' below is a
35
- # real, complete gate rather than skipping that spec for lack of a server.
36
- - name: Start Keycloak
37
- run: |
38
- docker run -d --name keycloak -p 8080:8080 \
39
- -e KC_BOOTSTRAP_ADMIN_USERNAME=admin \
40
- -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin \
41
- -e KC_HOSTNAME=http://localhost:8080 \
42
- -e KC_HOSTNAME_ADMIN=http://localhost:8080 \
43
- -e KC_HTTP_ENABLED=true \
44
- -e KC_DB=dev-file \
45
- quay.io/keycloak/keycloak:26.7.0 \
46
- start-dev
47
-
48
- - name: Wait for Keycloak to be ready
49
- run: |
50
- for i in $(seq 1 30); do
51
- if curl --silent --fail http://localhost:8080/realms/master > /dev/null; then
52
- echo "Keycloak is ready"
53
- exit 0
54
- fi
55
- sleep 5
56
- done
57
- echo "Keycloak did not become ready in time"
58
- docker logs keycloak
59
- exit 1
60
-
61
- - name: create realm
62
- run: |
63
- TOKEN=$(curl --silent --location --request POST "http://localhost:8080/realms/master/protocol/openid-connect/token" \
64
- --header 'Content-Type: application/x-www-form-urlencoded' \
65
- --data-urlencode 'grant_type=password' \
66
- --data-urlencode 'username=admin' \
67
- --data-urlencode 'password=admin' \
68
- --data-urlencode 'client_id=admin-cli' | jq -r '.access_token')
69
-
70
- curl --silent --show-error -L -X POST "http://localhost:8080/admin/realms" \
71
- --header "Content-Type: application/json" \
72
- --header "Authorization: Bearer ${TOKEN}" \
73
- --data '{"realm":"dummy","enabled":true}'
74
-
75
- curl --silent --show-error --request POST 'http://localhost:8080/admin/realms/dummy/clients' \
76
- --header 'Authorization: Bearer '$TOKEN \
77
- --header 'Content-Type: application/json' \
78
- --data-raw '{
79
- "clientId":"dummy-client",
80
- "enabled":true,
81
- "consentRequired": false,
82
- "attributes":{},
83
- "serviceAccountsEnabled": true,
84
- "protocol":"openid-connect",
85
- "publicClient":false,
86
- "authorizationServicesEnabled": true,
87
- "clientAuthenticatorType":"client-secret",
88
- "redirectUris":["http://localhost:8180/demo"]
89
- }'
90
-
91
- - uses: actions/checkout@v4
92
-
93
- - name: Set up Ruby
94
- uses: ruby/setup-ruby@v1
95
- with:
96
- ruby-version: '3.4'
97
- bundler-cache: true
98
-
99
- - name: Check that the tag matches KeycloakAdmin::VERSION
100
- run: |
101
- tag="${GITHUB_REF_NAME#v}"
102
- version="$(ruby -Ilib -r keycloak-admin/version -e 'print KeycloakAdmin::VERSION')"
103
- if [ "$tag" != "$version" ]; then
104
- echo "::error::Tag '${GITHUB_REF_NAME}' does not match KeycloakAdmin::VERSION '${version}'"
105
- exit 1
106
- fi
107
-
108
- - name: Run tests
109
- run: bundle exec rspec
110
-
111
- # Builds the gem, pushes it to RubyGems.org and waits for it to be available.
112
- - uses: rubygems/release-gem@v1
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- .bundle/
2
- log/*.log
3
- pkg/
4
- test/dummy/db/*.sqlite3
5
- test/dummy/db/*.sqlite3-journal
6
- test/dummy/log/*.log
7
- test/dummy/tmp/
8
- *.gem
9
- .idea/
10
- .byebug_history