title: Keycloak redirect URI gives https://localhost instead of http://localhost
body: <p>I am trying to authenticate a Cordova Android app on Keycloak.</p>
  
  <p>I made a previous question about it, but I'm paring it down here to just the essentials, as I've discovered a lot over the past 2-3 days.</p>
  
  <p><a href="https://stackoverflow.com/questions/57734603/webpage-not-available-in-cordova-android-app">Webpage not available in Cordova Android app</a></p>
  
  <p>Despite the fact that it should theoretically pass back <a href="http://localhost/x/y/z" rel="nofollow noreferrer">http://localhost/x/y/z</a> I am instead getting <a href="https://localhost/x/y/z" rel="nofollow noreferrer">https://localhost/x/y/z</a></p>
  
  <p>This is causing authentication to fail.</p>
  
  <p>Inside keycloak.js:</p>
  
  <pre><code>ref.addEventListener('loaderror', function(event) {
                      if (!completed) {
                          if (event.url.indexOf('http://localhost') == 0) {
                              var callback = parseCallback(event.url);
                              processCallback(callback, promise);
                              closeBrowser();
                              completed = true;
                          } else {
                              promise.setError();
                              closeBrowser();
                          }
                      }
                  });
  </code></pre>
  
  <p>This error is getting thrown due to the fact that my localhost is going to https://, not http://</p>
  
  <p>This is a sample return:</p>
  
  <pre><code>https://localhost/#state=3bc5b8e8-ee17-4c78-861c-6fa62f5e353b&amp;session_state=43d5518d-c278-4245-b181-899783fd2c6b&amp;code=8e50a9c0-d1a6-4ecd-8e91-e85d92350900.43d5518d-c278-4245-b181-899783fd2c6b.863570ca-9c62-41a5-97bb-33880fe6c62d
  </code></pre>
  
  <p>I am trying this:</p>
  
  <pre><code>keycloak.init({ onLoad: "check-sso", redirectUri: "http://localhost" })
  </code></pre>
  
  <p>I am strongly guessing it might be due to my standalone.xml settings (I've included the full thing as I don't know what might be causing the issue):</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt; 
  
  &lt;server xmlns="urn:jboss:domain:8.0"&gt; 
  &lt;extensions&gt; 
  &lt;extension module="org.jboss.as.clustering.infinispan"/&gt; 
  &lt;extension module="org.jboss.as.connector"/&gt; 
  &lt;extension module="org.jboss.as.deployment-scanner"/&gt; 
  &lt;extension module="org.jboss.as.ee"/&gt; 
  &lt;extension module="org.jboss.as.ejb3"/&gt; 
  &lt;extension module="org.jboss.as.jaxrs"/&gt; 
  &lt;extension module="org.jboss.as.jmx"/&gt; 
  &lt;extension module="org.jboss.as.jpa"/&gt; 
  &lt;extension module="org.jboss.as.logging"/&gt; 
  &lt;extension module="org.jboss.as.mail"/&gt; 
  &lt;extension module="org.jboss.as.naming"/&gt; 
  &lt;extension module="org.jboss.as.remoting"/&gt; 
  &lt;extension module="org.jboss.as.security"/&gt; 
  &lt;extension module="org.jboss.as.transactions"/&gt; 
  &lt;extension module="org.keycloak.keycloak-server-subsystem"/&gt; 
  &lt;extension module="org.wildfly.extension.bean-validation"/&gt; 
  &lt;extension module="org.wildfly.extension.core-management"/&gt; 
  &lt;extension module="org.wildfly.extension.elytron"/&gt; 
  &lt;extension module="org.wildfly.extension.io"/&gt; 
  &lt;extension module="org.wildfly.extension.request-controller"/&gt; 
  &lt;extension module="org.wildfly.extension.security.manager"/&gt; 
  &lt;extension module="org.wildfly.extension.undertow"/&gt; 
  &lt;/extensions&gt; 
  &lt;management&gt; 
  &lt;security-realms&gt; 
  &lt;security-realm name="ManagementRealm"&gt; 
  &lt;authentication&gt; 
  &lt;local default-user="$local" skip-group-loading="true"/&gt; 
  &lt;properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/&gt; 
  &lt;/authentication&gt; 
  &lt;authorization map-groups-to-roles="false"&gt; 
  &lt;properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/&gt; 
  &lt;/authorization&gt; 
  &lt;/security-realm&gt; 
  &lt;security-realm name="ApplicationRealm"&gt; 
  &lt;server-identities&gt; 
  &lt;ssl&gt; 
  &lt;keystore path="application.keystore" relative-to="jboss.server.config.dir" keystore-password="password" alias="server" key-password="password" generate-self-signed-certificate-host="localhost"/&gt; 
  &lt;/ssl&gt; 
  &lt;/server-identities&gt; 
  &lt;authentication&gt; 
  &lt;local default-user="$local" allowed-users="*" skip-group-loading="true"/&gt; 
  &lt;properties path="application-users.properties" relative-to="jboss.server.config.dir"/&gt; 
  &lt;/authentication&gt; 
  &lt;authorization&gt; 
  &lt;properties path="application-roles.properties" relative-to="jboss.server.config.dir"/&gt; 
  &lt;/authorization&gt; 
  &lt;/security-realm&gt; 
  &lt;/security-realms&gt; 
  &lt;audit-log&gt; 
  &lt;formatters&gt; 
  &lt;json-formatter name="json-formatter"/&gt; 
  &lt;/formatters&gt; 
  &lt;handlers&gt; 
  &lt;file-handler name="file" formatter="json-formatter" path="audit-log.log" relative-to="jboss.server.data.dir"/&gt; 
  &lt;/handlers&gt; 
  &lt;logger log-boot="true" log-read-only="false" enabled="false"&gt; 
  &lt;handlers&gt; 
  &lt;handler name="file"/&gt; 
  &lt;/handlers&gt; 
  &lt;/logger&gt; 
  &lt;/audit-log&gt; 
  &lt;management-interfaces&gt; 
  &lt;http-interface security-realm="ManagementRealm"&gt; 
  &lt;http-upgrade enabled="true"/&gt; 
  &lt;socket-binding http="management-http"/&gt; 
  &lt;/http-interface&gt; 
  &lt;/management-interfaces&gt; 
  &lt;access-control provider="simple"&gt; 
  &lt;role-mapping&gt; 
  &lt;role name="SuperUser"&gt; 
  &lt;include&gt; 
  &lt;user name="$local"/&gt; 
  &lt;/include&gt; 
  &lt;/role&gt; 
  &lt;/role-mapping&gt; 
  &lt;/access-control&gt; 
  &lt;/management&gt; 
  &lt;profile&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:logging:6.0"&gt; 
  &lt;console-handler name="CONSOLE"&gt; 
  &lt;level name="INFO"/&gt; 
  &lt;formatter&gt; 
  &lt;named-formatter name="COLOR-PATTERN"/&gt; 
  &lt;/formatter&gt; 
  &lt;/console-handler&gt; 
  &lt;periodic-rotating-file-handler name="FILE" autoflush="true"&gt; 
  &lt;formatter&gt; 
  &lt;named-formatter name="PATTERN"/&gt; 
  &lt;/formatter&gt; 
  &lt;file relative-to="jboss.server.log.dir" path="server.log"/&gt; 
  &lt;suffix value=".yyyy-MM-dd"/&gt; 
  &lt;append value="true"/&gt; 
  &lt;/periodic-rotating-file-handler&gt; 
  &lt;logger category="com.arjuna"&gt; 
  &lt;level name="WARN"/&gt; 
  &lt;/logger&gt; 
  &lt;logger category="org.jboss.as.config"&gt; 
  &lt;level name="DEBUG"/&gt; 
  &lt;/logger&gt; 
  &lt;logger category="sun.rmi"&gt; 
  &lt;level name="WARN"/&gt; 
  &lt;/logger&gt; 
  &lt;root-logger&gt; 
  &lt;level name="INFO"/&gt; 
  &lt;handlers&gt; 
  &lt;handler name="CONSOLE"/&gt; 
  &lt;handler name="FILE"/&gt; 
  &lt;/handlers&gt; 
  &lt;/root-logger&gt; 
  &lt;formatter name="PATTERN"&gt; 
  &lt;pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/&gt; 
  &lt;/formatter&gt; 
  &lt;formatter name="COLOR-PATTERN"&gt; 
  &lt;pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/&gt; 
  &lt;/formatter&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:bean-validation:1.0"/&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:core-management:1.0"/&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:datasources:5.0"&gt; 
  &lt;datasources&gt; 
  &lt;datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true"&gt; 
  &lt;connection-url&gt;jdbc:postgresql://cactus-stg-postgres.caxdkvuertc9.us-west-1.rds.amazonaws.com:5432/keycloak&lt;/connection-url&gt; 
  &lt;driver&gt;postgresql&lt;/driver&gt; 
  &lt;pool&gt; 
  &lt;flush-strategy&gt;IdleConnections&lt;/flush-strategy&gt; 
  &lt;/pool&gt; 
  &lt;security&gt; 
  &lt;user-name&gt;cactusmedia&lt;/user-name&gt; 
  &lt;password&gt;caCt1Bl0om&lt;/password&gt; 
  &lt;/security&gt; 
  &lt;validation&gt; 
  &lt;valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/&gt; 
  &lt;background-validation&gt;true&lt;/background-validation&gt; 
  &lt;exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/&gt; 
  &lt;/validation&gt; 
  &lt;/datasource&gt; 
  &lt;drivers&gt; 
  &lt;driver name="postgresql" module="org.postgresql.jdbc"&gt; 
  &lt;xa-datasource-class&gt;org.postgresql.xa.PGXADataSource&lt;/xa-datasource-class&gt; 
  &lt;/driver&gt; 
  &lt;/drivers&gt; 
  &lt;/datasources&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0"&gt; 
  &lt;deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000" runtime-failure-causes-rollback="${jboss.deployment.scanner.rollback.on.failure:false}"/&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:ee:4.0"&gt; 
  &lt;spec-descriptor-property-replacement&gt;false&lt;/spec-descriptor-property-replacement&gt; 
  &lt;concurrent&gt; 
  &lt;context-services&gt; 
  &lt;context-service name="default" jndi-name="java:jboss/ee/concurrency/context/default" use-transaction-setup-provider="true"/&gt; 
  &lt;/context-services&gt; 
  &lt;managed-thread-factories&gt; 
  &lt;managed-thread-factory name="default" jndi-name="java:jboss/ee/concurrency/factory/default" context-service="default"/&gt; 
  &lt;/managed-thread-factories&gt; 
  &lt;managed-executor-services&gt; 
  &lt;managed-executor-service name="default" jndi-name="java:jboss/ee/concurrency/executor/default" context-service="default" hung-task-threshold="60000" keepalive-time="5000"/&gt; 
  &lt;/managed-executor-services&gt; 
  &lt;managed-scheduled-executor-services&gt; 
  &lt;managed-scheduled-executor-service name="default" jndi-name="java:jboss/ee/concurrency/scheduler/default" context-service="default" hung-task-threshold="60000" keepalive-time="3000"/&gt; 
  &lt;/managed-scheduled-executor-services&gt; 
  &lt;/concurrent&gt; 
  &lt;default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/KeycloakDS" 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"/&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:ejb3:5.0"&gt; 
  &lt;session-bean&gt; 
  &lt;stateless&gt; 
  &lt;bean-instance-pool-ref pool-name="slsb-strict-max-pool"/&gt; 
  &lt;/stateless&gt; 
  &lt;stateful default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/&gt; 
  &lt;singleton default-access-timeout="5000"/&gt; 
  &lt;/session-bean&gt; 
  &lt;pools&gt; 
  &lt;bean-instance-pools&gt; 
  &lt;strict-max-pool name="slsb-strict-max-pool" derive-size="from-worker-pools" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/&gt; 
  &lt;strict-max-pool name="mdb-strict-max-pool" derive-size="from-cpu-count" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/&gt; 
  &lt;/bean-instance-pools&gt; 
  &lt;/pools&gt; 
  &lt;caches&gt; 
  &lt;cache name="simple"/&gt; 
  &lt;cache name="distributable" passivation-store-ref="infinispan" aliases="passivating clustered"/&gt; 
  &lt;/caches&gt; 
  &lt;passivation-stores&gt; 
  &lt;passivation-store name="infinispan" cache-container="ejb" max-size="10000"/&gt; 
  &lt;/passivation-stores&gt; 
  &lt;async thread-pool-name="default"/&gt; 
  &lt;timer-service thread-pool-name="default" default-data-store="default-file-store"&gt; 
  &lt;data-stores&gt; 
  &lt;file-data-store name="default-file-store" path="timer-service-data" relative-to="jboss.server.data.dir"/&gt; 
  &lt;/data-stores&gt; 
  &lt;/timer-service&gt; 
  &lt;remote connector-ref="http-remoting-connector" thread-pool-name="default"&gt; 
  &lt;channel-creation-options&gt; 
  &lt;option name="READ_TIMEOUT" value="${prop.remoting-connector.read.timeout:20}" type="xnio"/&gt; 
  &lt;option name="MAX_OUTBOUND_MESSAGES" value="1234" type="remoting"/&gt; 
  &lt;/channel-creation-options&gt; 
  &lt;/remote&gt; 
  &lt;thread-pools&gt; 
  &lt;thread-pool name="default"&gt; 
  &lt;max-threads count="10"/&gt; 
  &lt;keepalive-time time="100" unit="milliseconds"/&gt; 
  &lt;/thread-pool&gt; 
  &lt;/thread-pools&gt; 
  &lt;default-security-domain value="other"/&gt; 
  &lt;default-missing-method-permissions-deny-access value="true"/&gt; 
  &lt;log-system-exceptions value="true"/&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:wildfly:elytron:4.0" final-providers="combined-providers" disallowed-providers="OracleUcrypto"&gt; 
  &lt;providers&gt; 
  &lt;aggregate-providers name="combined-providers"&gt; 
  &lt;providers name="elytron"/&gt; 
  &lt;providers name="openssl"/&gt; 
  &lt;/aggregate-providers&gt; 
  &lt;provider-loader name="elytron" module="org.wildfly.security.elytron"/&gt; 
  &lt;provider-loader name="openssl" module="org.wildfly.openssl"/&gt; 
  &lt;/providers&gt; 
  &lt;audit-logging&gt; 
  &lt;file-audit-log name="local-audit" path="audit.log" relative-to="jboss.server.log.dir" format="JSON"/&gt; 
  &lt;/audit-logging&gt; 
  &lt;security-domains&gt; 
  &lt;security-domain name="ApplicationDomain" default-realm="ApplicationRealm" permission-mapper="default-permission-mapper"&gt; 
  &lt;realm name="ApplicationRealm" role-decoder="groups-to-roles"/&gt; 
  &lt;realm name="local"/&gt; 
  &lt;/security-domain&gt; 
  &lt;security-domain name="ManagementDomain" default-realm="ManagementRealm" permission-mapper="default-permission-mapper"&gt; 
  &lt;realm name="ManagementRealm" role-decoder="groups-to-roles"/&gt; 
  &lt;realm name="local" role-mapper="super-user-mapper"/&gt; 
  &lt;/security-domain&gt; 
  &lt;/security-domains&gt; 
  &lt;security-realms&gt; 
  &lt;identity-realm name="local" identity="$local"/&gt; 
  &lt;properties-realm name="ApplicationRealm"&gt; 
  &lt;users-properties path="application-users.properties" relative-to="jboss.server.config.dir" digest-realm-name="ApplicationRealm"/&gt; 
  &lt;groups-properties path="application-roles.properties" relative-to="jboss.server.config.dir"/&gt; 
  &lt;/properties-realm&gt; 
  &lt;properties-realm name="ManagementRealm"&gt; 
  &lt;users-properties path="mgmt-users.properties" relative-to="jboss.server.config.dir" digest-realm-name="ManagementRealm"/&gt; 
  &lt;groups-properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/&gt; 
  &lt;/properties-realm&gt; 
  &lt;/security-realms&gt; 
  &lt;mappers&gt; 
  &lt;simple-permission-mapper name="default-permission-mapper" mapping-mode="first"&gt; 
  &lt;permission-mapping match-all="true"&gt; 
  &lt;permission-set name="login-permission"/&gt; 
  &lt;permission-set name="default-permissions"/&gt; 
  &lt;/permission-mapping&gt; 
  &lt;permission-mapping&gt; 
  &lt;principal name="anonymous"/&gt; 
  &lt;permission-set name="default-permissions"/&gt; 
  &lt;/permission-mapping&gt; 
  &lt;/simple-permission-mapper&gt; 
  &lt;constant-realm-mapper name="local" realm-name="local"/&gt; 
  &lt;simple-role-decoder name="groups-to-roles" attribute="groups"/&gt; 
  &lt;constant-role-mapper name="super-user-mapper"&gt; 
  &lt;role name="SuperUser"/&gt; 
  &lt;/constant-role-mapper&gt; 
  &lt;/mappers&gt; 
  &lt;permission-sets&gt; 
  &lt;permission-set name="login-permission"&gt; 
  &lt;permission class-name="org.wildfly.security.auth.permission.LoginPermission"/&gt; 
  &lt;/permission-set&gt; 
  &lt;permission-set name="default-permissions"&gt; 
  &lt;permission class-name="org.wildfly.extension.batch.jberet.deployment.BatchPermission" module="org.wildfly.extension.batch.jberet" target-name="*"/&gt; 
  &lt;permission class-name="org.wildfly.transaction.client.RemoteTransactionPermission" module="org.wildfly.transaction.client"/&gt; 
  &lt;permission class-name="org.jboss.ejb.client.RemoteEJBPermission" module="org.jboss.ejb-client"/&gt; 
  &lt;/permission-set&gt; 
  &lt;/permission-sets&gt; 
  &lt;http&gt; 
  &lt;http-authentication-factory name="management-http-authentication" security-domain="ManagementDomain" http-server-mechanism-factory="global"&gt; 
  &lt;mechanism-configuration&gt; 
  &lt;mechanism mechanism-name="DIGEST"&gt; 
  &lt;mechanism-realm realm-name="ManagementRealm"/&gt; 
  &lt;/mechanism&gt; 
  &lt;/mechanism-configuration&gt; 
  &lt;/http-authentication-factory&gt; 
  &lt;provider-http-server-mechanism-factory name="global"/&gt; 
  &lt;/http&gt; 
  &lt;sasl&gt; 
  &lt;sasl-authentication-factory name="management-sasl-authentication" sasl-server-factory="configured" security-domain="ManagementDomain"&gt; 
  &lt;mechanism-configuration&gt; 
  &lt;mechanism mechanism-name="JBOSS-LOCAL-USER" realm-mapper="local"/&gt; 
  &lt;mechanism mechanism-name="DIGEST-MD5"&gt; 
  &lt;mechanism-realm realm-name="ManagementRealm"/&gt; 
  &lt;/mechanism&gt; 
  &lt;/mechanism-configuration&gt; 
  &lt;/sasl-authentication-factory&gt; 
  &lt;sasl-authentication-factory name="application-sasl-authentication" sasl-server-factory="configured" security-domain="ApplicationDomain"&gt;
  &lt;mechanism-configuration&gt; 
  &lt;mechanism mechanism-name="JBOSS-LOCAL-USER" realm-mapper="local"/&gt; 
  &lt;mechanism mechanism-name="DIGEST-MD5"&gt; 
  &lt;mechanism-realm realm-name="ApplicationRealm"/&gt; 
  &lt;/mechanism&gt; 
  &lt;/mechanism-configuration&gt; 
  &lt;/sasl-authentication-factory&gt; 
  &lt;configurable-sasl-server-factory name="configured" sasl-server-factory="elytron"&gt; 
  &lt;properties&gt; 
  &lt;property name="wildfly.sasl.local-user.default-user" value="$local"/&gt; 
  &lt;/properties&gt; 
  &lt;/configurable-sasl-server-factory&gt; 
  &lt;mechanism-provider-filtering-sasl-server-factory name="elytron" sasl-server-factory="global"&gt; 
  &lt;filters&gt; 
  &lt;filter provider-name="WildFlyElytron"/&gt; 
  &lt;/filters&gt; 
  &lt;/mechanism-provider-filtering-sasl-server-factory&gt; 
  &lt;provider-sasl-server-factory name="global"/&gt; 
  &lt;/sasl&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:infinispan:7.0"&gt; 
  &lt;cache-container name="keycloak"&gt; 
  &lt;local-cache name="realms"&gt; 
  &lt;object-memory size="10000"/&gt; 
  &lt;/local-cache&gt; 
  &lt;local-cache name="users"&gt; 
  &lt;object-memory size="10000"/&gt; 
  &lt;/local-cache&gt; 
  &lt;local-cache name="sessions"/&gt; 
  &lt;local-cache name="offlineSessions"/&gt; 
  &lt;local-cache name="loginFailures"/&gt; 
  &lt;local-cache name="work"/&gt; 
  &lt;local-cache name="authorization"&gt; 
  &lt;object-memory size="10000"/&gt; 
  &lt;/local-cache&gt; 
  &lt;local-cache name="keys"&gt; 
  &lt;object-memory size="1000"/&gt; 
  &lt;expiration max-idle="3600000"/&gt; 
  &lt;/local-cache&gt; 
  &lt;local-cache name="authenticationSessions"/&gt; 
  &lt;local-cache name="actionTokens"&gt; 
  &lt;object-memory size="-1"/&gt; 
  &lt;expiration interval="300000" max-idle="-1"/&gt; 
  &lt;/local-cache&gt; 
  &lt;local-cache name="offlineClientSessions"/&gt; 
  &lt;local-cache name="clientSessions"/&gt; 
  &lt;/cache-container&gt; 
  &lt;cache-container name="server" default-cache="default" module="org.wildfly.clustering.server"&gt; 
  &lt;local-cache name="default"&gt; 
  &lt;transaction mode="BATCH"/&gt; 
  &lt;/local-cache&gt; 
  &lt;/cache-container&gt; 
  &lt;cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan"&gt; 
  &lt;local-cache name="passivation"&gt; 
  &lt;locking isolation="REPEATABLE_READ"/&gt; 
  &lt;transaction mode="BATCH"/&gt; 
  &lt;file-store passivation="true" purge="false"/&gt; 
  &lt;/local-cache&gt; 
  &lt;/cache-container&gt; 
  &lt;cache-container name="ejb" aliases="sfsb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan"&gt; 
  &lt;local-cache name="passivation"&gt; 
  &lt;locking isolation="REPEATABLE_READ"/&gt; 
  &lt;transaction mode="BATCH"/&gt; 
  &lt;file-store passivation="true" purge="false"/&gt; 
  &lt;/local-cache&gt; 
  &lt;/cache-container&gt; 
  &lt;cache-container name="hibernate" module="org.infinispan.hibernate-cache"&gt; 
  &lt;local-cache name="entity"&gt; 
  &lt;transaction mode="NON_XA"/&gt; 
  &lt;object-memory size="10000"/&gt; 
  &lt;expiration max-idle="100000"/&gt; 
  &lt;/local-cache&gt; 
  &lt;local-cache name="local-query"&gt; 
  &lt;object-memory size="10000"/&gt; 
  &lt;expiration max-idle="100000"/&gt; 
  &lt;/local-cache&gt; 
  &lt;local-cache name="timestamps"/&gt; 
  &lt;/cache-container&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:io:3.0"&gt; 
  &lt;worker name="default"/&gt; 
  &lt;buffer-pool name="default"/&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:jca:5.0"&gt; 
  &lt;archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/&gt; 
  &lt;bean-validation enabled="true"/&gt; 
  &lt;default-workmanager&gt; 
  &lt;short-running-threads&gt; 
  &lt;core-threads count="50"/&gt; 
  &lt;queue-length count="50"/&gt; 
  &lt;max-threads count="50"/&gt; 
  &lt;keepalive-time time="10" unit="seconds"/&gt; 
  &lt;/short-running-threads&gt; 
  &lt;long-running-threads&gt; 
  &lt;core-threads count="50"/&gt; 
  &lt;queue-length count="50"/&gt; 
  &lt;max-threads count="50"/&gt; 
  &lt;keepalive-time time="10" unit="seconds"/&gt; 
  &lt;/long-running-threads&gt; 
  &lt;/default-workmanager&gt; 
  &lt;cached-connection-manager/&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:jmx:1.3"&gt; 
  &lt;expose-resolved-model/&gt; 
  &lt;expose-expression-model/&gt; 
  &lt;remoting-connector/&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:jpa:1.1"&gt; 
  &lt;jpa default-datasource="" default-extended-persistence-inheritance="DEEP"/&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:keycloak-server:1.1"&gt; 
  &lt;web-context&gt;auth&lt;/web-context&gt; 
  &lt;providers&gt; 
  &lt;provider&gt; 
  classpath:${jboss.home.dir}/providers/* 
  &lt;/provider&gt; 
  &lt;/providers&gt; 
  &lt;master-realm-name&gt;master&lt;/master-realm-name&gt; 
  &lt;scheduled-task-interval&gt;900&lt;/scheduled-task-interval&gt; 
  &lt;theme&gt; 
  &lt;staticMaxAge&gt;2592000&lt;/staticMaxAge&gt; 
  &lt;cacheThemes&gt;true&lt;/cacheThemes&gt; 
  &lt;cacheTemplates&gt;true&lt;/cacheTemplates&gt; 
  &lt;dir&gt;${jboss.home.dir}/themes&lt;/dir&gt; 
  &lt;/theme&gt; 
  &lt;spi name="eventsStore"&gt; 
  &lt;provider name="jpa" enabled="true"&gt; 
  &lt;properties&gt; 
  &lt;property name="exclude-events" value="[&amp;quot;REFRESH_TOKEN&amp;quot;]"/&gt; 
  &lt;/properties&gt; 
  &lt;/provider&gt; 
  &lt;/spi&gt; 
  &lt;spi name="userCache"&gt; 
  &lt;provider name="default" enabled="true"/&gt; 
  &lt;/spi&gt; 
  &lt;spi name="userSessionPersister"&gt; 
  &lt;default-provider&gt;jpa&lt;/default-provider&gt; 
  &lt;/spi&gt; 
  &lt;spi name="timer"&gt; 
  &lt;default-provider&gt;basic&lt;/default-provider&gt; 
  &lt;/spi&gt; 
  &lt;spi name="connectionsHttpClient"&gt; 
  &lt;provider name="default" enabled="true"/&gt; 
  &lt;/spi&gt; 
  &lt;spi name="connectionsJpa"&gt; 
  &lt;provider name="default" enabled="true"&gt; 
  &lt;properties&gt; 
  &lt;property name="dataSource" value="java:jboss/datasources/KeycloakDS"/&gt; 
  &lt;property name="initializeEmpty" value="true"/&gt; 
  &lt;property name="migrationStrategy" value="update"/&gt; 
  &lt;property name="migrationExport" value="${jboss.home.dir}/keycloak-database-update.sql"/&gt; 
  &lt;/properties&gt; 
  &lt;/provider&gt; 
  &lt;/spi&gt; 
  &lt;spi name="realmCache"&gt; 
  &lt;provider name="default" enabled="true"/&gt; 
  &lt;/spi&gt; 
  &lt;spi name="connectionsInfinispan"&gt; 
  &lt;default-provider&gt;default&lt;/default-provider&gt; 
  &lt;provider name="default" enabled="true"&gt; 
  &lt;properties&gt; 
  &lt;property name="cacheContainer" value="java:jboss/infinispan/container/keycloak"/&gt; 
  &lt;/properties&gt; 
  &lt;/provider&gt; 
  &lt;/spi&gt; 
  &lt;spi name="jta-lookup"&gt; 
  &lt;default-provider&gt;${keycloak.jta.lookup.provider:jboss}&lt;/default-provider&gt; 
  &lt;provider name="jboss" enabled="true"/&gt; 
  &lt;/spi&gt; 
  &lt;spi name="publicKeyStorage"&gt; 
  &lt;provider name="infinispan" enabled="true"&gt; 
  &lt;properties&gt; 
  &lt;property name="minTimeBetweenRequests" value="10"/&gt; 
  &lt;/properties&gt; 
  &lt;/provider&gt; 
  &lt;/spi&gt; 
  &lt;spi name="x509cert-lookup"&gt; 
  &lt;default-provider&gt;${keycloak.x509cert.lookup.provider:default}&lt;/default-provider&gt; 
  &lt;provider name="default" enabled="true"/&gt; 
  &lt;/spi&gt; 
  &lt;spi name="hostname"&gt; 
  &lt;default-provider&gt;request&lt;/default-provider&gt; 
  &lt;provider name="fixed" enabled="true"&gt; 
  &lt;properties&gt; 
  &lt;property name="hostname" value="localhost"/&gt; 
  &lt;property name="httpPort" value="-1"/&gt; 
  &lt;property name="httpsPort" value="-1"/&gt; 
  &lt;/properties&gt; 
  &lt;/provider&gt; 
  &lt;/spi&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:mail:3.0"&gt; 
  &lt;mail-session name="default" jndi-name="java:jboss/mail/Default"&gt; 
  &lt;smtp-server outbound-socket-binding-ref="mail-smtp"/&gt; 
  &lt;/mail-session&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:naming:2.0"&gt; 
  &lt;remote-naming/&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:remoting:4.0"&gt; 
  &lt;http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:request-controller:1.0"/&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:security:2.0"&gt; 
  &lt;security-domains&gt; 
  &lt;security-domain name="other" cache-type="default"&gt; 
  &lt;authentication&gt; 
  &lt;login-module code="Remoting" flag="optional"&gt; 
  &lt;module-option name="password-stacking" value="useFirstPass"/&gt; 
  &lt;/login-module&gt; 
  &lt;login-module code="RealmDirect" flag="required"&gt; 
  &lt;module-option name="password-stacking" value="useFirstPass"/&gt; 
  &lt;/login-module&gt; 
  &lt;/authentication&gt; 
  &lt;/security-domain&gt; 
  &lt;security-domain name="jboss-web-policy" cache-type="default"&gt; 
  &lt;authorization&gt; 
  &lt;policy-module code="Delegating" flag="required"/&gt; 
  &lt;/authorization&gt; 
  &lt;/security-domain&gt; 
  &lt;security-domain name="jboss-ejb-policy" cache-type="default"&gt; 
  &lt;authorization&gt; 
  &lt;policy-module code="Delegating" flag="required"/&gt; 
  &lt;/authorization&gt; 
  &lt;/security-domain&gt; 
  &lt;security-domain name="jaspitest" cache-type="default"&gt; 
  &lt;authentication-jaspi&gt; 
  &lt;login-module-stack name="dummy"&gt; 
  &lt;login-module code="Dummy" flag="optional"/&gt; 
  &lt;/login-module-stack&gt; 
  &lt;auth-module code="Dummy"/&gt; 
  &lt;/authentication-jaspi&gt; 
  &lt;/security-domain&gt; 
  &lt;/security-domains&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:security-manager:1.0"&gt; 
  &lt;deployment-permissions&gt; 
  &lt;maximum-set&gt; 
  &lt;permission class="java.security.AllPermission"/&gt; 
  &lt;/maximum-set&gt; 
  &lt;/deployment-permissions&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:transactions:5.0"&gt; 
  &lt;core-environment node-identifier="${jboss.tx.node.id:1}"&gt; 
  &lt;process-id&gt; 
  &lt;uuid/&gt; 
  &lt;/process-id&gt; 
  &lt;/core-environment&gt; 
  &lt;recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/&gt; 
  &lt;object-store relative-to="jboss.server.data.dir"/&gt; 
  &lt;/subsystem&gt; 
  &lt;subsystem xmlns="urn:jboss:domain:undertow:7.0"&gt; 
  &lt;buffer-cache name="default"/&gt; 
  &lt;server name="default-server"&gt; 
  &lt;http-listener name="default" socket-binding="http" redirect-socket="http" proxy-address-forwarding="true" enable-http2="true"/&gt; 
  &lt;https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/&gt; 
  &lt;host name="default-host" alias="localhost"&gt; 
  &lt;location name="/" handler="welcome-content"/&gt; 
  &lt;http-invoker security-realm="ApplicationRealm"/&gt; 
  &lt;/host&gt; 
  &lt;/server&gt; 
  &lt;servlet-container name="default"&gt; 
  &lt;jsp-config/&gt; 
  &lt;websockets/&gt; 
  &lt;/servlet-container&gt; 
  &lt;handlers&gt; 
  &lt;file name="welcome-content" path="${jboss.home.dir}/welcome-content"/&gt; 
  &lt;/handlers&gt; 
  &lt;/subsystem&gt; 
  &lt;/profile&gt; 
  &lt;interfaces&gt; 
  &lt;interface name="management"&gt; 
  &lt;inet-address value="${jboss.bind.address.management:127.0.0.1}"/&gt; 
  &lt;/interface&gt; 
  &lt;interface name="public"&gt; 
  &lt;inet-address value="${jboss.bind.address:127.0.0.1}"/&gt; 
  &lt;/interface&gt; 
  &lt;/interfaces&gt; 
  &lt;socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}"&gt; 
  &lt;socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/&gt; 
  &lt;socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/&gt; 
  &lt;socket-binding name="ajp" port="${jboss.ajp.port:8009}"/&gt; 
  &lt;socket-binding name="http" port="${jboss.http.port:8080}"/&gt; 
  &lt;socket-binding name="https" port="${jboss.https.port:8443}"/&gt; 
  &lt;socket-binding name="txn-recovery-environment" port="4712"/&gt; 
  &lt;socket-binding name="txn-status-manager" port="4713"/&gt; 
  &lt;outbound-socket-binding name="mail-smtp"&gt; 
  &lt;remote-destination host="localhost" port="25"/&gt; 
  &lt;/outbound-socket-binding&gt; 
  &lt;/socket-binding-group&gt; 
  &lt;/server&gt;
  </code></pre>