You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've configured Azure Entra ID as identity provider in Keycloak 26. After checking it was working, I decided to map the username to a different claim. That messed up the users I had already signed on as (with SSO) and now they have null usernames.
Now I cannot login as them even if I remove the IdP mappers and when I try to delete them I get The user could not be deleted unknown_error in the web interface and a null pointer exception in the sever log
2024-11-15 17:40:51,793 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-436) Uncaught server error: java.lang.NullPointerException at java.base/java.util.Objects.requireNonNull(Objects.java:233) at org.keycloak.models.cache.infinispan.events.UserUpdatedEvent.<init>(UserUpdatedEvent.java:44) at org.keycloak.models.cache.infinispan.events.UserUpdatedEvent.create(UserUpdatedEvent.java:50) at org.keycloak.models.cache.infinispan.UserCacheSession.registerUserInvalidation(UserCacheSession.java:128) at org.keycloak.models.cache.infinispan.UserAdapter.getDelegateForUpdate(UserAdapter.java:105) at org.keycloak.models.cache.infinispan.UserAdapter.invalidate(UserAdapter.java:120) at org.keycloak.models.cache.infinispan.UserCacheSession.fullyInvalidateUser(UserCacheSession.java:836) at org.keycloak.models.cache.infinispan.UserCacheSession.removeUser(UserCacheSession.java:850) at org.keycloak.models.UserManager.removeUser(UserManager.java:36) at org.keycloak.models.UserManager.removeUser(UserManager.java:32) at org.keycloak.services.resources.admin.UserResource.deleteUser(UserResource.java:648) at org.keycloak.services.resources.admin.UserResource$quarkusrestinvoker$deleteUser_1ab1e247046f32b48fb55de7f71f5540f6c8ea14.invoke(Unknown Source) at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29) at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141) at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147) at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:635) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521) at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11) at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:1583)
Is there any way I can delete them? I can't create more users in the IdP and I cannot keep testing with those. Thank you.
I encountered the same problem, the possibility of authentication is blocked for all users.
It is not possible to enter the user details to overwrite the username.
It is not possible to delete users without a username.
Is it possible to solve the problem as soon as possible? Thank you
I encountered a similar issue and was able to resolve it by working directly in the database, as neither the UI nor the API provided a solution.
We experienced the problem after updating to version 26. In my case, users were created via an IdP with the "NameID policy format" set to "unspecified," and the sAMAccountName was used, even though our default setting is actually "email".
It turned out that there were users without the specified sAMAccountName. Deleting or editing them wasn't possible because every try ended in a command like "delete user=null." By looking into the Keycloak database using SQL, I found that the "username" field contained null. I then entered the email as the username and changed the IdP setting to "NameID policy format" = "email." Since then, everything has been working fine.
Here's the SQL command I used. Please use it with caution and adjust it to fit your scenario: UPDATE user_entity SET username = email WHERE realm_id =<your_realm> and username is null;
Once again, you can risk your system. Please only do this if you are sure what your commands will do. Remember to backup your database.
Manual database update fixed it for me as well. Make sure to include the postgres schema if you don't connect to the default public schema (UPDATE keycloak_schema.user_entity SET ...)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hi!
I've configured Azure Entra ID as identity provider in Keycloak 26. After checking it was working, I decided to map the username to a different claim. That messed up the users I had already signed on as (with SSO) and now they have null usernames.
Now I cannot login as them even if I remove the IdP mappers and when I try to delete them I get
The user could not be deleted unknown_errorin the web interface and a null pointer exception in the sever log2024-11-15 17:40:51,793 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-436) Uncaught server error: java.lang.NullPointerException at java.base/java.util.Objects.requireNonNull(Objects.java:233) at org.keycloak.models.cache.infinispan.events.UserUpdatedEvent.<init>(UserUpdatedEvent.java:44) at org.keycloak.models.cache.infinispan.events.UserUpdatedEvent.create(UserUpdatedEvent.java:50) at org.keycloak.models.cache.infinispan.UserCacheSession.registerUserInvalidation(UserCacheSession.java:128) at org.keycloak.models.cache.infinispan.UserAdapter.getDelegateForUpdate(UserAdapter.java:105) at org.keycloak.models.cache.infinispan.UserAdapter.invalidate(UserAdapter.java:120) at org.keycloak.models.cache.infinispan.UserCacheSession.fullyInvalidateUser(UserCacheSession.java:836) at org.keycloak.models.cache.infinispan.UserCacheSession.removeUser(UserCacheSession.java:850) at org.keycloak.models.UserManager.removeUser(UserManager.java:36) at org.keycloak.models.UserManager.removeUser(UserManager.java:32) at org.keycloak.services.resources.admin.UserResource.deleteUser(UserResource.java:648) at org.keycloak.services.resources.admin.UserResource$quarkusrestinvoker$deleteUser_1ab1e247046f32b48fb55de7f71f5540f6c8ea14.invoke(Unknown Source) at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29) at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141) at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147) at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:635) at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521) at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11) at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:1583)Is there any way I can delete them? I can't create more users in the IdP and I cannot keep testing with those. Thank you.
All reactions
Replies: 2 comments · 2 replies
Uh oh!
There was an error while loading. Please reload this page.
I encountered the same problem, the possibility of authentication is blocked for all users.
It is not possible to enter the user details to overwrite the username.
It is not possible to delete users without a username.
Is it possible to solve the problem as soon as possible? Thank you
All reactions
Uh oh!
There was an error while loading. Please reload this page.
Hello!
I encountered a similar issue and was able to resolve it by working directly in the database, as neither the UI nor the API provided a solution.
We experienced the problem after updating to version 26. In my case, users were created via an IdP with the "NameID policy format" set to "unspecified," and the sAMAccountName was used, even though our default setting is actually "email".
It turned out that there were users without the specified sAMAccountName. Deleting or editing them wasn't possible because every try ended in a command like "delete user=null." By looking into the Keycloak database using SQL, I found that the "username" field contained null. I then entered the email as the username and changed the IdP setting to "NameID policy format" = "email." Since then, everything has been working fine.
Here's the SQL command I used. Please use it with caution and adjust it to fit your scenario:
UPDATE user_entity SET username = email WHERE realm_id =<your_realm> and username is null;Once again, you can risk your system. Please only do this if you are sure what your commands will do. Remember to backup your database.
I hope this helps you!
All reactions
Uh oh!
There was an error while loading. Please reload this page.
Hello @simonhanemann7882 I got the same problem as you. Let me try your solution
All reactions
Uh oh!
There was an error while loading. Please reload this page.
Manual database update fixed it for me as well. Make sure to include the postgres schema if you don't connect to the default
publicschema (UPDATE keycloak_schema.user_entity SET ...)All reactions