切换到 Keycloak 后主体名称显示不同

Principal name is showing different after switching to Keycloak

UserPrincipal.getName 切换到 Keyclock 后显示为 cb3634be-e0e1-479e-aec9-0cb38c8a0468。当我们使用 LDAP 时,会显示 LDAP uid。将用户从 LDAP 同步到 KC 后,当应用程序代码检查用户主体名称时,它显示了这一点。

有什么想法吗?

Keycloak 考虑 preferred_username 属性。

另请参阅: