diff --git a/auth_backend/auth_plugins/keycloak.py b/auth_backend/auth_plugins/keycloak.py index 9336581..f86af86 100644 --- a/auth_backend/auth_plugins/keycloak.py +++ b/auth_backend/auth_plugins/keycloak.py @@ -71,7 +71,10 @@ async def _register( token_result = await response.json() logger.debug(token_result) if 'access_token' not in token_result: - raise OauthAuthFailed('Invalid credentials for keycloak account') + raise OauthAuthFailed( + 'Invalid credentials for keycloak account', + 'Неверные данные для входа в аккаунт keycloak', + ) token = token_result['access_token'] async with session.get( @@ -134,7 +137,10 @@ async def _login(cls, user_inp: OauthResponseSchema, background_tasks: Backgroun token_result = await response.json() logger.debug(token_result) if 'access_token' not in token_result: - raise OauthAuthFailed('Invalid credentials for keycloak account') + raise OauthAuthFailed( + 'Invalid credentials for keycloak account', + 'Неверные данные для входа в аккаунт keycloak', + ) token = token_result['access_token'] async with session.get( @@ -151,7 +157,11 @@ async def _login(cls, user_inp: OauthResponseSchema, background_tasks: Backgroun user = await cls._get_user('user_id', keycloak_user_id, db_session=db.session) if not user: id_token = jwt.encode(userinfo, cls.settings.ENCRYPTION_KEY, algorithm="HS256") - raise OauthAuthFailed('No users found for keycloak account', id_token) + raise OauthAuthFailed( + 'No users found for keycloak account', + 'Пользователь с данным аккаунтом Keycloak не найден', + id_token, + ) userdata = await KeycloakAuth._convert_data_to_userdata_format(userinfo) background_tasks.add_task( get_kafka_producer().produce,