From c91df2b5c8a046f541e684ee2b70e67930d3bef2 Mon Sep 17 00:00:00 2001 From: arata-honda Date: Mon, 19 Apr 2021 22:39:49 +0900 Subject: [PATCH] Fix get_user_id to non case-sensitive --- keycloak/keycloak_admin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keycloak/keycloak_admin.py b/keycloak/keycloak_admin.py index c0ac364..cd9660a 100644 --- a/keycloak/keycloak_admin.py +++ b/keycloak/keycloak_admin.py @@ -410,9 +410,9 @@ class KeycloakAdmin: :return: user_id """ - - users = self.get_users(query={"search": username}) - return next((user["id"] for user in users if user["username"] == username), None) + lower_user_name = username.lower() + users = self.get_users(query={"search": lower_user_name}) + return next((user["id"] for user in users if user["username"] == lower_user_name), None) def get_user(self, user_id): """