Skip to content

Commit d62a495

Browse files
authored
feat: remove oauth/token api (#2814)
1 parent dc1139a commit d62a495

2 files changed

Lines changed: 0 additions & 18 deletions

File tree

apiserver/paasng/paasng/infras/accounts/urls.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@
3737
views.UserVerificationValidationView.as_view(),
3838
name="api.accounts.verification.validation",
3939
),
40-
re_path(
41-
r"^api/accounts/oauth/token/$",
42-
views.OauthTokenViewSet.as_view({"get": "fetch_paasv3cli_token"}),
43-
name="api.accounts.oauth.token",
44-
),
4540
re_path(r"^api/oauth/backends/$", views.Oauth2BackendsViewSet.as_view({"get": "list"})),
4641
re_path(
4742
r"^api/oauth/backends/(?P<backend>[^/]+)/(?P<pk>[^/]+)/$",

apiserver/paasng/paasng/infras/accounts/views.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
from paasng.core.tenant.user import get_tenant
3232
from paasng.infras.accounts import serializers
3333
from paasng.infras.accounts.models import AccountFeatureFlag, Oauth2TokenHolder, UserProfile, make_verifier
34-
from paasng.infras.accounts.oauth.backends import get_bkapp_oauth_backend_cls
3534
from paasng.infras.accounts.oauth.exceptions import BKAppOauthError
3635
from paasng.infras.accounts.oauth.utils import get_available_backends, get_backend
3736
from paasng.infras.accounts.permissions.application import application_perm_class
@@ -148,18 +147,6 @@ class OauthTokenViewSet(viewsets.ViewSet, ApplicationCodeInPathMixin):
148147

149148
permission_classes = [IsAuthenticated, application_perm_class(AppAction.VIEW_BASIC_INFO)]
150149

151-
def fetch_paasv3cli_token(self, request):
152-
"""获取代表 paasv3cli 和用户身份的 AccessToken, 暂不考虑 refresh token"""
153-
backend = get_bkapp_oauth_backend_cls().from_paasv3cli()
154-
try:
155-
return Response(
156-
data=backend.fetch_token(
157-
username=request.user.username, user_credential=backend.get_user_credential_from_request(request)
158-
)
159-
)
160-
except BKAppOauthError as e:
161-
return Response(status=e.response_code, data={"message": e.error_message})
162-
163150
def fetch_app_token(self, request, app_code: str, env_name: str):
164151
"""获取代表指定应用和用户身份的 AccessToken"""
165152
application = self.get_application()

0 commit comments

Comments
 (0)