conjur-api 5.3.8.pre.319 → 5.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +10 -0
  3. data/.dockerignore +1 -0
  4. data/.github/CODEOWNERS +10 -0
  5. data/.gitignore +32 -0
  6. data/.gitleaks.toml +219 -0
  7. data/.overcommit.yml +16 -0
  8. data/.project +18 -0
  9. data/.rubocop.yml +3 -0
  10. data/.rubocop_settings.yml +86 -0
  11. data/.rubocop_todo.yml +709 -0
  12. data/.yardopts +1 -0
  13. data/CHANGELOG.md +448 -0
  14. data/CONTRIBUTING.md +138 -0
  15. data/Dockerfile +16 -0
  16. data/Gemfile +7 -0
  17. data/Jenkinsfile +136 -0
  18. data/LICENSE +202 -0
  19. data/README.md +162 -0
  20. data/Rakefile +47 -0
  21. data/SECURITY.md +42 -0
  22. data/VERSION +1 -1
  23. data/bin/parse-changelog.sh +12 -0
  24. data/ci/configure_v4.sh +12 -0
  25. data/ci/configure_v5.sh +19 -0
  26. data/ci/oauth/keycloak/create_client +18 -0
  27. data/ci/oauth/keycloak/create_user +21 -0
  28. data/ci/oauth/keycloak/fetch_certificate +18 -0
  29. data/ci/oauth/keycloak/keycloak_functions.sh +71 -0
  30. data/ci/oauth/keycloak/standalone.xml +578 -0
  31. data/ci/oauth/keycloak/wait_for_server +56 -0
  32. data/ci/submit-coverage +36 -0
  33. data/conjur-api.gemspec +41 -0
  34. data/dev/Dockerfile.dev +12 -0
  35. data/dev/docker-compose.yml +56 -0
  36. data/dev/start +22 -0
  37. data/dev/stop +5 -0
  38. data/docker-compose.yml +98 -0
  39. data/example/demo_v4.rb +49 -0
  40. data/example/demo_v5.rb +57 -0
  41. data/features/authenticators.feature +41 -0
  42. data/features/authn.feature +14 -0
  43. data/features/authn_local.feature +32 -0
  44. data/features/exists.feature +37 -0
  45. data/features/group.feature +11 -0
  46. data/features/host.feature +50 -0
  47. data/features/host_factory_create_host.feature +28 -0
  48. data/features/host_factory_token.feature +63 -0
  49. data/features/load_policy.feature +61 -0
  50. data/features/members.feature +51 -0
  51. data/features/new_api.feature +36 -0
  52. data/features/permitted.feature +70 -0
  53. data/features/permitted_roles.feature +30 -0
  54. data/features/public_keys.feature +11 -0
  55. data/features/resource_fields.feature +53 -0
  56. data/features/role_fields.feature +15 -0
  57. data/features/rotate_api_key.feature +13 -0
  58. data/features/step_definitions/api_steps.rb +52 -0
  59. data/features/step_definitions/policy_steps.rb +134 -0
  60. data/features/step_definitions/result_steps.rb +11 -0
  61. data/features/support/env.rb +19 -0
  62. data/features/support/hooks.rb +3 -0
  63. data/features/support/world.rb +12 -0
  64. data/features/update_password.feature +14 -0
  65. data/features/user.feature +58 -0
  66. data/features/variable_fields.feature +20 -0
  67. data/features/variable_value.feature +60 -0
  68. data/features_v4/authn_local.feature +27 -0
  69. data/features_v4/exists.feature +29 -0
  70. data/features_v4/host.feature +18 -0
  71. data/features_v4/host_factory_token.feature +49 -0
  72. data/features_v4/members.feature +39 -0
  73. data/features_v4/permitted.feature +15 -0
  74. data/features_v4/permitted_roles.feature +8 -0
  75. data/features_v4/resource_fields.feature +47 -0
  76. data/features_v4/rotate_api_key.feature +13 -0
  77. data/features_v4/step_definitions/api_steps.rb +17 -0
  78. data/features_v4/step_definitions/result_steps.rb +3 -0
  79. data/features_v4/support/env.rb +23 -0
  80. data/features_v4/support/policy.yml +34 -0
  81. data/features_v4/support/world.rb +12 -0
  82. data/features_v4/variable_fields.feature +11 -0
  83. data/features_v4/variable_value.feature +54 -0
  84. data/lib/conjur/acts_as_resource.rb +123 -0
  85. data/lib/conjur/acts_as_role.rb +142 -0
  86. data/lib/conjur/acts_as_rolsource.rb +32 -0
  87. data/lib/conjur/acts_as_user.rb +68 -0
  88. data/lib/conjur/api/authenticators.rb +43 -0
  89. data/lib/conjur/api/authn.rb +144 -0
  90. data/lib/conjur/api/host_factories.rb +71 -0
  91. data/lib/conjur/api/ldap_sync.rb +38 -0
  92. data/lib/conjur/api/policies.rb +56 -0
  93. data/lib/conjur/api/pubkeys.rb +53 -0
  94. data/lib/conjur/api/resources.rb +109 -0
  95. data/lib/conjur/api/roles.rb +98 -0
  96. data/lib/conjur/api/router/v4.rb +206 -0
  97. data/lib/conjur/api/router/v5.rb +269 -0
  98. data/lib/conjur/api/variables.rb +59 -0
  99. data/lib/conjur/api.rb +105 -0
  100. data/lib/conjur/base.rb +355 -0
  101. data/lib/conjur/base_object.rb +57 -0
  102. data/lib/conjur/build_object.rb +47 -0
  103. data/lib/conjur/cache.rb +26 -0
  104. data/lib/conjur/cert_utils.rb +63 -0
  105. data/lib/conjur/cidr.rb +71 -0
  106. data/lib/conjur/configuration.rb +460 -0
  107. data/lib/conjur/escape.rb +129 -0
  108. data/lib/conjur/exceptions.rb +4 -0
  109. data/lib/conjur/group.rb +41 -0
  110. data/lib/conjur/has_attributes.rb +98 -0
  111. data/lib/conjur/host.rb +27 -0
  112. data/lib/conjur/host_factory.rb +75 -0
  113. data/lib/conjur/host_factory_token.rb +78 -0
  114. data/lib/conjur/id.rb +71 -0
  115. data/lib/conjur/layer.rb +9 -0
  116. data/lib/conjur/log.rb +72 -0
  117. data/lib/conjur/log_source.rb +60 -0
  118. data/lib/conjur/policy.rb +34 -0
  119. data/lib/conjur/policy_load_result.rb +61 -0
  120. data/lib/conjur/query_string.rb +12 -0
  121. data/lib/conjur/resource.rb +29 -0
  122. data/lib/conjur/role.rb +29 -0
  123. data/lib/conjur/role_grant.rb +85 -0
  124. data/lib/conjur/routing.rb +29 -0
  125. data/lib/conjur/user.rb +40 -0
  126. data/lib/conjur/variable.rb +208 -0
  127. data/lib/conjur/webservice.rb +30 -0
  128. data/lib/conjur-api/version.rb +24 -0
  129. data/lib/conjur-api.rb +2 -0
  130. data/publish.sh +5 -0
  131. data/spec/api/host_factories_spec.rb +34 -0
  132. data/spec/api_spec.rb +254 -0
  133. data/spec/base_object_spec.rb +13 -0
  134. data/spec/cert_utils_spec.rb +173 -0
  135. data/spec/cidr_spec.rb +34 -0
  136. data/spec/configuration_spec.rb +330 -0
  137. data/spec/has_attributes_spec.rb +63 -0
  138. data/spec/helpers/errors_matcher.rb +34 -0
  139. data/spec/helpers/request_helpers.rb +10 -0
  140. data/spec/id_spec.rb +29 -0
  141. data/spec/ldap_sync_spec.rb +21 -0
  142. data/spec/log_source_spec.rb +13 -0
  143. data/spec/log_spec.rb +42 -0
  144. data/spec/roles_spec.rb +24 -0
  145. data/spec/spec_helper.rb +113 -0
  146. data/spec/ssl_spec.rb +109 -0
  147. data/spec/uri_escape_spec.rb +21 -0
  148. data/test.sh +76 -0
  149. data/tmp/.keep +0 -0
  150. metadata +196 -5
