No longer hard-code the realm name in the service.
Showing
2 changed files
with
7 additions
and
2 deletions
... | @@ -272,10 +272,11 @@ Map<String, Object> pushKeycloakUser() { | ... | @@ -272,10 +272,11 @@ Map<String, Object> pushKeycloakUser() { |
272 | Map<String, Object> getKeycloakUsers() { | 272 | Map<String, Object> getKeycloakUsers() { |
273 | String keycloakClientId = 'moqui' | 273 | String keycloakClientId = 'moqui' |
274 | 274 | ||
275 | Keycloak keycloak = ec.getTool('Keycloak', Keycloak.class) | 275 | KeycloakToolFactory keycloakToolFactory = ec.getFactory().getToolFactory('Keycloak') |
276 | Keycloak keycloak = keycloakToolFactory.getInstance() | ||
276 | 277 | ||
277 | try { | 278 | try { |
278 | RealmResource realm = keycloak.realm('master') | 279 | RealmResource realm = keycloak.realm(keycloakToolFactory.getRealmName()) |
279 | /* | 280 | /* |
280 | ServerInfoResource serverInfo = keycloak.serverInfo() | 281 | ServerInfoResource serverInfo = keycloak.serverInfo() |
281 | logger.info('keycloak serverInfo: ' + keycloakToJson(serverInfo.getInfo())) | 282 | logger.info('keycloak serverInfo: ' + keycloakToJson(serverInfo.getInfo())) | ... | ... |
... | @@ -70,6 +70,10 @@ class KeycloakToolFactory implements ToolFactory<Keycloak> { | ... | @@ -70,6 +70,10 @@ class KeycloakToolFactory implements ToolFactory<Keycloak> { |
70 | return keycloakBuilder.build() | 70 | return keycloakBuilder.build() |
71 | } | 71 | } |
72 | 72 | ||
73 | String getRealmName() { | ||
74 | return (String) System.getProperty("moqui_keycloak_realm") | ||
75 | } | ||
76 | |||
73 | @Override | 77 | @Override |
74 | void destroy() { | 78 | void destroy() { |
75 | } | 79 | } | ... | ... |
-
Please register or sign in to post a comment