Я использую какой-то скрипт для настройки конфигурации Keycloak.
До сих пор я использовал Keycloak 2.5.5.Final. Я только что обновился до Keycloak 4.5.0.Final, и у меня проблема.
Мой сценарий назывался так:
E:\...\scripts>keycloak-cli.bat --connect --controller=localhost:9990
-DdeployDir=E:\\...\\config\bin -DmysqlHost=localhost -DmysqlPort=3306
-DmysqlUser=KeycloakSQL -DmysqlPwd=somepwd -DadminPort=9991 -DhttpPort=8081
-DhttpsPort=8444 --file=E:\...\cli\keycloak_wildfly.cli
Keycloak-cli.bat быть:
@echo off
REM set NOPAUSe to avoid to block the cmd when a wildfly cli script is executed
set NOPAUSE=true
REM set the java_home environment variable
set JAVA_HOME=E:\...\jdk
call "E:\...\keycloak\bin\jboss-cli.bat" %*
и keycloak_wildfly.cli, являющиеся:
#batch
#---------------------------------------------------------------------------
# Create db datasource
#---------------------------------------------------------------------------
if (outcome != success) of /subsystem=datasources/jdbc-driver=mariadb:read-resource
/subsystem=datasources/jdbc-driver=mariadb:add(driver-name=mariadb,driver-module-name=org.mariadb,driver-xa-datasource-class-name=org.mariadb.jdbc.Driver)
end-if
if (outcome != success) of /subsystem=security/security-domain=KeycloakDatabaseLogin/:read-resource
/subsystem=security/security-domain=KeycloakDatabaseLogin/:add(cache-type=default)
/subsystem=security/security-domain=KeycloakDatabaseLogin/authentication=classic:add(login-modules=[{"code"=>"SecureIdentity", "flag"=>"required", "module-options"=>[("username"=>"${mysqlUser}"),("password"=>"-123456789")]}])
end-if
# Modify the default datasource (if already exist) to use our mariaDB
if (outcome == success) of /subsystem=datasources/data-source=KeycloakDS:read-resource
/subsystem=datasources/data-source=KeycloakDS:write-attribute(name="jta",value="false")
/subsystem=datasources/data-source=KeycloakDS:write-attribute(name="use-ccm",value="false")
/subsystem=datasources/data-source=KeycloakDS:write-attribute(name="enabled",value="true")
/subsystem=datasources/data-source=KeycloakDS:write-attribute(name="jndi-name",value="java:jboss/datasources/KeycloakDS")
/subsystem=datasources/data-source=KeycloakDS:write-attribute(name="max-pool-size",value="10")
/subsystem=datasources/data-source=KeycloakDS:write-attribute(name="min-pool-size",value="5")
/subsystem=datasources/data-source=KeycloakDS:write-attribute(name="driver-name",value="mariadb")
/subsystem=datasources/data-source=KeycloakDS:write-attribute(name="connection-url",value="jdbc:mysql://${mysqlHost}:${mysqlPort}/KeycloakDB")
/subsystem=datasources/data-source=KeycloakDS:undefine-attribute(name="password")
/subsystem=datasources/data-source=KeycloakDS:undefine-attribute(name="user-name")
/subsystem=datasources/data-source=KeycloakDS:write-attribute(name="security-domain",value="KeycloakDatabaseLogin")
end-if
# Else create a new datasource if not available
if (outcome != success) of /subsystem=datasources/data- source=KeycloakDS:read-resource
/subsystem=datasources/data-source="KeycloakDS":add(jta="false",use-ccm="false",enabled="true",jndi-name=java:jboss/datasources/KeycloakDS,max-pool-size=10,min-pool-size=5,driver-name=mariadb,connection-url=jdbc:mysql://${mysqlHost}:${mysqlPort}/KeycloakDB,security-domain="KeycloakDatabaseLogin")
end-if
#---------------------------------------------------------------------------
# Change IP settings
#---------------------------------------------------------------------------
#Public interface listen on all IPs
/interface=public:write-attribute(name="inet-address",value="${jboss.bind.address:0.0.0.0}")
# Change http and https ports
/socket-binding-group=standard-sockets/socket-binding="management- http":write-attribute(name="port",value="${adminPort}")
/socket-binding-group=standard-sockets/socket-binding="http":write-attribute(name="port",value="${httpPort}")
/socket-binding-group=standard-sockets/socket-binding="https":write-attribute(name="port",value="${httpsPort}")
Отлично сработало.
В версии 4.5.0.Final of Keycloak у меня появляется следующая ошибка при запуске скрипта:
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "failed",
"failure-description" => "WFLYCTL0211: Cannot resolve expression '${httpPort}'",
"rolled-back" => true,
"response-headers" => {"process-state" => "reload-required"}
}
Он не заменяет $ {xxx} значением, переданным в командной строке как -D.
Я не понимаю почему.
Кто-нибудь может мне помочь?
Спасибо,
Себ