@@ -0,0 +1,578 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+
3
+ <server xmlns="urn:jboss:domain:5.0">
4
+ <extensions>
5
+ <extension module="org.jboss.as.clustering.infinispan"/>
6
+ <extension module="org.jboss.as.connector"/>
7
+ <extension module="org.jboss.as.deployment-scanner"/>
8
+ <extension module="org.jboss.as.ee"/>
9
+ <extension module="org.jboss.as.ejb3"/>
10
+ <extension module="org.jboss.as.jaxrs"/>
11
+ <extension module="org.jboss.as.jmx"/>
12
+ <extension module="org.jboss.as.jpa"/>
13
+ <extension module="org.jboss.as.logging"/>
14
+ <extension module="org.jboss.as.mail"/>
15
+ <extension module="org.jboss.as.naming"/>
16
+ <extension module="org.jboss.as.remoting"/>
17
+ <extension module="org.jboss.as.security"/>
18
+ <extension module="org.jboss.as.transactions"/>
19
+ <extension module="org.keycloak.keycloak-server-subsystem"/>
20
+ <extension module="org.wildfly.extension.bean-validation"/>
21
+ <extension module="org.wildfly.extension.elytron"/>
22
+ <extension module="org.wildfly.extension.io"/>
23
+ <extension module="org.wildfly.extension.request-controller"/>
24
+ <extension module="org.wildfly.extension.security.manager"/>
25
+ <extension module="org.wildfly.extension.undertow"/>
26
+ </extensions>
27
+ <management>
28
+ <security-realms>
29
+ <security-realm name="ManagementRealm">
30
+ <authentication>
31
+ <local default-user="$local" skip-group-loading="true"/>
32
+ <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
33
+ </authentication>
34
+ <authorization map-groups-to-roles="false">
35
+ <properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/>
36
+ </authorization>
37
+ </security-realm>
38
+ <security-realm name="ApplicationRealm">
39
+ <server-identities>
40
+ <ssl>
41
+ <keystore path="application.keystore" relative-to="jboss.server.config.dir" keystore-password="password" alias="server" key-password="password" generate-self-signed-certificate-host="keycloak"/>
42
+ </ssl>
43
+ </server-identities>
44
+ <authentication>
45
+ <local default-user="$local" allowed-users="*" skip-group-loading="true"/>
46
+ <properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
47
+ </authentication>
48
+ <authorization>
49
+ <properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
50
+ </authorization>
51
+ </security-realm>
52
+ </security-realms>
53
+ <audit-log>
54
+ <formatters>
55
+ <json-formatter name="json-formatter"/>
56
+ </formatters>
57
+ <handlers>
58
+ <file-handler name="file" formatter="json-formatter" path="audit-log.log" relative-to="jboss.server.data.dir"/>
59
+ </handlers>
60
+ <logger log-boot="true" log-read-only="false" enabled="false">
61
+ <handlers>
62
+ <handler name="file"/>
63
+ </handlers>
64
+ </logger>
65
+ </audit-log>
66
+ <management-interfaces>
67
+ <http-interface security-realm="ManagementRealm">
68
+ <http-upgrade enabled="true"/>
69
+ <socket-binding http="management-http"/>
70
+ </http-interface>
71
+ </management-interfaces>
72
+ <access-control provider="simple">
73
+ <role-mapping>
74
+ <role name="SuperUser">
75
+ <include>
76
+ <user name="$local"/>
77
+ </include>
78
+ </role>
79
+ </role-mapping>
80
+ </access-control>
81
+ </management>
82
+ <profile>
83
+ <subsystem xmlns="urn:jboss:domain:logging:3.0">
84
+ <console-handler name="CONSOLE">
85
+ <formatter>
86
+ <named-formatter name="COLOR-PATTERN"/>
87
+ </formatter>
88
+ </console-handler>
89
+ <logger category="com.arjuna">
90
+ <level name="WARN"/>
91
+ </logger>
92
+ <logger category="org.jboss.as.config">
93
+ <level name="DEBUG"/>
94
+ </logger>
95
+ <logger category="sun.rmi">
96
+ <level name="WARN"/>
97
+ </logger>
98
+ <logger category="org.keycloak">
99
+ <level name="${env.KEYCLOAK_LOGLEVEL:INFO}"/>
100
+ </logger>
101
+ <root-logger>
102
+ <level name="${env.ROOT_LOGLEVEL:INFO}"/>
103
+ <handlers>
104
+ <handler name="CONSOLE"/>
105
+ </handlers>
106
+ </root-logger>
107
+ <formatter name="PATTERN">
108
+ <pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
109
+ </formatter>
110
+ <formatter name="COLOR-PATTERN">
111
+ <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
112
+ </formatter>
113
+ </subsystem>
114
+ <subsystem xmlns="urn:jboss:domain:bean-validation:1.0"/>
115
+ <subsystem xmlns="urn:jboss:domain:datasources:5.0">
116
+ <datasources>
117
+ <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
118
+ <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
119
+ <driver>h2</driver>
120
+ <security>
121
+ <user-name>sa</user-name>
122
+ <password>sa</password>
123
+ </security>
124
+ </datasource>
125
+ <datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
126
+ <connection-url>jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE</connection-url>
127
+ <driver>h2</driver>
128
+ <security>
129
+ <user-name>sa</user-name>
130
+ <password>sa</password>
131
+ </security>
132
+ </datasource>
133
+ <drivers>
134
+ <driver name="h2" module="com.h2database.h2">
135
+ <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
136
+ </driver>
137
+ </drivers>
138
+ </datasources>
139
+ </subsystem>
140
+ <subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0">
141
+ <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000" runtime-failure-causes-rollback="${jboss.deployment.scanner.rollback.on.failure:false}"/>
142
+ </subsystem>
143
+ <subsystem xmlns="urn:jboss:domain:ee:4.0">
144
+ <spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>
145
+ <concurrent>
146
+ <context-services>
147
+ <context-service name="default" jndi-name="java:jboss/ee/concurrency/context/default" use-transaction-setup-provider="true"/>
148
+ </context-services>
149
+ <managed-thread-factories>
150
+ <managed-thread-factory name="default" jndi-name="java:jboss/ee/concurrency/factory/default" context-service="default"/>
151
+ </managed-thread-factories>
152
+ <managed-executor-services>
153
+ <managed-executor-service name="default" jndi-name="java:jboss/ee/concurrency/executor/default" context-service="default" hung-task-threshold="60000" keepalive-time="5000"/>
154
+ </managed-executor-services>
155
+ <managed-scheduled-executor-services>
156
+ <managed-scheduled-executor-service name="default" jndi-name="java:jboss/ee/concurrency/scheduler/default" context-service="default" hung-task-threshold="60000" keepalive-time="3000"/>
157
+ </managed-scheduled-executor-services>
158
+ </concurrent>
159
+ <default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/ExampleDS" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/>
160
+ </subsystem>
161
+ <subsystem xmlns="urn:jboss:domain:ejb3:5.0">
162
+ <session-bean>
163
+ <stateless>
164
+ <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
165
+ </stateless>
166
+ <stateful default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/>
167
+ <singleton default-access-timeout="5000"/>
168
+ </session-bean>
169
+ <pools>
170
+ <bean-instance-pools>
171
+ <strict-max-pool name="slsb-strict-max-pool" derive-size="from-worker-pools" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
172
+ <strict-max-pool name="mdb-strict-max-pool" derive-size="from-cpu-count" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
173
+ </bean-instance-pools>
174
+ </pools>
175
+ <caches>
176
+ <cache name="simple"/>
177
+ <cache name="distributable" passivation-store-ref="infinispan" aliases="passivating clustered"/>
178
+ </caches>
179
+ <passivation-stores>
180
+ <passivation-store name="infinispan" cache-container="ejb" max-size="10000"/>
181
+ </passivation-stores>
182
+ <async thread-pool-name="default"/>
183
+ <timer-service thread-pool-name="default" default-data-store="default-file-store">
184
+ <data-stores>
185
+ <file-data-store name="default-file-store" path="timer-service-data" relative-to="jboss.server.data.dir"/>
186
+ </data-stores>
187
+ </timer-service>
188
+ <remote connector-ref="http-remoting-connector" thread-pool-name="default">
189
+ <channel-creation-options>
190
+ <option name="READ_TIMEOUT" value="${prop.remoting-connector.read.timeout:20}" type="xnio"/>
191
+ <option name="MAX_OUTBOUND_MESSAGES" value="1234" type="remoting"/>
192
+ </channel-creation-options>
193
+ </remote>
194
+ <thread-pools>
195
+ <thread-pool name="default">
196
+ <max-threads count="10"/>
197
+ <keepalive-time time="100" unit="milliseconds"/>
198
+ </thread-pool>
199
+ </thread-pools>
200
+ <default-security-domain value="other"/>
201
+ <default-missing-method-permissions-deny-access value="true"/>
202
+ <log-system-exceptions value="true"/>
203
+ </subsystem>
204
+ <subsystem xmlns="urn:jboss:domain:io:2.0">
205
+ <worker name="default"/>
206
+ <buffer-pool name="default"/>
207
+ </subsystem>
208
+ <subsystem xmlns="urn:jboss:domain:infinispan:4.0">
209
+ <cache-container name="keycloak" jndi-name="infinispan/Keycloak">
210
+ <local-cache name="realms">
211
+ <eviction strategy="LRU" max-entries="10000"/>
212
+ </local-cache>
213
+ <local-cache name="users">
214
+ <eviction strategy="LRU" max-entries="10000"/>
215
+ </local-cache>
216
+ <local-cache name="sessions"/>
217
+ <local-cache name="authenticationSessions"/>
218
+ <local-cache name="offlineSessions"/>
219
+ <local-cache name="clientSessions"/>
220
+ <local-cache name="offlineClientSessions"/>
221
+ <local-cache name="loginFailures"/>
222
+ <local-cache name="work"/>
223
+ <local-cache name="authorization">
224
+ <eviction strategy="LRU" max-entries="10000"/>
225
+ </local-cache>
226
+ <local-cache name="keys">
227
+ <eviction strategy="LRU" max-entries="1000"/>
228
+ <expiration max-idle="3600000"/>
229
+ </local-cache>
230
+ <local-cache name="actionTokens">
231
+ <eviction strategy="NONE" max-entries="-1"/>
232
+ <expiration interval="300000" max-idle="-1"/>
233
+ </local-cache>
234
+ </cache-container>
235
+ <cache-container name="server" default-cache="default" module="org.wildfly.clustering.server">
236
+ <local-cache name="default">
237
+ <transaction mode="BATCH"/>
238
+ </local-cache>
239
+ </cache-container>
240
+ <cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
241
+ <local-cache name="passivation">
242
+ <locking isolation="REPEATABLE_READ"/>
243
+ <transaction mode="BATCH"/>
244
+ <file-store passivation="true" purge="false"/>
245
+ </local-cache>
246
+ </cache-container>
247
+ <cache-container name="ejb" aliases="sfsb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan">
248
+ <local-cache name="passivation">
249
+ <locking isolation="REPEATABLE_READ"/>
250
+ <transaction mode="BATCH"/>
251
+ <file-store passivation="true" purge="false"/>
252
+ </local-cache>
253
+ </cache-container>
254
+ <cache-container name="hibernate" module="org.hibernate.infinispan">
255
+ <local-cache name="entity">
256
+ <transaction mode="NON_XA"/>
257
+ <eviction strategy="LRU" max-entries="10000"/>
258
+ <expiration max-idle="100000"/>
259
+ </local-cache>
260
+ <local-cache name="local-query">
261
+ <eviction strategy="LRU" max-entries="10000"/>
262
+ <expiration max-idle="100000"/>
263
+ </local-cache>
264
+ <local-cache name="timestamps"/>
265
+ </cache-container>
266
+ </subsystem>
267
+ <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
268
+ <subsystem xmlns="urn:jboss:domain:jca:5.0">
269
+ <archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/>
270
+ <bean-validation enabled="true"/>
271
+ <default-workmanager>
272
+ <short-running-threads>
273
+ <core-threads count="50"/>
274
+ <queue-length count="50"/>
275
+ <max-threads count="50"/>
276
+ <keepalive-time time="10" unit="seconds"/>
277
+ </short-running-threads>
278
+ <long-running-threads>
279
+ <core-threads count="50"/>
280
+ <queue-length count="50"/>
281
+ <max-threads count="50"/>
282
+ <keepalive-time time="10" unit="seconds"/>
283
+ </long-running-threads>
284
+ </default-workmanager>
285
+ <cached-connection-manager/>
286
+ </subsystem>
287
+ <subsystem xmlns="urn:jboss:domain:jmx:1.3">
288
+ <expose-resolved-model/>
289
+ <expose-expression-model/>
290
+ <remoting-connector/>
291
+ </subsystem>
292
+ <subsystem xmlns="urn:jboss:domain:jpa:1.1">
293
+ <jpa default-datasource="" default-extended-persistence-inheritance="DEEP"/>
294
+ </subsystem>
295
+ <subsystem xmlns="urn:jboss:domain:mail:3.0">
296
+ <mail-session name="default" jndi-name="java:jboss/mail/Default">
297
+ <smtp-server outbound-socket-binding-ref="mail-smtp"/>
298
+ </mail-session>
299
+ </subsystem>
300
+ <subsystem xmlns="urn:jboss:domain:naming:2.0">
301
+ <remote-naming/>
302
+ </subsystem>
303
+ <subsystem xmlns="urn:jboss:domain:remoting:4.0">
304
+ <endpoint/>
305
+ <http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>
306
+ </subsystem>
307
+ <subsystem xmlns="urn:jboss:domain:request-controller:1.0"/>
308
+ <subsystem xmlns="urn:jboss:domain:security-manager:1.0">
309
+ <deployment-permissions>
310
+ <maximum-set>
311
+ <permission class="java.security.AllPermission"/>
312
+ </maximum-set>
313
+ </deployment-permissions>
314
+ </subsystem>
315
+ <subsystem xmlns="urn:wildfly:elytron:1.2" final-providers="combined-providers" disallowed-providers="OracleUcrypto">
316
+ <providers>
317
+ <aggregate-providers name="combined-providers">
318
+ <providers name="elytron"/>
319
+ <providers name="openssl"/>
320
+ </aggregate-providers>
321
+ <provider-loader name="elytron" module="org.wildfly.security.elytron"/>
322
+ <provider-loader name="openssl" module="org.wildfly.openssl"/>
323
+ </providers>
324
+ <audit-logging>
325
+ <file-audit-log name="local-audit" path="audit.log" relative-to="jboss.server.log.dir" format="JSON"/>
326
+ </audit-logging>
327
+ <security-domains>
328
+ <security-domain name="ApplicationDomain" default-realm="ApplicationRealm" permission-mapper="default-permission-mapper">
329
+ <realm name="ApplicationRealm" role-decoder="groups-to-roles"/>
330
+ <realm name="local"/>
331
+ </security-domain>
332
+ <security-domain name="ManagementDomain" default-realm="ManagementRealm" permission-mapper="default-permission-mapper">
333
+ <realm name="ManagementRealm" role-decoder="groups-to-roles"/>
334
+ <realm name="local" role-mapper="super-user-mapper"/>
335
+ </security-domain>
336
+ </security-domains>
337
+ <security-realms>
338
+ <identity-realm name="local" identity="$local"/>
339
+ <properties-realm name="ApplicationRealm">
340
+ <users-properties path="application-users.properties" relative-to="jboss.server.config.dir" digest-realm-name="ApplicationRealm"/>
341
+ <groups-properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
342
+ </properties-realm>
343
+ <properties-realm name="ManagementRealm">
344
+ <users-properties path="mgmt-users.properties" relative-to="jboss.server.config.dir" digest-realm-name="ManagementRealm"/>
345
+ <groups-properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/>
346
+ </properties-realm>
347
+ </security-realms>
348
+ <mappers>
349
+ <simple-permission-mapper name="default-permission-mapper" mapping-mode="first">
350
+ <permission-mapping>
351
+ <principal name="anonymous"/>
352
+ <permission class-name="org.wildfly.extension.batch.jberet.deployment.BatchPermission" module="org.wildfly.extension.batch.jberet" target-name="*"/>
353
+ <permission class-name="org.wildfly.transaction.client.RemoteTransactionPermission" module="org.wildfly.transaction.client"/>
354
+ <permission class-name="org.jboss.ejb.client.RemoteEJBPermission" module="org.jboss.ejb-client"/>
355
+ </permission-mapping>
356
+ <permission-mapping match-all="true">
357
+ <permission class-name="org.wildfly.security.auth.permission.LoginPermission"/>
358
+ <permission class-name="org.wildfly.extension.batch.jberet.deployment.BatchPermission" module="org.wildfly.extension.batch.jberet" target-name="*"/>
359
+ <permission class-name="org.wildfly.transaction.client.RemoteTransactionPermission" module="org.wildfly.transaction.client"/>
360
+ <permission class-name="org.jboss.ejb.client.RemoteEJBPermission" module="org.jboss.ejb-client"/>
361
+ </permission-mapping>
362
+ </simple-permission-mapper>
363
+ <constant-realm-mapper name="local" realm-name="local"/>
364
+ <simple-role-decoder name="groups-to-roles" attribute="groups"/>
365
+ <constant-role-mapper name="super-user-mapper">
366
+ <role name="SuperUser"/>
367
+ </constant-role-mapper>
368
+ </mappers>
369
+ <http>
370
+ <http-authentication-factory name="management-http-authentication" http-server-mechanism-factory="global" security-domain="ManagementDomain">
371
+ <mechanism-configuration>
372
+ <mechanism mechanism-name="DIGEST">
373
+ <mechanism-realm realm-name="ManagementRealm"/>
374
+ </mechanism>
375
+ </mechanism-configuration>
376
+ </http-authentication-factory>
377
+ <http-authentication-factory name="application-http-authentication" http-server-mechanism-factory="global" security-domain="ApplicationDomain">
378
+ <mechanism-configuration>
379
+ <mechanism mechanism-name="BASIC">
380
+ <mechanism-realm realm-name="Application Realm"/>
381
+ </mechanism>
382
+ <mechanism mechanism-name="FORM"/>
383
+ </mechanism-configuration>
384
+ </http-authentication-factory>
385
+ <provider-http-server-mechanism-factory name="global"/>
386
+ </http>
387
+ <sasl>
388
+ <sasl-authentication-factory name="management-sasl-authentication" sasl-server-factory="configured" security-domain="ManagementDomain">
389
+ <mechanism-configuration>
390
+ <mechanism mechanism-name="JBOSS-LOCAL-USER" realm-mapper="local"/>
391
+ <mechanism mechanism-name="DIGEST-SHA-256">
392
+ <mechanism-realm realm-name="ManagementRealm"/>
393
+ </mechanism>
394
+ </mechanism-configuration>
395
+ </sasl-authentication-factory>
396
+ <sasl-authentication-factory name="application-sasl-authentication" sasl-server-factory="configured" security-domain="ApplicationDomain">
397
+ <mechanism-configuration>
398
+ <mechanism mechanism-name="JBOSS-LOCAL-USER" realm-mapper="local"/>
399
+ <mechanism mechanism-name="DIGEST-SHA-256">
400
+ <mechanism-realm realm-name="ApplicationRealm"/>
401
+ </mechanism>
402
+ </mechanism-configuration>
403
+ </sasl-authentication-factory>
404
+ <configurable-sasl-server-factory name="configured" sasl-server-factory="elytron">
405
+ <properties>
406
+ <property name="wildfly.sasl.local-user.default-user" value="$local"/>
407
+ </properties>
408
+ </configurable-sasl-server-factory>
409
+ <mechanism-provider-filtering-sasl-server-factory name="elytron" sasl-server-factory="global">
410
+ <filters>
411
+ <filter provider-name="WildFlyElytron"/>
412
+ </filters>
413
+ </mechanism-provider-filtering-sasl-server-factory>
414
+ <provider-sasl-server-factory name="global"/>
415
+ </sasl>
416
+ </subsystem>
417
+ <subsystem xmlns="urn:jboss:domain:security:2.0">
418
+ <security-domains>
419
+ <security-domain name="other" cache-type="default">
420
+ <authentication>
421
+ <login-module code="Remoting" flag="optional">
422
+ <module-option name="password-stacking" value="useFirstPass"/>
423
+ </login-module>
424
+ <login-module code="RealmDirect" flag="required">
425
+ <module-option name="password-stacking" value="useFirstPass"/>
426
+ </login-module>
427
+ </authentication>
428
+ </security-domain>
429
+ <security-domain name="jboss-web-policy" cache-type="default">
430
+ <authorization>
431
+ <policy-module code="Delegating" flag="required"/>
432
+ </authorization>
433
+ </security-domain>
434
+ <security-domain name="jboss-ejb-policy" cache-type="default">
435
+ <authorization>
436
+ <policy-module code="Delegating" flag="required"/>
437
+ </authorization>
438
+ </security-domain>
439
+ <security-domain name="jaspitest" cache-type="default">
440
+ <authentication-jaspi>
441
+ <login-module-stack name="dummy">
442
+ <login-module code="Dummy" flag="optional"/>
443
+ </login-module-stack>
444
+ <auth-module code="Dummy"/>
445
+ </authentication-jaspi>
446
+ </security-domain>
447
+ </security-domains>
448
+ </subsystem>
449
+ <subsystem xmlns="urn:jboss:domain:transactions:4.0">
450
+ <core-environment>
451
+ <process-id>
452
+ <uuid/>
453
+ </process-id>
454
+ </core-environment>
455
+ <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
456
+ <object-store path="tx-object-store" relative-to="jboss.server.data.dir"/>
457
+ </subsystem>
458
+ <subsystem xmlns="urn:jboss:domain:undertow:4.0">
459
+ <buffer-cache name="default"/>
460
+ <server name="default-server">
461
+ <http-listener name="default" socket-binding="http" redirect-socket="https" proxy-address-forwarding="${env.PROXY_ADDRESS_FORWARDING:false}" enable-http2="true"/>
462
+ <https-listener name="https" socket-binding="https" proxy-address-forwarding="${env.PROXY_ADDRESS_FORWARDING:false}" security-realm="ApplicationRealm" enable-http2="true"/>
463
+ <host name="default-host" alias="localhost">
464
+ <location name="/" handler="welcome-content"/>
465
+ <http-invoker security-realm="ApplicationRealm"/>
466
+ </host>
467
+ </server>
468
+ <servlet-container name="default">
469
+ <jsp-config/>
470
+ <websockets/>
471
+ </servlet-container>
472
+ <handlers>
473
+ <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
474
+ </handlers>
475
+ </subsystem>
476
+ <subsystem xmlns="urn:jboss:domain:keycloak-server:1.1">
477
+ <web-context>auth</web-context>
478
+ <providers>
479
+ <provider>
480
+ classpath:${jboss.home.dir}/providers/*
481
+ </provider>
482
+ </providers>
483
+ <master-realm-name>master</master-realm-name>
484
+ <scheduled-task-interval>900</scheduled-task-interval>
485
+ <theme>
486
+ <staticMaxAge>2592000</staticMaxAge>
487
+ <cacheThemes>true</cacheThemes>
488
+ <cacheTemplates>true</cacheTemplates>
489
+ <dir>${jboss.home.dir}/themes</dir>
490
+ </theme>
491
+ <spi name="eventsStore">
492
+ <provider name="jpa" enabled="true">
493
+ <properties>
494
+ <property name="exclude-events" value="[&quot;REFRESH_TOKEN&quot;]"/>
495
+ </properties>
496
+ </provider>
497
+ </spi>
498
+ <spi name="userCache">
499
+ <provider name="default" enabled="true"/>
500
+ </spi>
501
+ <spi name="userSessionPersister">
502
+ <default-provider>jpa</default-provider>
503
+ </spi>
504
+ <spi name="timer">
505
+ <default-provider>basic</default-provider>
506
+ </spi>
507
+ <spi name="connectionsHttpClient">
508
+ <provider name="default" enabled="true"/>
509
+ </spi>
510
+ <spi name="connectionsJpa">
511
+ <provider name="default" enabled="true">
512
+ <properties>
513
+ <property name="dataSource" value="java:jboss/datasources/KeycloakDS"/>
514
+ <property name="initializeEmpty" value="true"/>
515
+ <property name="migrationStrategy" value="update"/>
516
+ <property name="migrationExport" value="${jboss.home.dir}/keycloak-database-update.sql"/>
517
+ </properties>
518
+ </provider>
519
+ </spi>
520
+ <spi name="realmCache">
521
+ <provider name="default" enabled="true"/>
522
+ </spi>
523
+ <spi name="connectionsInfinispan">
524
+ <default-provider>default</default-provider>
525
+ <provider name="default" enabled="true">
526
+ <properties>
527
+ <property name="cacheContainer" value="java:comp/env/infinispan/Keycloak"/>
528
+ </properties>
529
+ </provider>
530
+ </spi>
531
+ <spi name="jta-lookup">
532
+ <default-provider>${keycloak.jta.lookup.provider:jboss}</default-provider>
533
+ <provider name="jboss" enabled="true"/>
534
+ </spi>
535
+ <spi name="publicKeyStorage">
536
+ <provider name="infinispan" enabled="true">
537
+ <properties>
538
+ <property name="minTimeBetweenRequests" value="10"/>
539
+ </properties>
540
+ </provider>
541
+ </spi>
542
+ <spi name="x509cert-lookup">
543
+ <default-provider>${keycloak.x509cert.lookup.provider:default}</default-provider>
544
+ <provider name="default" enabled="true"/>
545
+ </spi>
546
+ <spi name="hostname">
547
+ <default-provider>request</default-provider>
548
+ <provider name="fixed" enabled="true">
549
+ <properties>
550
+ <property name="hostname" value="localhost"/>
551
+ <property name="httpPort" value="-1"/>
552
+ <property name="httpsPort" value="-1"/>
553
+ </properties>
554
+ </provider>
555
+ </spi>
556
+ </subsystem>
557
+ </profile>
558
+ <interfaces>
559
+ <interface name="management">
560
+ <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
561
+ </interface>
562
+ <interface name="public">
563
+ <inet-address value="${jboss.bind.address:127.0.0.1}"/>
564
+ </interface>
565
+ </interfaces>
566
+ <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
567
+ <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
568
+ <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
569
+ <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
570
+ <socket-binding name="http" port="${jboss.http.port:8080}"/>
571
+ <socket-binding name="https" port="${jboss.https.port:8443}"/>
572
+ <socket-binding name="txn-recovery-environment" port="4712"/>
573
+ <socket-binding name="txn-status-manager" port="4713"/>
574
+ <outbound-socket-binding name="mail-smtp">
575
+ <remote-destination host="localhost" port="25"/>
576
+ </outbound-socket-binding>
577
+ </socket-binding-group>
578
+ </server>
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env bash
2
+
3
+ SERVER_HEALTH_CHECK_URL="http://localhost:8080/"
4
+ SERVER_IS_READY="N0"
5
+
6
+ function print_help() {
7
+ cat << EOF
8
+ Wait for keycloak server to start, the script should run from inside keycloak container
9
+ Example:
10
+ ./wait_for_server <service-name>
11
+ EOF
12
+ }
13
+
14
+ function input_validation() {
15
+ local args_number="$#"
16
+ if [[ ${args_number} -ne 0 ]] ; then
17
+ echo "Error: invalid arguments"
18
+ print_help
19
+ exit 1
20
+ fi
21
+ }
22
+
23
+ function wait_for_keycloak() {
24
+ for i in {1..40}; do
25
+ sleep=5
26
+ set_server_readiness
27
+
28
+ if [[ "${SERVER_IS_READY}" == "YES" ]] ; then
29
+ echo "Keycloak server is up and ready"
30
+ return 0
31
+ fi
32
+
33
+ echo "Keycloak not ready yet sleep number $i for $sleep seconds"
34
+ sleep "$sleep"
35
+ done
36
+
37
+ echo "Error with keycloak server start or it is too slow"
38
+ exit 1
39
+ }
40
+
41
+ function set_server_readiness()
42
+ {
43
+ curl --silent --output /dev/null "${SERVER_HEALTH_CHECK_URL}"
44
+ local ret_code=$?
45
+ echo "Return code of accessing ${SERVER_HEALTH_CHECK_URL} is: ${ret_code}"
46
+ if [[ "${ret_code}" -eq 0 ]] ; then
47
+ SERVER_IS_READY="YES"
48
+ fi
49
+ }
50
+
51
+ function main() {
52
+ input_validation "$@"
53
+ wait_for_keycloak
54
+ }
55
+
56
+ main "$@"