首页 > 解决方案 > MultiNOde 中的 KeyCloak 不与 infinispan 共享用户会话和令牌

问题描述

InfiniSpan 不会在 keycloak 中的节点之间复制用户会话和 JWT 令牌。使用 jgroup 的发现正在工作,因为我可以看到两个节点发现的日志。请帮助解决问题。

<jgroups>
        <stack-file name="jgroups" path="${jgroups.configfile:jgroups.xml}"/>
    </jgroups>

    <cache-container name="keycloak" jndi-name="infinispan/Keycloak" start="EAGER">
        <transport stack="jgroups"  lock-timeout="60000"/>
        <local-cache name="realms">
            <memory>
                <object size="10000"/>
            </memory>
        </local-cache>
        <local-cache name="users">
            <memory>
                <object size="10000"/>
            </memory>
        </local-cache>

         <distributed-cache name="sessions" mode="SYNC" owners="${infinispan.dist_cache.owners:2}"/>
        <distributed-cache name="authenticationSessions"  mode="SYNC" owners="${infinispan.dist_cache.owners:2}"/>
        <distributed-cache name="offlineSessions" mode="SYNC" owners="${infinispan.dist_cache.owners:2}"/>
        <distributed-cache name="clientSessions" mode="SYNC" owners="${infinispan.dist_cache.owners:2}"/>
        <distributed-cache name="offlineClientSessions" mode="SYNC" owners="${infinispan.dist_cache.owners:2}"/>
        <distributed-cache name="loginFailures" mode="SYNC" owners="${infinispan.dist_cache.owners:2}"/>
        <!--replicated-cache name="sessions"  statistics-enabled="true"/>
        <replicated-cache name="clientSessions" statistics-enabled="true"/-->

        <local-cache name="authorization">
            <memory>
                <object size="10000"/>
            </memory>
        </local-cache>
        <replicated-cache name="work"  mode="SYNC"/>
        <local-cache name="keys">
            <expiration max-idle="3600000"/>
            <memory>
                <object size="1000"/>
            </memory>
        </local-cache>
        <distributed-cache name="actionTokens" mode="SYNC" owners="2">
            <expiration max-idle="-1" interval="300000"/>
            <memory>
                <object size="-1"/>
            </memory>
        </distributed-cache>
    </cache-container>

标签: keycloakinfinispan

解决方案


推荐阅读