diff --git a/sdks/bkpaas-auth/CHANGES.md b/sdks/bkpaas-auth/CHANGES.md index 1092b50b..b0317838 100644 --- a/sdks/bkpaas-auth/CHANGES.md +++ b/sdks/bkpaas-auth/CHANGES.md @@ -1,5 +1,8 @@ # 版本历史 +## 2.0.6 +- TokenRequestBackend.request_username 支持国际化 + ## 2.0.5 - TokenRequestBackend 处理蓝鲸统一登录的错误状态码 code=1302403 - CookieLoginMiddleware 根据错误状态码 code=1302403, 限制用户的访问权限 diff --git a/sdks/bkpaas-auth/bkpaas_auth/__init__.py b/sdks/bkpaas-auth/bkpaas_auth/__init__.py index 818cf208..3a67ec2a 100644 --- a/sdks/bkpaas-auth/bkpaas_auth/__init__.py +++ b/sdks/bkpaas-auth/bkpaas_auth/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -__version__ = "2.0.5" +__version__ = "2.0.6" def get_user_by_user_id(user_id: str, username_only: bool = True): diff --git a/sdks/bkpaas-auth/bkpaas_auth/core/token.py b/sdks/bkpaas-auth/bkpaas_auth/core/token.py index 130f43bd..8096ef50 100644 --- a/sdks/bkpaas-auth/bkpaas_auth/core/token.py +++ b/sdks/bkpaas-auth/bkpaas_auth/core/token.py @@ -5,13 +5,14 @@ import logging from django.utils.timezone import now +from django.utils.translation import get_language from bkpaas_auth.conf import bkauth_settings -from bkpaas_auth.core.constants import ProviderType, ACCESS_PERMISSION_DENIED_CODE -from bkpaas_auth.core.exceptions import InvalidTokenCredentialsError, ServiceError, AccessPermissionDenied +from bkpaas_auth.core.constants import ACCESS_PERMISSION_DENIED_CODE, ProviderType +from bkpaas_auth.core.exceptions import AccessPermissionDenied, InvalidTokenCredentialsError, ServiceError from bkpaas_auth.core.http import http_get -from bkpaas_auth.core.user_info import BkUserInfo, RtxUserInfo, UserInfo from bkpaas_auth.core.services import get_app_credentials +from bkpaas_auth.core.user_info import BkUserInfo, RtxUserInfo, UserInfo from bkpaas_auth.models import User logger = logging.getLogger(__name__) @@ -29,7 +30,10 @@ class TokenRequestBackend(AbstractRequestBackend): def request_username(self, **credentials): """Get username through credentials""" is_success, resp = http_get( - bkauth_settings.USER_COOKIE_VERIFY_URL, params=dict(credentials, **get_app_credentials()), timeout=10 + bkauth_settings.USER_COOKIE_VERIFY_URL, + params=dict(credentials, **get_app_credentials()), + timeout=10, + headers={'blueking-language': get_language()}, ) if not is_success: raise ServiceError('unable to fetch token services') diff --git a/sdks/bkpaas-auth/pyproject.toml b/sdks/bkpaas-auth/pyproject.toml index bef6d954..5b358477 100644 --- a/sdks/bkpaas-auth/pyproject.toml +++ b/sdks/bkpaas-auth/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "bkpaas-auth" -version = "2.0.5" +version = "2.0.6" description = "User authentication django app for blueking internal projects" license = "Apach License 2.0" readme = "README.md" diff --git a/sdks/bkpaas-auth/setup.py b/sdks/bkpaas-auth/setup.py index 3871077e..6f283b35 100644 --- a/sdks/bkpaas-auth/setup.py +++ b/sdks/bkpaas-auth/setup.py @@ -23,7 +23,7 @@ setup( long_description=readme, name='bkpaas-auth', - version='2.0.5', + version='2.0.6', description='User authentication django app for blueking internal projects', python_requires='<4.0,>=3.6', author='blueking',